mag.js
mag.js copied to clipboard
unload LF event for inner modules
It would be nice to be able to execute on unload life cycle event for a module inside a module that was attached to the state and then removed.
For example
mag.module('unloader', {
view: function(state) {
state.button = {_onclick:function(){
state.count = state.count + 1 || 1
}
}
state.mod = state.count%2 == 0 ? mag.module('testmod', {
controller: function() {
this.onunload = function() {
console.log('removed from state')
}
},
view: function() {}
}) : null
}
})