ftlabs / fruitmachine

View rendering engine
MIT License
247 stars 18 forks source link

Build in `modelFound` logic #12

Closed wilsonpage closed 11 years ago

wilsonpage commented 11 years ago

Giving the dev the opportunity to switch out 'dead' models embedded in the server rendered view json, with 'live' synced models on the client.

FruitMachine.define({
  onModelFound: function(model, view) {
    //...swap it out
  }
});

or

FruitMachine.on('modelfound', function(model, view) {
  //...swap it out
});
wilsonpage commented 11 years ago

This functionality should now be available via the fm.on('inflation', function(view, options){}); and view.on('inflation', ...); event hooks. Soon to land in v0.4.