@filestack/loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Dependency free js async script loader for browsers maintained by @Filestack

Installation

npm install @filestack/loader

Usage

Loading JavaScript Modules

To load async modules just call method loadModule

import { loadModule } from '@filestack/loader';

loadModule('module-id', 'url/to/b.js').then((b) => {
  b.helloWorld();
});
You can register some metadata after module will be loaded with register module

import { registerModule } from '@filestack/loader';

const api = {
  helloWorld() {
    console.log('Hello world!');
  },
};

// Module need to "tell" the loader that it's loaded and ready.
registerModule('module-id', api, { version: 123 });

Loading CSS

import { loadCss } from '@filestack/loader';

loadCss('url/to/style.css').then(() => {
  console.log('Style loaded!');
});

Development

Setup

npm install

Testing

Unit

npm test

This command opens in the browser semi-manual tests. Those tests don't have watch, so you need to refire the command with each change.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.978,108latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.978,108
1.0.81,015
1.0.71,674
1.0.60
1.0.50
1.0.40
1.0.310
1.0.20
1.0.10

Package Sidebar

Install

npm i @filestack/loader

Weekly Downloads

80,807

Version

1.0.9

License

SEE LICENSE IN LICENSE

Unpacked Size

128 kB

Total Files

13

Last publish

Collaborators

  • promanski
  • filestack-admin
  • pcholuj
  • filestack-dev
  • sebastian-wec