-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* PubSub.js | ||
* Javascript implementation of the Publish/Subscribe pattern. | ||
* | ||
* @version 3.3.0 | ||
* @version 3.4.0 | ||
* @author George Raptis <[email protected]> (georapbox.github.io) | ||
* @homepage https://github.com/georapbox/PubSub#readme | ||
* @repository https://github.com/georapbox/PubSub.git | ||
|
@@ -16,11 +16,14 @@ | |
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = definition(); | ||
} else { | ||
context[name] = definition(); | ||
context[name] = definition(name, context); | ||
} | ||
}('PubSub', this, function () { | ||
}('PubSub', this, function (name, context) { | ||
'use strict'; | ||
|
||
var VERSION = '3.4.0'; | ||
var OLD_PUBLIC_API = (context || {})[name]; | ||
|
||
function forOwn(obj, callback, thisArg) { | ||
var key; | ||
|
||
|
@@ -408,5 +411,33 @@ | |
return this; | ||
}; | ||
|
||
/** | ||
* Rolls back the global `PubSub` identifier and returns the current constructor function. | ||
* This can be used to keep the global namespace clean, or it can be used to have multiple simultaneous libraries | ||
* (including separate versions/copies of `PubSub`) in the same project without conflicts over the `PubSub` global identifier. | ||
* | ||
* @NOTE The `PubSub.noConflict()` static method only makes sense when used in a normal browser global namespace environment. | ||
* It should not be used with CommonJS or AMD style modules. | ||
* | ||
* @memberof PubSub | ||
* @return {PubSub} The PubSub constructor. | ||
* @example | ||
* | ||
* var EventEmitter = PubSub.noConflict(); | ||
* var emitter = new EventEmitter(); | ||
*/ | ||
PubSub.noConflict = function noConflict() { | ||
if (context) { | ||
context[name] = OLD_PUBLIC_API; | ||
} | ||
return PubSub; | ||
}; | ||
|
||
/** | ||
* PubSub version | ||
* @type {String} | ||
*/ | ||
PubSub.version = VERSION; | ||
|
||
return PubSub; | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters