chore: separate kill subprocess and dispose functions
This commit is contained in:
parent
fd512f2cee
commit
d0e484a663
@ -13,7 +13,7 @@ const dispose = async () =>
|
|||||||
new Promise(async (resolve) => {
|
new Promise(async (resolve) => {
|
||||||
if (window.electronAPI) {
|
if (window.electronAPI) {
|
||||||
window.electronAPI
|
window.electronAPI
|
||||||
.invokePluginFunc(MODULE_PATH, "killSubprocess")
|
.invokePluginFunc(MODULE_PATH, "dispose")
|
||||||
.then((res) => resolve(res));
|
.then((res) => resolve(res));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -72,6 +72,11 @@ async function initModel(product) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dispose() {
|
function dispose() {
|
||||||
|
killSubprocess();
|
||||||
|
// clean other registered resources here
|
||||||
|
}
|
||||||
|
|
||||||
|
function killSubprocess() {
|
||||||
if (subprocess) {
|
if (subprocess) {
|
||||||
subprocess.kill();
|
subprocess.kill();
|
||||||
subprocess = null;
|
subprocess = null;
|
||||||
@ -83,5 +88,6 @@ function dispose() {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
initModel,
|
initModel,
|
||||||
|
killSubprocess,
|
||||||
dispose,
|
dispose,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user