Skip to content

Commit

Permalink
Merge pull request #63 from mroderick/fix-49-51-commonjs-strict
Browse files Browse the repository at this point in the history
Fix CommonJS issues for contexts without `module` global
  • Loading branch information
aron committed Aug 11, 2014
2 parents 334ced1 + 4e5a118 commit a38ff7f
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ https://github.com/mroderick/PubSubJS
require,
window
*/
(function(root, factory){
(function (root, factory){
'use strict';

// CommonJS
if (typeof exports === 'object' && module){
module.exports = factory();
if (typeof define === 'function' && define.amd){
// AMD. Register as an anonymous module.
define(['exports'], factory);

// AMD
} else if (typeof define === 'function' && define.amd){
define(factory);
// Browser
} else {
root.PubSub = factory();
}
}( ( typeof window === 'object' && window ) || this, function(){
} else if (typeof exports === 'object'){
// CommonJS
factory(exports);

} else {
// Browser globals
factory((root.PubSub = {}));

}
}(( typeof window === 'object' && window ) || this, function (PubSub){
'use strict';

var PubSub = {},
messages = {},
var messages = {},
lastUid = -1;

function hasKeys(obj){
Expand Down Expand Up @@ -236,6 +236,4 @@ https://github.com/mroderick/PubSubJS

return result;
};

return PubSub;
}));

0 comments on commit a38ff7f

Please sign in to comment.