Skip to content

Commit 69af314

Browse files
update constructor in case already emitted SDK_READY event
1 parent 438eaad commit 69af314

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib/js-split-provider.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ export class OpenFeatureSplitProvider implements Provider {
3131
constructor(options: SplitProviderOptions) {
3232
this.client = options.splitClient;
3333
this.initialized = new Promise((resolve) => {
34-
this.client.on(this.client.Event.SDK_READY, () => {
34+
if ((this.client as any).__getStatus().isReady) {
3535
console.log(`${this.metadata.name} provider initialized`);
3636
resolve();
37-
});
37+
} else {
38+
this.client.on(this.client.Event.SDK_READY, () => {
39+
console.log(`${this.metadata.name} provider initialized`);
40+
resolve();
41+
});
42+
}
3843
});
3944
}
4045

0 commit comments

Comments
 (0)