interface HTMLElement {
webkitRequestFullScreen(options?: FullscreenOptions): Promise
mozRequestFullScreen(options?: FullscreenOptions): Promise
msRequestFullscreen(options?: FullscreenOptions): Promise
}
interface Document {
webkitFullscreenElement: Element | null
mozFullScreenElement: Element | null
msFullscreenElement: Element | null
webkitCurrentFullScreenElement: Element | null
mozCancelFullScreen(): Promise
webkitExitFullscreen(): Promise
msExitFullscreen(): Promise
}
// AWS SDK 类型声明
/*
interface Window {
AWS: {
config: {
update: (credentials: { accessKeyId: string; secretAccessKey: string }) => void
region: string
}
S3: new (config: { params: { Bucket: string } }) => {
getObject: (params: { Bucket: string; Key: string }, callback: (err: any, data: any) => void) => void
}
}
}
*/
interface Window {
AWS: {
config: {
update: (credentials: { accessKeyId: string; secretAccessKey: string }) => void;
region: string;
};
S3: new (config: { params: { Bucket: string }, httpOptions: { timeout: number } }) => S3Instance;
};
}
// 定义 S3 实例的方法
interface S3Instance {
getObject(params: { Bucket: string; Key: string }, callback: (err: any, data: any) => void): void;
upload(params: S3UploadParams, options?: S3UploadOptions): S3ManagedUpload;
}
// upload 方法的参数
interface S3UploadParams {
Key: string;
ContentType: string;
Body: File | Blob;
ACL?: string;
// 其他可选参数...
}
// upload 方法的选项
interface S3UploadOptions {
partSize?: number;
queueSize?: number;
leavePartsOnError?: boolean;
}
// upload 返回的管理对象
interface S3ManagedUpload {
promise(): Promise;
on(event: string, listener: (...args: any[]) => void): this;
send(callback: (err: any, data: any) => void): void;
}
// upload 成功返回的数据
interface S3UploadResult {
Location: string;
ETag: string;
Bucket: string;
Key: string;
}