Quantcast
Channel: techscouting through the java news » Data Binding
Viewing all articles
Browse latest Browse all 5

Object.observe() will become a web standard

$
0
0

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
}

The post Object.observe() will become a web standard appeared first on techscouting through the java news.


Viewing all articles
Browse latest Browse all 5

Trending Articles