Conversation
57ddf2a to
1433ffe
Compare
src/types.ts
Outdated
| export interface ProviderEventing { | ||
| events?: EventEmitter; | ||
| ready?: boolean; | ||
| } |
There was a problem hiding this comment.
I'll take the time to document all these types if this looks good to everyone.
955aaa9 to
e490a9f
Compare
Codecov Report
@@ Coverage Diff @@
## main #316 +/- ##
==========================================
- Coverage 99.67% 99.08% -0.60%
==========================================
Files 15 15
Lines 1236 1307 +71
Branches 97 104 +7
==========================================
+ Hits 1232 1295 +63
- Misses 4 12 +8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
13b7ee7 to
55bf085
Compare
| export interface EventProvider { | ||
| readonly events: EventEmitter; | ||
| readonly ready: boolean; | ||
| } |
There was a problem hiding this comment.
Providers can optionally implement this (backwards compatible) to support events.
All they must do is mark themselves as ready with the boolean, and call events.emit(xxx) to support events.
a14c823 to
61f34e1
Compare
61f34e1 to
7735bda
Compare
Signed-off-by: Todd Baert <[email protected]>
7735bda to
86e7e17
Compare
|
/publish |
|
Using EventEmitter can be somewhat annoying if you are working on non-node platforms. I am not sure if EventTarget is any better in that regard. You can of course, but the more polyfills people need the more annoying things are. Sometimes it is better to just mirror some of that API. |
Yes, for web, we will probably have a completely separate SDK. To minimize dependencies, in my web SDK PoC, I've used |
|
This is implemented in the experimental web-sdk. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
A PoC for eventing, meant to be used with the experimental flagd-web provider.
Specifically:
addHandler()method to the client which can be passed an event type (PROVIDER_READY,PROVIDER_ERROR,PROVIDER_CONFIGURATION_CHANGED,PROVIDER_SHUTDOWNand a function to run when that event is fired)CACHEDdefault reasonEventProviderinterface, which providers can OPTIONALLY implement to fire events.