Feature: You can register objects on instantiation now

No need for calling the register method afterwards anymore. Pass an
array or a single object
This commit is contained in:
Oliver Sartun 2013-10-23 16:40:43 +02:00
parent ab20281c58
commit b01f919b9a

View File

@ -587,6 +587,15 @@
if (attr && attr.track) {
this.startTracking();
}
// Register objects passed in the "register" attribute
if (attr && attr.register) {
if (_.isArray(attr.register) || _.isArguments(attr.register)) {
apply(this.register, this, attr.register);
} else {
this.register(attr.register);
}
}
},
/**
* Starts tracking. Changes of registered objects won't be processed until you've called this function