bylexus / protobone

Backbone-inspired PrototypeJS Model extension - Enables Prototype JS users to fetch / store Models from / to a backend using AJAX / REST
http://bylexus.github.io/protobone/
MIT License
1 stars 1 forks source link

implement "defaults" on model #1

Open bylexus opened 9 years ago

bylexus commented 9 years ago

When defining a Model with Class.create, default attribute with values should be definable, e.g.:

var Color = Class.create(Prototype.Model, {
    defaults: {
        'r': 0,
        'g': 100,
        'b': 200
    }
});

Those defaults get set on Model instantiation as default values and get overridden by set values.