ento.js
Simple, stateful, observable objects in JavaScript. Yet another model library, but this one aims to make the API experience as close to plain JavaScript objects as possible.
var User = ; me = firstName: 'John' lastName: 'Coltrane' ; mefirstName = 'Jacques';mefirst_name; m;
-
Plain attributes: ECMAScript getters and setters are used to listen for updates in attributes. No need for methods like .get() and .set().
-
Change tracking: Listen for changes in instances via
.on('change')
. -
Custom sync: No persistence is built in (AJAX, SQL, etc). Implement it however you need it.
-
Model states: Keeps track of your model's state if it's fetching, or got an error. This is useful when used with data-binding view libraries.
-
Browser or Node.js: Reuse the same business code in your client-side libs and your server-side libs.
"Ento" is the Esperanto transation of the word "entity."
API overview
Computed properties: you can define properties that are derived from other properties.
var Person = ; var me = firstName: "Miles" lastName: "Davis" ; mefullName; "Miles Davis"
Plugins, and instance methods: create methods via use()
.
var Car = // plugins ; var civic = ;civicstart;
See the documentation for even more features.
What's it like?
- It's like Ember.Object, except decoupled from any MVC library.
- It's like Backbone.Model, but less emphasis on collections.
- It's like Spine.Model, but with change tracking.
- It's like Modella, but with collections. (You should probably try Modella, actually.)
- It's like all of the above, with simpler syntax, and a use-only-what-you-need approach.
Acknowledgements
Contains code from Backbone.js.
Backbone's MIT license goes here