javascript - Unsubscribe in Observable KnockOutJS -
im using knockout js , conducted research when observable notified fire function
function functiontosubscribe() { } var testobservable = ko.observablearray([]); testobservable.subscribe(functiontosubscribe);
i subscribing functiontosubscribe
in event
im thinking there way unsubscribe it? in c#? when unsubscribing events have idea regarding this???
the subscribe
function returns "subscription" object has dispose
method can use unsubscribe:
var testobservable = ko.observablearray([]); var subscription = testobservable.subscribe(functiontosubscribe); //call dispose when want unsubscribe subscription.dispose();
see in documentation: explicitly subscribing observables
Comments
Post a Comment