Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Latest commit

 

History

History
25 lines (17 loc) · 622 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 622 Bytes

LocalStorageFunctionCall

Call a function via the localStorage and register callbacks between Tabs etc.

Register a function:

	RegisterLocalStorageFunction("test", function(param){
      return param+param;
    })

Call a function:

let str = "testing";
CallLocalStorageFunction("test",str,function(para){
	console.log(para);
	});

Keep in mind that localStorage just wants strings and no objects. Stringify them before. Should work in all browsers which support localStorage.

communicator.js is based on the 'storage' event listener.

Sample page