agent-backend/contracts/EventTimer/EventTimer.yjs
2021-09-26 12:49:24 +08:00

21 lines
419 B
Plaintext

contract EventTimer{
function onCreate() {
Global.timers = {};
}
export function init() {
YancloudUtil.subscribe("timer", handler);
return "done";
}
export function get(tag) {
if (tag && Global.timers[tag]) {
return String(Global.timers[tag]);
}
return JSON.stringify(Global.timers);
}
function handler(e) {
Global.timers[e.content] = new Date().getTime();
}
}