Comparing version 1.4.0 to 1.5.0
{ | ||
"name": "sysend", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Send messages to other tabs/windows in the same browser", | ||
@@ -23,3 +23,3 @@ "main": "sysend.js", | ||
], | ||
"author": "Jakub T. Jankiewicz <jcubic@onet.pl> (http://jcubic.pl/me/)", | ||
"author": "Jakub T. Jankiewicz <jcubic@onet.pl> (https://jakub.jankiewicz.org/)", | ||
"license": "MIT", | ||
@@ -26,0 +26,0 @@ "bugs": { |
![Sysend.js Logo](https://github.com/jcubic/sysend.js/blob/master/assets/logo.svg?raw=true) | ||
[![npm](https://img.shields.io/badge/npm-1.4.0-blue.svg)](https://www.npmjs.com/package/sysend) | ||
![bower](https://img.shields.io/badge/bower-1.4.0-yellow.svg) | ||
[![npm](https://img.shields.io/badge/npm-1.5.0-blue.svg)](https://www.npmjs.com/package/sysend) | ||
![bower](https://img.shields.io/badge/bower-1.5.0-yellow.svg) | ||
![downloads](https://img.shields.io/npm/dt/sysend.svg) | ||
@@ -54,3 +54,3 @@ [![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/sysend)](https://www.jsdelivr.com/package/npm/sysend) | ||
or | ||
or jsDelivr: | ||
@@ -61,3 +61,3 @@ ``` | ||
jsDelivr minified the file. | ||
jsDelivr will minify the file. From my testing it's faster then unpkg.com. | ||
@@ -68,8 +68,8 @@ ## Usage | ||
window.onload = function() { | ||
sysend.on('foo', function(message) { | ||
console.log(message); | ||
sysend.on('foo', function(data) { | ||
console.log(data.message); | ||
}); | ||
var input = document.getElementsByTagName('input')[0]; | ||
document.getElementsByTagName('button')[0].onclick = function() { | ||
sysend.broadcast('foo', {message: input.value}); | ||
sysend.broadcast('foo', { message: input.value }); | ||
}; | ||
@@ -108,11 +108,12 @@ }; | ||
* `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](https://github.com/jcubic/sysend.js/blob/master/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) | ||
* `serializer(to_string, from_string)` - add serializer and deserializer functions (new in 1.4.0) | ||
* `on(name, callback)` - `callback(object, name)` - add event handler for specified name. | ||
* `off(name [, callback])` - remove event handler for given name, if callback is not specified it will remove all callbacks for given name. | ||
* `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. | ||
* `emit(name, [, object])` - same as broadcast but also invoke the even on same page (new in 1.5.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) 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). | ||
* `serializer(to_string, from_string)` - add serializer and deserializer functions (new in 1.4.0). | ||
## License | ||
Copyright (C) 2014-2021 [Jakub T. Jankiewicz](http://jcubic.pl/me)<br/> | ||
Copyright (C) 2014-2021 [Jakub T. Jankiewicz](https://jakub.jankiewicz.org)<br/> | ||
Released under the [MIT license](https://opensource.org/licenses/MIT) | ||
@@ -119,0 +120,0 @@ |
/**@license | ||
* sysend.js - send messages between browser windows/tabs version 1.4.0 | ||
* sysend.js - send messages between browser windows/tabs version 1.5.0 | ||
* | ||
* Copyright (C) 2014-2021 Jakub T. Jankiewicz <https://jcubic.pl/me> | ||
* Copyright (C) 2014-2021 Jakub T. Jankiewicz <https://jakub.jankiewicz.org> | ||
* Released under the MIT license | ||
@@ -12,2 +12,3 @@ * | ||
broadcast(event: string, message?: any): void; | ||
emit(event: string, message?: any): void; | ||
on(event: string, callback: callback): void; | ||
@@ -14,0 +15,0 @@ off(event: string, callback?: callback): void; |
/**@license | ||
* sysend.js - send messages between browser windows/tabs version 1.4.0 | ||
* sysend.js - send messages between browser windows/tabs version 1.5.0 | ||
* | ||
* Copyright (C) 2014-2021 Jakub T. Jankiewicz <https://jcubic.pl/me> | ||
* Copyright (C) 2014-2021 Jakub T. Jankiewicz <https://jakub.jankiewicz.org> | ||
* Released under the MIT license | ||
@@ -54,2 +54,6 @@ * | ||
}, | ||
emit: function(event, message) { | ||
sysend.broadcast(event, message); | ||
invoke(event, message); | ||
}, | ||
serializer: function(to, from) { | ||
@@ -56,0 +60,0 @@ if (typeof to !== 'function' || typeof from !== 'function') { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18354
305
119
0