Skip to content

Commit

Permalink
Add the onConfigCompleteLoad event to the Viewer. (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
aberthet-gpsw authored May 15, 2017
1 parent 0036187 commit eba82f0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/core/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ FORGE.Viewer = function(parent, config, callbacks)
*/
this._onResume = null;

/**
* Event dispatcher for the on config load complete event.
* @name FORGE.Viewer#_onConfigLoadComplete
* @type {FORGE.EventDispatcher}
* @private
*/
this._onConfigLoadComplete = null;

/**
* Callback function for the viewer.
* @name FORGE.Viewer#_callbacks
Expand Down Expand Up @@ -497,6 +505,11 @@ FORGE.Viewer.prototype._parseMainConfig = function(config)
}

this._raf.start();

if (this._onConfigLoadComplete !== null)
{
this._onConfigLoadComplete.dispatch();
}
};

/**
Expand Down Expand Up @@ -801,6 +814,12 @@ FORGE.Viewer.prototype.destroy = function()
this._onResume = null;
}

if (this._onConfigLoadComplete !== null)
{
this._onConfigLoadComplete.destroy();
this._onConfigLoadComplete = null;
}

FORGE.VIEWERS.splice(this._uid, 1);

FORGE.BaseObject.prototype.destroy.call(this);
Expand Down Expand Up @@ -1411,3 +1430,23 @@ Object.defineProperty(FORGE.Viewer.prototype, "onResume",
return this._onResume;
}
});

/**
* Get the "onConfigLoadComplete" {@link FORGE.EventDispatcher} of the viewer.
* @name FORGE.Viewer#onConfigLoadComplete
* @readonly
* @type {FORGE.EventDispatcher}
*/
Object.defineProperty(FORGE.Viewer.prototype, "onConfigLoadComplete",
{
/** @this {FORGE.Viewer} */
get: function()
{
if (this._onConfigLoadComplete === null)
{
this._onConfigLoadComplete = new FORGE.EventDispatcher(this);
}

return this._onConfigLoadComplete;
}
});

0 comments on commit eba82f0

Please sign in to comment.