New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

crs-modules

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crs-modules

CRS modules allows you to define modules based on keys. The aim is to load modules only when required. Under normal conditions you would just use the import language feature. When working with schema driven UI however you may want to have something

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

CRS Modules

Introduction

CRS modules allows you to define modules based on keys.
The aim is to load modules only when required.
Under normal conditions you would just use the import language feature. When working with schema driven UI however you may want to have something that will dynamically load modules based on the features defined in the modules.

This library aims to be used alongside packages such as crs-schema and crs-components for the above example.

Functions

dispose

When you are done with the modules, call dispose to clear resources

clear

Clear all resources registered on modules

add

Add new module to load providing a key and value pair.

await crs.modules.add("module-name", "/app/function-test.js");

remove

Remove a module from the registry.

await crs.modules.remove("module-name");

get

Load and get the module from the registry for further use.

await crs.modules.get("module-name");

getDefault

Load the module and return the default exported module item.

const fn = await this.getDefault("module-name");

getInstanceOf

Create a class instance defined on the module.

await crs.modules.getInstanceOf("module-name", "ClassName");

getInstanceOfDefault

Create a class instance that is exported as the default

await crs.modules.getInstanceOfDefault("module-name");

call

Call a function defined on the module.

await crs.modules.call("module-name", null, "functionTest", param1, param2);

callDefault

Call a function that is set as the default export.

await crs.modules.callDefault("default", null, "Hello World"); 

FAQs

Package last updated on 01 Apr 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc