feat(exit): #136 provide a method to exit program
This commit is contained in:
parent
5ae187f090
commit
3e569ac609
@ -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
1
src/index.d.ts
vendored
@ -77,6 +77,7 @@ export interface FFmpeg {
|
||||
setProgress(progress: ProgressCallback): void;
|
||||
setLogger(log: LogCallback): void;
|
||||
setLogging(logging: boolean): void;
|
||||
exit(): void;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user