12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- interface HandSummary {
- chi: string;
- cun: string;
- guan: string;
- summary: string[];
- }
- type HandKeys = 'chen' | 'chi' | 'fu' | 'hua' | 'kong' | 'ruan' | 'shi' | 'shu' | 'xi' | 'xian';
- interface ScanData {
- code: string;
- state: number;
- type: number;
- }
- export interface BridgeEventMap {
- scan: CustomEvent<{code: number, data?: ScanData, message?: string}>;
- }
- export class Bridge extends EventTarget {
- public static getInstance(): Bridge;
- public static pulse(userId: string): Promise<{
- measureId: string;
- summaryLabel: {
- summary?: HandSummary['summary'];
- left?: HandSummary;
- right?: HandSummary;
- };
- summaryValue: Record<HandKeys, number[]>;
- time: string;
- appId?: string;
- userId?: string;
- url: string;
- report: string;
- }>;
- public static print(): Promise<void>;
- public static print(params: { url?: string }): Promise<void>;
- /**
- * 监听扫码事件
- * @param type 事件类型 'scan'
- * @param listener 事件回调,参数为 ScanEvent
- * @param options
- */
- addEventListener<T extends keyof BridgeEventMap>(type: T, listener: (event: BridgeEventMap[T]) => void, options?: boolean | AddEventListenerOptions): () => void;
- removeEventListener<T extends keyof BridgeEventMap>(type: T, listener: (event: BridgeEventMap[T]) => void, options?: boolean | AddEventListenerOptions): () => void;
- }
- export interface globalAIO {
- scan(value: string): number;
- print(value: string): void;
- }
|