forked from gzt/A8000
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
564 B
26 lines
564 B
// src/eventBus.ts
|
|
import mitt from 'mitt'
|
|
import { MsgLevel } from './websocket/socket'
|
|
|
|
export type ErrorDetail = {
|
|
name: string
|
|
description: string
|
|
}
|
|
|
|
export type ErrorModalData = {
|
|
messageLevel: MsgLevel
|
|
title: string
|
|
info: string
|
|
detailInfo?: string
|
|
stackInfo?: null
|
|
}
|
|
|
|
export type ConsumeType = 'Plate' | 'LittleBuf' | 'BigBuf' | 'Tip'
|
|
type Events = {
|
|
initDevice: void,
|
|
socketClosed: number,
|
|
'show-error-modal': ErrorModalData
|
|
'show-stack-modal': ErrorModalData['stackInfo'] | null | undefined
|
|
}
|
|
|
|
export const eventBus = mitt<Events>()
|