aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/diagnostics_channel.exports.js
blob: 732e8fb73e22bb429fada43f5b4ee41f2ff85286 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// This is a stub! None of this is actually implemented yet.

function hideFromStack(fns) {
  for (const fn of fns) {
    Object.defineProperty(fn, "name", {
      value: "::bunternal::",
    });
  }
}

class TODO extends Error {
  constructor(messageName) {
    const message = messageName
      ? `node:diagnostics_channel ${messageName} is not implemented yet in Bun.`
      : `node:diagnostics_channel is not implemented yet in Bun.`;
    super(message);
    this.name = "TODO";
  }
}

function notimpl() {
  throw new TODO();
}

class Channel {
  constructor(name) {
    notimpl();
  }
}

function channel() {
  notimpl();
}

function hasSubscribers() {
  notimpl();
}
function subscribe() {
  notimpl();
}

function unsubscribe() {
  notimpl();
}

const defaultObject = {
  channel,
  hasSubscribers,
  subscribe,
  unsubscribe,
  Channel,
  [Symbol.for("CommonJS")]: 0,
};

export { defaultObject as default, Channel, channel, hasSubscribers, subscribe, unsubscribe };

hideFromStack([TODO.prototype.constructor, notimpl, channel, hasSubscribers, subscribe, unsubscribe, Channel]);