MapChanges

An abstract collection that provides the interface for listening to and dispatching notifications when the value for a key changes and when entries are added or removed.

Methods

addMapChangeListener(listener, token?, beforeChange?)

Adds a listener for when the value for a key changes, or when entries are added or removed.

addBeforeMapChangeListener(listener, token?)

Adds a listener for before map entries are created, deleted, or updated.

removeMapChangeListener(listener, token?, beforeChange?)

Unregisters a map change listener provided by addMapChangeListener.

removeBeforeMapChangeListener(listener, token?)

Unregisters a map change listener provided by addBeforeMapChangeListener or addMapChangeListener with the beforeChange flag.

dispatchMapChange(key, value, beforeChange?)

Informs map change listeners that an entry was created, deleted, or updated.

dispatchBeforeMapChange(key, value)

Informs map change listeners that an entry will be created, deleted, or updated.

Usage

require("collections/shim-object");
var MapChange = require("collections/listen/map-changes");
Object.addEach(MyMap.prototype, MapChange.prototype);
  • MapChanges
Source code