Created
September 1, 2017 19:04
-
-
Save asvae/eca3299607f74517564ad47583729ed0 to your computer and use it in GitHub Desktop.
2c2p-promise-loader.js
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
let promise | |
export async function getMy2c2p () { | |
promise || (promise = new Promise((resolve, reject) => { | |
const script = document.createElement('script') | |
script.src = 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js' | |
script.async = true | |
script.onload = () => { | |
resolve(My2c2p) | |
} | |
script.onerror = () => { | |
reject() | |
} | |
document.body.appendChild(script) | |
})) | |
return promise | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment