Calling ko.applyBindings on specific elements frequently
I have a chat room style application and each entry is processed on the
client once it is received and then some html is generated to display it.
As certain messages will have tooltips and other bits of data embedded
within them which use knockout bindings to display.
Now after looking over all the posts around this the answers to this
problem seem to be:
Make sure all your elements exist up front but are empty
Call ko.applyBindings on the new elements when they are added
The first one is not feasible as you only create the elements as the chat
comes in from the server, so the second option seems the only way to do
it, however this would require calling for each chat message that comes
in. A lot of people say that ko.applyBindings can incur significant
overheads, however I think they mean if you were to call it upon all
elements rather than just targeting specific ones.
So can anyone who has facts to back up their answer tell me of if there is
any significant issues with calling ko.applyBindings on a multiple single
elements which could range into the 100s.
No comments:
Post a Comment