Features Example API Examples GitHub Get Started
v1.0.0 Released

postMessage
Made Simple

Type-safe, robust framework for window, tab, and iframe communication. Zero dependencies, full TypeScript support, security-first design.

npm install parley-js

Built for Production

Everything you need for secure cross-window communication

🔒

Security-First

Origin validation, message integrity checks, and configurable security policies protect your application.

📦

Zero Dependencies

Lightweight ~40KB bundle with no runtime dependencies. Just pure, efficient JavaScript.

🔷

Full TypeScript

Complete type safety with generics, strict typing, and excellent IDE support out of the box.

🔄

Request/Response

Built-in timeout handling, automatic retries, and response correlation for reliable messaging.

💓

Connection Lifecycle

Heartbeat monitoring, automatic reconnection, and connection state management.

📊

Analytics Ready

Built-in hooks for monitoring, debugging, and performance tracking integration.

Simple, Intuitive API

Get started in minutes with a clean, well-documented API

import { Parley, SYSTEM_EVENTS } from 'parley-js';

// Create instance with security config
const parley = Parley.create({
    allowedOrigins: ['https://child.example.com'],
    timeout: 5000,
});

// Register message handler
parley.on<{ user: string }>('hello', (payload, respond) => {
    console.log(`Hello from ${payload.user}!`);
    respond({ greeting: `Welcome!` });
});

// Connect to iframe
const iframe = document.querySelector('#child');
await parley.connect(iframe, 'child');

// Send message and get response
const response = await parley.send(
    'calculate',
    { data: [1, 2, 3] },
    { targetId: 'child' }
);

~40KB

Minified Bundle

0

Dependencies

100%

TypeScript

MIT

Licensed

Enjoying Parley-js?

If this framework has helped you build better applications, consider buying me a coffee to support continued development!