rollup-plugin-worker-factory
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -0,1 +1,8 @@ | ||
<a name="0.5.5"></a> | ||
## [0.5.5](https://github.com/brandonocasey/rollup-plugin-worker-factory/compare/v0.5.4...v0.5.5) (2021-04-09) | ||
### Bug Fixes | ||
* support dispatchEvent on mock worker. Rename FakeWorker to MockWorker ([0050391](https://github.com/brandonocasey/rollup-plugin-worker-factory/commit/0050391)) | ||
<a name="0.5.4"></a> | ||
@@ -2,0 +9,0 @@ ## [0.5.4](https://github.com/brandonocasey/rollup-plugin-worker-factory/compare/v0.5.3...v0.5.4) (2021-03-11) |
{ | ||
"name": "rollup-plugin-worker-factory", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "Bundle web workers that work in nodejs and the browser, without a separate build target.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,2 +0,2 @@ | ||
class FakeWorker { | ||
class MockWorker { | ||
constructor() { | ||
@@ -26,2 +26,12 @@ this.listeners_ = []; | ||
dispatchEvent(event) { | ||
if (!event || event.type !== 'message') { | ||
return; | ||
} | ||
this.listeners_.forEach(function(fn) { | ||
fn(event); | ||
}); | ||
} | ||
postMessage(data) { | ||
@@ -56,9 +66,9 @@ if (this.remote_) { | ||
FakeWorker.prototype.on = FakeWorker.prototype.addEventListener; | ||
FakeWorker.prototype.off = FakeWorker.prototype.removeEventListener; | ||
MockWorker.prototype.on = MockWorker.prototype.addEventListener; | ||
MockWorker.prototype.off = MockWorker.prototype.removeEventListener; | ||
export const factory = function(fn) { | ||
return function() { | ||
const client = new FakeWorker(); | ||
const worker = new FakeWorker(); | ||
const client = new MockWorker(); | ||
const worker = new MockWorker(); | ||
@@ -65,0 +75,0 @@ client.remote_ = worker; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25657
255