All Projects → macku → trainmanjs

macku / trainmanjs

Licence: MIT license
TrainmanJS - Cross-Origin Communication Library

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to trainmanjs

post-messenger
👶 ~1 Kb wrapper of window.postMessage for cross-document communication.
Stars: ✭ 28 (+75%)
Mutual labels:  communication, iframe, postmessage
rx-postmessenger
Minimal RxJS adapter for the window.postMessage API for request-response streams and notification streams across frame windows.
Stars: ✭ 27 (+68.75%)
Mutual labels:  events, iframe, postmessage
chronosjs
JS Channels (Events / Commands / Reqest-Response / Courier) Mechanism
Stars: ✭ 35 (+118.75%)
Mutual labels:  events, communication, postmessage
ibridge
Typesafe iframe bridge for easy parent child bidirectional communication
Stars: ✭ 25 (+56.25%)
Mutual labels:  communication, iframe, postmessage
Post Me
📩 Use web Workers and other Windows through a simple Promise API
Stars: ✭ 398 (+2387.5%)
Mutual labels:  communication, iframe
iframe-communication
Basic two way iframe communication
Stars: ✭ 88 (+450%)
Mutual labels:  communication, iframe
dead-simple
💀💡 Dead simple PubSub and EventEmitter in JavaScript
Stars: ✭ 21 (+31.25%)
Mutual labels:  events, eventemitter
tsee
Typed EventEmitter implemented with tsargs
Stars: ✭ 22 (+37.5%)
Mutual labels:  events, eventemitter
events
Tiny type-safe event emitter
Stars: ✭ 25 (+56.25%)
Mutual labels:  events, eventemitter
Eventemitter
Evented JavaScript for the browser
Stars: ✭ 3,107 (+19318.75%)
Mutual labels:  events, eventemitter
Joynr
A transport protocol agnostic (MQTT, HTTP, WebSockets etc.) Franca IDL based communication framework supporting multiple communication paradigms (RPC, Pub-Sub, broadcast etc.)
Stars: ✭ 124 (+675%)
Mutual labels:  events, communication
Postmate
📭 A powerful, simple, promise-based postMessage library.
Stars: ✭ 1,638 (+10137.5%)
Mutual labels:  iframe, postmessage
PostEvent
A Cross-Domain Event Handler javascript library. Pure Vanilla JS, no dependencies.
Stars: ✭ 14 (-12.5%)
Mutual labels:  iframe, postmessage
Across Tabs
Easy communication between cross-origin browser tabs. Simplified "CORS"ing!
Stars: ✭ 1,575 (+9743.75%)
Mutual labels:  postmessage, cross-origin
tiny-typed-emitter
Fully type-checked NodeJS EventEmitter
Stars: ✭ 96 (+500%)
Mutual labels:  events, eventemitter
Grouparoo
🦘 The Grouparoo Monorepo - open source customer data sync framework
Stars: ✭ 334 (+1987.5%)
Mutual labels:  events, communication
ember-window-messenger
This aims to be an simple window postMessage services provider.
Stars: ✭ 17 (+6.25%)
Mutual labels:  communication, postmessage
scion-microfrontend-platform
SCION Microfrontend Platform is a TypeScript-based open-source library that helps to implement a microfrontend architecture using iframes.
Stars: ✭ 51 (+218.75%)
Mutual labels:  iframe, cross-origin
ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 107 (+568.75%)
Mutual labels:  communication
SwiftHooks
Event driven programming in Swift
Stars: ✭ 17 (+6.25%)
Mutual labels:  events

TrainmanJS

npm version npm dependencies npm dev dependencies Build Status Coverage Status Greenkeeper badge

TrainmanJS is Cross-Origin Communication Library. It's a wrapper for the native postMessage API.

It allows you to send bidirectional Topics and Messages between the iframes and wrapper (parent) window.

Trainman

The Trainman is an exile who created and operates Mobil Avenue and is a servant of another exile program known as the Merovingian.

source: http://matrix.wikia.com/wiki/The_Trainman

Features

  • Topics and messages

    You can listen to different kind of topics and message to it. You have control to which frame you would like to send a message. What is also important, the parent frame knows exactly which child frame did send the message. Thanks to that you can omit some topics from particular recipients inside your topic listener.

  • Lazy loading

    Thanks to the queuing mechanism and buffer you can start sending messages immediately. You can send a message from the wrapper (parent) window to the child iframe even it's still loading. Queued messages will be delivered once the connection is established.

  • Reconnection

    When the child frame will reload itself, Trainman will try to reconnect with it. During the reconnection, Trainman will queue messages inside his buffer. Queued messages will be delivered once the connection is established again.

  • Bulk operation (upcoming)

    Post a message to all child frames at once. Don't need to specify an exact recipient. You can use the '*' symbol for sending a message to all of the connect children frames.

  • Debug mode

    Easily turn on and off logging mechanism. Thanks to that you can debug your code and application in a much more simple way. You can track and check whole Trainman and Passenger communication.

  • F2F (upcoming)

    Frame-to-frame direct communication. Allow to send and proxy messages directly between the child frames.

How to install

NPM and Yarn

You can install the library using NPM:

npm install trainmanjs -S
// or
yarn add trainmanjs

Next, you can import TrainmanJS module into your app:

import Trainman from 'trainmnanjs';

For the child pages (frames) you should import Passenger class:

import { Passenger } from 'trainmnanjs';

Using CDN

You can also use the CDN service ex. unpkg.com or npm-cdn.herrokuapp.com

<script src="https://unpkg.com/trainmanjs"></script>

<!-- or -->

<script src="http://npm-cdn.herokuapp.com/[email protected]/lib/trainmanjs.js"></script>

Then you can access the Trainman and Passenger from the injected module:

(function(module) {
  const Trainman = module.Trainman;
  const Passenger = module.Passenger;
})(window.trainmanjs);

How to use it

TBA

Examples

Simple Example

  1. Check simple example how to use Trainman
  2. Here you can find the source code for the above example

Re-connection and Debug Mode

  1. Reconnection example
  2. Here you can find the source code for the above example
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].