Adds items to the ModelCollection.
The items to add to the ModelCollection.
Removes all items from the ModelCollection.
The name of the event to fire.
Optional arguments to pass to subscribers.
Returns false
if the bus is stopped. Otherwise,
returns a Promise that will resolve with an array of values returned by
event subscribers, or reject with the first Promise rejection or thrown error.
The set of items in the ModelCollection.
NOTE: Returns a shallow copy of the underlying collection. That means the array returned can be mutated without affecting the real ModelCollection, but all the items in the array are the same by reference, so mutating an object in the collection will also mutate the object stored in the ModelCollection.
Moves to the next page of items. Does nothing if called on the last page.
The new page index.
Registers a subscriber for the given event. The subscriber will be invoked in the context used to create the EventBus and passed any arguments provided to the fire method.
The name of the event to listen for.
The subscriber to invoke when the event is fired.
Method to invoke to remove the subscriber.
Similar to on, except the subscriber will be removed as soon as it is invoked.
The name of the event to listen for.
The subscriber to invoke when the event is fired.
Method to invoke to remove the subscriber.
Gets or sets the current page index (base 0). If outside the available bounds, the given index will be clamped between 0 and pageCount - 1.
The new page index.
The new page index.
Gets or sets the current page size (the number of items that should be visible on each page.)
The number of items to show on each page. Pass no arguments to retrieve the current page size.
The current page size.
Moves to the previous page of items. Does nothing if called on the first page.
The new page index.
Removes items from the ModelCollection.
The items to remove from the ModelCollection.
Resumes notifying subscribers after stop was called. Any events fired before resuming are dropped entirely.
Stops notifying subscribers of fired events until resume is called.
Provides paging functionality to the wrapped ModelCollection instance.
Order of Operations: Typically, you should call
withPaging
after applying any other decorators. This ensures the underlingitems
collection represents the correct set of items when calculating page counts.Note on Active Items: If you apply paging to a ActiveModelCollection created using the {@link module:models.withActive withActive} decorator, the current page index will update automatically as you change the active item.
{@link Events.ADDED}
{@link Events.REMOVED}
{@link Events.ACTIVE_CHANGED}
{@link Events.FILTER_CHANGED}