@arms/rum-uniapp 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/uniapp-sdk.js +1 -1
  2. package/es/collector/action/index.js +61 -3
  3. package/es/collector/exception/index.d.ts +1 -0
  4. package/es/collector/exception/index.js +3 -2
  5. package/es/collector/resource/api.js +1 -1
  6. package/es/collector/view/perf.js +74 -1
  7. package/es/collector/view/pv.d.ts +2 -12
  8. package/es/collector/view/pv.js +1 -1
  9. package/es/reporter/index.js +2 -2
  10. package/es/shell.js +5 -5
  11. package/es/types/client.d.ts +5 -2
  12. package/es/utils/mixin.d.ts +5 -1
  13. package/es/utils/mixin.js +2 -1
  14. package/es/utils/platform.d.ts +3 -0
  15. package/es/utils/platform.js +2 -2
  16. package/es/utils/session.js +2 -1
  17. package/es/utils/view.d.ts +12 -11
  18. package/es/utils/view.js +6 -24
  19. package/lib/collector/action/index.js +62 -2
  20. package/lib/collector/exception/index.d.ts +1 -0
  21. package/lib/collector/exception/index.js +3 -2
  22. package/lib/collector/resource/api.js +1 -1
  23. package/lib/collector/view/perf.js +75 -1
  24. package/lib/collector/view/pv.d.ts +2 -12
  25. package/lib/collector/view/pv.js +1 -1
  26. package/lib/index.js +1 -1
  27. package/lib/reporter/index.js +1 -1
  28. package/lib/shell.js +5 -5
  29. package/lib/types/client.d.ts +5 -2
  30. package/lib/utils/mixin.d.ts +5 -1
  31. package/lib/utils/mixin.js +2 -1
  32. package/lib/utils/platform.d.ts +3 -0
  33. package/lib/utils/platform.js +2 -2
  34. package/lib/utils/session.js +2 -1
  35. package/lib/utils/view.d.ts +12 -11
  36. package/lib/utils/view.js +6 -24
  37. package/package.json +2 -2
  38. package/es/collector/action/index.d.ts +0 -14
  39. package/es/collector/view/perf.d.ts +0 -10
  40. package/lib/collector/action/index.d.ts +0 -14
  41. package/lib/collector/view/perf.d.ts +0 -10
@@ -1,28 +1,29 @@
1
- import { IContext, IRumSession, IViewData } from '@arms/rum-core';
1
+ import { IContext, IViewData } from '@arms/rum-core';
2
2
  export interface Page {
3
3
  route: string;
4
4
  is: string;
5
- getPageId: () => string;
6
- __rum_view_id?: string;
5
+ __rum_view?: IViewData;
6
+ $page: {
7
+ id?: number;
8
+ fullPath?: string;
9
+ route?: string;
10
+ openType?: string;
11
+ };
7
12
  }
8
- export declare const PAGE_ID = "__rum_view_id";
9
13
  /**
10
- * 获取 RUM 内置的view_id标识
11
- * @param page
12
- * @param session
14
+ * 获取当前 page
13
15
  * @returns
14
16
  */
15
- export declare function getRumViewId(page: Page, session?: IRumSession): string;
17
+ export declare function getCurrentPage(): any;
16
18
  /**
17
19
  * 获取当前 view
18
- * @param viewId
19
20
  * @param ctx
20
21
  * @returns
21
22
  */
22
- export declare function getViewById(viewId: string, ctx: IContext): IViewData;
23
+ export declare function getCurView(ctx: IContext): IViewData;
23
24
  /**
24
25
  * 获取当前 view
25
26
  * @param ctx
26
27
  * @returns
27
28
  */
