Package detail

@filestack/loader

filestack311.3kSEE LICENSE IN LICENSE1.0.9

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

readme


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.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.0.9 (2021-03-25)

Bug Fixes

  • instances: move adding prefix before check if module is loaded (c7bba8b)

1.0.8 (2020-10-05)

1.0.7 (2020-03-25)

Bug Fixes

  • nodejs: fix problems with window object in node (9ac935e)

1.0.6 (2020-03-25)

Bug Fixes

  • node: disable register module method when window is missing (13f57f5)
  • nodejs: window is not defined in node env (293bbdd)

1.0.5 (2020-03-25)

Bug Fixes

  • nodejs: fix error when using in nodejs env (b053360)

1.0.4 (2020-03-19)

1.0.3 (2020-03-19)

1.0.2 (2020-03-19)

1.0.1 (2020-03-19)