1.8.4 • Published 6 months ago
modapp-resource v1.8.4
ModApp Resource
Utility classes implementing modapp's resource interfaces for Models and Collections.
Installation
With npm:
npm install modapp-resource
With yarn:
yarn add modapp-resource
Usage
import { Model } from 'modapp-resource';
// Creating generic model
let model = new Model({
data: {
id: 12,
foo: "bar"
}
});
let onChange = changed => alert("Foo is now ", model.foo);
// Adding a model listener
model.on('change', onChange);
// Setting the property foo, triggering a change event
model.set({foo: "baz"});
// Removing model listener
model.off('change', onChange);