28
- export declare function getCurView(ctx: IContext): IViewData;
29
+ export declare function getCurViews(): IViewData[];
package/lib/utils/view.js CHANGED
@@ -1,31 +1,13 @@
1
- "use strict";exports.__esModule=!0,exports.PAGE_ID=void 0,exports.getCurView=getCurView,exports.getRumViewId=getRumViewId,exports.getViewById=getViewById;var PAGE_ID=exports.PAGE_ID="__rum_view_id";// declare var getCurrentPages: Function;
2
- // /**
3
- // * 获取当前 page
4
- // * @returns
5
- // */
6
- // export function getCurPage() {
7
- // // TODO: 改成从config里获取
8
- // if (typeof getCurrentPages === 'function') {
9
- // try {
10
- // const pages = getCurrentPages() || [];
11
- // return pages[pages.length - 1];
12
- // } catch (error) {
13
- // console.warn('[arms] error in getCurView', error);
14
- // }
15
- // }
16
- // }
17
- /**
18
- * 获取 RUM 内置的view_id标识
19
- * @param page
20
- * @param session
1
+ "use strict";exports.__esModule=!0,exports.getCurView=getCurView,exports.getCurViews=getCurViews,exports.getCurrentPage=getCurrentPage;var _rumCore=require("@arms/rum-core"),PAGE_KEY="__rum_view";/**
2
+ * 获取当前 page
21
3
  * @returns
22
- */function getRumViewId(a,b){return a?a[PAGE_ID]?a[PAGE_ID]:b?a[PAGE_ID]=b.getViewId():void 0:void 0}/**
4
+ */function getCurrentPage(){if("function"==typeof getCurrentPages)try{var a=getCurrentPages()||[];return a[a.length-1]}catch(a){// console.warn('[arms] error in getCurView', error);
5
+ }}/**
23
6
  * 获取当前 view
24
- * @param viewId
25
7
  * @param ctx
26
8
  * @returns
27
- */function getViewById(a,b){return a&&b?b.getViews().find(function(b){return b.id===a}):void 0}/**
9
+ */function getCurView(a){if(a){var b=getCurrentPage();if(b){if(PAGE_KEY in b)return b[PAGE_KEY];var c=b.$page||{},d=c.fullPath,e=c.route,f=c.openType,g=a.session.getViewId(),h=d||e||b.route,i=e||b.route,j=a.getConfig(),k=j.parseViewName;return(0,_rumCore.isFunction)(k)&&(i=k(h)),b[PAGE_KEY]={id:g,name:i,url:h,loading_type:f,_noReport:!0}}}}/**
28
10
  * 获取当前 view
29
11
  * @param ctx
30
12
  * @returns
31
- */function getCurView(a){if(a){var b=a.getViews();if(b&&b.length)return b[b.length-1]}}
13
+ */function getCurViews(){var a=[];if("function"==typeof getCurrentPages)try{(getCurrentPages()||[]).forEach(function(b){PAGE_KEY in b&&a.push(b[PAGE_KEY])})}catch(a){}return a}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arms/rum-uniapp",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "arms rum javascript sdk for uniapp native",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",
@@ -25,7 +25,7 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
- "@arms/rum-core": "0.1.1"
28
+ "@arms/rum-core": "0.1.5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^4.9.4"
@@ -1,14 +0,0 @@
1
- import { ICollector, IContext, RumActionEvent, RumEvent } from '@arms/rum-core';
2
- export default class ActionCollector implements ICollector {
3
- name: string;
4
- private DELAY_TIME;
5
- ctx: IContext;
6
- sendEvent: (payload: RumEvent) => void;
7
- events: string[];
8
- lastEvent: RumActionEvent;
9
- timer: any;
10
- setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
11
- onEvent: (e: any) => void;
12
- sendAction: () => void;
13
- destroy(): void;
14
- }
@@ -1,10 +0,0 @@
1
- import { ICollector, IContext, RumEvent } from '@arms/rum-core';
2
- export default class PerfCollector implements ICollector {
3
- name: string;
4
- ctx: IContext;
5
- sendEvent: (payload: RumEvent) => void;
6
- perfObserver: any;
7
- setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
8
- observerHandler: (ev: any) => void;
9
- destroy(): void;
10
- }
@@ -1,14 +0,0 @@
1
- import { ICollector, IContext, RumActionEvent, RumEvent } from '@arms/rum-core';
2
- export default class ActionCollector implements ICollector {
3
- name: string;
4
- private DELAY_TIME;
5
- ctx: IContext;
6
- sendEvent: (payload: RumEvent) => void;
7
- events: string[];
8
- lastEvent: RumActionEvent;
9
- timer: any;
10
- setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
11
- onEvent: (e: any) => void;
12
- sendAction: () => void;
13
- destroy(): void;
14
- }
@@ -1,10 +0,0 @@
1
- import { ICollector, IContext, RumEvent } from '@arms/rum-core';
2
- export default class PerfCollector implements ICollector {
3
- name: string;
4
- ctx: IContext;
5
- sendEvent: (payload: RumEvent) => void;
6
- perfObserver: any;
7
- setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
8
- observerHandler: (ev: any) => void;
9
- destroy(): void;
10
- }