An abstract collection that provides the interface for listening to and dispatching notifications when values are removed then added at an index.
Every change to an array, or any flat collection of values, can model any content change as a values added or removed at a particular index.
Every method that changes an array can be implemented in terms of
For example, every time you
set(index, value) on an array, it can be modeled
splice(index, 1, value).
Every time you push a value onto an array, it can be modeled as
Every time you shift a value off an array, it cam be modeled as
Each of these changes can be communicated with a single message,
index): the values removed after that index, then the values that were added
after that index, and the index, in that order.
Range change listeners receive such messages synchronously, as the array changes.
Adds a listener for when values are added or removed at any position.
Unregisters a range change listener provided by addRangeChangeListener.
Informs range change listeners that values were removed then added at an index.
Adds a listener for before values are added or removed at any position.
Unregisters a range change listener provided by addBeforeRangeChangeListener or addRangeChangeListener with the
Informs range change listeners that values will be removed then added at an index.
require("collections/shim-object"); var RangeChange = require("collections/listen/range-changes"); Object.addEach(MyRange.prototype, RangeChange.prototype);