Mastering Reactive JavaScript
上QQ阅读APP看书,第一时间看更新

Subscribing using the assign method

The assign() method lets you call a function on an object every time an event occurs. It is especially useful to set the content of DOM elements. You can use it to set the value of a DOM object class using jQuery:

observable 
.assign($("#myElement"), "class");
The assign() method is just a synonym for the onValue() method.