From 67a235ad4214aae1d545c3c1aa343b3fd319453f Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 26 Feb 2022 19:19:36 +0000 Subject: [PATCH] InfoBroker: Add cpu_live --- src/lib/core/InfoBroker.mjs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/core/InfoBroker.mjs b/src/lib/core/InfoBroker.mjs index 49ac2f8..1f73519 100644 --- a/src/lib/core/InfoBroker.mjs +++ b/src/lib/core/InfoBroker.mjs @@ -13,11 +13,16 @@ const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/")); class InfoBroker { constructor() { - this.sym_meta = Symbol("____meta_info____") this.allowed_tables = { // name → sysinfo name cpu: "cpu", - meta: this.sym_meta + cpu_live: async () => { + return { + frequency: await sysinfo.cpuCurrentSpeed(), + temperature: await sysinfo.cpuTemperature() + }; + }, + meta: async () => await this.make_table_meta() }; } @@ -45,8 +50,9 @@ class InfoBroker { } let name_translated = this.allowed_tables[name]; - if(name_translated === this.sym_meta) - return await this.make_table_meta(); + + if(typeof name_translated === "function") + return await name_translated(); return await sysinfo[name_translated](); }