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.10.0 to 1.11.0

2

package.json
{
"name": "sysend",
"version": "1.10.0",
"version": "1.11.0",
"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.10.0-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.10.0-yellow.svg)
[![npm](https://img.shields.io/badge/npm-1.11.0-blue.svg)](https://www.npmjs.com/package/sysend)
![bower](https://img.shields.io/badge/bower-1.11.0-yellow.svg)
![downloads](https://img.shields.io/npm/dt/sysend.svg)

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

| `broadcast(name [, object])` | send any object and fire all events with specified name (in different pages that register callback using on). You can also just send notification without an object | name - string - The name of the event<br>object - optional any data | 1.0.0 |
| `proxy(url)` | create iframe proxy for different domain, the target domain/URL should have [proxy.html](https://github.com/jcubic/sysend.js/blob/master/proxy.html)<br> file. If url domain is the same as page domain, it's ignored. So you can put both proxy calls on both | url - string | 1.3.0 |
| `proxy(<urls>)` | create iframe proxy for different domain, the target domain/URL should have [proxy.html](https://github.com/jcubic/sysend.js/blob/master/proxy.html)<br> file. If url domain is the same as page domain, it's ignored. So you can put both proxy calls on both | url - string | 1.3.0 |
| `serializer(to_string, from_string)` | add serializer and deserializer functions | both arguments are functions (data: any) => string | 1.4.0 |

@@ -121,0 +121,0 @@ | `emit(name, [, object])` | same as `broadcast()` but also invoke the even on same page | name - string - The name of the event<br>object - optional any data | 1.5.0 |

/**@license
* sysend.js - send messages between browser windows/tabs version 1.10.0
* sysend.js - send messages between browser windows/tabs version 1.11.0
*

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

off(event: string, callback?: callback): void;
proxy(url: string): void;
proxy(args?: string[]): void;
serializer(to: (data: any) => string, from: (data: string) => any): void;

@@ -19,0 +19,0 @@ track(event: 'open', callback: (data: {id: string, count: number, primary: boolean}) => void): void;

/**@license
* sysend.js - send messages between browser windows/tabs version 1.10.0
* sysend.js - send messages between browser windows/tabs version 1.11.0
*

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

var index = 0;
var proxy_mode = false;
var channel;

@@ -87,34 +88,39 @@ var primary = true;

},
proxy: function(url) {
if (typeof url === 'string' && host(url) !== window.location.host) {
domains = domains || [];
domains.push(origin(url));
var iframe = document.createElement('iframe');
iframe.style.width = iframe.style.height = 0;
iframe.style.border = 'none';
var proxy_url = url;
if (!url.match(/\.html$/)) {
proxy_url = url.replace(/\/$/, '') + '/proxy.html';
proxy: function() {
[].slice.call(arguments).forEach(function(url) {
if (typeof url === 'string' && host(url) !== window.location.host) {
domains = domains || [];
domains.push(origin(url));
var iframe = document.createElement('iframe');
iframe.style.width = iframe.style.height = 0;
iframe.style.border = 'none';
var proxy_url = url;
if (!url.match(/\.html$/)) {
proxy_url = url.replace(/\/$/, '') + '/proxy.html';
}
iframe.addEventListener('error', function handler() {
setTimeout(function() {
throw new Error('html proxy file not found on "' + url +
'" url');
}, 0);
iframe.removeEventListener('error', handler);
});
iframe.addEventListener('load', function handler() {
var win;
// fix for Safari
// https://stackoverflow.com/q/42632188/387194
try {
win = iframe.contentWindow;
} catch(e) {
win = iframe.contentWindow;
}
iframes.push({window: win, node: iframe});
iframe.removeEventListener('load', handler);
});
document.body.appendChild(iframe);
iframe.src = proxy_url;
}
iframe.addEventListener('error', function handler() {
setTimeout(function() {
throw new Error('html proxy file not found on "' + url +
'" url');
}, 0);
iframe.removeEventListener('error', handler);
});
iframe.addEventListener('load', function handler() {
var win;
// fix for Safari
// https://stackoverflow.com/q/42632188/387194
try {
win = iframe.contentWindow;
} catch(e) {
win = iframe.contentWindow;
}
iframes.push({window: win, node: iframe});
iframe.removeEventListener('load', handler);
});
document.body.appendChild(iframe);
iframe.src = proxy_url;
});
if (!arguments.length && is_iframe) {
proxy_mode = true;
}

@@ -365,2 +371,6 @@ },

// -------------------------------------------------------------------------
function is_proxy_iframe() {
return is_iframe && proxy_mode;
}
// -------------------------------------------------------------------------
function send_to_iframes(key, data) {

@@ -445,3 +455,5 @@ // propagate events to iframes

// -------------------------------------------------------------------------
init();
window.addEventListener('load', function() {
setTimeout(init, 0);
});
// -------------------------------------------------------------------------

@@ -453,3 +465,3 @@ function init() {

if (event.target.name === uniq_prefix) {
if (is_iframe) {
if (is_proxy_iframe()) {
var payload = {

@@ -502,3 +514,3 @@ name: uniq_prefix,

if (is_iframe) {
if (is_proxy_iframe()) {
window.addEventListener('message', function(e) {

@@ -505,0 +517,0 @@ if (is_sysend_post_message(e) && is_valid_origin(e.origin)) {

Sorry, the diff of this file is not supported yet

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