Skip to content

async script fetcher to help lazy load scripts after a document has loaded

License

Notifications You must be signed in to change notification settings

rileyhilliard/fetch-script-async

Repository files navigation

fetch-script-async

Async script fetcher with a promise API to help lazy load scripts.

Installation

npm install fetch-script-async
yarn add fetch-script-async

Example

import fetchScript from 'fetch-script-async';

const GA = 'https://www.google-analytics.com/analytics.js';

fetchScript(GA).then(script => {
  // do something after google analytics has been fetched and instantiated
});

About

async script fetcher to help lazy load scripts after a document has loaded

Resources

License

Stars

Watchers

Forks

Packages

No packages published