diff --git a/remix/app/components/Thingtime/Thingtime.tsx b/remix/app/components/Thingtime/Thingtime.tsx index 1076aa3..f16b705 100644 --- a/remix/app/components/Thingtime/Thingtime.tsx +++ b/remix/app/components/Thingtime/Thingtime.tsx @@ -1,6 +1,7 @@ import React from 'react' import { Box, Flex } from '@chakra-ui/react' import { Safe } from '../Safety/Safe' +import { useThingtime } from './useThingtime' export const Thingtime = props => { // const uuid = React.useMemo(() => { @@ -8,6 +9,12 @@ export const Thingtime = props => { // }, []) const uuid = React.useRef(Math.random().toString(36).substring(7)) + const { state } = useThingtime() + + React.useEffect(() => { + console.log('nik state changed', state) + }, [state]) + const depth = React.useMemo(() => { return props?.depth || 1 }, [props?.depth]) diff --git a/remix/app/components/Thingtime/useThingtime.tsx b/remix/app/components/Thingtime/useThingtime.tsx new file mode 100644 index 0000000..63416ce --- /dev/null +++ b/remix/app/components/Thingtime/useThingtime.tsx @@ -0,0 +1,15 @@ +import React from 'react' + +const getGlobal = () => { + try { + return window + } catch { + return globalThis + } +} + +export const useThingtime = (props?: any) => { + const glob = getGlobal() + + return { state: {} } +} diff --git a/remix/app/root.tsx b/remix/app/root.tsx index 3c998fb..530f0e5 100644 --- a/remix/app/root.tsx +++ b/remix/app/root.tsx @@ -54,6 +54,8 @@ const setThingtime = glob => { try { glob.thingtime = { tmp: {}, + subscribers: {}, + state: {}, things: { db: {}, limit: 9999,