global.d.ts 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. export {};
  2. declare global {
  3. export interface Platform extends EventTarget {
  4. pulse(userId?: string): Promise<{
  5. id: string;
  6. url: string;
  7. date?: string;
  8. result?: string;
  9. }>;
  10. injection(config?: { callbackFn?: (key: string) => string }): void;
  11. __execution__map__: Map<string, any>;
  12. __execution__<M>(key: keyof PlatformAIO, ...args: any[]): Promise<M>;
  13. }
  14. /**
  15. * webview 设备注入的 全局对象
  16. */
  17. export interface PlatformAIO {
  18. pulse(callback: string, userId?: string): boolean;
  19. }
  20. interface Window {
  21. platform: Platform;
  22. /**
  23. * webview 设备注入的 全局对象
  24. */
  25. platformAIO: PlatformAIO;
  26. }
  27. declare var platform: Platform;
  28. /**
  29. * Promise 扩展
  30. */
  31. interface PromiseConstructor {
  32. withResolvers<T>(): {
  33. promise: Promise<T>;
  34. resolve: (value: T | PromiseLike<T>) => void;
  35. reject: (reason?: any) => void;
  36. };
  37. }
  38. }