| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import type { SimplePulseModel } from './pulse';
- 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<SimplePulseModel & { report: string; time: string; } & {
- appId?: string;
- userId?: 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;
- postMessage(...args: any[]): Promise<void>;
- }
- export interface globalAIO {
- scan(value: string): number;
- print(value: string): void;
- }
|