UNPKG

2.31 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6exports.WorkerStates =
7 exports.WorkerEvents =
8 exports.PARENT_MESSAGE_SETUP_ERROR =
9 exports.PARENT_MESSAGE_OK =
10 exports.PARENT_MESSAGE_MEM_USAGE =
11 exports.PARENT_MESSAGE_CUSTOM =
12 exports.PARENT_MESSAGE_CLIENT_ERROR =
13 exports.CHILD_MESSAGE_MEM_USAGE =
14 exports.CHILD_MESSAGE_INITIALIZE =
15 exports.CHILD_MESSAGE_END =
16 exports.CHILD_MESSAGE_CALL =
17 void 0;
18
19/**
20 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
21 *
22 * This source code is licensed under the MIT license found in the
23 * LICENSE file in the root directory of this source tree.
24 */
25// Because of the dynamic nature of a worker communication process, all messages
26// coming from any of the other processes cannot be typed. Thus, many types
27// include "unknown" as a TS type, which is (unfortunately) correct here.
28const CHILD_MESSAGE_INITIALIZE = 0;
29exports.CHILD_MESSAGE_INITIALIZE = CHILD_MESSAGE_INITIALIZE;
30const CHILD_MESSAGE_CALL = 1;
31exports.CHILD_MESSAGE_CALL = CHILD_MESSAGE_CALL;
32const CHILD_MESSAGE_END = 2;
33exports.CHILD_MESSAGE_END = CHILD_MESSAGE_END;
34const CHILD_MESSAGE_MEM_USAGE = 3;
35exports.CHILD_MESSAGE_MEM_USAGE = CHILD_MESSAGE_MEM_USAGE;
36const PARENT_MESSAGE_OK = 0;
37exports.PARENT_MESSAGE_OK = PARENT_MESSAGE_OK;
38const PARENT_MESSAGE_CLIENT_ERROR = 1;
39exports.PARENT_MESSAGE_CLIENT_ERROR = PARENT_MESSAGE_CLIENT_ERROR;
40const PARENT_MESSAGE_SETUP_ERROR = 2;
41exports.PARENT_MESSAGE_SETUP_ERROR = PARENT_MESSAGE_SETUP_ERROR;
42const PARENT_MESSAGE_CUSTOM = 3;
43exports.PARENT_MESSAGE_CUSTOM = PARENT_MESSAGE_CUSTOM;
44const PARENT_MESSAGE_MEM_USAGE = 4;
45exports.PARENT_MESSAGE_MEM_USAGE = PARENT_MESSAGE_MEM_USAGE;
46let WorkerStates;
47exports.WorkerStates = WorkerStates;
48
49(function (WorkerStates) {
50 WorkerStates['STARTING'] = 'starting';
51 WorkerStates['OK'] = 'ok';
52 WorkerStates['OUT_OF_MEMORY'] = 'oom';
53 WorkerStates['RESTARTING'] = 'restarting';
54 WorkerStates['SHUTTING_DOWN'] = 'shutting-down';
55 WorkerStates['SHUT_DOWN'] = 'shut-down';
56})(WorkerStates || (exports.WorkerStates = WorkerStates = {}));
57
58let WorkerEvents;
59exports.WorkerEvents = WorkerEvents;
60
61(function (WorkerEvents) {
62 WorkerEvents['STATE_CHANGE'] = 'state-change';
63})(WorkerEvents || (exports.WorkerEvents = WorkerEvents = {}));