Closed sobrinho closed 9 years ago
Would be nice to have default values like this:
MyStore = Fluxo.CollectionStore.extend({ defaults: { someFilter: true, anotherFilter: {} } });
Note that in store constructor we need to deep clone the defaults to avoid mutating the defaults object itself.
Backbone did a different approach which I don't like (isn't obvious that it need to be that way until you find a obscure bug):
MyModel = Backbone.Model.extend({ defaults: function () { return { someFilter: true, anotherFilter: {} }; } });
Although using function is a must because we may need to use new Date() for example:
new Date()
MyStore = Fluxo.CollectionStore.extend({ defaults: function () { return { someFilter: new Date, anotherFilter: {} }; } });
Using classes it would be a static property:
class MyStore extends Fluxo.CollectionStore { } MyStore.defaults = { ... };
:ok_hand:
See #11
Would be nice to have default values like this:
Note that in store constructor we need to deep clone the defaults to avoid mutating the defaults object itself.
Backbone did a different approach which I don't like (isn't obvious that it need to be that way until you find a obscure bug):
Although using function is a must because we may need to use
new Date()
for example:Using classes it would be a static property: