Amplitude-TypeScript
Amplitude-TypeScript copied to clipboard
feat(analytics-core): remote config client
Summary
Remote config client
- Have the same design and APIs as the iOS one https://github.com/amplitude/AmplitudeCore-Swift/pull/2
- A remote config client based on request-on-demand and subscription + callback modes.
- The remote config client has 3 public APIs. See code comment for more details.
subscribe()is very similar toaddEventListener(). Callback is called when the remote config fetched.- Analytics SDK will initialize a remote config client and plugins can use it for request remote config on their needs.
export interface IRemoteConfigClient {
subscribe(key: string | undefined, deliveryMode: DeliveryMode, callback: RemoteConfigCallback): string;
unsubscribe(id: string): boolean;
updateConfigs(): void;
}
Remote config storage
- Default to local storage. Ideally we can take advantages of browser storage instead of using local storage, but it requires extra response headers (AMP-126646) and work.
Checklist
- [ ] Does your PR title have the correct title format?
- Does your PR have a breaking change?: