summaryrefslogtreecommitdiff
path: root/core/lib.deno_core.d.ts
blob: 2cec6be76067546ba9e58e4f100ad23d9733df17 (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
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.

// deno-lint-ignore-file no-explicit-any

/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

declare namespace Deno {
  declare namespace core {
    /** Call an op in Rust, and synchronously receive the result. */
    function opSync(
      opName: string,
      a?: any,
      b?: any,
    ): any;

    /** Call an op in Rust, and asynchronously receive the result. */
    function opAsync(
      opName: string,
      a?: any,
      b?: any,
    ): Promise<any>;

    /**
     * Retrieve a list of all registered ops, in the form of a map that maps op
     * name to internal numerical op id.
     */
    function ops(): Record<string, number>;

    /**
     * Retrieve a list of all open resources, in the form of a map that maps
     * resource id to the resource name.
     */
    function resources(): Record<string, string>;

    /** Close the resource with the specified op id. */
    function close(rid: number): void;

    /** Get heap stats for current isolate/worker */
    function heapStats(): Record<string, number>;

    /** Encode a string to its Uint8Array representation. */
    function encode(input: string): Uint8Array;
  }
}