2024-07-30 23:33:33 +08:00
|
|
|
import type { SysCallMapping } from "../system.ts";
|
|
|
|
import type { EventHookI } from "../eventhook.ts";
|
2022-03-29 17:21:32 +08:00
|
|
|
|
2024-03-16 22:29:24 +08:00
|
|
|
export function eventSyscalls(eventHook: EventHookI): SysCallMapping {
|
2022-03-29 17:21:32 +08:00
|
|
|
return {
|
2022-10-10 20:50:21 +08:00
|
|
|
"event.dispatch": (_ctx, eventName: string, data: any) => {
|
2022-03-29 17:21:32 +08:00
|
|
|
return eventHook.dispatchEvent(eventName, data);
|
|
|
|
},
|
2022-10-10 20:50:21 +08:00
|
|
|
"event.list": () => {
|
2022-07-04 21:07:27 +08:00
|
|
|
return eventHook.listEvents();
|
|
|
|
},
|
2022-03-29 17:21:32 +08:00
|
|
|
};
|
|
|
|
}
|