mcpbrowser 0.2.0 → 0.2.2
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.
- package/.mcpregistry_github_token +1 -0
- package/.mcpregistry_registry_token +1 -0
- package/README.md +68 -35
- package/extension/.vscodeignore +6 -0
- package/extension/LICENSE +21 -0
- package/extension/README.md +61 -0
- package/extension/icon.png +0 -0
- package/extension/icon.svg +35 -0
- package/extension/mcpbrowser-0.1.1.vsix +0 -0
- package/extension/mcpbrowser-0.1.2.vsix +0 -0
- package/extension/mcpbrowser-0.1.3.vsix +0 -0
- package/extension/mcpbrowser-0.1.4.vsix +0 -0
- package/extension/mcpbrowser-config-0.1.0.vsix +0 -0
- package/extension/node_modules/.package-lock.json +32 -0
- package/extension/node_modules/@types/node/LICENSE +21 -0
- package/extension/node_modules/@types/node/README.md +15 -0
- package/extension/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/extension/node_modules/@types/node/assert.d.ts +1062 -0
- package/extension/node_modules/@types/node/async_hooks.d.ts +605 -0
- package/extension/node_modules/@types/node/buffer.buffer.d.ts +471 -0
- package/extension/node_modules/@types/node/buffer.d.ts +1936 -0
- package/extension/node_modules/@types/node/child_process.d.ts +1475 -0
- package/extension/node_modules/@types/node/cluster.d.ts +577 -0
- package/extension/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/extension/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/extension/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/extension/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/extension/node_modules/@types/node/console.d.ts +452 -0
- package/extension/node_modules/@types/node/constants.d.ts +21 -0
- package/extension/node_modules/@types/node/crypto.d.ts +4590 -0
- package/extension/node_modules/@types/node/dgram.d.ts +597 -0
- package/extension/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/extension/node_modules/@types/node/dns/promises.d.ts +479 -0
- package/extension/node_modules/@types/node/dns.d.ts +871 -0
- package/extension/node_modules/@types/node/domain.d.ts +170 -0
- package/extension/node_modules/@types/node/events.d.ts +977 -0
- package/extension/node_modules/@types/node/fs/promises.d.ts +1270 -0
- package/extension/node_modules/@types/node/fs.d.ts +4375 -0
- package/extension/node_modules/@types/node/globals.d.ts +172 -0
- package/extension/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/extension/node_modules/@types/node/http.d.ts +2049 -0
- package/extension/node_modules/@types/node/http2.d.ts +2631 -0
- package/extension/node_modules/@types/node/https.d.ts +578 -0
- package/extension/node_modules/@types/node/index.d.ts +93 -0
- package/extension/node_modules/@types/node/inspector.generated.d.ts +3966 -0
- package/extension/node_modules/@types/node/module.d.ts +539 -0
- package/extension/node_modules/@types/node/net.d.ts +1012 -0
- package/extension/node_modules/@types/node/os.d.ts +506 -0
- package/extension/node_modules/@types/node/package.json +140 -0
- package/extension/node_modules/@types/node/path.d.ts +200 -0
- package/extension/node_modules/@types/node/perf_hooks.d.ts +961 -0
- package/extension/node_modules/@types/node/process.d.ts +1957 -0
- package/extension/node_modules/@types/node/punycode.d.ts +117 -0
- package/extension/node_modules/@types/node/querystring.d.ts +152 -0
- package/extension/node_modules/@types/node/readline/promises.d.ts +162 -0
- package/extension/node_modules/@types/node/readline.d.ts +589 -0
- package/extension/node_modules/@types/node/repl.d.ts +430 -0
- package/extension/node_modules/@types/node/sea.d.ts +153 -0
- package/extension/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/extension/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/extension/node_modules/@types/node/stream/web.d.ts +533 -0
- package/extension/node_modules/@types/node/stream.d.ts +1675 -0
- package/extension/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/extension/node_modules/@types/node/test.d.ts +1787 -0
- package/extension/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/extension/node_modules/@types/node/timers.d.ts +286 -0
- package/extension/node_modules/@types/node/tls.d.ts +1255 -0
- package/extension/node_modules/@types/node/trace_events.d.ts +197 -0
- package/extension/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/extension/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/extension/node_modules/@types/node/ts5.6/index.d.ts +93 -0
- package/extension/node_modules/@types/node/tty.d.ts +208 -0
- package/extension/node_modules/@types/node/url.d.ts +964 -0
- package/extension/node_modules/@types/node/util.d.ts +2331 -0
- package/extension/node_modules/@types/node/v8.d.ts +809 -0
- package/extension/node_modules/@types/node/vm.d.ts +1001 -0
- package/extension/node_modules/@types/node/wasi.d.ts +181 -0
- package/extension/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/extension/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/extension/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/extension/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
- package/extension/node_modules/@types/node/worker_threads.d.ts +715 -0
- package/extension/node_modules/@types/node/zlib.d.ts +540 -0
- package/extension/node_modules/@types/vscode/LICENSE +21 -0
- package/extension/node_modules/@types/vscode/README.md +15 -0
- package/extension/node_modules/@types/vscode/index.d.ts +21153 -0
- package/extension/node_modules/@types/vscode/package.json +26 -0
- package/extension/node_modules/undici-types/LICENSE +21 -0
- package/extension/node_modules/undici-types/README.md +6 -0
- package/extension/node_modules/undici-types/agent.d.ts +31 -0
- package/extension/node_modules/undici-types/api.d.ts +43 -0
- package/extension/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/extension/node_modules/undici-types/cache.d.ts +36 -0
- package/extension/node_modules/undici-types/client.d.ts +108 -0
- package/extension/node_modules/undici-types/connector.d.ts +34 -0
- package/extension/node_modules/undici-types/content-type.d.ts +21 -0
- package/extension/node_modules/undici-types/cookies.d.ts +28 -0
- package/extension/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/extension/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/extension/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/extension/node_modules/undici-types/errors.d.ts +149 -0
- package/extension/node_modules/undici-types/eventsource.d.ts +61 -0
- package/extension/node_modules/undici-types/fetch.d.ts +209 -0
- package/extension/node_modules/undici-types/file.d.ts +39 -0
- package/extension/node_modules/undici-types/filereader.d.ts +54 -0
- package/extension/node_modules/undici-types/formdata.d.ts +108 -0
- package/extension/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/extension/node_modules/undici-types/global-origin.d.ts +7 -0
- package/extension/node_modules/undici-types/handlers.d.ts +15 -0
- package/extension/node_modules/undici-types/header.d.ts +4 -0
- package/extension/node_modules/undici-types/index.d.ts +71 -0
- package/extension/node_modules/undici-types/interceptors.d.ts +17 -0
- package/extension/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/extension/node_modules/undici-types/mock-client.d.ts +25 -0
- package/extension/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/extension/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/extension/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/extension/node_modules/undici-types/package.json +55 -0
- package/extension/node_modules/undici-types/patch.d.ts +33 -0
- package/extension/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/extension/node_modules/undici-types/pool.d.ts +39 -0
- package/extension/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/extension/node_modules/undici-types/readable.d.ts +65 -0
- package/extension/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/extension/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/extension/node_modules/undici-types/util.d.ts +18 -0
- package/extension/node_modules/undici-types/webidl.d.ts +228 -0
- package/extension/node_modules/undici-types/websocket.d.ts +150 -0
- package/extension/package-lock.json +44 -0
- package/extension/package.json +55 -0
- package/extension/src/extension.js +257 -0
- package/package.json +2 -1
- package/server.json +20 -0
- package/src/mcp-browser.js +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
+
* that return `Promise` objects. The API is accessible via
|
|
4
|
+
* `require('node:timers/promises')`.
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* import {
|
|
8
|
+
* setTimeout,
|
|
9
|
+
* setImmediate,
|
|
10
|
+
* setInterval,
|
|
11
|
+
* } from 'node:timers/promises';
|
|
12
|
+
* ```
|
|
13
|
+
* @since v15.0.0
|
|
14
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.x/lib/timers/promises.js)
|
|
15
|
+
*/
|
|
16
|
+
declare module "timers/promises" {
|
|
17
|
+
import { TimerOptions } from "node:timers";
|
|
18
|
+
/**
|
|
19
|
+
* ```js
|
|
20
|
+
* import {
|
|
21
|
+
* setTimeout,
|
|
22
|
+
* } from 'node:timers/promises';
|
|
23
|
+
*
|
|
24
|
+
* const res = await setTimeout(100, 'result');
|
|
25
|
+
*
|
|
26
|
+
* console.log(res); // Prints 'result'
|
|
27
|
+
* ```
|
|
28
|
+
* @since v15.0.0
|
|
29
|
+
* @param delay The number of milliseconds to wait before fulfilling the
|
|
30
|
+
* promise. **Default:** `1`.
|
|
31
|
+
* @param value A value with which the promise is fulfilled.
|
|
32
|
+
*/
|
|
33
|
+
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* ```js
|
|
36
|
+
* import {
|
|
37
|
+
* setImmediate,
|
|
38
|
+
* } from 'node:timers/promises';
|
|
39
|
+
*
|
|
40
|
+
* const res = await setImmediate('result');
|
|
41
|
+
*
|
|
42
|
+
* console.log(res); // Prints 'result'
|
|
43
|
+
* ```
|
|
44
|
+
* @since v15.0.0
|
|
45
|
+
* @param value A value with which the promise is fulfilled.
|
|
46
|
+
*/
|
|
47
|
+
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns an async iterator that generates values in an interval of `delay` ms.
|
|
50
|
+
* If `ref` is `true`, you need to call `next()` of async iterator explicitly
|
|
51
|
+
* or implicitly to keep the event loop alive.
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* import {
|
|
55
|
+
* setInterval,
|
|
56
|
+
* } from 'node:timers/promises';
|
|
57
|
+
*
|
|
58
|
+
* const interval = 100;
|
|
59
|
+
* for await (const startTime of setInterval(interval, Date.now())) {
|
|
60
|
+
* const now = Date.now();
|
|
61
|
+
* console.log(now);
|
|
62
|
+
* if ((now - startTime) > 1000)
|
|
63
|
+
* break;
|
|
64
|
+
* }
|
|
65
|
+
* console.log(Date.now());
|
|
66
|
+
* ```
|
|
67
|
+
* @since v15.9.0
|
|
68
|
+
* @param delay The number of milliseconds to wait between iterations.
|
|
69
|
+
* **Default:** `1`.
|
|
70
|
+
* @param value A value with which the iterator returns.
|
|
71
|
+
*/
|
|
72
|
+
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): NodeJS.AsyncIterator<T>;
|
|
73
|
+
interface Scheduler {
|
|
74
|
+
/**
|
|
75
|
+
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
76
|
+
* being developed as a standard Web Platform API.
|
|
77
|
+
*
|
|
78
|
+
* Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent
|
|
79
|
+
* to calling `timersPromises.setTimeout(delay, undefined, options)` except that
|
|
80
|
+
* the `ref` option is not supported.
|
|
81
|
+
*
|
|
82
|
+
* ```js
|
|
83
|
+
* import { scheduler } from 'node:timers/promises';
|
|
84
|
+
*
|
|
85
|
+
* await scheduler.wait(1000); // Wait one second before continuing
|
|
86
|
+
* ```
|
|
87
|
+
* @since v17.3.0, v16.14.0
|
|
88
|
+
* @experimental
|
|
89
|
+
* @param delay The number of milliseconds to wait before resolving the
|
|
90
|
+
* promise.
|
|
91
|
+
*/
|
|
92
|
+
wait(delay: number, options?: { signal?: AbortSignal }): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
95
|
+
* being developed as a standard Web Platform API.
|
|
96
|
+
*
|
|
97
|
+
* Calling `timersPromises.scheduler.yield()` is equivalent to calling
|
|
98
|
+
* `timersPromises.setImmediate()` with no arguments.
|
|
99
|
+
* @since v17.3.0, v16.14.0
|
|
100
|
+
* @experimental
|
|
101
|
+
*/
|
|
102
|
+
yield(): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
const scheduler: Scheduler;
|
|
105
|
+
}
|
|
106
|
+
declare module "node:timers/promises" {
|
|
107
|
+
export * from "timers/promises";
|
|
108
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `timer` module exposes a global API for scheduling functions to
|
|
3
|
+
* be called at some future period of time. Because the timer functions are
|
|
4
|
+
* globals, there is no need to import `node:timers` to use the API.
|
|
5
|
+
*
|
|
6
|
+
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
|
+
* provided by Web Browsers but use a different internal implementation that is
|
|
8
|
+
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.x/lib/timers.js)
|
|
10
|
+
*/
|
|
11
|
+
declare module "timers" {
|
|
12
|
+
import { Abortable } from "node:events";
|
|
13
|
+
import * as promises from "node:timers/promises";
|
|
14
|
+
export interface TimerOptions extends Abortable {
|
|
15
|
+
/**
|
|
16
|
+
* Set to `false` to indicate that the scheduled `Timeout`
|
|
17
|
+
* should not require the Node.js event loop to remain active.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
ref?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
global {
|
|
23
|
+
namespace NodeJS {
|
|
24
|
+
/**
|
|
25
|
+
* This object is created internally and is returned from `setImmediate()`. It
|
|
26
|
+
* can be passed to `clearImmediate()` in order to cancel the scheduled
|
|
27
|
+
* actions.
|
|
28
|
+
*
|
|
29
|
+
* By default, when an immediate is scheduled, the Node.js event loop will continue
|
|
30
|
+
* running as long as the immediate is active. The `Immediate` object returned by
|
|
31
|
+
* `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`
|
|
32
|
+
* functions that can be used to control this default behavior.
|
|
33
|
+
*/
|
|
34
|
+
interface Immediate extends RefCounted, Disposable {
|
|
35
|
+
/**
|
|
36
|
+
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
37
|
+
* @since v11.0.0
|
|
38
|
+
*/
|
|
39
|
+
hasRef(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
42
|
+
* `Immediate` is active. Calling `immediate.ref()` multiple times will have no
|
|
43
|
+
* effect.
|
|
44
|
+
*
|
|
45
|
+
* By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
|
|
46
|
+
* to call `immediate.ref()` unless `immediate.unref()` had been called previously.
|
|
47
|
+
* @since v9.7.0
|
|
48
|
+
* @returns a reference to `immediate`
|
|
49
|
+
*/
|
|
50
|
+
ref(): this;
|
|
51
|
+
/**
|
|
52
|
+
* When called, the active `Immediate` object will not require the Node.js event
|
|
53
|
+
* loop to remain active. If there is no other activity keeping the event loop
|
|
54
|
+
* running, the process may exit before the `Immediate` object's callback is
|
|
55
|
+
* invoked. Calling `immediate.unref()` multiple times will have no effect.
|
|
56
|
+
* @since v9.7.0
|
|
57
|
+
* @returns a reference to `immediate`
|
|
58
|
+
*/
|
|
59
|
+
unref(): this;
|
|
60
|
+
/**
|
|
61
|
+
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
|
62
|
+
* @since v20.5.0, v18.18.0
|
|
63
|
+
* @experimental
|
|
64
|
+
*/
|
|
65
|
+
[Symbol.dispose](): void;
|
|
66
|
+
_onImmediate(...args: any[]): void;
|
|
67
|
+
}
|
|
68
|
+
// Legacy interface used in Node.js v9 and prior
|
|
69
|
+
/** @deprecated Use `NodeJS.Timeout` instead. */
|
|
70
|
+
interface Timer extends RefCounted {
|
|
71
|
+
hasRef(): boolean;
|
|
72
|
+
refresh(): this;
|
|
73
|
+
[Symbol.toPrimitive](): number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* This object is created internally and is returned from `setTimeout()` and
|
|
77
|
+
* `setInterval()`. It can be passed to either `clearTimeout()` or
|
|
78
|
+
* `clearInterval()` in order to cancel the scheduled actions.
|
|
79
|
+
*
|
|
80
|
+
* By default, when a timer is scheduled using either `setTimeout()` or
|
|
81
|
+
* `setInterval()`, the Node.js event loop will continue running as long as the
|
|
82
|
+
* timer is active. Each of the `Timeout` objects returned by these functions
|
|
83
|
+
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
|
|
84
|
+
* control this default behavior.
|
|
85
|
+
*/
|
|
86
|
+
interface Timeout extends RefCounted, Disposable, Timer {
|
|
87
|
+
/**
|
|
88
|
+
* Cancels the timeout.
|
|
89
|
+
* @since v0.9.1
|
|
90
|
+
* @legacy Use `clearTimeout()` instead.
|
|
91
|
+
* @returns a reference to `timeout`
|
|
92
|
+
*/
|
|
93
|
+
close(): this;
|
|
94
|
+
/**
|
|
95
|
+
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
96
|
+
* @since v11.0.0
|
|
97
|
+
*/
|
|
98
|
+
hasRef(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
101
|
+
* `Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
102
|
+
*
|
|
103
|
+
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
104
|
+
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
105
|
+
* @since v0.9.1
|
|
106
|
+
* @returns a reference to `timeout`
|
|
107
|
+
*/
|
|
108
|
+
ref(): this;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the timer's start time to the current time, and reschedules the timer to
|
|
111
|
+
* call its callback at the previously specified duration adjusted to the current
|
|
112
|
+
* time. This is useful for refreshing a timer without allocating a new
|
|
113
|
+
* JavaScript object.
|
|
114
|
+
*
|
|
115
|
+
* Using this on a timer that has already called its callback will reactivate the
|
|
116
|
+
* timer.
|
|
117
|
+
* @since v10.2.0
|
|
118
|
+
* @returns a reference to `timeout`
|
|
119
|
+
*/
|
|
120
|
+
refresh(): this;
|
|
121
|
+
/**
|
|
122
|
+
* When called, the active `Timeout` object will not require the Node.js event loop
|
|
123
|
+
* to remain active. If there is no other activity keeping the event loop running,
|
|
124
|
+
* the process may exit before the `Timeout` object's callback is invoked. Calling
|
|
125
|
+
* `timeout.unref()` multiple times will have no effect.
|
|
126
|
+
* @since v0.9.1
|
|
127
|
+
* @returns a reference to `timeout`
|
|
128
|
+
*/
|
|
129
|
+
unref(): this;
|
|
130
|
+
/**
|
|
131
|
+
* Coerce a `Timeout` to a primitive. The primitive can be used to
|
|
132
|
+
* clear the `Timeout`. The primitive can only be used in the
|
|
133
|
+
* same thread where the timeout was created. Therefore, to use it
|
|
134
|
+
* across `worker_threads` it must first be passed to the correct
|
|
135
|
+
* thread. This allows enhanced compatibility with browser
|
|
136
|
+
* `setTimeout()` and `setInterval()` implementations.
|
|
137
|
+
* @since v14.9.0, v12.19.0
|
|
138
|
+
*/
|
|
139
|
+
[Symbol.toPrimitive](): number;
|
|
140
|
+
/**
|
|
141
|
+
* Cancels the timeout.
|
|
142
|
+
* @since v20.5.0, v18.18.0
|
|
143
|
+
* @experimental
|
|
144
|
+
*/
|
|
145
|
+
[Symbol.dispose](): void;
|
|
146
|
+
_onTimeout(...args: any[]): void;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Schedules the "immediate" execution of the `callback` after I/O events'
|
|
151
|
+
* callbacks.
|
|
152
|
+
*
|
|
153
|
+
* When multiple calls to `setImmediate()` are made, the `callback` functions are
|
|
154
|
+
* queued for execution in the order in which they are created. The entire callback
|
|
155
|
+
* queue is processed every event loop iteration. If an immediate timer is queued
|
|
156
|
+
* from inside an executing callback, that timer will not be triggered until the
|
|
157
|
+
* next event loop iteration.
|
|
158
|
+
*
|
|
159
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
160
|
+
*
|
|
161
|
+
* This method has a custom variant for promises that is available using
|
|
162
|
+
* `timersPromises.setImmediate()`.
|
|
163
|
+
* @since v0.9.1
|
|
164
|
+
* @param callback The function to call at the end of this turn of
|
|
165
|
+
* the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout)
|
|
166
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
167
|
+
* @returns for use with `clearImmediate()`
|
|
168
|
+
*/
|
|
169
|
+
function setImmediate<TArgs extends any[]>(
|
|
170
|
+
callback: (...args: TArgs) => void,
|
|
171
|
+
...args: TArgs
|
|
172
|
+
): NodeJS.Immediate;
|
|
173
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
174
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
176
|
+
function setImmediate(callback: (_: void) => void): NodeJS.Immediate;
|
|
177
|
+
namespace setImmediate {
|
|
178
|
+
import __promisify__ = promises.setImmediate;
|
|
179
|
+
export { __promisify__ };
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Schedules repeated execution of `callback` every `delay` milliseconds.
|
|
183
|
+
*
|
|
184
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay` will be
|
|
185
|
+
* set to `1`. Non-integer delays are truncated to an integer.
|
|
186
|
+
*
|
|
187
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
188
|
+
*
|
|
189
|
+
* This method has a custom variant for promises that is available using
|
|
190
|
+
* `timersPromises.setInterval()`.
|
|
191
|
+
* @since v0.0.1
|
|
192
|
+
* @param callback The function to call when the timer elapses.
|
|
193
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
194
|
+
* `callback`. **Default:** `1`.
|
|
195
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
196
|
+
* @returns for use with `clearInterval()`
|
|
197
|
+
*/
|
|
198
|
+
function setInterval<TArgs extends any[]>(
|
|
199
|
+
callback: (...args: TArgs) => void,
|
|
200
|
+
delay?: number,
|
|
201
|
+
...args: TArgs
|
|
202
|
+
): NodeJS.Timeout;
|
|
203
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
204
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
206
|
+
function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
207
|
+
/**
|
|
208
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
209
|
+
*
|
|
210
|
+
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
211
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
212
|
+
* nor of their ordering. The callback will be called as close as possible to the
|
|
213
|
+
* time specified.
|
|
214
|
+
*
|
|
215
|
+
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
|
|
216
|
+
* will be set to `1`. Non-integer delays are truncated to an integer.
|
|
217
|
+
*
|
|
218
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
219
|
+
*
|
|
220
|
+
* This method has a custom variant for promises that is available using
|
|
221
|
+
* `timersPromises.setTimeout()`.
|
|
222
|
+
* @since v0.0.1
|
|
223
|
+
* @param callback The function to call when the timer elapses.
|
|
224
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
225
|
+
* `callback`. **Default:** `1`.
|
|
226
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
227
|
+
* @returns for use with `clearTimeout()`
|
|
228
|
+
*/
|
|
229
|
+
function setTimeout<TArgs extends any[]>(
|
|
230
|
+
callback: (...args: TArgs) => void,
|
|
231
|
+
delay?: number,
|
|
232
|
+
...args: TArgs
|
|
233
|
+
): NodeJS.Timeout;
|
|
234
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
235
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
236
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
237
|
+
function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
238
|
+
namespace setTimeout {
|
|
239
|
+
import __promisify__ = promises.setTimeout;
|
|
240
|
+
export { __promisify__ };
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Cancels an `Immediate` object created by `setImmediate()`.
|
|
244
|
+
* @since v0.9.1
|
|
245
|
+
* @param immediate An `Immediate` object as returned by `setImmediate()`.
|
|
246
|
+
*/
|
|
247
|
+
function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
|
|
248
|
+
/**
|
|
249
|
+
* Cancels a `Timeout` object created by `setInterval()`.
|
|
250
|
+
* @since v0.0.1
|
|
251
|
+
* @param timeout A `Timeout` object as returned by `setInterval()`
|
|
252
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
253
|
+
*/
|
|
254
|
+
function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
255
|
+
/**
|
|
256
|
+
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
257
|
+
* @since v0.0.1
|
|
258
|
+
* @param timeout A `Timeout` object as returned by `setTimeout()`
|
|
259
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
260
|
+
*/
|
|
261
|
+
function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
262
|
+
/**
|
|
263
|
+
* The `queueMicrotask()` method queues a microtask to invoke `callback`. If
|
|
264
|
+
* `callback` throws an exception, the `process` object `'uncaughtException'`
|
|
265
|
+
* event will be emitted.
|
|
266
|
+
*
|
|
267
|
+
* The microtask queue is managed by V8 and may be used in a similar manner to
|
|
268
|
+
* the `process.nextTick()` queue, which is managed by Node.js. The
|
|
269
|
+
* `process.nextTick()` queue is always processed before the microtask queue
|
|
270
|
+
* within each turn of the Node.js event loop.
|
|
271
|
+
* @since v11.0.0
|
|
272
|
+
* @param callback Function to be queued.
|
|
273
|
+
*/
|
|
274
|
+
function queueMicrotask(callback: () => void): void;
|
|
275
|
+
}
|
|
276
|
+
import clearImmediate = globalThis.clearImmediate;
|
|
277
|
+
import clearInterval = globalThis.clearInterval;
|
|
278
|
+
import clearTimeout = globalThis.clearTimeout;
|
|
279
|
+
import setImmediate = globalThis.setImmediate;
|
|
280
|
+
import setInterval = globalThis.setInterval;
|
|
281
|
+
import setTimeout = globalThis.setTimeout;
|
|
282
|
+
export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
|
|
283
|
+
}
|
|
284
|
+
declare module "node:timers" {
|
|
285
|
+
export * from "timers";
|
|
286
|
+
}
|