1.1.10 • Published 6 years ago

load-resource v1.1.10

Weekly downloads
98
License
ISC
Repository
-
Last release
6 years ago

HubSpot Client API

This package exposes a function named "load" which takes a URL or an array of URLs and returns a Promise will resolve after all resources finishes loading.

npm i
npm run prepublish

Installation

npm i -S load-resource

API

require('load-resource') returns a function with the following signature: function(url[, opts = {}) => Promise

url

Any url that you would like to load. May be absolute or relative.

, opts

A map of attributes to set on the script or link node before appending it to the DOM. By default this is empty.

Usage

import loadResource from 'load-resource';

// Load a single library
loadResource.load('url').then(res => {console.log('url has finished loading')});

// Load multiple libraries
loadResource.load([
	'url1', 
	'url2',
]).then(res => {console.log('all urls have finished loading')});

License

See LICENSE.txt

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

0.1.0

6 years ago