Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CommonJS issues for contexts without module global #63

Merged
merged 2 commits into from
Aug 11, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -210,6 +210,4 @@ https://github.com/mroderick/PubSubJS

return result;
};

return PubSub;
}));