adding onRenderComplete method

This commit is contained in:
ppisljar 2016-11-16 19:48:48 +01:00
parent fc78562c2b
commit 451ab9a1db

View file

@ -40,6 +40,8 @@ export default function VisFactory(Notifier, Private) {
this.setState(state);
this.setUiState(uiState);
this.on('renderComplete', () => this._renderComplete = true);
}
Vis.convertOldState = function (type, oldState) {
@ -171,6 +173,14 @@ export default function VisFactory(Notifier, Private) {
return this.type.implementsRenderComplete;
};
Vis.prototype.onRenderComplete = function (cb) {
this.on('renderComplete', cb);
if (this._renderComplete) {
// guarantees that caller receives event in case visualization already finished rendering
this.emit('renderComplete');
}
};
/**
* Currently this is only used to extract map-specific information
* (e.g. mapZoom, mapCenter).