Last active
July 9, 2016 21:17
-
-
Save TylerJPresley/eece8e2432a2366cd8705f4d874a7056 to your computer and use it in GitHub Desktop.
Load JS file on page // Aurelia (CLI/RequireJS)
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 class MyClass | |
activate(params, routeConfig, navigationInstruction) { | |
if (!document.querySelector('script#stripe-source')) { | |
let sc = document.createElement('script'); | |
sc.setAttribute('id', 'stripe-source'); | |
sc.async = true; | |
sc.setAttribute('src', 'https://js.stripe.com/v2/'); | |
document.body.appendChild(sc); | |
} | |
} | |
deactivate() { | |
let spriteScript = document.querySelector('script#stripe-source'); | |
if (spriteScript) { | |
spriteScript.remove(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment