- Instalation
- Usage
- API
Simply install the package in two applications, one that is going to be considered the Host, containing all the data you want to transfer, and a second one known as the Guest which will receive the data.
npm install cross-origin-storage
Use CrossOriginStorageHost
from cross-origin-storage
whenever you want to transfer data from Host to Guest:
import { CrossOriginStorageHost } from "cross-origin-storage";
const host = new CrossOriginStorageHost({
excludes: [],
whitelist: ["${GUEST_APPLICATION_URL}"],
identifier: "${SAME_IDENTIFIER_HOST_GUEST}",
iframeUrl: "${GUEST_APPLICATION_URL}",
initCallback: () => {},
});
Use CrossOriginStorageGuest
from cross-origin-storage
whenever you want to retrieve data from Host:
import { CrossOriginStorageGuest } from "cross-origin-storage";
const guest = new CrossOriginStorageGuest({
whitelist: ["${HOST_APPLICATION_URL}"],
identifier: "${SAME_IDENTIFIER_HOST_GUEST}",
});