Original intention
Before we have to update the model in the JS domain, we need this:
model.set(‘name‘‘sub‘);
This is really too earthy ...
We want to be like Angularjs, directly:
‘sub‘;
Then bong, the view will be updated! This kind of black technology must be excellent.
Goal
- Complete model update for black Tech
- Complete within 200 lines
Realize
This time the main reference to the Avalon "hijack" Setter,getter method, Link: Avalon Simplified version of Interpretation
It's difficult to read, although it's a simplified Avalon.
To organize the ideas, the main two major points:
1. VM Object –> Vmodel Object, Set,get method of hijacking VM's various properties
2. Scantag () –> traverse the DOM tree to find the keyword, go to Vmodel to find the evaluation function, register to the subscriber list
Which to go to vmodel this point is not very clear, these days must be clarified, their own mock a out
Very simple JS bidirectional data Binding framework (C): JS model Black Technology