Refactor Polling Mechanism: Implement Class-Based Poller with Start/Stop Control (#528)
* custom module updates to class based. * Finish poller logic. * Use composition for pollers * Rename poller * Handle recorder polling. * Fix quotes in bash command * Remove logs
This commit is contained in:
@@ -8,9 +8,11 @@ import Button from 'types/widgets/button';
|
||||
// Utility Methods
|
||||
import { inputHandler } from 'customModules/utils';
|
||||
import { getCPUTemperature } from './helpers';
|
||||
import { pollVariable } from 'customModules/PollVar';
|
||||
import { BarBoxChild } from 'lib/types/bar';
|
||||
import { Attribute, Child } from 'lib/types/widget';
|
||||
import { FunctionPoller } from 'lib/poller/FunctionPoller';
|
||||
import { Variable as VariableType } from 'types/variable';
|
||||
import { UnitType } from 'lib/types/weather';
|
||||
|
||||
// All the user configurable options for the cpu module that are needed
|
||||
const {
|
||||
@@ -30,7 +32,7 @@ const {
|
||||
|
||||
export const cpuTemp = Variable(0);
|
||||
|
||||
pollVariable(
|
||||
const cpuTempPoller = new FunctionPoller<number, [VariableType<boolean>, VariableType<UnitType>]>(
|
||||
// Variable to poll and update with the result of the function passed in
|
||||
cpuTemp,
|
||||
// Variables that should trigger the polling function to update when they change
|
||||
@@ -43,6 +45,8 @@ pollVariable(
|
||||
unit,
|
||||
);
|
||||
|
||||
cpuTempPoller.initialize('cputemp');
|
||||
|
||||
export const CpuTemp = (): BarBoxChild => {
|
||||
const cpuTempModule = module({
|
||||
textIcon: icon.bind('value'),
|
||||
|
||||
Reference in New Issue
Block a user