-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpolyfill.ts
35 lines (31 loc) · 905 Bytes
/
polyfill.ts
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
34
35
import { HTMLRewriter as HTMLRewriterImpl } from './index.ts'
import type * as types from './index.ts'
declare global {
class HTMLRewriter extends types.HTMLRewriter {}
interface Window {
HTMLRewriter: HTMLRewriter;
}
interface WorkerGlobalScope {
HTMLRewriter: HTMLRewriter;
}
type ContentTypeOptions = types.ContentTypeOptions;
type Element = types.Element;
type EndTag = types.EndTag;
type Comment = types.Comment;
type TextChunk = types.TextChunk;
type Doctype = types.Doctype;
type DocumentEnd = types.DocumentEnd;
type ElementHandlers = types.ElementHandlers;
type DocumentHandlers = types.DocumentHandlers;
}
if (!('HTMLRewriter' in self)) {
Object.defineProperty(self, 'HTMLRewriter', {
value: HTMLRewriterImpl,
writable: false,
enumerable: false,
configurable: false,
})
}
// Trigger WASM initialization
new HTMLRewriterImpl()
export {}