Amplitude-TypeScript icon indicating copy to clipboard operation
Amplitude-TypeScript copied to clipboard

feat(analytics-core): remote config client

Open Mercy811 opened this issue 9 months ago • 0 comments

Summary

AMP-124564

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 to addEventListener(). 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?:

Mercy811 avatar Mar 19 '25 23:03 Mercy811