diff --git a/app/assets/javascripts/bullseye.js b/app/assets/javascripts/bullseye.js index 1d2ce3a..ef9456a 100644 --- a/app/assets/javascripts/bullseye.js +++ b/app/assets/javascripts/bullseye.js @@ -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')); });