mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
PsfPlayer: revokeObjectURL.
This commit is contained in:
parent
e3a48b8b7f
commit
5ec3ee4632
2 changed files with 5 additions and 4 deletions
|
@ -51,8 +51,9 @@ export const init = createAsyncThunk<void>('init',
|
|||
}
|
||||
);
|
||||
|
||||
export const loadArchive = createAsyncThunk<string[] | undefined, string>('loadArchive',
|
||||
async (url : string, thunkAPI) => {
|
||||
export const loadArchive = createAsyncThunk<string[] | undefined, File>('loadArchive',
|
||||
async (file : File, thunkAPI) => {
|
||||
let url = URL.createObjectURL(file);
|
||||
console.log(`loading ${url}...`);
|
||||
await stopPsf();
|
||||
let blob = await fetch(url).then(response => {
|
||||
|
@ -70,6 +71,7 @@ export const loadArchive = createAsyncThunk<string[] | undefined, string>('loadA
|
|||
let stream = PsfPlayerModule.FS.open(archiveFilePath, "w+");
|
||||
PsfPlayerModule.FS.write(stream, data, 0, data.length, 0);
|
||||
PsfPlayerModule.FS.close(stream);
|
||||
URL.revokeObjectURL(url);
|
||||
let fileList = getPsfArchiveFileList(archiveFilePath);
|
||||
fileList = fileList.filter(path =>
|
||||
path.endsWith(".psf") ||
|
||||
|
|
|
@ -82,8 +82,7 @@ export default function App() {
|
|||
|
||||
const handleChange = function(event : ChangeEvent<HTMLInputElement>) {
|
||||
if(event.target && event.target.files && event.target.files.length !== 0) {
|
||||
var url = URL.createObjectURL(event.target.files[0]);
|
||||
dispatch(loadArchive(url));
|
||||
dispatch(loadArchive(event.target.files[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue