PrioritisedObject
Extends:
Direct Subclass:
Indirect Subclass:
Constructor Summary
Public Constructor | ||
public |
constructor(dataSource: DataSource, dataSnapshot: Snapshot): PrioritisedObject |
Member Summary
Public Members | ||
public get |
dataSource: * |
|
public get |
id: * |
|
public set |
id: * |
|
public get |
priority: * Priority (positioning) of the object in the dataSource |
|
public set |
priority: * |
Method Summary
Public Methods | ||
public |
disableChangeListener(): void Disables pushes of local changes to the dataSource, and stops event emits that refer to the model's data. |
|
public |
enableChangeListener(): void Enables pushes of local changes to the dataSource, and enables event emits that refer to the model's data. The change listener is active by default, so you'll only need to call this method if you've previously called disableChangeListener(). |
|
public |
Removes subscription to events emitted by this PrioritisedArray. |
|
public |
Subscribes to events emitted by this PrioritisedArray. |
|
public |
Subscribes to the given event type exactly once; it automatically unsubscribes after the first time it is triggered. |
|
public |
remove(): void Deletes the current object from the dataSource, and clears itself to free memory. |
|
public |
transaction(method: Function): void Allows multiple modifications to be made to the model without triggering dataSource pushes and event emits for each change. |
Public Constructors
public constructor(dataSource: DataSource, dataSnapshot: Snapshot): PrioritisedObject source
Params:
Name | Type | Attribute | Description |
dataSource | DataSource | DataSource to construct this PrioritisedObject with. |
|
dataSnapshot | Snapshot | Optional: dataSnapshot already containing model data, so we can skip subscribing to the full data on the dataSource. |
Public Members
public get dataSource: * source
public get id: * source
public set id: * source
public set priority: * source
Public Methods
public disableChangeListener(): void source
Disables pushes of local changes to the dataSource, and stops event emits that refer to the model's data.
Return:
void |
public enableChangeListener(): void source
Enables pushes of local changes to the dataSource, and enables event emits that refer to the model's data. The change listener is active by default, so you'll only need to call this method if you've previously called disableChangeListener().
Return:
void |
public off(event: String, handler: Function, context: Object): void source
Removes subscription to events emitted by this PrioritisedArray. If no handler or context is given, all handlers for the given event are removed. If no parameters are given at all, all event types will have their handlers removed.
Return:
void |
public on(event: String, handler: Function, context: Object): void source
Subscribes to events emitted by this PrioritisedArray.
Params:
Name | Type | Attribute | Description |
event | String | One of the following Event Types: 'value', 'child_changed', 'child_moved', 'child_removed'. |
|
handler | Function | Function that is called when the given event type is emitted. |
|
context | Object | Optional: context of 'this' inside the handler function when it is called. |
Return:
void |
public once(event: String, handler: Function, context: Object): void source
Subscribes to the given event type exactly once; it automatically unsubscribes after the first time it is triggered.
Params:
Name | Type | Attribute | Description |
event | String | One of the following Event Types: 'value', 'child_changed', 'child_moved', 'child_removed'. |
|
handler | Function | Function that is called when the given event type is emitted. |
|
context | Object | Optional: context of 'this' inside the handler function when it is called. |
Return:
void |
public remove(): void source
Deletes the current object from the dataSource, and clears itself to free memory.
Return:
void |
public transaction(method: Function): void source
Allows multiple modifications to be made to the model without triggering dataSource pushes and event emits for each change. Triggers a push to the dataSource after executing the given method. This push should then emit an event notifying subscribers of any changes.
Params:
Name | Type | Attribute | Description |
method | Function | Function in which the model can be modified. |
Return:
void |