Constructor
new Manager(optionsopt)
Constructor
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Properties
|
- Source:
Extends
Methods
addObject() → {*}
Public method to add an object
- Source:
Returns:
- Type
- *
addObjects(…arguments) → {Manager}
Add many objects to the collection
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
arguments |
object |
<repeatable> |
one or more objects |
- Source:
Returns:
- Type
- Manager
deleteObject() → {*}
Public method to delete an object
- Source:
Returns:
- Type
- *
deleteObjects() → {*}
Public method to delete all objects
- Source:
Returns:
- Type
- *
emit() → {EventSystem}
Alias to trigger method
- Inherited From:
- Source:
Returns:
- Type
- EventSystem
exists() → {boolean}
Public method to see if an object exists
- Source:
Returns:
- Type
- boolean
getId(obj) → {string|undefined}
Get the id of an object
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
- Source:
Returns:
- Type
- string | undefined
getIds() → {Array.<string>}
Get the ids of all objects
- Source:
Returns:
- Type
- Array.<string>
getObject() → {*}
Public method to get an object
- Source:
Returns:
- Type
- *
manage(data) → {Manager}
Given a collection of objects in an array,
or in an object, add and update them
in the manager's own collection.
Then delete any objects still in the manager's
collection that are not in the data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | Array.<object> |
- Source:
Returns:
- Type
- Manager
off(name, callback) → {EventSystem}
Detach a callback from an event.
This will only work if the callback is not anonymous
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | name of the event |
callback |
function | the callback function |
- Inherited From:
- Source:
Returns:
- Type
- EventSystem
offAll(name) → {EventSystem}
Remove all callbacks for an event
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | name of the event |
- Inherited From:
- Source:
Returns:
- Type
- EventSystem
on(name, callback) → {EventSystem}
Attaches a callback to an event
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | name of the event |
callback |
function | the callback function |
- Inherited From:
- Source:
Returns:
- Type
- EventSystem
serializer(indexopt, maxopt) → {Array.<object>}
Serialize all objects that have a serializer method
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
index |
number |
<optional> |
0 | index to start at |
max |
number |
<optional> |
0 | max amount to return |
- Source:
Returns:
- Type
- Array.<object>
trigger() → {EventSystem}
Run all callbacks attached to an event
- Inherited From:
- Source:
Returns:
- Type
- EventSystem
updateObject() → {*}
Public method to update an object
- Source:
Returns:
- Type
- *