summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.worker.d.ts
blob: a10b1a27686ce0b8b9d419c94bc3712f5b7784a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */

/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.shared_globals" />
/// <reference lib="esnext" />

declare class WorkerGlobalScope {
  new(): WorkerGlobalScope;
  self: WorkerGlobalScope & typeof globalThis;
  onmessage:
    | ((
      this: WorkerGlobalScope & typeof globalThis,
      ev: MessageEvent,
    ) => any)
    | null;
  onmessageerror:
    | ((
      this: WorkerGlobalScope & typeof globalThis,
      ev: MessageEvent,
    ) => any)
    | null;
  onerror:
    | ((
      this: WorkerGlobalScope & typeof globalThis,
      ev: ErrorEvent,
    ) => any)
    | null;
  close: () => void;
  postMessage: (message: any) => void;
  Deno: typeof Deno;
}

declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
  new(): DedicatedWorkerGlobalScope;
  name: string;
}

declare var self: WorkerGlobalScope & typeof globalThis;
declare var onmessage:
  | ((
    this: WorkerGlobalScope & typeof globalThis,
    ev: MessageEvent,
  ) => any)
  | null;
declare var onmessageerror:
  | ((
    this: WorkerGlobalScope & typeof globalThis,
    ev: MessageEvent,
  ) => any)
  | null;
declare var onerror:
  | ((
    this: WorkerGlobalScope & typeof globalThis,
    ev: ErrorEvent,
  ) => any)
  | null;
declare var close: () => void;
declare var name: string;
declare var postMessage: (message: any) => void;

/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */