完善翻译,添加翻译缺失检查工具

This commit is contained in:
undefined committed 2020-07-13 17:09:17 +08:00
1 parent 82c193b5ee
commit 13e3e0ec98
19 files changed
+242 -90

No files matched your search

+17
View File
@@ -1,8 +1,10 @@
import fs from 'fs';
import { serialize } from 'v8';
import cluster from 'cluster';
import path from 'path';
import * as superagent from 'superagent';
import proxy from 'superagent-proxy';
import Lru from 'lru-cache';
declare global {
interface StringConstructor {
@@ -24,6 +26,21 @@ declare global {
}
}
const lru = new Lru(1000);
export function lrucache(target: any, funcName: string, obj: any) {
const originalMethod = obj.value;
obj.value = function func(...args: any[]) {
const key = serialize({ funcName, args });
let val = lru.get(key);
if (val) return val;
val = originalMethod.call(this, ...args);
lru.set(key, val);
return val;
};
return obj;
}
proxy(superagent);
if (!cluster.worker) {