postalworker-es 4.0.7 → 4.0.8

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.
@@ -123,7 +123,11 @@ _getSubscriber(e){let s=e.split("://"),t=s[0];if(void 0!==s[1]){let e=s[1].split
123
123
  */
124
124
  _resolveWorker(){
125
125
  // Browser supports SharedWorker
126
- let e=!!window.SharedWorker;return e=Boolean(e),e?(this.sharedWorkerSupported=!0,_worker=this._polyfillSharedWorker()):(this.sharedWorkerSupported=!1,_worker=this._polyfillSharedWorker()),_worker}/**
126
+ let e=!!window.SharedWorker;
127
+ // TMP to work on dedicated worker
128
+ // _worker = this._polyfillSharedWorker();
129
+ // Fallback on failure
130
+ return e=Boolean(e),e?(this.sharedWorkerSupported=!0,(_worker=this._startSharedWorker())||(_worker=this._polyfillSharedWorker())):(this.sharedWorkerSupported=!1,_worker=this._polyfillSharedWorker()),_worker}/**
127
131
  * Attempt to start SharedWorker thread or fail and return false
128
132
  * @return {SharedWorker | boolean}
129
133
  * @private
@@ -144,7 +148,7 @@ window.console.warn("PostalWorker - Unable to start SharedWorker"),window.consol
144
148
  * Start a basic web worker (not available at this time)
145
149
  * @private
146
150
  */
147
- _polyfillSharedWorker(){let e,s=this._getPostalRoute();try{e=new Worker(s.concat("PolyfillSharedWorker").concat(".").concat(JS),{name:POSTAL_WORKER}),console.info(e),
151
+ _polyfillSharedWorker(){let e,s=this._getPostalRoute();try{e=new Worker(s.concat("PolyfillSharedWorker").concat(".").concat(JS),{name:POSTAL_WORKER}),
148
152
  // /* !!! DEPRECATED messaging route !!! but leaving in place as fallback for older browsers */
149
153
  // // this stuff is no longer tested and does not work
150
154
  // // (no more messaging, only the connection is being established here)
@@ -63,7 +63,11 @@ this._resolveWorker()}/**
63
63
  */
64
64
  return s(e,[{key:"_getSubscriber",value:function(e){var t=e.split("://"),r=t[0];if(void 0!==t[1]){var o=t[1].split("/")[0];return r.concat("://").concat(o)}return e}},{key:"_resolveWorker",value:function(){
65
65
  // Browser supports SharedWorker
66
- var e=!!window.SharedWorker;return e=Boolean(e),e?(this.sharedWorkerSupported=!0,p=this._polyfillSharedWorker()):(this.sharedWorkerSupported=!1,p=this._polyfillSharedWorker()),p}},{key:"_startSharedWorker",value:function(){var e=this,t=void 0,r=this._getPostalRoute();try{t=new SharedWorker(r.concat("PostalSharedWorker").concat(".").concat("js"),{name:"PostalWorker"});/* !!! DEPRECATED messaging route !!! but leaving in place as fallback for older browsers */
66
+ var e=!!window.SharedWorker;
67
+ // TMP to work on dedicated worker
68
+ // _worker = this._polyfillSharedWorker();
69
+ // Fallback on failure
70
+ return e=Boolean(e),e?(this.sharedWorkerSupported=!0,(p=this._startSharedWorker())||(p=this._polyfillSharedWorker())):(this.sharedWorkerSupported=!1,p=this._polyfillSharedWorker()),p}},{key:"_startSharedWorker",value:function(){var e=this,t=void 0,r=this._getPostalRoute();try{t=new SharedWorker(r.concat("PostalSharedWorker").concat(".").concat("js"),{name:"PostalWorker"});/* !!! DEPRECATED messaging route !!! but leaving in place as fallback for older browsers */
67
71
  // this stuff is no longer tested and does not work
68
72
  // (no more messaging, only the connection is being established here)
69
73
  // but leaving it in to polyfill older browsers potentially
@@ -75,7 +79,7 @@ switch(r.type){case"WORKERREGISTER":if(
75
79
  // worker startup
76
80
  e.workerOnline=!0,e._mapToBroadcastNetwork(e.id),b.length)for(;function(){return b.length}();)b.shift()();break;case"FIRE":r.data.msgClass&&v.get(r.data.msgClass)&&v.get(r.data.msgClass)(r.data.message);break;case"ERROR":console.error(r.data)}}}catch(e){
77
81
  // todo: Add intelligent error handling, including destination options
78
- window.console.warn("PostalWorker - Unable to start SharedWorker"),window.console.debug(e)}return t||!1}},{key:"_polyfillSharedWorker",value:function(){var e=this,t=void 0,r=this._getPostalRoute();try{t=new Worker(r.concat("PolyfillSharedWorker").concat(".").concat("js"),{name:"PostalWorker"}),console.info(t),
82
+ window.console.warn("PostalWorker - Unable to start SharedWorker"),window.console.debug(e)}return t||!1}},{key:"_polyfillSharedWorker",value:function(){var e=this,t=void 0,r=this._getPostalRoute();try{t=new Worker(r.concat("PolyfillSharedWorker").concat(".").concat("js"),{name:"PostalWorker"}),
79
83
  // /* !!! DEPRECATED messaging route !!! but leaving in place as fallback for older browsers */
80
84
  // // this stuff is no longer tested and does not work
81
85
  // // (no more messaging, only the connection is being established here)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postalworker-es",
3
- "version": "4.0.7",
3
+ "version": "4.0.8",
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",
@@ -36,6 +36,7 @@
36
36
  "docdash": "^0.4.0",
37
37
  "jsdoc": "^3.5.5",
38
38
  "mocha": "^5.2.0",
39
+ "nodemon": "^2.0.22",
39
40
  "nyc": "^13.0.1",
40
41
  "rollup": "^0.52.0",
41
42
  "rollup-plugin-babel": "^2.7.1",
@@ -47,8 +48,7 @@
47
48
  "rollup-plugin-replace": "^1.2.1",
48
49
  "rollup-plugin-uglify-es": "0.0.1",
49
50
  "sinon": "^1.17.7",
50
- "sinon-chai": "^2.8.0",
51
- "nodemon": "^2.0.15"
51
+ "sinon-chai": "^2.8.0"
52
52
  },
53
53
  "dependencies": {
54
54
  "body-parser": "^1.19.1",