postalworker-es 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # PostalWorker
2
+
2
3
  A JavaScript WebWorker & postMessage library that connects UI elements, Web Workers, & Cross-Site Windows
3
4
 
4
5
  # Installation:
6
+
5
7
  npm install -save postalworker
6
8
 
7
9
  # npm Commands:
10
+
8
11
  ```
9
12
  npm run build - Runs rollup.js to combine all the modules and dependencies and output the primary library script PostalWorker.js
10
13
  npm run build-worker - Builds the worker libraries (SharedWorker and WebWorker scripts are run separately from main library)
@@ -18,30 +21,34 @@ npm run relase - Build, generate, run unit tests (basicaly - DO EVERYTHING)
18
21
  Usage examples
19
22
 
20
23
  ```javascript
21
- import PostalWorker from "postalworker";
24
+ import PostalWorker from "postalworker-es";
22
25
 
23
26
  // In one window:
24
- PostalWorker().on('example', (msg) => { window.console.info(msg); });
27
+ PostalWorker().on("example", msg => {
28
+ window.console.info(msg);
29
+ });
25
30
 
26
31
  // In another window:
27
- PostalWorker().fire('example', 'This is an example');
32
+ PostalWorker().fire("example", "This is an example");
28
33
 
29
34
  // In the above, the first window will print the message passed on message class "example" into the window.console: "This is an example"
30
35
 
31
36
  // To cross launch a new window with the ability to send messages (even if the new window is not on the same host/domain)
32
37
  PostalWorker().crossOn(
33
- 'crossExample',
34
- function(msg) { window.console.info(msg); },
35
- 'http://myurl', // This is where you specify the url you want to open to (it must have a copy of PostalWorker hosted too)
36
- 'MyURL', // This is where you name the new window if you want to interact with it directly with Javascript - limited by cross origin rules of course)
37
- false // The last argument is optional and it includes more specific window parameters like width, height, etc...
38
+ "crossExample",
39
+ function (msg) {
40
+ window.console.info(msg);
41
+ },
42
+ "http://myurl", // This is where you specify the url you want to open to (it must have a copy of PostalWorker hosted too)
43
+ "MyURL", // This is where you name the new window if you want to interact with it directly with Javascript - limited by cross origin rules of course)
44
+ false // The last argument is optional and it includes more specific window parameters like width, height, etc...
38
45
  );
39
46
 
40
47
  // Then to send it a message:
41
- PostalWorker().crossFire('crossExample', 'This is a message for my url window');
48
+ PostalWorker().crossFire("crossExample", "This is a message for my url window");
42
49
 
43
50
  // In the above 2 commands, a window will be opened by the primary window, which will point to the url provided in argument 3
44
51
  // 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
45
-
46
52
  ```
53
+
47
54
  # PostalWorker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postalworker-es",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "A JavaScript WebWorker & postMessage library that connects UI elements, Web Workers, & Cross-Site Windows",
5
5
  "main": "index.js",
6
6
  "module": "dist/PostalWorker.es.js",