Skip to content
Hai Phan edited this page Jun 24, 2018 · 4 revisions

TrackKeys

When called on an object, this method will create a keys property and keep it populated with the object's keys.

function MyModel() {
  this.users = require("push-model").trackKeys({});
  this.signIn = function() {
    this.users[7] = {name: "Ronaldo"};
    this.users[10] = {name: "Messi"};
    console.log(this.users.keys);	//[7,10]
  }
}
Clone this wiki locally