Object.observe() will become a web standard

Two-Way data binding is a requirement for declarative Model/View separation mechanisms as seen in frameworks like KnockoutJS or AngularJS.
When the user enters data in a form, the data model gets updated immediately, and when the data model changes, the UI updates automatically without explicit DOM manipulations.

Two-way data binding is currently implemented in JavaScript frameworks like KnockoutJS or AngularJS, but they use proprietary techniques to achieve the data binding.

Now there is a proposal for a standardized API for observing changes to JavaScript objects: Object.observe().
The proposal was accepted and will be part of a future Ecmascript version.

Object.observe() allows you to register a callback that will be called everytime an object changes:

Object.observe(obj, callback);

You will be notified whenever a value of the object’s properties changes or when properties are added / removed.
When a property value changes, your callback will be called with an event object as follows:

  type: "updated",
  object: o,
  name: "x",
  oldValue: 1
Short URL for this post: https://blog.oio.de/rRlb6
This entry was posted in Web as a Platform and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *