MCPcopy Create free account
hub / github.com/msgbyte/tailchat / request

Method request

client/shared/api/socket.ts:50–69  ·  view source on GitHub ↗
(
    eventName: string,
    eventData: unknown = {}
  )

Source from the content-addressed store, hash-verified

48 }
49
50 async request<T = unknown>(
51 eventName: string,
52 eventData: unknown = {}
53 ): Promise<T> {
54 return new Promise((resolve, reject) => {
55 this.socket.emit(eventName, eventData, (resp: SocketEventRespones<T>) => {
56 if (resp.result === true) {
57 resolve(resp.data);
58 } else if (resp.result === false) {
59 reject(
60 new SocketEventError(
61 `[${eventName}]: ${resp.message}: \ndata: ${JSON.stringify(
62 eventData
63 )}`
64 )
65 );
66 }
67 });
68 });
69 }
70
71 /**
72 * 监听远程通知

Callers 3

initialFunction · 0.80
listenNotifyFunction · 0.80
emitGlobalSocketEventFunction · 0.80

Calls 2

rejectFunction · 0.85
emitMethod · 0.65

Tested by

no test coverage detected