Skip to content

Commit

Permalink
Merge pull request #4 from desko27/feature/support-react-native
Browse files Browse the repository at this point in the history
Support react-native by replacing crypto UUID by id counter
  • Loading branch information
desko27 authored Aug 12, 2024
2 parents 9cef594 + 82fab7f commit af41b51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/createCallable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ export function createCallable<P = void, R = void>(
UserComponent: UserComponentType<P, R>,
): Callable<P, R> {
let $setStack: PrivateStackStateSetter<P, R> | null = null
let $nextKey = 0

const call: CallFunction<P, R> = (props) => {
if ($setStack === null) throw new Error('No <Root> found!')

const key = globalThis.crypto.randomUUID()
const key = String($nextKey++)
const promise = Promise.withResolvers<R>()

const end = (response: R) => {
Expand All @@ -39,6 +40,7 @@ export function createCallable<P = void, R = void>(
$setStack = setStack
return () => {
$setStack = null
$nextKey = 0
}
}, [])

Expand Down

0 comments on commit af41b51

Please sign in to comment.