Bypassing Notifications

Normally, if a property of an observable object has listeners and you change the property then the listeners are notified. However, there are certain situations in which you might want to bypass notification. In other words, you might need to change a property value silently without triggering any functions registered for notification.

If you want to change a property without triggering notifications then you should change the property by using the backingData property. The code in Listing 3.3 illustrates how you can change the price property silently.

LISTING 3.3 Bypassing Notifications (observablesBypass\observablesBypass.html)

// Simple product objectvar product = {    name: "Milk",    description: ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.