Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sysend

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sysend - npm Package Compare versions

Comparing version 1.14.2 to 1.14.3

2

package.json
{
"name": "sysend",
"version": "1.14.2",
"version": "1.14.3",
"description": "Web application synchronization between different tabs",

@@ -5,0 +5,0 @@ "main": "sysend.js",

@@ -5,4 +5,4 @@ <p align="center">

[![npm](https://img.shields.io/badge/npm-1.14.2-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.14.2-yellow.svg)
[![npm](https://img.shields.io/badge/npm-1.14.3-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.14.3-yellow.svg)
![downloads](https://img.shields.io/npm/dt/sysend.svg)

@@ -33,3 +33,3 @@ [![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/sysend)](https://www.jsdelivr.com/package/npm/sysend)

sandboxed environment. That's why this library like any other solution for cross-domain
comunication, don't work on Safari.
communication, don't work on Safari.

@@ -79,2 +79,4 @@ ## Installation

### Cross-Domain communication
If you want to add support for Cross-Domain communication, you need to call proxy method with url on target domain

@@ -88,7 +90,17 @@ that have [proxy.html file](https://github.com/jcubic/sysend.js/blob/master/proxy.html).

on Firefox you need to add **CORS** for the proxy.html that will be loaded into iframe (see [Cross-Domain LocalStorage](https://jcubic.wordpress.com/2014/06/20/cross-domain-localstorage/))
on Firefox you need to add **CORS** for the proxy.html that will be loaded into iframe (see [Cross-Domain LocalStorage](https://jcubic.wordpress.com/2014/06/20/cross-domain-localstorage/)).
if you want to send custom data you can use serializer (new in 1.4.0).
Example serializer can be [json-dry](https://github.com/11ways/json-dry).
### Security protection
Since version 1.10.0 as a security mesure Cross-Domain communication has been limited to only those domains that are allowed.
To allow domain to listen to sysend communication you need to specify channel inside iframe. You need add your origins to the
`sysend.channel()` function (origin is combination of protocol domain and optional port).
### Serialization
if you want to send custom data you can use serializer (new in 1.4.0) this API
was created for localStorage that needs serialization.
Example serializer can be [json-dry](https://github.com/11ways/json-dry):
```javascript

@@ -102,2 +114,12 @@ sysend.serializer(function(data) {

or [JSON5](https://json5.org/):
```javascript
sysend.serializer(function(data) {
return JSON5.stringify(string);
}, function(string) {
return JSON5.parse(string);
});
````
## Demos

@@ -141,3 +163,3 @@

The story of this library came from my question on StackOverflow in 2014: [Sending notifications between instances of the page in the same browser](https://stackoverflow.com/q/24182409/387194), with hint from user called **Niet the Dark Absol**, I was able to create a PoC of the solution using localStorage. I quickly created a library from my solution. I've also explained how to have [Cross-Domain LocalStorage](https://jcubic.wordpress.com/2014/06/20/cross-domain-localstorage/). The blog post have steady number of visitors (actually it's most viewed post on that blog).
The story of this library came from my question on StackOverflow from 2014: [Sending notifications between instances of the page in the same browser](https://stackoverflow.com/q/24182409/387194), with hint from user called **Niet the Dark Absol**, I was able to create a PoC of the solution using localStorage. I quickly created a library from my solution. I've also explained how to have [Cross-Domain LocalStorage](https://jcubic.wordpress.com/2014/06/20/cross-domain-localstorage/). The blog post have steady number of visitors (actually it's most viewed post on that blog).

@@ -144,0 +166,0 @@ And the name of the library is just random word "sy" and "send" suffix. But it can be an backronym for **Synchronizing Send** as in sychronizing application between browser tabs.

/**@license
* sysend.js - send messages between browser windows/tabs version 1.14.2
* sysend.js - send messages between browser windows/tabs version 1.14.3
*

@@ -4,0 +4,0 @@ * Copyright (C) 2014-2022 Jakub T. Jankiewicz <https://jcubic.pl/me>

/**@license
* sysend.js - send messages between browser windows/tabs version 1.14.2
* sysend.js - send messages between browser windows/tabs version 1.14.3
*

@@ -43,3 +43,3 @@ * Copyright (C) 2014-2022 Jakub T. Jankiewicz <https://jcubic.pl/me>

// id of the window/tabAnd two-way communication is tracked in
// id of the window/tabAnd two-way communication is tracked in
var target_id = generate_uuid();

@@ -99,2 +99,4 @@ var target_count = 1;

iframe.style.width = iframe.style.height = 0;
iframe.style.position = 'absolute';
iframe.style.top = iframe.style.left = '-9999px';
iframe.style.border = 'none';

@@ -230,2 +232,5 @@ var proxy_url = url;

return function(url) {
if (!url) {
return url;
}
url = new URL(url);

@@ -237,2 +242,5 @@ return url.host;

return function(url) {
if (!url) {
return url;
}
a.href = url;

@@ -252,12 +260,21 @@ return a.host;

var origin = (function() {
function tc(f) {
return function origin(url) {
try {
return f(url);
} catch(e) {
return url;
}
};
}
if (window.URL) {
return function(url) {
return tc(function origin(url) {
return new URL(url).origin;
};
});
}
var a = document.createElement('a');
return function origin(url) {
return tc(function origin(url) {
a.href = url;
return a.origin;
};
});
})();

@@ -264,0 +281,0 @@ // -------------------------------------------------------------------------

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc