-
-
Save ZenwalkerD/ed2982b84277781462344e3f4f9e8148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadDynamicScript(): Promise<any> { | |
let that: this = this; | |
return new Promise((resolve, reject) => { | |
if (isNullOrUndefined(window.document.getElementById(this.id))) { | |
const scriptElement = window.document.createElement('script'); | |
scriptElement.id = this.id; | |
scriptElement.src = 'https://<Remote storage URL>/external-widgets/plotly.js/1.48.3/plotly.min.js'; | |
scriptElement.onload = () => { | |
resolve(); | |
}; | |
scriptElement.oncancel = () => { | |
window.document.getElementById(this.id).remove(); | |
reject(); | |
}; | |
scriptElement.onerror = () => { | |
window.document.getElementById(this.id).remove(); | |
reject(); | |
}; | |
window.document.body.appendChild(scriptElement); | |
} | |
else resolve(); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment