@paciolan/remote-module-loader
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16979
96