useSystemTime
Hook that returns the time of the system MoBro is running on. The hook can auto refresh in a given interval to simulate something like a clock.
Arguments
The hook can take an object as argument with the following properties.
Field | Type | Description |
---|---|---|
autoRefresh | boolean? | Flag to enable auto refreshing based on the given interval |
refreshInterval | number? | The interval to refresh the system time in ms |
Returns
A Date
object with the time of the system MoBro is running on.
Example
src/widgets/example/Example.tsx
import React from 'react'
import {useSystemTime} from '@modbros/dashboard-sdk'
export default function Example() {
const systemTime = useSystemTime({
autoRefresh: true,
refreshInterval: 1000
})
return null
}