mikeric / rivets

Lightweight and powerful data binding.

Home Page:http://rivetsjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get Callback when component args change

GtrPksRnt4eatin opened this issue · comments

Hello, not really an issue but more a question/feature request.
Is there any way that i can trigger a callback function on a rivets components viewModel anytime the arguments to the component change? I have a plugin that needs some manual setup/configuration within the view. I would like to trigger the functions that do this from within the component every time the arguments change. I was thinking something along the lines of the following:

rivets.components['session-chooser'] = {
template: function() { return SessionChooser.prototype.HTML; },
initialize: function(el,attr) {
let viewModel = new SessionChooser(el,attr);
this.observers.event.callback <- point this at a function on the viewModel somehow or add another observer to do so..
return viewModel;
}
}