Skip to content

Call a function via the localStorage and register callbacks

License

Notifications You must be signed in to change notification settings

Astasian/LocalStorageFunctionCall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Call a function via the localStorage and register callbacks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published