mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: add type annotations (#300)
Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
1 parent
04685ef864
commit
b0f1c0d52c
19 files changed
+418
-71
No files matched your search
@@ -23,19 +23,19 @@ import { Queue, sleep } from './utils';
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
onDestory: Function[]
|
||||
onDestroy: Function[]
|
||||
hosts: any
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!global.onDestory) global.onDestory = [];
|
||||
if (!global.onDestroy) global.onDestroy = [];
|
||||
if (!global.hosts) global.hosts = [];
|
||||
let exit = false;
|
||||
|
||||
const terminate = async () => {
|
||||
log.info('正在保存数据');
|
||||
try {
|
||||
await Promise.all(global.onDestory.map((f) => f()));
|
||||
await Promise.all(global.onDestroy.map((f: Function) => f()));
|
||||
process.exit(1);
|
||||
} catch (e) {
|
||||
if (exit) process.exit(1);
|
||||
|
||||
Reference in new issue
Block a user