schvenk
28 Nov 2010, 10:43 AM
I'm setting up an app using (roughly) MVC, which means I need my view (or objects within it) to generate arbitrary events that my controller can then listen for.
in jQuery I can have any object fire arbitrary events and then listen for them, e.g.:
var myObject = (function() {
this.doSomething = function() {
$(this).trigger('testEvent');
};
})();
$(myObject).bind('testEvent', function() { alert('Test event fired.'); });
In that example, calling myObject.doSomething() would result in the alert "Test event fired" being shown.
What's the Sencha Touch equivalent for this?
Thanks!
in jQuery I can have any object fire arbitrary events and then listen for them, e.g.:
var myObject = (function() {
this.doSomething = function() {
$(this).trigger('testEvent');
};
})();
$(myObject).bind('testEvent', function() { alert('Test event fired.'); });
In that example, calling myObject.doSomething() would result in the alert "Test event fired" being shown.
What's the Sencha Touch equivalent for this?
Thanks!