forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinternal-binding.d.ts
More file actions
33 lines (27 loc) · 1.15 KB
/
internal-binding.d.ts
File metadata and controls
33 lines (27 loc) · 1.15 KB
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
/**
* @file internal-binding.d.ts
* @author Tom Tang <xmader@distributive.network>
* @date June 2023
*/
/**
* Note: `internalBinding` APIs are generally unsafe as they do not perform argument type checking, etc.
* Argument checking should be done in JavaScript side.
*/
declare function internalBinding(namespace: string): any; // catch-all
declare function internalBinding(namespace: "utils"): {
defineGlobal(name: string, value: any): void;
isAnyArrayBuffer(obj: any): obj is (ArrayBuffer | SharedArrayBuffer);
isPromise<T>(obj: any): obj is Promise<T>;
isRegExp(obj: any): obj is RegExp;
isTypedArray(obj: any): obj is TypedArray;
/**
* Get the promise state (fulfilled/rejected/pending) and result (either fulfilled resolution or rejection reason)
*/
getPromiseDetails(promise: Promise<any>): [state: PromiseState.Pending] | [state: PromiseState.Fulfilled | PromiseState.Rejected, result: any];
/**
* Get the proxy target object and handler
* @return `undefined` if it's not a proxy
*/
getProxyDetails<T extends object>(proxy: T): undefined | [target: T, handler: ProxyHandler<T>];
};
export = internalBinding;