API Docs for: 1.0.0.6ab0d507
Show:

EmberObjectUtils Class

Item Index

Methods

Methods

addToHierarchy

(
  • hierarchy
  • type
  • classObj
  • level
)
static

Add an entry to the hierarchy. It takes care of updating meta also.

Parameters:

  • hierarchy Object
  • type String
  • classObj Class
  • level Number

belongsTo

(
  • modelClass
  • [modelClassKey]
  • [defaultKey]
  • [mixin]
  • [mixinKey]
  • [defaultMixin]
  • [registry]
  • [idKey]
)
Instance static

Creates a computed property for an object that when set with native js object will return an instances of a class.

The class is decided by the 1st param 'modelClass'. If it is not a class but an object and 'modelClassKey', the 2nd parameter is a string, then the 'modelClassKey' in the object is used as a key in 'modelClass' the object to get the class. 'defaultKey' the 3rd parameter is used as a default if object[modelClassKey] is not present.

Optionally can create the instance with mixin. A single mixin can be passed or a map of mixins as 4th parameter with key extracted from object using mixinKey (5th parameter) can be passed. 'defaultMixin' (6th parameter) is used when object[mixinKey] is not present.

Can pass a 7th argument. A registry of objects. If the object (identified by an idKey) is already present, reference to the object is returned. 8th argument is the idKey

Parameters:

  • modelClass Class | Object
  • [modelClassKey] String optional
  • [defaultKey] String optional
  • [mixin] Mixin | Object optional
  • [mixinKey] String optional
  • [defaultMixin] String optional
  • [registry] Object optional
  • [idKey] String optional

Returns:

Instance:

hasMany

(
  • modelClass
  • [modelClassKey]
  • [defaultKey]
  • [registry]
  • [idKey]
)
Instance static

Defined in addon/hasMany.js:3

Creates a computed property for an array that when set with array of native js object will return an array of instances of a class.

The class is decided by the 1st param 'modelClass'. If it is not a class but an object and 'modelClassKey', the 2nd parameter is a string, then the 'modelClassKey' in the object is used as a key in 'modelClass' the object to get the class. 'defaultKey' the 3rd parameter is used as a default if object[modelClassKey] is not present.

Can pass a 4th argument. A registry of objects. If the object (identified by an idKey) is already present, reference to the object is returned. 5th argument is the idKey

Parameters:

  • modelClass Class | Object
  • [modelClassKey] String optional
  • [defaultKey] String optional
  • [registry] Object optional
  • [idKey] String optional

Returns:

Instance:

hasManyWithHierarchy

(
  • hasManyHierarchy
  • level
  • key
)
Instance static

Creates a computed property which creates a class for every element in the set array based on hierarchy. The objects in the array can be of any level at or below the current level. An instance with the basic class is automatically wrapped around the objects at lower level.

Parameters:

  • hasManyHierarchy Object

    Assumed to be already initialized by calling 'registerHierarchy'.

  • level Number

    Level of the computed property.

  • key String

    Key used to get the key used in retrieving the class object in the classes map.

Returns:

Instance:

registerHierarchy

(
  • hierarchy
)
static

Register a hierarchy. This will setup the meta of the hierarchy.

Parameters:

  • hierarchy Object