mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-21 05:10:58 +08:00
GlobalEvent type
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { EventEmitter } from "events"
|
||||
|
||||
export type GlobalEvent = {
|
||||
directory?: string
|
||||
project?: string
|
||||
workspace?: string
|
||||
payload: any
|
||||
}
|
||||
|
||||
export const GlobalBus = new EventEmitter<{
|
||||
event: [
|
||||
{
|
||||
directory?: string
|
||||
project?: string
|
||||
workspace?: string
|
||||
payload: any
|
||||
},
|
||||
]
|
||||
event: [GlobalEvent]
|
||||
}>()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GlobalBus } from "@/bus/global"
|
||||
import { GlobalBus, type GlobalEvent } from "@/bus/global"
|
||||
|
||||
export function waitEvent(input: { timeout: number; signal?: AbortSignal; fn: (event: GlobalEvent) => boolean }) {
|
||||
if (input.signal?.aborted) return Promise.reject(input.signal.reason ?? new Error("Request aborted"))
|
||||
|
||||
Reference in New Issue
Block a user