feat: main Attempted rolling own state
This commit is contained in:
parent
9793237357
commit
16b9c41bbe
@ -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])
|
||||
|
15
remix/app/components/Thingtime/useThingtime.tsx
Normal file
15
remix/app/components/Thingtime/useThingtime.tsx
Normal file
@ -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: {} }
|
||||
}
|
@ -54,6 +54,8 @@ const setThingtime = glob => {
|
||||
try {
|
||||
glob.thingtime = {
|
||||
tmp: {},
|
||||
subscribers: {},
|
||||
state: {},
|
||||
things: {
|
||||
db: {},
|
||||
limit: 9999,
|
||||
|
Loading…
Reference in New Issue
Block a user