Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Initialize Pluggable with app to get rid of globals.
Browse files Browse the repository at this point in the history
  • Loading branch information
omarreiss committed Oct 6, 2015
1 parent 8353966 commit ce32d4a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/pluggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ YoastSEO = ( "undefined" === typeof YoastSEO ) ? {} : YoastSEO;
* @property plugins {object} The plugins that have been registered.
* @property modifications {object} The modifications that have been registered. Every modification contains an array with callables.
*/
YoastSEO.Pluggable = function() {
YoastSEO.Pluggable = function( app ) {
this.app = app;
this.loaded = false;
this.preloadThreshold = 3000;
this.plugins = {};
Expand Down Expand Up @@ -106,7 +107,7 @@ YoastSEO.Pluggable.prototype._registerPlugin = function( pluginName, options ) {
}

this.plugins[pluginName] = options;
YoastSEO.app.updateLoadingDialog( this.plugins );
this.app.updateLoadingDialog( this.plugins );
return true;
};

Expand All @@ -128,7 +129,7 @@ YoastSEO.Pluggable.prototype._ready = function( pluginName ) {
}

this.plugins[pluginName].status = "ready";
YoastSEO.app.updateLoadingDialog( this.plugins );
this.app.updateLoadingDialog( this.plugins );
return true;
};

Expand All @@ -149,7 +150,7 @@ YoastSEO.Pluggable.prototype._reloaded = function( pluginName ) {
return false;
}

YoastSEO.app.runAnalyzer( YoastSEO.app.rawData );
this.app.runAnalyzer( this.app.rawData );
return true;
};

Expand Down Expand Up @@ -218,7 +219,7 @@ YoastSEO.Pluggable.prototype._pollLoadingPlugins = function( pollTime ) {
pollTime = pollTime === undefined ? 0 : pollTime;
if ( this._allReady() === true ) {
this.loaded = true;
YoastSEO.app.pluginsLoaded();
this.app.pluginsLoaded();
} else if ( pollTime >= this.preloadThreshold ) {
this._pollTimeExceeded();
} else {
Expand Down Expand Up @@ -255,7 +256,7 @@ YoastSEO.Pluggable.prototype._pollTimeExceeded = function() {
}
}
this.loaded = true;
YoastSEO.app.pluginsLoaded();
this.app.pluginsLoaded();
};

/**
Expand Down

0 comments on commit ce32d4a

Please sign in to comment.