From ead79069b79df8c4f7d3324047cdb3b9d4c33571 Mon Sep 17 00:00:00 2001 From: Sven Busse Date: Fri, 13 Nov 2020 08:34:59 +0100 Subject: [PATCH] Fix amd module export (#173) Co-authored-by: Kevin <58685946+Kepeters@users.noreply.github.com> --- src/pubsub.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/pubsub.js b/src/pubsub.js index 91ff290..b05dc78 100644 --- a/src/pubsub.js +++ b/src/pubsub.js @@ -7,26 +7,24 @@ (function (root, factory){ 'use strict'; - + var PubSub = {}; root.PubSub = PubSub; - - var define = root.define; - factory(PubSub); - - // AMD support - if (typeof define === 'function' && define.amd){ - define(function() { return PubSub; }); - - // CommonJS and Node.js module support - } else if (typeof exports === 'object'){ + // CommonJS and Node.js module support + if (typeof exports === 'object'){ if (module !== undefined && module.exports) { exports = module.exports = PubSub; // Node.js specific `module.exports` } exports.PubSub = PubSub; // CommonJS module 1.1.1 spec module.exports = exports = PubSub; // CommonJS } + // AMD support + /* eslint-disable no-undef */ + else if (typeof define === 'function' && define.amd){ + define(function() { return PubSub; }); + /* eslint-enable no-undef */ + } }(( typeof window === 'object' && window ) || this, function (PubSub){ 'use strict';