Skip to content
Browse files

Updated Build.

  • Loading branch information...
1 parent 0b30097 commit 1caf3cb0bdc041954d6332639224e16f43853ad0 @efeminella committed
View
21 dist/backbone-eventbroker.amd.js
@@ -24,8 +24,11 @@ define( function($, Backbone, _) {
* namespaced brokers can also be created in order to provide unique brokers
* within a particular part of an application.
*/
- Backbone.EventBroker = Backbone.EventBroker || ( function() {
- // Defines the cache which contains each namespaced EventBroker instance
+ Backbone.EventBroker = Backbone.EventBroker || (function() {
+ // Define a reference to Backbone.Events.trigger method
+ var _trigger = Backbone.Events.trigger;
+
+ // Define the cache which contains each namespaced EventBroker instance
var _brokers = {};
/*
@@ -219,7 +222,19 @@ define( function($, Backbone, _) {
}
return this;
}
- }, Backbone.Events, EventRegistry );
+ }, Backbone.Events, EventRegistry, {
+ /*
+ * Override Backbone.Events.Trigger to ensure an event name is provided,
+ * if so, forward arguments to native implementation, otherwise, throw
+ * an error.
+ */
+ trigger: function(name) {
+ if (name !== null && name !== void 0) {
+ return _trigger.apply(this, [].slice.call(arguments));
+ }
+ throw new Error('Backbone.EventBroker.trigger invoked with null or undefined event');
+ },
+ });
}());
// exports
return Backbone.EventBroker;
View
2 dist/backbone-eventbroker.amd.min.js
@@ -1 +1 @@
-define(function(e,t,n){var n=require("underscore"),e=require("jquery"),t=require("backbone");return"use strict",t.EventBroker=t.EventBroker||function(){var e={},r=function(e,t,r,i){var s;return!t&&e.interests&&(t=e,e=e.interests),s=n.isFunction(e)?e():e,n.each(s,function(s,o){var u=t[s];if(!n.isFunction(u))throw new Error("method '"+e[o]+"' not found for event '"+o+"'");r[i](o,u,t)}),r},i={register:function(e,t){return e||t?r(e,t,this,"on"):this},unregister:function(e,t){return e||t?r(e,t,this,"off"):this}};return n.extend({namespace:"",get:function(r){return this.has(r)||(e[r]=n.extend({namespace:r},t.Events,i)),e[r]},has:function(t){return typeof e[t]!="undefined"},destroy:function(t){return t?this.has(t)&&(e[t].off(),delete e[t]):n.each(e,function(e,t){this.destroy(t)},this),this}},t.Events,i)}(),t.EventBroker})
+define(function(e,t,n){var n=require("underscore"),e=require("jquery"),t=require("backbone");return"use strict",t.EventBroker=t.EventBroker||function(){var e=t.Events.trigger,r={},i=function(e,t,r,i){var s;return!t&&e.interests&&(t=e,e=e.interests),s=n.isFunction(e)?e():e,n.each(s,function(s,o){var u=t[s];if(!n.isFunction(u))throw new Error("method '"+e[o]+"' not found for event '"+o+"'");r[i](o,u,t)}),r},s={register:function(e,t){return e||t?i(e,t,this,"on"):this},unregister:function(e,t){return e||t?i(e,t,this,"off"):this}};return n.extend({namespace:"",get:function(e){return this.has(e)||(r[e]=n.extend({namespace:e},t.Events,s)),r[e]},has:function(e){return typeof r[e]!="undefined"},destroy:function(e){return e?this.has(e)&&(r[e].off(),delete r[e]):n.each(r,function(e,t){this.destroy(t)},this),this}},t.Events,s,{trigger:function(t){if(t!==null&&t!==void 0)return e.apply(this,[].slice.call(arguments));throw new Error("Backbone.EventBroker.trigger invoked with null or undefined event")}})}(),t.EventBroker})
View
4 dist/backbone-eventbroker.js
@@ -17,10 +17,10 @@
* within a particular part of an application.
*/
Backbone.EventBroker = Backbone.EventBroker || (function() {
- // Defines a reference to the native Backbone.Events.trigger method
+ // Define a reference to Backbone.Events.trigger method
var _trigger = Backbone.Events.trigger;
- // Defines the cache which contains each namespaced EventBroker instance
+ // Define the cache which contains each namespaced EventBroker instance
var _brokers = {};
/*
View
2 dist/backbone-eventbroker.min.js
@@ -1 +1 @@
-(function(e,t,n){"use strict";n.EventBroker=n.EventBroker||function(){var e={},r=function(e,n,r,i){var s;return!n&&e.interests&&(n=e,e=e.interests),s=t.isFunction(e)?e():e,t.each(s,function(s,o){var u=n[s];if(!t.isFunction(u))throw new Error("method '"+e[o]+"' not found for event '"+o+"'");r[i](o,u,n)}),r},i={register:function(e,t){return e||t?r(e,t,this,"on"):this},unregister:function(e,t){return e||t?r(e,t,this,"off"):this}};return t.extend({namespace:"",get:function(r){return this.has(r)||(e[r]=t.extend({namespace:r},n.Events,i)),e[r]},has:function(t){return typeof e[t]!="undefined"},destroy:function(n){return n?this.has(n)&&(e[n].off(),delete e[n]):t.each(e,function(e,t){this.destroy(t)},this),this}},n.Events,i)}();if(typeof define=="function"&&define.amd)return define(function(){return n.EventBroker});if(typeof module=="object"&&typeof module.exports=="object"){module.exports=n.EventBroker;return}})(jQuery,_,Backbone)
+(function(e,t,n){"use strict";n.EventBroker=n.EventBroker||function(){var e=n.Events.trigger,r={},i=function(e,n,r,i){var s;return!n&&e.interests&&(n=e,e=e.interests),s=t.isFunction(e)?e():e,t.each(s,function(s,o){var u=n[s];if(!t.isFunction(u))throw new Error("method '"+e[o]+"' not found for event '"+o+"'");r[i](o,u,n)}),r},s={register:function(e,t){return e||t?i(e,t,this,"on"):this},unregister:function(e,t){return e||t?i(e,t,this,"off"):this}};return t.extend({namespace:"",get:function(e){return this.has(e)||(r[e]=t.extend({namespace:e},n.Events,s)),r[e]},has:function(e){return typeof r[e]!="undefined"},destroy:function(e){return e?this.has(e)&&(r[e].off(),delete r[e]):t.each(r,function(e,t){this.destroy(t)},this),this}},n.Events,s,{trigger:function(t){if(t!==null&&t!==void 0)return e.apply(this,[].slice.call(arguments));throw new Error("Backbone.EventBroker.trigger invoked with null or undefined event")}})}();if(typeof define=="function"&&define.amd)return define(function(){return n.EventBroker});if(typeof module=="object"&&typeof module.exports=="object"){module.exports=n.EventBroker;return}})(jQuery,_,Backbone)

0 comments on commit 1caf3cb

Please sign in to comment.
Something went wrong with that request. Please try again.