@types/node 15.0.2 → 15.6.0

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.
node/worker_threads.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  declare module 'worker_threads' {
2
2
  import { Context } from 'vm';
3
- import EventEmitter = require('events');
3
+ import { EventEmitter } from 'events';
4
+ import { EventLoopUtilityFunction } from 'perf_hooks';
5
+ import { FileHandle } from 'fs/promises';
4
6
  import { Readable, Writable } from 'stream';
5
7
  import { URL } from 'url';
6
- import { FileHandle } from 'fs/promises';
8
+ import { X509Certificate } from 'crypto';
7
9
 
8
10
  const isMainThread: boolean;
9
11
  const parentPort: null | MessagePort;
@@ -17,7 +19,11 @@ declare module 'worker_threads' {
17
19
  readonly port2: MessagePort;
18
20
  }
19
21
 
20
- type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
22
+ interface WorkerPerformance {
23
+ eventLoopUtilization: EventLoopUtilityFunction;
24
+ }
25
+
26
+ type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate;
21
27
 
22
28
  class MessagePort extends EventEmitter {
23
29
  close(): void;
@@ -119,6 +125,7 @@ declare module 'worker_threads' {
119
125
  readonly stderr: Readable;
120
126
  readonly threadId: number;
121
127
  readonly resourceLimits?: ResourceLimits;
128
+ readonly performance: WorkerPerformance;
122
129
 
123
130
  /**
124
131
  * @param filename The path to the Worker’s main script or module.
@@ -203,6 +210,22 @@ declare module 'worker_threads' {
203
210
  off(event: string | symbol, listener: (...args: any[]) => void): this;
204
211
  }
205
212
 
213
+ interface BroadcastChannel extends NodeJS.RefCounted {}
214
+
215
+ /**
216
+ * See https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
217
+ */
218
+ class BroadcastChannel {
219
+ readonly name: string;
220
+ onmessage: (message: unknown) => void;
221
+ onmessageerror: (message: unknown) => void;
222
+
223
+ constructor(name: string);
224
+
225
+ close(): void;
226
+ postMessage(message: unknown): void;
227
+ }
228
+
206
229
  /**
207
230
  * Mark an object as not transferable.
208
231
  * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.