component / model

Minimalistic extensible data models
122 stars 40 forks source link

Don't emit "change" events when first initialized & model-level "change" events when attributes are set #27

Closed matthewmueller closed 11 years ago

matthewmueller commented 11 years ago

This pull request does two things:

Model-level change events are particularly useful for synchronizing shared data between two client-side models, especially when the models arrive at different times during the life-cycle of the app.

matthewmueller commented 11 years ago

cool, thanks man!

tj commented 11 years ago

np thanks!

matthewmueller commented 11 years ago

well this problem could also be solved by giving model.set a silent option. The main issue this PR was solving was to prevent all the change events from being fired when you first initialize.

karlbohlmark commented 11 years ago

In #23 there is a proposal to emit a 'construct' event from the constructor which would be a better way to intercept the construction.

I think the ´silent´ parameter could probably be useful anyway, and it is expected by people migrating from backbone (not sure if that is an argument though).

Anyway I'd really like component/model and component/collection to progress into smth usable to make component an easier sell as a backbone replacement.