0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-05 10:26:44 -05:00
deno/cli/tsc/dts/lib.deno_broadcast_channel.d.ts
Bartek Iwańczuk e4b8fa5f4f
fix: move extension file declarations to cli/tsc/dts (#28180)
This commits moves all `.d.ts` files from `ext/*` to `cli/tsc/dts`.

Due to TSC snapshot removal, `cargo publish` is now erroring out,
unable to find the declaration files. These files were moved to
"cli/tsc/dts", because it's much easier than keeping them in 
extension directories, while still providing them compressed 
or uncompressed depending on the build type.
2025-02-19 02:53:21 +01:00

67 lines
1.8 KiB
TypeScript

// Copyright 2018-2025 the Deno authors. MIT license.
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
/**
* @category Messaging
* @experimental
*/
interface BroadcastChannelEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
/**
* @category Messaging
* @experimental
*/
interface BroadcastChannel extends EventTarget {
/**
* Returns the channel name (as passed to the constructor).
*/
readonly name: string;
onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null;
onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null;
/**
* Closes the BroadcastChannel object, opening it up to garbage collection.
*/
close(): void;
/**
* Sends the given message to other BroadcastChannel objects set up for
* this channel. Messages can be structured objects, e.g. nested objects
* and arrays.
*/
postMessage(message: any): void;
addEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
removeEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
/**
* @category Messaging
* @experimental
*/
declare var BroadcastChannel: {
readonly prototype: BroadcastChannel;
new (name: string): BroadcastChannel;
};