@yume-chan/stream-extra 2.5.3 → 3.0.0-beta.0

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.
Files changed (167) hide show
  1. package/LICENSE +1 -1
  2. package/esm/buffered-transform.d.ts +2 -2
  3. package/esm/buffered-transform.d.ts.map +1 -1
  4. package/esm/buffered-transform.js +1 -1
  5. package/esm/buffered-transform.js.map +1 -1
  6. package/esm/buffered.d.ts +1 -1
  7. package/esm/buffered.d.ts.map +1 -1
  8. package/esm/buffered.js.map +1 -1
  9. package/esm/concat.d.ts +25 -16
  10. package/esm/concat.d.ts.map +1 -1
  11. package/esm/concat.js +124 -93
  12. package/esm/concat.js.map +1 -1
  13. package/esm/consumable/readable.d.ts +2 -2
  14. package/esm/consumable/readable.d.ts.map +1 -1
  15. package/esm/consumable/readable.js +1 -1
  16. package/esm/consumable/readable.js.map +1 -1
  17. package/esm/consumable/wrap-byte-readable.d.ts +5 -2
  18. package/esm/consumable/wrap-byte-readable.d.ts.map +1 -1
  19. package/esm/consumable/wrap-byte-readable.js +12 -6
  20. package/esm/consumable/wrap-byte-readable.js.map +1 -1
  21. package/esm/consumable/wrap-writable.d.ts +1 -1
  22. package/esm/consumable/wrap-writable.d.ts.map +1 -1
  23. package/esm/consumable/wrap-writable.js +1 -1
  24. package/esm/consumable/wrap-writable.js.map +1 -1
  25. package/esm/consumable/writable.d.ts +2 -2
  26. package/esm/consumable/writable.d.ts.map +1 -1
  27. package/esm/consumable/writable.js +1 -1
  28. package/esm/consumable/writable.js.map +1 -1
  29. package/esm/consumable.d.ts +4 -0
  30. package/esm/consumable.d.ts.map +1 -1
  31. package/esm/consumable.js +5 -0
  32. package/esm/consumable.js.map +1 -1
  33. package/esm/distribution.d.ts +1 -1
  34. package/esm/distribution.d.ts.map +1 -1
  35. package/esm/distribution.js +1 -1
  36. package/esm/distribution.js.map +1 -1
  37. package/esm/duplex.d.ts +2 -2
  38. package/esm/duplex.d.ts.map +1 -1
  39. package/esm/duplex.js +1 -1
  40. package/esm/duplex.js.map +1 -1
  41. package/esm/global/abort-signal.d.ts +87 -0
  42. package/esm/global/abort-signal.d.ts.map +1 -0
  43. package/esm/global/abort-signal.js +4 -0
  44. package/esm/global/abort-signal.js.map +1 -0
  45. package/esm/global/compression.d.ts +15 -0
  46. package/esm/global/compression.d.ts.map +1 -0
  47. package/esm/global/compression.js +4 -0
  48. package/esm/global/compression.js.map +1 -0
  49. package/esm/global/encoding.d.ts +25 -0
  50. package/esm/global/encoding.d.ts.map +1 -0
  51. package/esm/global/encoding.js +4 -0
  52. package/esm/global/encoding.js.map +1 -0
  53. package/esm/global/event.d.ts +191 -0
  54. package/esm/global/event.d.ts.map +1 -0
  55. package/esm/global/event.js +4 -0
  56. package/esm/global/event.js.map +1 -0
  57. package/esm/global/index.d.ts +7 -0
  58. package/esm/global/index.d.ts.map +1 -0
  59. package/esm/global/index.js +7 -0
  60. package/esm/global/index.js.map +1 -0
  61. package/esm/{types.d.ts → global/streams.d.ts} +136 -222
  62. package/esm/global/streams.d.ts.map +1 -0
  63. package/esm/{stream.js → global/streams.js} +16 -8
  64. package/esm/global/streams.js.map +1 -0
  65. package/esm/global/timer.d.ts +13 -0
  66. package/esm/global/timer.d.ts.map +1 -0
  67. package/esm/global/timer.js +4 -0
  68. package/esm/global/timer.js.map +1 -0
  69. package/esm/global/utils.d.ts +9 -0
  70. package/esm/global/utils.d.ts.map +1 -0
  71. package/esm/global/utils.js +5 -0
  72. package/esm/global/utils.js.map +1 -0
  73. package/esm/index.d.ts +2 -2
  74. package/esm/index.d.ts.map +1 -1
  75. package/esm/index.js +2 -2
  76. package/esm/index.js.map +1 -1
  77. package/esm/inspect.d.ts +6 -2
  78. package/esm/inspect.d.ts.map +1 -1
  79. package/esm/inspect.js +10 -4
  80. package/esm/inspect.js.map +1 -1
  81. package/esm/maybe-consumable/wrap-writable.d.ts +1 -1
  82. package/esm/maybe-consumable/wrap-writable.d.ts.map +1 -1
  83. package/esm/maybe-consumable/wrap-writable.js +1 -1
  84. package/esm/maybe-consumable/wrap-writable.js.map +1 -1
  85. package/esm/maybe-consumable/writable.d.ts +2 -2
  86. package/esm/maybe-consumable/writable.d.ts.map +1 -1
  87. package/esm/maybe-consumable/writable.js +1 -1
  88. package/esm/maybe-consumable/writable.js.map +1 -1
  89. package/esm/pipe-from.d.ts +3 -3
  90. package/esm/pipe-from.d.ts.map +1 -1
  91. package/esm/pipe-from.js +1 -1
  92. package/esm/pipe-from.js.map +1 -1
  93. package/esm/push-readable.d.ts +20 -3
  94. package/esm/push-readable.d.ts.map +1 -1
  95. package/esm/push-readable.js +180 -180
  96. package/esm/push-readable.js.map +1 -1
  97. package/esm/split-string.d.ts +6 -2
  98. package/esm/split-string.d.ts.map +1 -1
  99. package/esm/split-string.js +28 -7
  100. package/esm/split-string.js.map +1 -1
  101. package/esm/struct-deserialize.js.map +1 -1
  102. package/esm/struct-serialize.d.ts +1 -1
  103. package/esm/struct-serialize.d.ts.map +1 -1
  104. package/esm/struct-serialize.js +1 -1
  105. package/esm/struct-serialize.js.map +1 -1
  106. package/esm/task-queue.d.ts +8 -0
  107. package/esm/task-queue.d.ts.map +1 -0
  108. package/esm/task-queue.js +50 -0
  109. package/esm/task-queue.js.map +1 -0
  110. package/esm/try-close.d.ts +3 -5
  111. package/esm/try-close.d.ts.map +1 -1
  112. package/esm/try-close.js.map +1 -1
  113. package/esm/wrap-readable.d.ts +2 -2
  114. package/esm/wrap-readable.d.ts.map +1 -1
  115. package/esm/wrap-readable.js +1 -1
  116. package/esm/wrap-readable.js.map +1 -1
  117. package/esm/wrap-writable.d.ts +2 -2
  118. package/esm/wrap-writable.d.ts.map +1 -1
  119. package/esm/wrap-writable.js +1 -1
  120. package/esm/wrap-writable.js.map +1 -1
  121. package/package.json +8 -8
  122. package/src/buffered-transform.ts +8 -7
  123. package/src/buffered.ts +4 -1
  124. package/src/concat.ts +161 -118
  125. package/src/consumable/readable.ts +2 -2
  126. package/src/consumable/wrap-byte-readable.ts +20 -7
  127. package/src/consumable/wrap-writable.ts +1 -1
  128. package/src/consumable/writable.ts +2 -2
  129. package/src/consumable.ts +8 -0
  130. package/src/distribution.ts +1 -1
  131. package/src/duplex.ts +2 -2
  132. package/src/global/abort-signal.ts +129 -0
  133. package/src/global/compression.ts +28 -0
  134. package/src/global/encoding.ts +36 -0
  135. package/src/global/event.ts +221 -0
  136. package/src/global/index.ts +6 -0
  137. package/src/{types.ts → global/streams.ts} +266 -244
  138. package/src/global/timer.ts +18 -0
  139. package/src/global/utils.ts +14 -0
  140. package/src/index.ts +2 -2
  141. package/src/inspect.ts +18 -4
  142. package/src/maybe-consumable/wrap-writable.ts +1 -1
  143. package/src/maybe-consumable/writable.ts +3 -3
  144. package/src/pipe-from.ts +2 -2
  145. package/src/push-readable.ts +226 -198
  146. package/src/split-string.ts +41 -7
  147. package/src/struct-deserialize.ts +1 -1
  148. package/src/struct-serialize.ts +1 -1
  149. package/src/task-queue.ts +69 -0
  150. package/src/try-close.ts +0 -12
  151. package/src/wrap-readable.ts +2 -2
  152. package/src/wrap-writable.ts +5 -2
  153. package/tsconfig.build.json +1 -6
  154. package/CHANGELOG.md +0 -102
  155. package/esm/encoding.d.ts +0 -21
  156. package/esm/encoding.d.ts.map +0 -1
  157. package/esm/encoding.js +0 -4
  158. package/esm/encoding.js.map +0 -1
  159. package/esm/stream.d.ts +0 -25
  160. package/esm/stream.d.ts.map +0 -1
  161. package/esm/stream.js.map +0 -1
  162. package/esm/types.d.ts.map +0 -1
  163. package/esm/types.js +0 -3
  164. package/esm/types.js.map +0 -1
  165. package/src/encoding.ts +0 -39
  166. package/src/stream.ts +0 -106
  167. package/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,129 @@
1
+ import type {
2
+ AddEventListenerOptions,
3
+ Event,
4
+ EventListenerOptions,
5
+ EventListenerOrEventListenerObject,
6
+ } from "./event.js";
7
+ import type { GlobalPrototypeOr, GlobalValueOr } from "./utils.js";
8
+ import { getGlobalValue } from "./utils.js";
9
+
10
+ interface AbortSignalEventMap {
11
+ abort: Event;
12
+ }
13
+
14
+ /**
15
+ * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.
16
+ *
17
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
18
+ */
19
+ interface _AbortSignal {
20
+ /**
21
+ * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (true) or not (false).
22
+ *
23
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
24
+ */
25
+ readonly aborted: boolean;
26
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
27
+ onabort: ((this: AbortSignal, ev: Event) => void) | null;
28
+ /**
29
+ * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
30
+ *
31
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
32
+ */
33
+ readonly reason: unknown;
34
+ /**
35
+ * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.
36
+ *
37
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
38
+ */
39
+ throwIfAborted(): void;
40
+ addEventListener<K extends keyof AbortSignalEventMap>(
41
+ type: K,
42
+ listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => void,
43
+ options?: boolean | AddEventListenerOptions,
44
+ ): void;
45
+ addEventListener(
46
+ type: string,
47
+ listener: EventListenerOrEventListenerObject,
48
+ options?: boolean | AddEventListenerOptions,
49
+ ): void;
50
+ removeEventListener<K extends keyof AbortSignalEventMap>(
51
+ type: K,
52
+ listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => void,
53
+ options?: boolean | EventListenerOptions,
54
+ ): void;
55
+ removeEventListener(
56
+ type: string,
57
+ listener: EventListenerOrEventListenerObject,
58
+ options?: boolean | EventListenerOptions,
59
+ ): void;
60
+ }
61
+
62
+ export type AbortSignal = GlobalPrototypeOr<"AbortSignal", _AbortSignal>;
63
+
64
+ interface _AbortSignalConstructor {
65
+ /**
66
+ * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).
67
+ *
68
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
69
+ */
70
+ abort(reason?: unknown): AbortSignal;
71
+ /**
72
+ * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal.
73
+ *
74
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
75
+ */
76
+ any(signals: Iterable<AbortSignal>): AbortSignal;
77
+ /**
78
+ * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
79
+ *
80
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
81
+ */
82
+ timeout(milliseconds: number): AbortSignal;
83
+ }
84
+
85
+ type AbortSignalConstructor = GlobalValueOr<
86
+ "AbortSignal",
87
+ _AbortSignalConstructor
88
+ >;
89
+
90
+ export const AbortSignal =
91
+ getGlobalValue<AbortSignalConstructor>("AbortSignal");
92
+
93
+ /**
94
+ * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
95
+ *
96
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
97
+ */
98
+ interface _AbortController {
99
+ /**
100
+ * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.
101
+ *
102
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
103
+ */
104
+ readonly signal: AbortSignal;
105
+ /**
106
+ * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.
107
+ *
108
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
109
+ */
110
+ abort(reason?: unknown): void;
111
+ }
112
+
113
+ export type AbortController = GlobalPrototypeOr<
114
+ "AbortController",
115
+ _AbortController
116
+ >;
117
+
118
+ interface _AbortControllerConstructor {
119
+ prototype: AbortController;
120
+ new (): AbortController;
121
+ }
122
+
123
+ type AbortControllerConstructor = GlobalValueOr<
124
+ "AbortController",
125
+ _AbortControllerConstructor
126
+ >;
127
+
128
+ export const AbortController =
129
+ getGlobalValue<AbortControllerConstructor>("AbortController");
@@ -0,0 +1,28 @@
1
+ import type { TransformStream } from "./streams.js";
2
+ import { getGlobalValue } from "./utils.js";
3
+
4
+ export type CompressionStream = TransformStream<
5
+ ArrayBufferView | ArrayBufferLike,
6
+ Uint8Array<ArrayBuffer>
7
+ >;
8
+
9
+ interface CompressionStreamConstructor {
10
+ prototype: CompressionStream;
11
+ new (format: string): CompressionStream;
12
+ }
13
+
14
+ export const CompressionStream =
15
+ getGlobalValue<CompressionStreamConstructor>("CompressionStream");
16
+
17
+ export type DecompressionStream = TransformStream<
18
+ ArrayBufferView | ArrayBufferLike,
19
+ Uint8Array<ArrayBuffer>
20
+ >;
21
+
22
+ interface DecompressionStreamConstructor {
23
+ prototype: DecompressionStream;
24
+ new (): DecompressionStream;
25
+ }
26
+
27
+ export const DecompressionStream =
28
+ getGlobalValue<DecompressionStreamConstructor>("DecompressionStream");
@@ -0,0 +1,36 @@
1
+ import type { TransformStream } from "./streams.js";
2
+ import { getGlobalValue } from "./utils.js";
3
+
4
+ export interface TextDecoderOptions {
5
+ fatal?: boolean;
6
+ ignoreBOM?: boolean;
7
+ }
8
+
9
+ export interface TextDecoderStream extends TransformStream<
10
+ ArrayBufferView | ArrayBufferLike,
11
+ string
12
+ > {
13
+ readonly encoding: string;
14
+ readonly fatal: boolean;
15
+ readonly ignoreBOM: boolean;
16
+ }
17
+
18
+ interface TextDecoderStreamConstructor {
19
+ prototype: TextDecoderStream;
20
+ new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
21
+ }
22
+
23
+ export const TextDecoderStream =
24
+ getGlobalValue<TextDecoderStreamConstructor>("TextDecoderStream");
25
+
26
+ export interface TextEncoderStream extends TransformStream<string, Uint8Array> {
27
+ readonly encoding: string;
28
+ }
29
+
30
+ interface TextEncoderStreamConstructor {
31
+ prototype: TextEncoderStream;
32
+ new (): TextEncoderStream;
33
+ }
34
+
35
+ export const TextEncoderStream =
36
+ getGlobalValue<TextEncoderStreamConstructor>("TextEncoderStream");
@@ -0,0 +1,221 @@
1
+ import type { AbortSignal } from "./abort-signal.js";
2
+ import type { GlobalPrototypeOr, GlobalValueOr } from "./utils.js";
3
+ import { getGlobalValue } from "./utils.js";
4
+
5
+ type DOMHighResTimeStamp = number;
6
+
7
+ /**
8
+ * The **`Event`** interface represents an event which takes place on an EventTarget.
9
+ *
10
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
11
+ */
12
+ interface _Event {
13
+ /**
14
+ * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
15
+ *
16
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
17
+ */
18
+ readonly bubbles: boolean;
19
+ /**
20
+ * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.
21
+ * @deprecated
22
+ *
23
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
24
+ */
25
+ cancelBubble: boolean;
26
+ /**
27
+ * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
28
+ *
29
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
30
+ */
31
+ readonly cancelable: boolean;
32
+ /**
33
+ * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.
34
+ *
35
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
36
+ */
37
+ readonly composed: boolean;
38
+ /**
39
+ * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
40
+ *
41
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
42
+ */
43
+ readonly currentTarget: EventTarget | null;
44
+ /**
45
+ * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
46
+ *
47
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
48
+ */
49
+ readonly defaultPrevented: boolean;
50
+ /**
51
+ * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
52
+ *
53
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
54
+ */
55
+ readonly eventPhase: number;
56
+ /**
57
+ * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and false when the event was dispatched via EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents.
58
+ *
59
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
60
+ */
61
+ readonly isTrusted: boolean;
62
+ /**
63
+ * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
64
+ * @deprecated
65
+ *
66
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
67
+ */
68
+ returnValue: boolean;
69
+ /**
70
+ * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
71
+ * @deprecated
72
+ *
73
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
74
+ */
75
+ readonly srcElement: EventTarget | null;
76
+ /**
77
+ * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.
78
+ *
79
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
80
+ */
81
+ readonly target: EventTarget | null;
82
+ /**
83
+ * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
84
+ *
85
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
86
+ */
87
+ readonly timeStamp: DOMHighResTimeStamp;
88
+ /**
89
+ * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.
90
+ *
91
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
92
+ */
93
+ readonly type: string;
94
+ /**
95
+ * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed.
96
+ *
97
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
98
+ */
99
+ composedPath(): EventTarget[];
100
+ /**
101
+ * The **`Event.initEvent()`** method is used to initialize the value of an event created using Document.createEvent().
102
+ * @deprecated
103
+ *
104
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/initEvent)
105
+ */
106
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
107
+ /**
108
+ * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.
109
+ *
110
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
111
+ */
112
+ preventDefault(): void;
113
+ /**
114
+ * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
115
+ *
116
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
117
+ */
118
+ stopImmediatePropagation(): void;
119
+ /**
120
+ * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation().
121
+ *
122
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
123
+ */
124
+ stopPropagation(): void;
125
+ readonly NONE: 0;
126
+ readonly CAPTURING_PHASE: 1;
127
+ readonly AT_TARGET: 2;
128
+ readonly BUBBLING_PHASE: 3;
129
+ }
130
+
131
+ export type Event = GlobalPrototypeOr<"Event", _Event>;
132
+
133
+ export interface EventInit {
134
+ bubbles?: boolean;
135
+ cancelable?: boolean;
136
+ composed?: boolean;
137
+ }
138
+
139
+ interface _EventConstructor {
140
+ prototype: Event;
141
+ new (type: string, eventInitDict?: EventInit): Event;
142
+ readonly NONE: 0;
143
+ readonly CAPTURING_PHASE: 1;
144
+ readonly AT_TARGET: 2;
145
+ readonly BUBBLING_PHASE: 3;
146
+ }
147
+
148
+ type EventConstructor = GlobalValueOr<"Event", _EventConstructor>;
149
+
150
+ export const Event = getGlobalValue<EventConstructor>("Event");
151
+
152
+ export interface EventListenerOptions {
153
+ capture?: boolean;
154
+ }
155
+
156
+ export interface AddEventListenerOptions extends EventListenerOptions {
157
+ once?: boolean;
158
+ passive?: boolean;
159
+ signal?: AbortSignal;
160
+ }
161
+
162
+ interface EventListener {
163
+ (evt: Event): void;
164
+ }
165
+
166
+ interface EventListenerObject {
167
+ handleEvent(object: Event): void;
168
+ }
169
+
170
+ export type EventListenerOrEventListenerObject =
171
+ | EventListener
172
+ | EventListenerObject;
173
+
174
+ /**
175
+ * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.
176
+ *
177
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
178
+ */
179
+ interface _EventTarget {
180
+ /**
181
+ * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
182
+ *
183
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
184
+ */
185
+ addEventListener(
186
+ type: string,
187
+ callback: EventListenerOrEventListenerObject | null,
188
+ options?: AddEventListenerOptions | boolean,
189
+ ): void;
190
+ /**
191
+ * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
192
+ *
193
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
194
+ */
195
+ dispatchEvent(event: Event): boolean;
196
+ /**
197
+ * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
198
+ *
199
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
200
+ */
201
+ removeEventListener(
202
+ type: string,
203
+ callback: EventListenerOrEventListenerObject | null,
204
+ options?: EventListenerOptions | boolean,
205
+ ): void;
206
+ }
207
+
208
+ export type EventTarget = GlobalPrototypeOr<"EventTarget", _EventTarget>;
209
+
210
+ interface _EventTargetConstructor {
211
+ prototype: EventTarget;
212
+ new (): EventTarget;
213
+ }
214
+
215
+ type EventTargetConstructor = GlobalValueOr<
216
+ "EventTarget",
217
+ _EventTargetConstructor
218
+ >;
219
+
220
+ export const EventTarget =
221
+ getGlobalValue<EventTargetConstructor>("EventTarget");
@@ -0,0 +1,6 @@
1
+ export * from "./abort-signal.js";
2
+ export * from "./compression.js";
3
+ export * from "./encoding.js";
4
+ export * from "./event.js";
5
+ export * from "./streams.js";
6
+ export * from "./timer.js";