Enable gating and experimentation on native, send init event (#3149)
* Add the mobile fork * Add init event
This commit is contained in:
parent
31826633cb
commit
dd86d0964d
3 changed files with 74 additions and 6 deletions
|
|
@ -1,5 +1,9 @@
|
|||
import React from 'react'
|
||||
import {StatsigProvider, useGate as useStatsigGate} from 'statsig-react'
|
||||
import {
|
||||
Statsig,
|
||||
StatsigProvider,
|
||||
useGate as useStatsigGate,
|
||||
} from 'statsig-react'
|
||||
import {useSession} from '../../state/session'
|
||||
import {sha256} from 'js-sha256'
|
||||
|
||||
|
|
@ -13,6 +17,14 @@ const statsigOptions = {
|
|||
initTimeoutMs: 1,
|
||||
}
|
||||
|
||||
export function logEvent(
|
||||
eventName: string,
|
||||
value?: string | number | null,
|
||||
metadata?: Record<string, string> | null,
|
||||
) {
|
||||
Statsig.logEvent(eventName, value, metadata)
|
||||
}
|
||||
|
||||
export function useGate(gateName: string) {
|
||||
const {isLoading, value} = useStatsigGate(gateName)
|
||||
if (isLoading) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue