MCPcopy
hub / github.com/laurent22/joplin / MultiplexHandler

Class MultiplexHandler

packages/fork-htmlparser2/src/MultiplexHandler.ts:8–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6 * @param func — The function to multiplex all events to.
7 */
8export default class MultiplexHandler implements Handler {
9 _func: (event: keyof Handler, ...args: unknown[]) => void;
10
11 constructor(func: (event: keyof Handler, ...args: unknown[]) => void) {
12 this._func = func;
13 }
14
15 /* Format: eventname: number of arguments */
16 onattribute(name: string, value: string) {
17 this._func("onattribute", name, value);
18 }
19 oncdatastart() {
20 this._func("oncdatastart");
21 }
22 oncdataend() {
23 this._func("oncdataend");
24 }
25 ontext(text: string) {
26 this._func("ontext", text);
27 }
28 onprocessinginstruction(name: string, value: string) {
29 this._func("onprocessinginstruction", name, value);
30 }
31 oncomment(comment: string) {
32 this._func("oncomment", comment);
33 }
34 oncommentend() {
35 this._func("oncommentend");
36 }
37 onclosetag(name: string) {
38 this._func("onclosetag", name);
39 }
40 onopentag(name: string, attribs: { [key: string]: string }) {
41 this._func("onopentag", name, attribs);
42 }
43 onopentagname(name: string) {
44 this._func("onopentagname", name);
45 }
46 onerror(error: Error) {
47 this._func("onerror", error);
48 }
49 onend() {
50 this._func("onend");
51 }
52 onparserinit(parser: {}) {
53 this._func("onparserinit", parser);
54 }
55 onreset() {
56 this._func("onreset");
57 }
58}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected