Tggl Typescript SDK
The Typescript SDK can be used both on the client and server to evaluate flags and report usage to the Tggl API or a proxy.
Website • Documentation • NPM • Videos
Usage
Install the dependency:
npm i tggl-client
Client 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)) {
// ...
}