Comparing version 1.3.3 to 1.3.4
{ | ||
"name": "sysend", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Send messages to other tabs/windows in the same browser", | ||
@@ -15,2 +15,4 @@ "main": "sysend.js", | ||
"windows", | ||
"messages", | ||
"cross-domain", | ||
"events", | ||
@@ -21,3 +23,3 @@ "callback", | ||
], | ||
"author": "Jakub Jankiewicz <jcubic@onet.pl> (http://jcubic.pl/jakub-jankiewicz/)", | ||
"author": "Jakub T. Jankiewicz <jcubic@onet.pl> (http://jcubic.pl/jakub-jankiewicz/)", | ||
"license": "MIT", | ||
@@ -24,0 +26,0 @@ "bugs": { |
@@ -1,13 +0,17 @@ | ||
[![npm](https://img.shields.io/badge/npm-1.3.3-blue.svg)](https://www.npmjs.com/package/sysend) | ||
![bower](https://img.shields.io/badge/bower-1.3.3-yellow.svg) | ||
![Sysend.js Logo](https://github.com/jcubic/sysend.js/blob/master/assets/logo.svg?raw=true) | ||
[![npm](https://img.shields.io/badge/npm-1.3.4-blue.svg)](https://www.npmjs.com/package/sysend) | ||
![bower](https://img.shields.io/badge/bower-1.3.4-yellow.svg) | ||
![downloads](https://img.shields.io/npm/dt/sysend.svg) | ||
## sysend.js | ||
# Send messages between browser tabs | ||
sysend.js is small library that allow to send message between pages that are | ||
open in the same browser. It also support Cross-Domain comunication. The library don't use | ||
any dependencies and use HTML5 LocalStorage API or BroadcastChannel API. | ||
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](https://caniuse.com/#feat=broadcastchannel)) | ||
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). You can also send empty notification. | ||
(it will not be serialized to string but the values are limited to the ones that can be copied by | ||
the [structured cloning algorithm](https://html.spec.whatwg.org/multipage/structured-data.html#structured-clone)). | ||
You can also send empty notifications. | ||
@@ -21,3 +25,3 @@ | ||
## Instalation | ||
## Installation | ||
@@ -43,3 +47,10 @@ Include `sysend.js` file in your html, you can grab the file from npm: | ||
or | ||
``` | ||
https://cdn.jsdelivr.net/npm/sysend | ||
``` | ||
jsDelivr minified the file. | ||
## Usage | ||
@@ -60,3 +71,3 @@ | ||
If you want to add support for Cross-Domain communication you need to call proxy method with url on target domain | ||
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](https://github.com/jcubic/sysend.js/blob/master/proxy.html). | ||
@@ -86,3 +97,3 @@ | ||
Copyright (C) 2014-2018 [Jakub Jankiewicz](http://jcubic.pl)<br/> | ||
Copyright (C) 2014-2020 [Jakub T. Jankiewicz](http://jcubic.pl)<br/> | ||
Released under the [MIT license](https://opensource.org/licenses/MIT) | ||
@@ -89,0 +100,0 @@ |
/**@license | ||
* sysend.js - send messages between browser windows/tabs version 1.3.3 | ||
* sysend.js - send messages between browser windows/tabs version 1.3.4 | ||
* | ||
* Copyright (C) 2014-2018 Jakub Jankiewicz <http://jcubic.pl/me> | ||
* Copyright (C) 2014-2020 Jakub T. Jankiewicz <https://jcubic.pl/me> | ||
* Released under the MIT license | ||
@@ -127,5 +127,7 @@ * | ||
window.addEventListener('message', function(e) { | ||
var payload = JSON.parse(e.data); | ||
if (payload.name === uniq_prefix) { | ||
sysend.broadcast(payload.key, payload.data); | ||
if (typeof e.data === 'string') { | ||
var payload = JSON.parse(e.data); | ||
if (payload && payload.name === uniq_prefix) { | ||
sysend.broadcast(payload.key, payload.data); | ||
} | ||
} | ||
@@ -132,0 +134,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99
12473
5
197