Skip to content

Instantly share code, notes, and snippets.

@TylerJPresley
Last active July 9, 2016 21:17
Show Gist options
  • Save TylerJPresley/eece8e2432a2366cd8705f4d874a7056 to your computer and use it in GitHub Desktop.
Save TylerJPresley/eece8e2432a2366cd8705f4d874a7056 to your computer and use it in GitHub Desktop.
Load JS file on page // Aurelia (CLI/RequireJS)
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