Class Ember.MutableEnumerable

public
Uses: Ember.Enumerable
Defined in: packages/ember-runtime/lib/mixins/mutable_enumerable.js:12
Module: ember

This mixin defines the API for modifying generic enumerables. These methods can be applied to an object regardless of whether it is ordered or unordered.

Note that an Enumerable can change even if it does not implement this mixin. For example, a MappedEnumerable cannot be directly modified but if its underlying enumerable changes, it will change also.

Adding Objects

To add an object to an enumerable, use the addObject() method. This method will only add the object to the enumerable if the object is not already present and is of a type supported by the enumerable.

set.addObject(contact);

Removing Objects

To remove an object from an enumerable, use the removeObject() method. This will only remove the object if it is present in the enumerable, otherwise this method has no effect.

set.removeObject(contact);

Implementing In Your Own Code

If you are implementing an object and want to support this API, just include this mixin in your class and implement the required methods. In your unit tests, be sure to apply the Ember.MutableEnumerableTests to your object.

Methods

Properties

No documented items

Events

No documented items

© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/classes/Ember.MutableEnumerable