To create engaging applications with various content features, you must learn to receive notifications when content items are added, updated, or removed:
Define the event handlers for different notifications using the ContentChangeCallback listener interface:
var listener = { /* When new items are added */ oncontentadded: function(content) { console.log(content.contentURI + " content was added"); }, /* When items are updated */ oncontentupdated: function(content) { console.log(content.contentURI + " content was updated"); }, /* When items are deleted */ oncontentremoved: function(id) { console.log(id + " was removed"); } };
Register the listener to use the defined event handlers:
webapis.content.setChangeListener(listener);
To stop the notifications, use the unsetChangeListener() method:
webapis.content.unsetChangeListener();