new Record(props, opts)
js-data's Record class.
import {Record} from 'js-data'
Parameters:
Name | Type | Argument | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object |
<optional> |
The initial properties of the new Record instance. |
||||||||||
opts |
Object |
<optional> |
Configuration options. Properties
|
Extends
Methods
-
afterLoadRelations(relations, opts)
-
TODO
Parameters:
Name Type Description relations
Array.<string> TODO
opts
Object TODO
-
afterSave(opts)
-
TODO
Parameters:
Name Type Description opts
Object TODO
-
beforeLoadRelations(relations, opts)
-
TODO
Parameters:
Name Type Description relations
Array.<string> TODO
opts
Object TODO
-
beforeSave(opts)
-
TODO
Parameters:
Name Type Description opts
Object TODO
-
changes(opts)
-
Return changes to this record since it was instantiated or Record#commit was called.
Parameters:
Name Type Argument Description opts
<optional>
Configuration options.
Properties
Name Type Argument Description equalsFn
function <optional>
Equality function. Default uses
===
.ignore
Array <optional>
Array of strings or RegExp of fields to ignore.
-
commit()
-
TODO
-
create(opts)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. See Mapper#create.
-
dbg()
-
- Inherited From:
- Source:
-
destroy(opts)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. @see Model.destroy.
-
get(key)
-
Return the value at the given path for this instance.
Parameters:
Name Type Description key
string Path of value to retrieve.
Returns:
Value at path.
- Type
- *
-
hasChanges(opts)
-
Return whether this record has changed since it was instantiated or Record#commit was called.
Parameters:
Name Type Argument Description opts
<optional>
Configuration options.
Properties
Name Type Argument Description equalsFn
function <optional>
Equality function. Default uses
===
.ignore
Array <optional>
Array of strings or RegExp of fields to ignore.
-
hashCode()
-
TODO
-
loadRelations(relations, opts)
-
TODO
Parameters:
Name Type Argument Description relations
Array.<string> <optional>
TODO
opts
Object <optional>
TODO
-
log()
-
- Inherited From:
- Source:
-
previous(key)
-
TODO
Parameters:
Name Type Argument Description key
string <optional>
TODO
-
revert(opts)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options.
-
save(opts)
-
Delegates to Mapper#update.
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. See Mapper#create.
-
set(key, value, opts)
-
Set the value for a given key, or the values for the given keys if "key" is an object.
Parameters:
Name Type Argument Description key
string | Object Key to set or hash of key-value pairs to set.
value
* <optional>
Value to set for the given key.
opts
Object <optional>
Optional configuration.
Properties
Name Type Argument Default Description silent
boolean <optional>
false Whether to trigger change events.
-
toJSON(opts)
-
Return a plain object representation of this record. If the class from which this record was created has a mapper, then Mapper#toJSON will be called instead.
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options.
Properties
Name Type Argument Description with
Array.<string> <optional>
Array of relation names or relation fields to include in the representation. Only available as an option if the class from which this record was created has a mapper.
Returns:
Plain object representation of this record.
- Type
- Object
-
unset(key, opts)
-
Unset the value for a given key.
Parameters:
Name Type Argument Description key
string Key to unset.
opts
Object <optional>
Optional configuration.
Properties
Name Type Argument Default Description silent
boolean <optional>
false Whether to trigger change events.