import * as ko from "knockout" ; import { render as renderReact } from "react-dom" ; export function RegisterBindingHandlers ( ) { ko . bindingHandlers . react = { init : function ( ) { return { controlsDescendantBindings : true } ; } , update : function ( el , valueAccessor , allBindings ) { const reactOptions = ko . unwrap ( valueAccessor ( ) ) ; const component = ko . unwrap ( reactOptions . component ) ; renderReact ( component , el ) ; } } ; ko . bindingHandlers . afterRender = { init : function ( element , valueAccessor , allBindings , viewModel , bindingContext ) { } , update : function ( element , valueAccessor , allBindings , viewModel , bindingContext ) { valueAccessor ( ) ( element , valueAccessor , allBindings , viewModel , bindingContext ) ; } } ; }