sdk.ts 918 B

12345678910111213141516171819202122232425262728293031323334
  1. // import { getGlobalObject } from '@medici/utils';
  2. // import { BehaviorSubject } from 'rxjs';
  3. import { BaseTrack } from './basicTrack';
  4. import { IHistory } from './history';
  5. import { Eventer } from './event';
  6. export type PlatformType = 'web' | 'miniApp';
  7. export interface SDKInitConfig {
  8. user?: string;
  9. version?: string; //client version
  10. }
  11. export interface SDKConfigType {
  12. endPoint: string;
  13. appId: string;
  14. platform?: PlatformType;
  15. autoTrack?: boolean;
  16. config?: SDKInitConfig;
  17. }
  18. export class SDK extends BaseTrack {
  19. protected _platform: PlatformType;
  20. protected _config: SDKInitConfig;
  21. public eventer = new Eventer(this);
  22. public _history: IHistory;
  23. constructor(params: SDKConfigType) {
  24. super(params);
  25. console.log('params.appId', params.appId);
  26. this._history = new IHistory(this, params.appId);
  27. super._history = this._history;
  28. }
  29. }