PostalWorker
A JavaScript WebWorker & postMessage library that connects UI elements, Web Workers, & Cross-Site Windows
Installation:
npm install -save postalworker
npm Commands:
npm run build - Runs rollup.js to combine all the modules and dependencies and output the primary library script PostalWorker.js
npm run build-worker - Builds the worker libraries (SharedWorker and WebWorker scripts are run separately from main library)
npm run test - Run unit tests
npm run coverage - Generate code coverage report
npm run doc - Generate documentation
npm run demos - Generate demo pages
npm run relase - Build, generate, run unit tests (basicaly - DO EVERYTHING)
Usage examples
; // In one window:; // In another window:; // In the above, the first window will print the message passed on message class "example" into the window.console: "This is an example" // To cross launch a new window with the ability to send messages (even if the new window is not on the same host/domain); // Then to send it a message:; // In the above 2 commands, a window will be opened by the primary window, which will point to the url provided in argument 3// And the second command will publish the message to the message class "crossExample" which window 2 will invoke the callback in argument 2 of crossOn