source: trip-planner-front/node_modules/piscina/dist/src/common.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.kFieldCount = exports.kResponseCountField = exports.kRequestCountField = exports.isTaskQueue = exports.markMovable = exports.isMovable = exports.isTransferable = exports.kQueueOptions = exports.kValue = exports.kTransferable = exports.commonState = void 0;
4;
5exports.commonState = {
6 isWorkerThread: false,
7 workerData: undefined
8};
9// Internal symbol used to mark Transferable objects returned
10// by the Piscina.move() function
11const kMovable = Symbol('Piscina.kMovable');
12exports.kTransferable = Symbol.for('Piscina.transferable');
13exports.kValue = Symbol.for('Piscina.valueOf');
14exports.kQueueOptions = Symbol.for('Piscina.queueOptions');
15// True if the object implements the Transferable interface
16function isTransferable(value) {
17 return value != null &&
18 typeof value === 'object' &&
19 exports.kTransferable in value &&
20 exports.kValue in value;
21}
22exports.isTransferable = isTransferable;
23// True if object implements Transferable and has been returned
24// by the Piscina.move() function
25function isMovable(value) {
26 return isTransferable(value) && value[kMovable] === true;
27}
28exports.isMovable = isMovable;
29function markMovable(value) {
30 Object.defineProperty(value, kMovable, {
31 enumerable: false,
32 configurable: true,
33 writable: true,
34 value: true
35 });
36}
37exports.markMovable = markMovable;
38function isTaskQueue(value) {
39 return typeof value === 'object' &&
40 value !== null &&
41 'size' in value &&
42 typeof value.shift === 'function' &&
43 typeof value.remove === 'function' &&
44 typeof value.push === 'function';
45}
46exports.isTaskQueue = isTaskQueue;
47exports.kRequestCountField = 0;
48exports.kResponseCountField = 1;
49exports.kFieldCount = 2;
50//# sourceMappingURL=common.js.map
Note: See TracBrowser for help on using the repository browser.