Does the generated view exists right after you call ko.applyBindings()
or does the scaffolding happen asynchronously?
Thanks!
Does the generated view exists right after you call ko.applyBindings()
or does the scaffolding happen asynchronously?
Thanks!
ko.applyBindings
is a synchronous call.
There may be cases where bindings have special code to do things in a setTimeout, but this is not generally the case.
With the addition of components in Knockout 3.2, components are asynchronous. With Knockout 3.3, there will be an option to render components synchronously if the viewmodel / template is loaded.
ko.applyBindings
itself is synchronous. components are async. In KO 3.3, there will be an option to render components sync, if viewmodel/template is loaded. –
Closure Knockout is synchronous. Not only the ko.applyBindings
function as RP Niemeyer already said. When you set a value to an observable property which is binded to a view, you can be 100% sure that after executing
myViewModel.myObservableProperty(newValue);
your view's been updated. In fact, an observable property is a function and when you set a new value to your observable property you are simply calling a function with the new value as parameter: this function in its body will trigger synchronously the 'change' event (i don't know exactly the event's name).
Hope it helps.. sorry but my English is a bit rusty.
© 2022 - 2024 — McMap. All rights reserved.