ag-utilities
Advanced tools
Comparing version 1.1.184 to 1.1.185
export declare const AgCache: { | ||
append: <T>(id: string, obj: T) => void; | ||
append: <T>(id: string, obj: T) => { | ||
value: T; | ||
time: Date; | ||
}[]; | ||
peek: <T_1 = any>(id: string) => { | ||
@@ -7,8 +10,8 @@ value: T_1; | ||
}[]; | ||
get: <T_2>(id: string, obj: T_2) => { | ||
value: T_2; | ||
time: Date; | ||
}[]; | ||
stop: () => void; | ||
create(span: number): { | ||
append: <T>(id: string, obj: T) => void; | ||
append: <T>(id: string, obj: T) => { | ||
value: T; | ||
time: Date; | ||
}[]; | ||
peek: <T_1 = any>(id: string) => { | ||
@@ -18,7 +21,4 @@ value: T_1; | ||
}[]; | ||
get: <T_2>(id: string, obj: T_2) => { | ||
value: T_2; | ||
time: Date; | ||
}[]; | ||
stop: () => void; | ||
}; | ||
}; |
@@ -15,5 +15,6 @@ "use strict"; | ||
exports.AgCache = void 0; | ||
var AgVueWrap_1 = require("./AgVueWrap"); | ||
function create(span) { | ||
var datas = {}; | ||
setInterval(function () { | ||
var datas = (0, AgVueWrap_1.reactive)({}); | ||
var cleaner = setInterval(function () { | ||
var min = new Date().getTime() - span; | ||
@@ -24,3 +25,2 @@ for (var key in datas) { | ||
} | ||
// if (datas[key].length === 0) delete datas[key] | ||
} | ||
@@ -35,2 +35,3 @@ }, 1000); | ||
} | ||
return peek(id); | ||
} | ||
@@ -41,7 +42,6 @@ function peek(id) { | ||
} | ||
function get(id, obj) { | ||
append(id, obj); | ||
return peek(id); | ||
function stop() { | ||
clearInterval(cleaner); | ||
} | ||
return { append: append, peek: peek, get: get }; | ||
return { append: append, peek: peek, stop: stop }; | ||
} | ||
@@ -48,0 +48,0 @@ var instance = create(1000 * 60); |
{ | ||
"name": "ag-utilities", | ||
"version": "1.1.184", | ||
"version": "1.1.185", | ||
"author": "fangxq", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141704