1.0.11 • Published 11 months ago

cross-origin-client v1.0.11

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

Cross-Origin Client

License

Cross-Origin Client is a client library for secure cross-origin communication using the postMessage API. It simplifies cross-origin communication by providing a straightforward one-liner experience.

Installation

Install the library via npm:

npm install cross-origin-client

Usage

To use Cross-Origin Client in your project, import it and create an instance with trusted origin:

import { CrossOriginClient } from "cross-origin-client";

// Create an instance of Cross-Origin Client
const client = new CrossOriginClient({ trustedOrigin: "https://example.com" });

Sending Messages

You can send messages to trusted origin using the send method:

const messageType = "messageTypeSupportedByTheReceivingSide";
const response = await client.send({ type: messageType });
console.log("Response received:", response);

License

This project is licensed under the MIT License.

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago