Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

application_event

oatkiller edited this page Sep 13, 2010 · 5 revisions

use this to get an application_event object which you can subscribe to and fire.

(function () {

var my_event = o.application_event();
my_event.subscribe(function (payload) {
	// do something with the payload
});

my_event.fire({
	data: 'will be avail. in the function you subscribed'
});

})();

you can also use the events multi_subscribe fn

(function () {

var my_event = o.application_event();
my_event.multi_subscribe({
	start: function () {
		// do something when it starts
	},
	finish: function () {
		// do something when it finishes
	}
});
my_event.fire({
	type: 'start',
	data: 'this obj will be passed to the fn you subscribed to start'
});
my_event.fire({
	type: 'finish',
	data: 'this obj will be passed to the fn you subscribed to finish'
});

})();

Clone this wiki locally