From ed045043002f5102dd5c288facc06029d53a72d1 Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Thu, 22 Dec 2022 18:39:34 +0100 Subject: [PATCH] update README --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b00195e..6560dde 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Sysend.js logo

-[![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) [![jsdelivr](https://img.shields.io/jsdelivr/npm/hm/sysend)](https://www.jsdelivr.com/package/npm/sysend) @@ -94,8 +94,10 @@ To allow domain to listen to sysend communication you need to specify channel in ### Serialization -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). +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 sysend.serializer(function(data) { @@ -105,6 +107,16 @@ 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 * [Simple demo using iframes](https://jcubic.pl/sysend-demo/). @@ -143,7 +155,7 @@ To see details of using the API, see [demo.html source code](https://github.com/ ## Story -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). 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.