Skip to content

Commit 6a11c17

Browse files
committed
Remove GmailJS singleton implementation.
With support for nested XHR interceptors, we no longer need to maintain a singleton instance. (Besides... Singleton instances don't work properly with require()-style loading)
1 parent 656ebb8 commit 6a11c17

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/gmail.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/*eslint-env es6*/
88

9-
var Gmail_ = function(localJQuery) {
9+
var Gmail = function(localJQuery) {
1010

1111
/*
1212
Use the provided "jQuery" if possible, in order to avoid conflicts with
@@ -3020,24 +3020,7 @@ var Gmail_ = function(localJQuery) {
30203020
return api;
30213021
};
30223022

3023-
function initializeOnce(fn) {
3024-
var result;
3025-
return function() {
3026-
if (fn) {
3027-
result = fn.apply(this, arguments);
3028-
}
3029-
fn = null;
3030-
return result;
3031-
};
3032-
}
3033-
3034-
// required to avoid error in NodeJS.
3035-
var GmailClass = initializeOnce(Gmail_);
3036-
if (typeof(window) !== "undefined" && !window.Gmail) {
3037-
window.Gmail = GmailClass;
3038-
}
3039-
30403023
// make class accessible to require()-users.
30413024
if (typeof(exports) !== "undefined") {
3042-
exports.Gmail = GmailClass;
3025+
exports.Gmail = Gmail;
30433026
}

0 commit comments

Comments
 (0)