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
|
Methods
-
<static> extend(props, classProps)
-
Create a Record subclass.
var MyRecord = Record.extend({ foo: function () { return 'bar' } }) var record = new MyRecord() record.foo() // "bar"
Parameters:
Name Type Argument Default Description props
Object <optional>
{} Properties to add to the prototype of the subclass.
classProps
Object <optional>
{} Static properties to add to the subclass.
Returns:
Subclass of Record.
- Type
- function
-
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(key)
-
TODO
Parameters:
Name Type Argument Description key
string <optional>
TODO
-
commit()
-
TODO
-
create(opts)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. See Mapper#create.
-
destroy(opts)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. @see Model.destroy.
-
emit(event)
-
Trigger an event on this Record.
Parameters:
Name Type Description event
string Name of event to emit.
-
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()
-
TODO
-
hashCode()
-
TODO
-
loadRelations(relations, opts)
-
TODO
Parameters:
Name Type Argument Description relations
Array.<string> <optional>
TODO
opts
Object <optional>
TODO
-
off()
-
Remove an event listener from this Record.
-
on()
-
Register a new event listener on this Record.
-
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)
-
TODO
Parameters:
Name Type Argument Description opts
Object <optional>
Configuration options. See Mapper#create.
-
schema(key)
-
TODO
Parameters:
Name Type Argument Description key
string <optional>
TODO
-
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.
-
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.