Commit ee8241e2 authored by 余强's avatar 余强
Browse files

fix: loadFile接口定义返回Uint8Array

Showing with 10 additions and 5 deletions
+10 -5
......@@ -157,7 +157,7 @@ export const loadAudioBuffer: TloadAudioBuffer = (filePath: string, args: any[])
}
// TODO - 集中小段时间内可进行主目录下载的Res资源文件,进行批下载
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<ArrayBuffer | Uint8Array> => {
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<Uint8Array> => {
return new Promise((resolve, reject) => {
let info = Depend.getFile(filePath);
......
......@@ -17,7 +17,7 @@ export type TloadAudio = (filePath: string, args: any[]) => Promise<IPiAudio>;
export type TloadAudioBuffer = (filePath: string, args: any[]) => Promise<PiAudioBuffer>;
export type TloadFile = (filePath: string, args: any[]) => Promise<ArrayBuffer | Uint8Array>;
export type TloadFile = (filePath: string, args: any[]) => Promise<Uint8Array>;
//#endregion
......
......@@ -31,6 +31,6 @@ export const loadAudioBuffer: TloadAudioBuffer = (filePath: string, args: any[])
return Promise.resolve(null);
}
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<ArrayBuffer | Uint8Array> => {
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<Uint8Array> => {
return Promise.resolve(null);
}
......@@ -201,13 +201,18 @@ export const loadAudioBuffer: TloadAudioBuffer = (filePath: string, args: any[])
})
}
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<ArrayBuffer | Uint8Array> => {
export const loadFile: TloadFile = (filePath: string, args: any[]): Promise<Uint8Array> => {
return new Promise((resolve, reject) => {
let info = Depend.getFile(filePath);
if (info) {
loadRes(info)
.then(resolve)
.then(r => {
if (!ArrayBuffer.isView(r)) {
r = new Uint8Array(r);
}
resolve(r as Uint8Array);
})
.catch(reject);
} else {
reject(`loadFile - Not Found File Depend Info ${filePath}`);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment