new Values()
A collection of observable values.
- Mixes In:
- wp.customize.Events
- Source:
Extends
- wp.customize.Class
Members
-
defaultConstructor :object
-
The default constructor for items of the collection.
Type:
- object
- Source:
Methods
-
_change()
-
A helper function to propagate a 'change' event from an item to the collection itself.
- Source:
-
add(id, value)
-
Add an item to the collection.
Parameters:
Name Type Description idstring The ID of the item. valuemixed The item instance. - Source:
Returns:
The new item's instance.- Type
- mixed
-
create(id, value)
-
Create a new item of the collection using the collection's default constructor and store it in the collection.
Parameters:
Name Type Description idstring The ID of the item. valuemixed Any extra arguments are passed into the item's initialize method. - Source:
Returns:
The new item's instance.- Type
- mixed
-
each(callback, context)
-
Iterate over all items in the collection invoking the provided callback.
Parameters:
Name Type Description callbackfunction Function to invoke. contextobject Object context to invoke the function with. Optional. - Source:
-
has(id)
-
Whether the collection has an item with the given ID.
Parameters:
Name Type Description idstring The ID of the item to look for. - Source:
Returns:
- Type
- Boolean
-
instance(id)
-
Get the instance of an item from the collection if only ID is specified. If more than one argument is supplied, all are expected to be IDs and the last to be a function callback that will be invoked when the requested items are available.
Parameters:
Name Type Description idstring ID of the item. - Source:
- See:
-
- {api.Values.when}
Returns:
The item instance if only one ID was supplied. A Deferred Promise object if a callback function is supplied.- Type
- mixed
-
remove(id)
-
Remove an item from the collection.
Parameters:
Name Type Description idstring The ID of the item to remove. - Source:
-
value(id)
-
Get the instance of an item.
Parameters:
Name Type Description idstring The ID of the item. - Source:
Returns:
-
when()
-
Runs a callback once all requested values exist. when( ids*, [callback] ); For example: when( id1, id2, id3, function( value1, value2, value3 ) {} );
- Source:
Returns:
$.Deferred.promise();