-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Idea]: Decouple from LaunchDarkly (add more adapters) #40
Comments
Possible examples to configure adapters import launchdarklyAdapter from '@flopflip/launchdarkly-adapter';
<ConfigureFlopFlip adapter={launchdarklyAdapter} adapterArgs={{ clientSideId: '123' }}>
<App />
<ConfigureFlopFlip>
//..
import localstorageAdapter from '@flopflip/localstorage-adapter';
<ConfigureFlopFlip adapter={localstorageAdapter}>
<App />
<ConfigureFlopFlip> or something like import launchdarklyAdapter from '@flopflip/launchdarkly-adapter';
launchdarklyAdapter.configure({ ldClientSideId: '123' })
<ConfigureFlopFlip adapter={launchdarklyAdapter}>
<App />
<ConfigureFlopFlip> All adapters would have to satisfy an API which could be roughly something like
|
The localstorage adapter would
|
Another adapter could be an |
Another dapter could be an apiAdapter.configure({ url: 'http://my-great-service.com/flags', userKey: '123' }) It would then poll for changes taking the url |
Curious to what @dferber90 thinks if he finds time having a look 😅 . |
Adapters sound like a powerful concept. Somehow seems like a perfect use-case for After thinking about it a bit I'd prefer the version with Maybe use a signature for the Adapter like this: export default createAdapter = adapterArgs => (setStatusState, setFlagsState) => {
setStatusState({ ready: true })
setFlagsState({ FOO_FLAG: true })
} Now either we only call the factory when |
This will be part of #49. Thanks for all the feedback! Currently the |
👍❤️ |
The library could potentially allow multiple providers for toggles and was actually built from the ground up to do so. Another
packages/*
to integrate with another provider and the configuration on of a consumer facing package should then pick any of the integrations behind the scenes. The API for an integration has a quite minimal surface area:An integration is in charge of "doing" the targeting etc.
A simple idea is to integrate with an autoupdating/polling/streaming localstorage integration. Any app could, when receiving flags from it's backend, flush these to localstorage where the adapter/integration picks them up and they're automatically flushed to redux or the broadcasting variant.
The text was updated successfully, but these errors were encountered: