Model
Base class for all models
Member Summary
Public Members | ||
public |
eventStream: * |
|
public |
observers: *[] |
Private Members | ||
private |
_deepCopy: List: * Returns a deep copy of the array by reassigning the values. |
Method Summary
Public Methods | ||
public |
force() Force a toggle of the database listeners by the children. |
|
public |
Subscribes to the event stream. |
|
public |
Toggle the database listeners from on to off. |
|
public |
unsubscribe(observer: Class) Unsubscribe from the event stream. |
Private Methods | ||
private |
Creates an event stream (Subject/Observable) for presenters to subscribe to. |
|
private |
this method was deprecated. Use _createEventStream instead. This function is only used because currently all classes call it
|
|
private |
_notifyAll(message: Object) Notify all observers with a message. |
Public Members
public eventStream: * source
public observers: *[] source
Private Members
private _deepCopy: List: * source
Returns a deep copy of the array by reassigning the values. This is to make sure we can clear the data.
Return:
List | A list to copy |
Public Methods
public subscribe(observer: Class, force: Boolean) source
Subscribes to the event stream.
Params:
Name | Type | Attribute | Description |
observer | Class | A class that will observe the event stream. Must implement onUpdated |
|
force | Boolean | Force the model to retrigger their listeners by toggling them off and on |
public toggleListeners() source
Toggle the database listeners from on to off. Must be defined by children to take effect.
public unsubscribe(observer: Class) source
Unsubscribe from the event stream.
Params:
Name | Type | Attribute | Description |
observer | Class | A class that is subscribed to be unsubscribed. |
Private Methods
private _createEventStream() source
Creates an event stream (Subject/Observable) for presenters to subscribe to.