Kevlar is an MVC framework that I am developing while working at Jux (jux.com - make an account (3 form fields) and play).
My main intention and goal for writing this project was to address limitations and, to be frank, mediocrity in some of the other data frameworks that are out there (**cough cough BACKBONE cough**). Many are simplistic, don't support any schema ("whoops, I misspelled the attribute name and it failed silently!"), don't support any datatype checking, don't support any nesting of models, and just flat out aren't great for the long term maintenance and robustness that large applications require.
Will put some actual description on how to use up here sometime soon when it is in a more complete state :)
This is currently a work in progress, and is alpha.
- Fix for parent Models of a nested related (non-embedded) Collection to persist the IDs of the models in the Collection.
- Made parent Models of all nested Models and Collections (not just 'embedded' Models and Collections) always fire 'change' events for the nested Model/Collection's changes.
- Implemented nested 'related' (as opposed to 'embedded') Collections of a Model. The child Collection now synchronizes its Models with the server before the parent Model persists itself.
- Implemented Kevlar.Collection::sync(), which synchronizes the Collection's model with the server. This method creates, updates, and deletes models on the server that have been added (if it's a new model), modified, or removed from the Collection.
- Fix for Kevlar.util.Object.isEqual() method to properly shallow compare arrays (i.e. when the
deep
flag ===false
)
- Fix for when a model is added/removed/reordered in an embedded collection of a parent model, that an attribute-specific change event (i.e. "change:attr") is fired for the nested collection.
- Removed recursive search for functions from
defaultValue
functionality in attributes.
- Made attributes with user-defined 'setters' be updated after attributes with no user-defined setter when providing a set of values to update the Model with.
- Changed the name of the Model's load() method to reload() (and provided a backward compatibility alias).
- Added a static method to Model (and all of its subclasses) called getAttributes(), to statically retrieve the Attributes defined for a given Model class without needing an instance.
- Removed the ability to call the this._super() method in a provided set config function to Attribute. Was really unnecessary.
- Added default values for each of the "primitive" attribute types. Boolean attributes default to
false
, Number attributes default to0
, and String attributes default to the empty string (""
), unless theuseNull
config is set to true, in which case they will default tonull
(to denote an "unset" attribute).
- Updated to Class.js 0.3.1
- Added the ability for Model::isModified() and Collection::isModified() to only return true if persisted attributes are modified. Using this fixes an issue where a parent model might be persisted even though the only change to it was an unpersisted attribute in a nested child model.
- Merge pull request to fix URL appending in RestProxy.
- Changed the behavior of Collection's 'add' and 'remove' events. The 'add' and 'remove' events are now fired once for each addition or removal of one or more models. Added 'addset' and 'removeset' events for responding to a set of additions/removals all at once.
- Added a 'changeset' event, for handling a set of changes to a model all at once.
- Implemented automatic data conversions for the different Attribute types.
- Implemented "embedded" collections, where change events "bubble" to parent models.
- Implemented a range of other features / methods to fill in gaps, and make collections really usable.
- Implemented first Collection implementation.
- Implemented "embedded" models, where change events on nested embedded models "bubble" to parent models.
- Provide the old (previous) values of attributes to the Model's
change
event.
- Initial implementation