Socket
Socket
Sign inDemoInstall

@filestack/loader

Package Overview
Dependencies
0
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @filestack/loader

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


Version published
Weekly downloads
57K
decreased by-6.61%
Maintainers
3
Install size
125 kB
Created
Weekly downloads
 

Changelog

Source

1.0.9 (2021-03-25)

Bug Fixes

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

Readme

Source

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.

FAQs

Last updated on 25 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc