1.0.1 • Published 3 years ago

cross-origin-storage v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Table of Contents

  • Instalation
  • Usage
  • API

Instalation

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

Usage

Host

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: () => {},
});

Guest

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}",
});

API

CrossOriginStorageHost

CrossOriginStorageGuest