global.d.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. interface HTMLElement {
  2. webkitRequestFullScreen(options?: FullscreenOptions): Promise<void>
  3. mozRequestFullScreen(options?: FullscreenOptions): Promise<void>
  4. msRequestFullscreen(options?: FullscreenOptions): Promise<void>
  5. }
  6. interface Document {
  7. webkitFullscreenElement: Element | null
  8. mozFullScreenElement: Element | null
  9. msFullscreenElement: Element | null
  10. webkitCurrentFullScreenElement: Element | null
  11. mozCancelFullScreen(): Promise<void>
  12. webkitExitFullscreen(): Promise<void>
  13. msExitFullscreen(): Promise<void>
  14. }
  15. // AWS SDK 类型声明
  16. /*
  17. interface Window {
  18. AWS: {
  19. config: {
  20. update: (credentials: { accessKeyId: string; secretAccessKey: string }) => void
  21. region: string
  22. }
  23. S3: new (config: { params: { Bucket: string } }) => {
  24. getObject: (params: { Bucket: string; Key: string }, callback: (err: any, data: any) => void) => void
  25. }
  26. }
  27. }
  28. */
  29. interface Window {
  30. AWS: {
  31. config: {
  32. update: (credentials: { accessKeyId: string; secretAccessKey: string }) => void;
  33. region: string;
  34. };
  35. S3: new (config: { params: { Bucket: string }, httpOptions: { timeout: number } }) => S3Instance;
  36. };
  37. }
  38. // 定义 S3 实例的方法
  39. interface S3Instance {
  40. getObject(params: { Bucket: string; Key: string }, callback: (err: any, data: any) => void): void;
  41. upload(params: S3UploadParams, options?: S3UploadOptions): S3ManagedUpload;
  42. }
  43. // upload 方法的参数
  44. interface S3UploadParams {
  45. Key: string;
  46. ContentType: string;
  47. Body: File | Blob;
  48. ACL?: string;
  49. // 其他可选参数...
  50. }
  51. // upload 方法的选项
  52. interface S3UploadOptions {
  53. partSize?: number;
  54. queueSize?: number;
  55. leavePartsOnError?: boolean;
  56. }
  57. // upload 返回的管理对象
  58. interface S3ManagedUpload {
  59. promise(): Promise<S3UploadResult>;
  60. on(event: string, listener: (...args: any[]) => void): this;
  61. send(callback: (err: any, data: any) => void): void;
  62. }
  63. // upload 成功返回的数据
  64. interface S3UploadResult {
  65. Location: string;
  66. ETag: string;
  67. Bucket: string;
  68. Key: string;
  69. }