AlertModel
Extends:
Class for the alert model to be used by the alert Presenter
Constructor Summary
| Public Constructor | ||
| public |
Creates an instance of AlertModel. |
|
Member Summary
| Public Members | ||
| public |
listener: * |
|
| Private Members | ||
| private |
_activeBookmarks: *[] |
|
| private |
_callback: * |
|
| private |
_data: {"data": *} |
|
Method Summary
| Public Methods | ||
| public |
Get method for presenters to get data. |
|
| public |
Return the number of notifications. |
|
| public |
Moves the bookmarked data to the front of the list. |
|
| public |
Recalculates the 'timeago' property of the object, based on the milliseconds. |
|
| public |
setCallback(callback: Function) Set the model's callback to a new callback. This callback can be used anywhere and is usually passed in from a presenter. |
|
| public |
Toggle the database listener off and then on again to get the data again. |
|
| public |
Update method for presenters to update the model's data. |
|
| Private Methods | ||
| private |
_defaultCallback(message: *) Default callback |
|
| private |
_insertDataOnRead(databaseData: Object) Insert data into the data object when data has changed from the database |
|
| private |
Register an 'on' read from the database, supplying the callback when the database has changed. |
|
Public Constructors
public constructor() source
Creates an instance of AlertModel. Initializes , creates an observerlist, and registers an on read from the database.
Public Members
public listener: * source
Private Members
private _activeBookmarks: *[] source
private _callback: * source
private _data: {"data": *} source
Public Methods
public recalculateTimeAgo() source
Recalculates the 'timeago' property of the object, based on the milliseconds.
public setCallback(callback: Function) source
Set the model's callback to a new callback. This callback can be used anywhere and is usually passed in from a presenter.
Params:
| Name | Type | Attribute | Description |
| callback | Function | A callback to run when certain code is executed |
public toggleListeners() source
Toggle the database listener off and then on again to get the data again. TODO : Better method to do this?
public update(newData: Object) source
Update method for presenters to update the model's data.
Params:
| Name | Type | Attribute | Description |
| newData | Object | New data to add |
Private Methods
private _defaultCallback(message: *) source
Default callback
Params:
| Name | Type | Attribute | Description |
| message | * |
private _insertDataOnRead(databaseData: Object) source
Insert data into the data object when data has changed from the database
Params:
| Name | Type | Attribute | Description |
| databaseData | Object | Each data item is an object within the overall object |
private _registerDBReadListener() source
Register an 'on' read from the database, supplying the callback when the database has changed.
Reference
Source
