feat(exit): #136 provide a method to exit program

This commit is contained in:
Sociosarbis 2021-05-15 22:20:49 +08:00
parent 5ae187f090
commit 3e569ac609
2 changed files with 17 additions and 1 deletions

View File

@ -95,7 +95,6 @@ module.exports = (_options = {}) => {
}
};
/*
* Determine whether the Core is loaded.
*/
@ -171,6 +170,21 @@ module.exports = (_options = {}) => {
}
};
/**
* forcibly terminate the ffmpeg program.
*/
const exit = () => {
if (Core === null) {
throw NO_LOAD;
} else {
running = false;
Core.exit(1);
Core = null;
ffmpeg = null;
runResolve = null;
}
};
const setProgress = (_progress) => {
progress = _progress;
};
@ -191,6 +205,7 @@ module.exports = (_options = {}) => {
load,
isLoaded,
run,
exit,
FS,
};
};

1
src/index.d.ts vendored
View File

@ -77,6 +77,7 @@ export interface FFmpeg {
setProgress(progress: ProgressCallback): void;
setLogger(log: LogCallback): void;
setLogging(logging: boolean): void;
exit(): void;
}
/*