summaryrefslogtreecommitdiff
path: root/extensions/web/lib.deno_web.d.ts
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-08-09 10:39:00 +0200
committerGitHub <noreply@github.com>2021-08-09 10:39:00 +0200
commit16ae4a0d5799c9a4ed776f32929f73b1063ae4e8 (patch)
treeed5d0def5e0acbf67f2c64ac4664b1af46f4c468 /extensions/web/lib.deno_web.d.ts
parent02c74fb70970fcadb7d1e6dab857eeb2cea20e09 (diff)
feat(extensions/web): add structuredClone function (#11572)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'extensions/web/lib.deno_web.d.ts')
-rw-r--r--extensions/web/lib.deno_web.d.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/extensions/web/lib.deno_web.d.ts b/extensions/web/lib.deno_web.d.ts
index 6c79f61bd..3f110353f 100644
--- a/extensions/web/lib.deno_web.d.ts
+++ b/extensions/web/lib.deno_web.d.ts
@@ -673,7 +673,15 @@ declare class MessageEvent<T = any> extends Event {
type Transferable = ArrayBuffer | MessagePort;
-interface PostMessageOptions {
+/**
+ * @deprecated
+ *
+ * This type has been renamed to StructuredSerializeOptions. Use that type for
+ * new code.
+ */
+type PostMessageOptions = StructuredSerializeOptions;
+
+interface StructuredSerializeOptions {
transfer?: Transferable[];
}
@@ -710,7 +718,7 @@ declare class MessagePort extends EventTarget {
* objects or port, or if message could not be cloned.
*/
postMessage(message: any, transfer: Transferable[]): void;
- postMessage(message: any, options?: PostMessageOptions): void;
+ postMessage(message: any, options?: StructuredSerializeOptions): void;
/**
* Begins dispatching messages received on the port. This is implictly called
* when assiging a value to `this.onmessage`.
@@ -737,3 +745,8 @@ declare class MessagePort extends EventTarget {
options?: boolean | EventListenerOptions,
): void;
}
+
+declare function structuredClone(
+ value: any,
+ options?: StructuredSerializeOptions,
+): any;