Extensible observable models.
obs-model provides a minimal baseline for defining MVC or MVVM models with observable attributes.
var User = model'User'attr'id'attr'username';var bob = id: 1 username: 'bob';bobusernamesubscribeconsole.log"Bob's username is now: " + value;;bobusername'admin';// -> "Bob's username is now: admin"
Model with the given name.
The model's name as passed to
Defines a new attribute with the given name. The
options can be an object containing configuration data for model plugins.
The attribute will appear as an observable property on new model instances.
Adds the given plugin to the model. The function will later be called by the model's constructor with
this set to the new model instance.
This method is the backbone of model extensibility.
Model this model is an instance of.
Runs the model's destructors. Plugins can use these to free event listeners, subscriptions and such.
The MIT/Expat license.