Closed pgilad closed 8 years ago
Hi @pgilad
The purpose of freezer is to be a big data structure that contains all your whole app state. Every node of the structure can emit events, so you can see it like a big backbone nested model, but it is not really that way.
Backbone models are entities, for example a cat, so it is easy to bind them to a REST API endpoint, /cats.
Freezer can have any type of data in it, and bind REST capabilities for each node would be out of its scope.
Inside frezeer the cat would be just an object, and a collection of cats just an array, so it is better to have ajax logic out of it, because that logic would be taken off on every node update.
An example on how to use a rest interface with freezer nodes would be something like:
Function updateColor(cat, color){
Rest.patch('/cats/' + cat.id ).set({color: color}).end(function(response){
cat.reset( response.body );
});
}
Being cat
a freezer node, the update would refresh the app when finished.
Close?
Backbone.js Models & Collections have a rest interface. Since Freezer is very similar to Backbone Model (but without the REST interface), was wondering if there are recommended adapters or interfaces for REST, and also - for using Freezer along with collections (and REST)