web-ipc
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Web IPC

A TypeScript library for IPC (Inter-Process Communication) between web applications and browser extensions. It provides a native-like calling experience between different contexts.

Features

  • Native-like method invocation between different contexts
  • Full TypeScript support ensuring type safety
  • Promise-based async method call support
  • Context-based service registration and invocation
  • Simple and easy-to-use API, calling methods just like local ones

Installation

npm install web-ipc

API Reference

IpcContext

class IpcContext {
  constructor(public contextId: string = "default") {}
}

Service Registration

function register<T>(interfaceName: string, implementation: T, context: IpcContext): void

Service Invocation

const chromeIpcInvoker = new ChromeIpcInvokerFactory();
const proxy = chromeIpcInvoker.createProxy<T>(interfaceName, context)

License

MIT

Package Sidebar

Install

npm i web-ipc

Weekly Downloads

76

Version

1.0.9

License

MIT

Unpacked Size

29.1 kB

Total Files

30

Last publish

Collaborators

  • hhhhhg