diff --git a/lib/application/index.js b/lib/application/index.js index 5a95a59..1eb51b5 100644 --- a/lib/application/index.js +++ b/lib/application/index.js @@ -57,6 +57,7 @@ function Application (config) { this._readyQueue = []; this._renderQueue = []; this._configQueue = []; + this._paintsQueue = []; this._promise = new Promise(function (resolve, reject) { this._resolve = resolve; this._reject = reject; @@ -164,6 +165,22 @@ Application.prototype.processConfig = function (fn) { this.configure = this._configQueue.push = fn; }; +/** + * @param {Function} fn Function that can be queued to be executed + */ + +Application.prototype.queuePaintFunctions = function(fn) { + this._paintsQueue.push(fn); +} + +/** + * To be called by application after the interface has been painted + */ + +Application.prototype.processQueuedPaintFunctions = function() { + this._paintsQueue.forEach((fn) => fn()) +} + // -------------------------------------------------------------------------- // Exports class definition. // --------------------------------------------------------------------------