Skip to content

illBeRoy/incl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

incl

Travis

Handle your runtime cdn dependencies with care, and never again embed them using script tags.

incl handles runtime cdn dependencies for you, makes sure to not include any dependency more than once, and provides you with promise-based interface to monitor whether their inclusion was successful or not.

incl contains built-in type declarations, and can be used with typescript.

Installation

Using your favorite package manager, either:

$ npm install -s incl

Or:

$ yarn add incl

Quickstart

You can use it the old fashioned then \ catch way:

import { include } from 'incl';

include('//static.parastorage.com/services/js-sdk/1.89.0/js/wix.min.js')
	.then(() => Wix.requestLogin())
	.catch(() => window.location.href = '/err/500');

Or the more recent async \ await way:

import { include } from 'incl';

const main = async () => {
	
	try {
	
		await include('//static.parastorage.com/services/js-sdk/1.89.0/js/wix.min.js');
		Wix.requestLogin();
	} catch (err) {
	
		window.location.href = '/err/500';
	}
};

main();

License

Available to all under MIT license.

About

include and await cdn dependencies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published