Very simple js two-way data binding framework (III): js model black technology, jsmodel

Source: Internet
Author: User

Very simple js two-way data binding framework (III): js model black technology, jsmodel
Original Intention

Before we update the model in the js domain, we need:

Model. set ('name', 'sub ');

This is too earthy...
Like angularjs, we hope:

$ Scope. name = 'sub ';

Then bong, the view will be updated! Such a black technology must be excellent.

Target implementation

This is mainly based on the methods of "hijacking" setter and getter of aveon. For more information, see the explanation of aveon simplified version.

It is difficult to read even though it is a simplified aveon.
Sort out the following ideas:
1. vm object-> vModel object, hijack set of vm attributes, get Method
2. scanTag ()-> traverse the dom tree to find keywords, go to the vModel to find the value function, and register it with the subscriber list.

It is not very clear to go to The vModel. We must figure it out in the past few days.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.