W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: Object.observe()able properties on the web platform

From: Olli Pettay <olli@pettay.fi>
Date: Wed, 20 Aug 2014 22:16:48 +0300
Message-ID: <53F4F420.1040507@pettay.fi>
To: Domenic Denicola <domenic@domenicdenicola.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Anne van Kesteren <annevk@annevk.nl>
CC: Jonas Sicking <jonas@sicking.cc>, Mounir Lamouri <mounir@lamouri.fr>, Marcos Caceres <w3c@marcosc.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 08/20/2014 10:03 PM, Domenic Denicola wrote:
> From: Olli Pettay <olli@pettay.fi>
>> How would you implement observable properties efficiently?
> The efficiency is already solved by the Object.observe implementation.

In JS engine sure. But we're talking about DOM objects here.

> My understanding is that the overhead is close to negligible for cases when nobody observes the object.
> If you are asking how you tap into that as a developer, you do something like `this._notifier = Object.getNotifier(this)` in the constructor, and then do `this._notifier.notify({ type: 'update', name: 'propertyName', oldValue: propertyOldValue })` inside the relevant setter. Obviously real implementations would not use underscored-properties, but you can see how it is very much automatable via a WebIDL binding layer.
Received on Wednesday, 20 August 2014 19:51:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC