tggl-client
v3.2.1
Published
Tggl Typescript SDK for client and server
Maintainers
Readme
Usage
Install the dependency:
npm i tggl-clientClient applications (browsers, React Native, etc.) should use the TgglClient with a client API key:
import { TgglClient } from 'tggl-client'
const client = new TgglClient({
apiKey: 'XXX',
initialContext: { userId: 'abc123' },
})
await client.waitReady()
if (client.get('my-feature', true)) {
// ...
}Backend applications (NodeJs) should use the TgglLocalClient with a server API key:
import { TgglLocalClient } from 'tggl-client'
const client = new TgglLocalClient({
apiKey: 'XXX',
})
await client.waitReady()
if (client.get({ userId: 'abc123' }, 'my-feature', true)) {
// ...
}