Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
decorator-handler.js45 linesDownload Raw Back to handler
1'use strict'
2
3module.exports = class DecoratorHandler {
4  #handler
5
6  constructor (handler) {
7    if (typeof handler !== 'object' || handler === null) {
8      throw new TypeError('handler must be an object')
9    }
10    this.#handler = handler
11  }
12
13  onConnect (...args) {
14    return this.#handler.onConnect?.(...args)
15  }
16
17  onError (...args) {
18    return this.#handler.onError?.(...args)
19  }
20
21  onUpgrade (...args) {
22    return this.#handler.onUpgrade?.(...args)
23  }
24
25  onResponseStarted (...args) {
26    return this.#handler.onResponseStarted?.(...args)
27  }
28
29  onHeaders (...args) {
30    return this.#handler.onHeaders?.(...args)
31  }
32
33  onData (...args) {
34    return this.#handler.onData?.(...args)
35  }
36
37  onComplete (...args) {
38    return this.#handler.onComplete?.(...args)
39  }
40
41  onBodySent (...args) {
42    return this.#handler.onBodySent?.(...args)
43  }
44}
45 
codekingpro/portable-devtools · Team Ai