@@ -118,6 +118,8 @@ export class ContentScriptContext implements AbortController {
118
118
119
119
/**
120
120
* Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
121
+ *
122
+ * Intervals can be cleared by calling the normal `clearInterval` function.
121
123
*/
122
124
setInterval ( handler : ( ) => void , timeout ?: number ) : number {
123
125
const id = setInterval ( ( ) => {
@@ -129,6 +131,8 @@ export class ContentScriptContext implements AbortController {
129
131
130
132
/**
131
133
* Wrapper around `window.setTimeout` that automatically clears the interval when invalidated.
134
+ *
135
+ * Timeouts can be cleared by calling the normal `setTimeout` function.
132
136
*/
133
137
setTimeout ( handler : ( ) => void , timeout ?: number ) : number {
134
138
const id = setTimeout ( ( ) => {
@@ -141,6 +145,8 @@ export class ContentScriptContext implements AbortController {
141
145
/**
142
146
* Wrapper around `window.requestAnimationFrame` that automatically cancels the request when
143
147
* invalidated.
148
+ *
149
+ * Callbacks can be canceled by calling the normal `cancelAnimationFrame` function.
144
150
*/
145
151
requestAnimationFrame ( callback : FrameRequestCallback ) : number {
146
152
const id = requestAnimationFrame ( ( ...args ) => {
@@ -154,6 +160,8 @@ export class ContentScriptContext implements AbortController {
154
160
/**
155
161
* Wrapper around `window.requestIdleCallback` that automatically cancels the request when
156
162
* invalidated.
163
+ *
164
+ * Callbacks can be canceled by calling the normal `cancelIdleCallback` function.
157
165
*/
158
166
requestIdleCallback (
159
167
callback : IdleRequestCallback ,
@@ -170,6 +178,8 @@ export class ContentScriptContext implements AbortController {
170
178
/**
171
179
* Call `target.addEventListener` and remove the event listener when the context is invalidated.
172
180
*
181
+ * Listeners can be canceled by calling the normal `removeEventListener` function.
182
+ *
173
183
* Includes additional events useful for content scripts:
174
184
*
175
185
* - `"wxt:locationchange"` - Triggered when HTML5 history mode is used to change URL. Content
0 commit comments