Added support to dispatch all UI actions based on mercure bindings on a specific schedule instead of real time

This commit is contained in:
Alejandro Celaya
2020-09-12 08:52:03 +02:00
parent 9b45513684
commit ad437f655e
10 changed files with 31 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ const RealTimeUpdates = (
<Input
type="number"
min={0}
placeholder={realTimeUpdates.enabled ? 'Immediate' : ''}
placeholder="Immediate"
disabled={!realTimeUpdates.enabled}
value={intervalValue(realTimeUpdates.interval)}
onChange={(e) => setRealTimeUpdatesInterval(Number(e.target.value))}

View File

@@ -13,7 +13,10 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
// Services
bottle.serviceFactory('RealTimeUpdates', () => RealTimeUpdates);
bottle.decorator('RealTimeUpdates', connect([ 'settings' ], [ 'setRealTimeUpdatesInterval' ]));
bottle.decorator(
'RealTimeUpdates',
connect([ 'settings' ], [ 'toggleRealTimeUpdates', 'setRealTimeUpdatesInterval' ]),
);
// Actions
bottle.serviceFactory('toggleRealTimeUpdates', () => toggleRealTimeUpdates);