MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / api_register

Function api_register

src/shared/socket/SocketAPI.ts:38–53  ·  view source on GitHub ↗
(
  api: SocketAPIData<T, U, EVENT>,
  type: TYPE,
  callback: Callback<EVENT, U[TYPE]>
)

Source from the content-addressed store, hash-verified

36}
37
38export function api_register<
39 T extends T_BASE,
40 U extends U_BASE<T>,
41 EVENT extends EVENT_BASE,
42 TYPE extends T
43>(
44 api: SocketAPIData<T, U, EVENT>,
45 type: TYPE,
46 callback: Callback<EVENT, U[TYPE]>
47): void {
48 if (type in api.registered) {
49 console.warn(`Registering callback over an already used type (type: ${type}). You can ignore this message if it is intentional.`);
50 }
51
52 api.registered[type] = callback;
53}
54
55export function api_unregister<
56 T extends T_BASE,

Callers 2

registerMethod · 0.90
registerMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected