3 ms·
OK, this is an interesting approach. Here are some notes from reading the source: - Basic model classes: Model and Collection similar to Backbone, but much sim
by tjelen 12y ago
OK, this is an interesting approach.
Here are some notes from reading the source:
- Basic model classes: Model and Collection similar to Backbone, but much simplified (no REST-API stuff, validations etc, it's basically just that events are fired when data is changed)
- There are no templates, all or most of the markup is already present on the page
- The Controller class is attached to a DOM element. Specific nodes (called 'refs' as in React) inside this element are denoted by the "data-ref" attribute. These are collected by the controller during init phase and then their state is managed via the render() method.
- there's a special List controller which can be connected to a Collection. It manages a list of sub-Controllers (each attached to an item in the Collection)
I like the simplicity. It's very similar to what I'm using lately for smaller projects.
- akrymski 12y agoMay I add one more point: - the render() method provides a way to declare what the DOM looks like (React-style) OR manipulate the DOM imperatively (Backbone style) This helps the Flux one-directional data flow, which you can see in the ToDo example. Controller's model is actually its internal state by default, so all data mutation must go through the main data store. Thank you so much for boiling it down to the key points, I've been struggling to explain the details clearly. Really the best way to understand what's going on is to read the ToDo app as it's only 100 lines. We are using this for PhoneGap and node-webkit apps, it's a perfect for for mobiles where you need fine-grained control over memory and performance, and you know the runtime you're developing against (webkit) so there isn't a goal to get this running across every browser like React or Backbone.