All Projects → jcubic → Sysend.js

jcubic / Sysend.js

Licence: mit
Send messages between open pages or tabs in same browser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sysend.js

Eventd
A simple daemon to track remote or local events and do actions the user wants to
Stars: ✭ 43 (-87.61%)
Mutual labels:  events, notifications
React Native Listener
A utility component to allow easy access to browser native events
Stars: ✭ 136 (-60.81%)
Mutual labels:  events, browser
Vertical Tabs Reloaded
Firefox add-on for arranging tabs vertically
Stars: ✭ 115 (-66.86%)
Mutual labels:  tabs, browser
Chrome Tabs
Chrome-style tabs in HTML/CSS.
Stars: ✭ 1,348 (+288.47%)
Mutual labels:  tabs, browser
SwiftObserver
Elegant Reactive Primitives for Clean Swift Architecture #NoRx
Stars: ✭ 14 (-95.97%)
Mutual labels:  notifications, callback
Noel
A universal, human-centric, replayable javascript event emitter.
Stars: ✭ 158 (-54.47%)
Mutual labels:  events, browser
Espui
A simple web user interface library for ESP32 and ESP8266
Stars: ✭ 330 (-4.9%)
Mutual labels:  callback, browser
Browser Update
Remind users to update their browser in an unobtrusive way
Stars: ✭ 274 (-21.04%)
Mutual labels:  notifications, browser
angular-PubSub
Angular 1.x implementation of the Publish–Subscribe pattern.
Stars: ✭ 32 (-90.78%)
Mutual labels:  events, callback
Is Hotkey
Check whether a browser event matches a hotkey.
Stars: ✭ 211 (-39.19%)
Mutual labels:  events, browser
Smart-Inspector
Fluent re-take on Unity Inspector UX. Packed with QoL improvements.
Stars: ✭ 680 (+95.97%)
Mutual labels:  events, tabs
Pg Listen
📡 PostgreSQL LISTEN & NOTIFY for node.js that finally works.
Stars: ✭ 348 (+0.29%)
Mutual labels:  events, notifications
Inox Patchset
Inox patchset tries to provide a minimal Chromium based browser with focus on privacy by disabling data transmission to Google.
Stars: ✭ 335 (-3.46%)
Mutual labels:  browser
Grpc Web
gRPC Web implementation for Golang and TypeScript
Stars: ✭ 3,722 (+972.62%)
Mutual labels:  browser
Copy As Markdown
Copying Link, Image and Tab(s) as Markdown Much Easier.
Stars: ✭ 332 (-4.32%)
Mutual labels:  browser
Mmm Remote Control
Magic Mirror Module to shutdown or configure your mirror
Stars: ✭ 331 (-4.61%)
Mutual labels:  notifications
Libimagequant
Palette quantization library that powers pngquant and other PNG optimizers
Stars: ✭ 344 (-0.86%)
Mutual labels:  callback
Metacar
A reinforcement learning environment for self-driving cars in the browser.
Stars: ✭ 337 (-2.88%)
Mutual labels:  browser
Laravel Desktop Notifier
💻 Send notifications to your desktop from your Laravel Artisan Commands. An JoliNotif wrapper for Laravel.
Stars: ✭ 333 (-4.03%)
Mutual labels:  notifications
Ffpass
Import and Export passwords for Firefox Quantum 🔑
Stars: ✭ 329 (-5.19%)
Mutual labels:  browser

Sysend.js Logo

npm bower downloads jsdelivr

Send messages between browser tabs

sysend.js is a small library that allows to send messages between pages that are open in the same browser. It also supports Cross-Domain communication. The library doesn't have any dependencies and uses the HTML5 LocalStorage API or BroadcastChannel API. If your browser don't support BroadcastChannel (see Can I Use) then you can send any object that can be serialized to JSON with BroadcastChannel you can send any object (it will not be serialized to string but the values are limited to the ones that can be copied by the structured cloning algorithm). You can also send empty notifications.

Tested on:

GNU/Linux: in Chromium 34, FireFox 29, Opera 12.16 (64bit)
Windows 10 64bit: in IE11 and Edge 38, Chrome 56, Firefox 51
MacOS X El Captain: Safari 9, Chrome 56, Firefox 51

Installation

Include sysend.js file in your html, you can grab the file from npm:

npm install sysend

or bower

bower install sysend

you can also get it from unpkg.com CDN:

https://unpkg.com/sysend

or

https://cdn.jsdelivr.net/npm/sysend

jsDelivr minified the file.

Usage

window.onload = function() {
    sysend.on('foo', function(message) {
        console.log(message);
    });
    var input = document.getElementsByTagName('input')[0];
    document.getElementsByTagName('button')[0].onclick = function() {
        sysend.broadcast('foo', {message: input.value});
    };
};

If you want to add support for Cross-Domain communication, you need to call proxy method with url on target domain that have proxy.html file.

sysend.proxy('https://jcubic.pl');
sysend.proxy('https://terminal.jcubic.pl');

on Firefox you need to add CORS for the proxy.html that will be loaded into iframe (see Cross-Domain LocalStorage)

Demo

Open this demo page in two tabs/windows.

API

sysend object:

  • on(name, callback) - callback(object, name) - add event of specified name
  • off(name [, callback]) - remove callback
  • broadcast(name [, object]) - send object and fire all events with specified name (in different pages that register callback using on). You can also just send notification without object
  • proxy(url) - create iframe proxy for different domain, the targer domain/url should have proxy.html file. If url domain is the same as page domain, it's ignored. So you can put both proxy calls on both domains (new in 1.3.0)

License

Copyright (C) 2014-2021 Jakub T. Jankiewicz
Released under the MIT license

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

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].