Skip to content

matthewmueller/async-script-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-script-promise

asynchronously load scripts.

Returns a promise, so you can kick it off as soon as your script loads, but wait to use it until it's actually loaded.

Install

npm install async-script-promise

Use

it('should load stripe', async () => {
  // start loading...
  let p = load('https://checkout.stripe.com/v3/checkout.js')

  // ensure that it's finished before using it
  await p
  assert.ok(window.StripeCheckout.configure)
})

License

MIT

About

Asynchronously load scripts

Resources

Stars

Watchers

Forks

Packages

No packages published