You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,6 +158,46 @@ client
158
158
});
159
159
```
160
160
161
+
## Listening on events
162
+
163
+
You can listen on these events:
164
+
165
+
-`Event.READY` - SDK successfully initialized
166
+
-`Event.FAILED` - SDK throws an error
167
+
-`Event.CHANGED` - any new version of flag or segment triggers this event, if segment is changed then it will find all flags with segment match operator
168
+
169
+
Methods:
170
+
171
+
```typescript
172
+
on(Event.READY, () => {
173
+
console.log('READY');
174
+
});
175
+
176
+
on(Event.FAILED, () => {
177
+
console.log('FAILED');
178
+
});
179
+
180
+
on(Event.CHANGED, (identifier) => {
181
+
console.log('Changed', identifier);
182
+
});
183
+
```
184
+
185
+
and if you want to remove the `functionReference` listener for `Event.READY`:
186
+
187
+
```
188
+
off(Event.READY, functionReference);
189
+
```
190
+
191
+
or if you want to remove all listeners on `Event.READY`:
192
+
193
+
```
194
+
off(Event.READY);
195
+
```
196
+
197
+
or if you call `off()` without params it will close the client.
0 commit comments