Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Create globalNamespaceObject variable for easy namespacing in initial…

…ize.js
  • Loading branch information...
commit d146ae5682ab2e3006adde878bab3f89b0b0413e 1 parent 9fc4bf2
Chris Bosco authored
View
2  src/ascender/ascender_script.js
@@ -78,7 +78,7 @@ webfont.AscenderScript.prototype.parseVariations = function(source){
return variations;
};
-window[globalName].addModule(webfont.AscenderScript.NAME, function(configuration) {
+globalNamespaceObject.addModule(webfont.AscenderScript.NAME, function(configuration) {
var domHelper = new webfont.DomHelper(document);
return new webfont.AscenderScript(domHelper, configuration);
});
View
2  src/async_load.js
@@ -1,3 +1,3 @@
if (window['WebFontConfig']) {
- window[globalName]['load'](window['WebFontConfig']);
+ globalNamespaceObject['load'](window['WebFontConfig']);
}
View
6 src/core/initialize.js
@@ -2,7 +2,7 @@
var globalName = 'WebFont';
// Provide an instance of WebFont in the global namespace.
-window[globalName] = (function() {
+var globalNamespaceObject = window[globalName] = (function() {
var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document);
var userAgent = userAgentParser.parse();
var domHelper = new webfont.DomHelper(document);
@@ -13,8 +13,8 @@ window[globalName] = (function() {
})();
// Export the public API.
-window[globalName]['load'] = window[globalName].load;
-window[globalName]['addModule'] = window[globalName].addModule;
+globalNamespaceObject['load'] = globalNamespaceObject.load;
+globalNamespaceObject['addModule'] = globalNamespaceObject.addModule;
// Export the UserAgent API because we pass this object to external modules.
webfont.UserAgent.prototype['getName'] = webfont.UserAgent.prototype.getName;
View
2  src/custom/customcss.js
@@ -31,7 +31,7 @@ webfont.CustomCss.prototype.supportUserAgent = function(userAgent, support) {
return support(userAgent.isSupportingWebFont());
};
-window[globalName].addModule(webfont.CustomCss.NAME, function(configuration) {
+globalNamespaceObject.addModule(webfont.CustomCss.NAME, function(configuration) {
var domHelper = new webfont.DomHelper(document);
return new webfont.CustomCss(domHelper, configuration);
});
View
2  src/fontdeck/fontdeck_script.js
@@ -55,7 +55,7 @@ webfont.FontdeckScript.prototype.load = function(onReady) {
onReady(this.fontFamilies_, this.fontVariations_);
};
-window[globalName].addModule(webfont.FontdeckScript.NAME, function(configuration) {
+globalNamespaceObject.addModule(webfont.FontdeckScript.NAME, function(configuration) {
var domHelper = new webfont.DomHelper(document);
return new webfont.FontdeckScript(window, domHelper, configuration);
});
View
2  src/google/googlefontapi.js
@@ -48,7 +48,7 @@ webfont.GoogleFontApi.prototype.insertLink_ = function(onReady) {
fontApiParser.getFontTestStrings());
};
-window[globalName].addModule(webfont.GoogleFontApi.NAME, function(configuration) {
+globalNamespaceObject.addModule(webfont.GoogleFontApi.NAME, function(configuration) {
var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document);
var userAgent = userAgentParser.parse();
return new webfont.GoogleFontApi(userAgent, new webfont.DomHelper(document),
View
2  src/monotype/monotype_script.js
@@ -97,7 +97,7 @@ webfont.MonotypeScript.prototype.protocol = function () {
return defaultProtocol;
};
-window[globalName].addModule(webfont.MonotypeScript.NAME, function (configuration) {
+globalNamespaceObject.addModule(webfont.MonotypeScript.NAME, function (configuration) {
var userAgentParser = new webfont.UserAgentParser(navigator.userAgent, document);
var userAgent = userAgentParser.parse();
var domHelper = new webfont.DomHelper(document);
View
2  src/typekit/typekit_script.js
@@ -53,7 +53,7 @@ webfont.TypekitScript.prototype.load = function(onReady) {
onReady(this.fontFamilies_, this.fontVariations_);
};
-window[globalName].addModule(webfont.TypekitScript.NAME, function(configuration) {
+globalNamespaceObject.addModule(webfont.TypekitScript.NAME, function(configuration) {
var domHelper = new webfont.DomHelper(document);
return new webfont.TypekitScript(window, domHelper, configuration);
});
Please sign in to comment.
Something went wrong with that request. Please try again.