ensure targets are available

This commit is contained in:
John Bintz 2012-08-26 21:33:39 -04:00
parent f31dd0f3d4
commit 7c1b4b1ca5

View File

@ -2,11 +2,12 @@
this.Bullseye = {
target: function(controller, action, callback) {
this.targets = (this.targets || {});
this.targets[controller] = (this.targets[controller] || {});
this.targets[controller][action] = callback;
},
targets: {},
exec: function(controller, action) {
if (this.targets[controller] && this.targets[controller][action]) {
this.targets[controller][action].apply(this.context);
@ -17,8 +18,5 @@ this.Bullseye = {
Bullseye.context = this;
$(function() {
var controller = $('body').data('controller');
var action = $('body').data('action');
Bullseye.exec(controller, action);
Bullseye.exec($('body').data('controller'), $('body').data('action'));
});