diff --git a/src/pubsub.js b/src/pubsub.js index 16e1730..29f73bc 100644 --- a/src/pubsub.js +++ b/src/pubsub.js @@ -9,8 +9,14 @@ 'use strict'; var PubSub = {}; - root.PubSub = PubSub; - factory(PubSub); + + if (root.PubSub) { + PubSub = root.PubSub; + console.warn("PubSub already loaded, using existing version"); + } else { + root.PubSub = PubSub; + factory(PubSub); + } // CommonJS and Node.js module support if (typeof exports === 'object'){ if (module !== undefined && module.exports) {