async-script-promise

Asynchronously load scripts

Downloads
25
Stars
9

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

Package Rankings
Top 16.66% on Npmjs.org