20 lines
371 B
TypeScript
20 lines
371 B
TypeScript
|
import React, { useContext } from 'react'
|
||
|
|
||
|
import { ThingtimeContext } from '~/Providers/ThingtimeProvider'
|
||
|
|
||
|
const getGlobal = () => {
|
||
|
try {
|
||
|
return window
|
||
|
} catch {
|
||
|
return globalThis
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const useThingtime = (props?: any) => {
|
||
|
const value = useContext(ThingtimeContext)
|
||
|
|
||
|
const { thingtime, setThingtime, getThingtime } = value
|
||
|
|
||
|
return value
|
||
|
}
|