aegis.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Core, { Config, CoreApiConfig, SendOption, SendSuccess, SendFail } from "../../core/src";
  2. declare type WebApiConfig = {
  3. injectTraceHeader?: 'traceparent' | 'sw8' | 'b3' | 'sentry-trace';
  4. injectTraceUrls?: Array<string | RegExp>;
  5. injectTraceIgnoreUrls?: Array<string | RegExp>;
  6. usePerformanceTiming?: boolean;
  7. } & CoreApiConfig;
  8. export interface WebConfig extends Config {
  9. asyncPlugin?: boolean;
  10. reportApiSpeed?: boolean | {
  11. urlHandler: (url: string, payload: object) => string;
  12. };
  13. reportImmediately?: boolean;
  14. offlineLog?: boolean;
  15. dbConfig?: any;
  16. offlineLogExp?: number;
  17. getNetworkType?: Function;
  18. getNetworkStatus?: Function;
  19. reportBridgeSpeed?: boolean;
  20. h5Bridge?: Object;
  21. h5BridgeFunc?: string[];
  22. /** 当前页面是否是单页应用 */
  23. spa?: boolean;
  24. api?: WebApiConfig;
  25. }
  26. interface AsyncPluginOption {
  27. exportsConstructor?: string;
  28. onAegisInit?: (aegis: Core) => void;
  29. onAegisInitAndPluginLoaded?: (aegis: Aegis, exportsConstructor?: Function) => void;
  30. }
  31. export default class Aegis extends Core {
  32. static sessionID: string;
  33. sendNow: boolean;
  34. isReportReady: boolean;
  35. reportRequestQueue: {
  36. options: SendOption;
  37. success?: SendSuccess;
  38. fail?: SendFail;
  39. }[];
  40. firstScreenInfo: {
  41. element: any;
  42. timing: number;
  43. [key: string]: any;
  44. };
  45. constructor(config: WebConfig);
  46. getBean(filter?: string[]): string;
  47. private getCurrentPageUrl;
  48. ready(): void;
  49. request(_options: SendOption, _success?: SendSuccess, _fail?: SendFail): void;
  50. private $request;
  51. speedLogPipeline: import("../../core/src").Pipeline<any, any>;
  52. private static asyncPlugin;
  53. static useAsyncPlugin(url: string, options?: AsyncPluginOption): void;
  54. publishPluginsLogs(): void;
  55. uploadLogs(params?: any, conds?: any): void;
  56. static urls: {
  57. [key: string]: string;
  58. };
  59. }
  60. export {};