Closed wilsonpage closed 11 years ago
New model changes: 41980531bf453d921b3aee1d7bc2662990064772
Currently models must have a .toJSON()
method on them to work with FruitMachine. If anyone can think of a clever, clean way of supporting models that don't have this method, please say so.
After speaking with Jamie (@orangemug), he raised concerns about how users were encouraged to couple models into their Views via the
View#data
API.Suggested changes:
model
.Model
instance, FruitMachine will upgrade it to a model internally (bad, but required to fulfil the bad way we manage data in the web app)..get()
,set()
,toJSON()
) or define an 'adaptor' to translate the FruitMachine.Model API onto the foreign API.'modelfound'
event passing themodel
and the associatedview
to a callback. This is the developer's opportunity to swap out this 'detached' temporary model with a reference to a 'live' model if they wish. This means that if the application wishes to make changes to the 'live' model, the server rendered view will hear them and be able to update.