Last active
March 12, 2018 10:15
-
-
Save ryanjonhealy/cfffa7ffad2630b5a3271d276c90f828 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
export default class HelloWorldApplicationCustomizer extends BaseApplicationCustomizer { | |
private _externalJsUrl: string = "https://{yourtenant}.sharepoint.com/CDN/CustomStyling.css"; | |
private _externalJsUrl2: string = "https://{yourtenant}.sharepoint.com/CDN/CustomScript.js"; | |
private _externalJsUrl3: string = "https://{yourtenant}.sharepoint.com/CDN/jquery-3.3.1.min.js"; | |
public onInit(): Promise { | |
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`); | |
// Added to handle possible changes on the existence of placeholders. | |
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders); | |
// Call render method for generating the HTML elements. | |
this._renderPlaceHolders(); | |
return Promise.resolve(); | |
} | |
private _renderPlaceHolders(): void { | |
let scriptTag1: HTMLLinkElement = document.createElement("link"); | |
scriptTag1.rel = "stylesheet"; | |
scriptTag1.href = this._externalJsUrl; | |
scriptTag1.type = "text/css"; | |
document.getElementsByTagName("head")[0].appendChild(scriptTag1); | |
let scriptTag2: HTMLScriptElement = document.createElement("script"); | |
scriptTag2.src = this._externalJsUrl2; | |
scriptTag2.type = "text/javascript"; | |
document.getElementsByTagName("head")[0].appendChild(scriptTag2); | |
let scriptTag3: HTMLScriptElement = document.createElement("script"); | |
scriptTag3.src = this._externalJsUrl3; | |
scriptTag3.type = "text/javascript"; | |
document.getElementsByTagName("head")[0].appendChild(scriptTag3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment