constructor no longer has the option to initialize with a collection of records, use add()
This commit is contained in:
parent
cccffd3fa4
commit
d44346d7be
src
|
@ -22,18 +22,23 @@
|
|||
* // create a new record (in-memory)
|
||||
* let pets = new Record();
|
||||
*
|
||||
* @example
|
||||
* // create a new record (localStorage)
|
||||
* let pets = new Record({"store": "pets"});
|
||||
*
|
||||
* @param {array} init - collection to start with
|
||||
* @param {object} opts
|
||||
* @param {object} opts.store - localStorage ID to use
|
||||
* @param {object} opts.debug - show console logs
|
||||
*/
|
||||
constructor(init, opts) {
|
||||
constructor(opts) {
|
||||
// define options
|
||||
this.store = (opts || {}).store;
|
||||
this.debug = (opts || {}).debug || false;
|
||||
|
||||
// initialize the collection
|
||||
this.records = Array.isArray(init) ? init : [];
|
||||
this.records = [];
|
||||
|
||||
// get stored records, merge as needed
|
||||
if(this.store && localStorage) {
|
||||
this._log("Initializing localStorage for " + this.store);
|
||||
|
|
Loading…
Reference in New Issue