@e-mc/core 0.12.6 → 0.12.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.
Files changed (3) hide show
  1. package/README.md +9 -8
  2. package/index.js +10 -2
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.12.6/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.7/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, LogStatus, WorkerAction } from "./squared";
@@ -171,6 +171,7 @@ interface WorkerGroupConstructor {
171
171
  interface IWorkerChannel extends EventEmitter {
172
172
  [Symbol.iterator](): IteratorObject<Worker, BuiltinIteratorReturn>;
173
173
  sendObject(data: unknown, transferList?: Transferable[], callback?: WorkerChannelResponse<unknown>, ...returnArgs: unknown[]): Worker;
174
+ sendBuffer(data: Buffer | SharedArrayBuffer, callback: WorkerChannelResponse<unknown>, ...returnArgs: unknown[]): Worker | null;
174
175
  sendBuffer(data: Buffer, shared?: boolean, callback?: WorkerChannelResponse<unknown>, ...returnArgs: unknown[]): Worker | null;
175
176
  send(data: unknown, transferList?: Transferable[]): Promise<unknown>;
176
177
  drop(count?: number): Promise<number>;
@@ -318,13 +319,13 @@ NOTE: **@e-mc/core** is mostly a collection of abstract base classes which canno
318
319
 
319
320
  ## References
320
321
 
321
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/squared.d.ts
322
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/core.d.ts
323
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/db.d.ts
324
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/dom.d.ts
325
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/logger.d.ts
326
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/node.d.ts
327
- - https://www.unpkg.com/@e-mc/types@0.12.6/lib/settings.d.ts
322
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/squared.d.ts
323
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/core.d.ts
324
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/db.d.ts
325
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/dom.d.ts
326
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/logger.d.ts
327
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/node.d.ts
328
+ - https://www.unpkg.com/@e-mc/types@0.12.7/lib/settings.d.ts
328
329
 
329
330
  * https://www.npmjs.com/package/@types/node
330
331
 
package/index.js CHANGED
@@ -1599,9 +1599,17 @@ class WorkerChannel extends EventEmitter {
1599
1599
  throw err;
1600
1600
  }
1601
1601
  }
1602
- sendBuffer(data, shared = true, callback, ...returnArgs) {
1602
+ sendBuffer(data, shared = true, ...returnArgs) {
1603
1603
  try {
1604
- return this.sendObject(data, shared ? [] : [data.buffer], callback, ...returnArgs);
1604
+ let callback;
1605
+ if (typeof shared === 'function') {
1606
+ callback = shared;
1607
+ shared = false;
1608
+ }
1609
+ else if (typeof returnArgs[0] === 'function') {
1610
+ callback = returnArgs.shift();
1611
+ }
1612
+ return this.sendObject(data, shared || data instanceof SharedArrayBuffer ? [] : [data.buffer], callback, ...returnArgs);
1605
1613
  }
1606
1614
  catch (err) {
1607
1615
  this.addLog(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/core",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
4
4
  "description": "Core modules for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "license": "BSD-3-Clause",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/module": "0.12.6",
23
- "@e-mc/types": "0.12.6",
22
+ "@e-mc/module": "0.12.8",
23
+ "@e-mc/types": "0.12.8",
24
24
  "ipaddr.js": "^2.2.0",
25
25
  "picomatch": "^4.0.3"
26
26
  }