aloof-computer-50221
02/22/2024, 8:46 PMhappy-autumn-40938
02/22/2024, 8:48 PMaloof-computer-50221
02/22/2024, 8:50 PMimport { Injectable } from '@nestjs/common';
import { GrowthBook, Context } from '@growthbook/growthbook';
import { DoraServiceFeatures } from './features';
const GROWTHBOOK_CLIENTKEY = process.env.GROWTHBOOK_CLIENTKEY;
@Injectable()
export class GrowthBookService {
private growthBook: GrowthBook;
constructor() {
const { setPolyfills } = require("@growthbook/growthbook");
setPolyfills({
// Required when using built-in feature loading and Node 17 or lower
fetch: require("cross-fetch"),
EventSource: require("eventsource"),
});
this.growthBook = new GrowthBook<DoraServiceFeatures>({
apiHost: "<https://cdn.growthbook.io>",
clientKey: GROWTHBOOK_CLIENTKEY,
enableDevMode: true,
subscribeToChanges: true
});
(async () => {
await this.growthBook.loadFeatures({
autoRefresh: true,
timeout: 2000
});
})();
}
aloof-computer-50221
02/22/2024, 8:51 PMhappy-autumn-40938
02/22/2024, 9:02 PMhappy-autumn-40938
02/22/2024, 9:03 PMaloof-computer-50221
02/22/2024, 9:08 PMhappy-autumn-40938
02/22/2024, 10:27 PMhappy-autumn-40938
02/22/2024, 10:27 PM/sub
endpoint.aloof-computer-50221
02/22/2024, 10:56 PMhappy-autumn-40938
02/22/2024, 11:22 PMfresh-football-47124
aloof-computer-50221
02/23/2024, 12:29 PMaloof-computer-50221
02/25/2024, 12:28 PMaloof-computer-50221
02/25/2024, 12:33 PMhappy-autumn-40938
02/26/2024, 11:13 PM