Last active
June 11, 2017 19:28
-
-
Save chrisobriensp/49d1eb63326c44796a6e627f7e2881ce to your computer and use it in GitHub Desktop.
Adds some JS to every page as part of an SPFx Application Customizer.
This file contains hidden or 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
export default class CobGlobalJsApplicationCustomizer | |
extends BaseApplicationCustomizer<ICobGlobalJsApplicationCustomizerProperties> { | |
private _externalJsUrl: string = "https://sharepointnutsandbolts.azurewebsites.net/scripts/SPFxGlobalScript.js"; | |
@override | |
public onInit(): Promise<void> { | |
console.log(`CobGlobalJsApplicationCustomizer.onInit(): Entered.`); | |
let scriptTag: HTMLScriptElement = document.createElement("script"); | |
scriptTag.src = this._externalJsUrl; | |
scriptTag.type = "text/javascript"; | |
document.getElementsByTagName("head")[0].appendChild(scriptTag); | |
console.log(`CobGlobalJsApplicationCustomizer.onInit(): Added script link.`); | |
console.log(`CobGlobalJsApplicationCustomizer.onInit(): Leaving.`); | |
return Promise.resolve<void>(); | |
} | |
// other methods omitted.. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment