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.
Groups the underlying items in the ModelCollection collection.
The grouping logic to apply.
Returns the groups from the underlying collection. Groups are returned as an object whose keys are the group names; each value is an array of the objects belonging to that group.
The grouped objects.
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.
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.
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.
Adds grouping functionality to an existing ModelCollection instance.