GlobalEvent type
This commit is contained in:
parent
7242893f80
commit
52be213ecb
2 changed files with 9 additions and 9 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
import { EventEmitter } from "events"
|
import { EventEmitter } from "events"
|
||||||
|
|
||||||
|
export type GlobalEvent = {
|
||||||
|
directory?: string
|
||||||
|
project?: string
|
||||||
|
workspace?: string
|
||||||
|
payload: any
|
||||||
|
}
|
||||||
|
|
||||||
export const GlobalBus = new EventEmitter<{
|
export const GlobalBus = new EventEmitter<{
|
||||||
event: [
|
event: [GlobalEvent]
|
||||||
{
|
|
||||||
directory?: string
|
|
||||||
project?: string
|
|
||||||
workspace?: string
|
|
||||||
payload: any
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}>()
|
}>()
|
||||||
|
|
|
||||||
|
|
@ -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 }) {
|
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"))
|
if (input.signal?.aborted) return Promise.reject(input.signal.reason ?? new Error("Request aborted"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue