Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@paciolan/remote-module-loader

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paciolan/remote-module-loader - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

package.json
{
"name": "@paciolan/remote-module-loader",
"version": "1.0.0",
"version": "1.1.0",
"description": "",

@@ -12,3 +12,3 @@ "main": "dist/main.js",

"type": "ssh",
"url": "git@gitlabdev.paciolan.info:development/library/library/remote-module-loader.git"
"url": "git@gitlabdev.paciolan.info:development/library/javascript/remote-module-loader.git"
},

@@ -15,0 +15,0 @@ "scripts": {

@@ -5,2 +5,8 @@ # Remote Module Loader [![pipeline status](https://gitlabdev.paciolan.info/development/library/javascript/remote-module-loader/badges/master/pipeline.svg)](https://gitlabdev.paciolan.info/development/library/javascript/remote-module-loader/commits/master) [![coverage report](https://gitlabdev.paciolan.info/development/library/javascript/remote-module-loader/badges/master/coverage.svg)](https://gitlabdev.paciolan.info/development/library/javascript/remote-module-loader/commits/master)

# Use Cases
Lazy Load Modules to keep initial load times down and load modules just in time.
Update Remote Modules independent of the web application. Update a module without redeploying the web application.
# Install

@@ -12,4 +18,6 @@

# Simple Example
# createLoadRemoteModule
## Simple Example
If your module has no external dependencies, this is the easiest method to fetch the remote module.

@@ -27,19 +35,4 @@

```javascript
/**
* src/index.js
*/
## Require Example
import loadRemoteModule from "./lib/loadRemoteModule";
const myModule = loadRemoteModule("http://fake.url/modules/my-module.js");
myModule.then(m => {
const value = m.default();
console.log({ value });
});
```
# Require Example
You can pass dependencies to the module.

@@ -65,19 +58,4 @@

```javascript
/**
* src/index.js
*/
## Using your own fetcher
import loadRemoteModule from "./lib/loadRemoteModule";
const myModule = loadRemoteModule("http://fake.url/modules/my-module.js");
myModule.then(m => {
const value = m.default();
console.log({ value });
});
```
# Using your own fetcher
By default `loadRemoteModule` will use the `XMLHttpRequest` object avaiable in the browser. This can be overridden if you want to use an alternate method.

@@ -98,2 +76,6 @@

# Usage
Modules are loaded asynchronously, so use similar techniques to any other async function.
```javascript

@@ -114,16 +96,2 @@ /**

# React Hooks
The same techniques to include a `requires` and a `fetcher` with `createLoadRemoteModule` also work with `createUseRemoteComponent`. No need to go over them again.
```javascript
/**
* src/lib/useRemoteComponent.js
*/
import { createUseRemoteComponent } from "@paciolan/remote-module-loader";
export default createUseRemoteComponent();
```
# Contributors

@@ -130,0 +98,0 @@

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