DataModel
Extends:
DataModel holds a map of string,value pairs, sometimes fetched from or sent to a back-end server.
It fires events when values are changed so that {Component}s and other logic can react.
Constructor Summary
Public Constructor | ||
public |
constructor(data: Object, options: Object, fieldDataObjects: Object) |
Member Summary
Public Members | ||
public |
collection: * |
|
public |
data: {} |
Method Summary
Public Methods | ||
public |
cleanup() |
|
public |
delete(): * |
|
public |
|
|
public |
Find a value held within this DataModel. |
|
public |
has(dataField: *): * |
|
public |
|
|
public |
reset(data: {}) |
|
public |
set(dataField: *, value: *): * Set a key/value pair |
|
public |
setBatch(values: *): * Set a group of values. |
Inherited Summary
From class EventHandler | ||
public get |
listeners: EventListener[]: * |
|
public |
addListener(callback: function(eventName: string, eventSource: EventHandler), eventName: Object | Symbol, once: bool) |
|
public |
cleanup() |
|
public |
removeListener(callback: *, eventName: undefined) |
|
public |
trigger(eventName: *, params: ...*) Send an event to listeners |
From class DataObject | ||
public static |
fetchAll(dataObjects: ...*): * Fetch each DataObject and then wait for them all to return Note: this resolves when the fetches complete, regardless of whether they succeed or fail. |
|
public get |
fetchOptions: {"credentials": string} |
|
public get |
isNew: bool |
|
public get |
|
|
public |
|
|
public |
options: * |
|
public |
cleanup() |
|
public |
delete(): * |
|
public |
equals(obj: *): * |
|
public |
fetch(): * |
|
public |
onFirstReset(func: *) |
|
public |
parse(data: *): * |
|
public |
reset(data: {}) Clear out old data and set it to data, should trigger a 'reset' event |
|
public |
save(): * |
Public Constructors
public constructor(data: Object, options: Object, fieldDataObjects: Object) source
Override:
DataObject#constructorPublic Methods
public equals(obj: *): boolean source
Override:
DataObject#equalsParams:
Name | Type | Attribute | Description |
obj | * |
public get(dataField: *, defaultValue: undefined): * source
Find a value held within this DataModel.
Params:
Name | Type | Attribute | Description |
dataField | * | ||
defaultValue | undefined |
|
Return:
* | may be native types or, if mapped by options.fieldDataObjects, another DataObject |
public increment(dataField: *, amount: number) source
Params:
Name | Type | Attribute | Description |
dataField | * | ||
amount | number |
|
public reset(data: {}) source
Clear out old data and set it to data, should trigger a 'reset' event
Override:
DataObject#resetParams:
Name | Type | Attribute | Description |
data | {} |
|
public set(dataField: *, value: *): * source
Set a key/value pair
Params:
Name | Type | Attribute | Description |
dataField | * | ||
value | * |
Return:
* |
public setBatch(values: *): * source
Set a group of values. The 'values' parameter should be an object that works in for(key in values) loops like a dictionary: {} If a key is in options.fieldDataObjects then the value will be used to contruct a DataObject and that will be the saved value.
Params:
Name | Type | Attribute | Description |
values | * |
Return:
* |