示例工程 31-notifications-taskbar

31-notifications-taskbar/app/src/api.d.ts

typescript · 0.9 KB

import type {
  NotifyPayload,
  NotifySnapshot,
  ProgressMode,
  Redacted,
} from "../shared/ipc";

declare global {
  interface Window {
    api: {
      notify: {
        get: () => Promise<NotifySnapshot>;
        preview: (title: string, body: string) => Promise<Redacted>;
        send: (payload: NotifyPayload) => Promise<NotifySnapshot>;
        simulateClick: () => Promise<NotifySnapshot>;
        setBadge: (text: string) => Promise<NotifySnapshot>;
        setProgress: (
          value: number,
          mode: ProgressMode,
        ) => Promise<NotifySnapshot>;
        bounce: () => Promise<NotifySnapshot>;
        clear: () => Promise<NotifySnapshot>;
        onChange: (callback: (state: NotifySnapshot) => void) => () => void;
      };
    };
    __prepareShots?: (stage: "compose" | "sent" | "dock") => Promise<void>;
    __smoke?: () => Promise<unknown>;
  }
}

export {};