@lark-apaas/observable-web-lite 1.0.1 → 1.0.2-alpha.20260811143735
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.
- package/README.md +12 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,18 @@ pvTracker.start({
|
|
|
42
42
|
|
|
43
43
|
停止上报并立即 flush 剩余数据。
|
|
44
44
|
|
|
45
|
+
### `getDeviceId()`
|
|
46
|
+
|
|
47
|
+
返回持久化在 `localStorage`(key 为 `x_sdk_device_id`)的设备 ID,是 UV 的计算依据。
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { getDeviceId } from '@lark-apaas/observable-web-lite';
|
|
51
|
+
|
|
52
|
+
const did = getDeviceId();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
导出它是为了让同一宿主页面内的其他 aPaaS 观测 SDK 复用同一个 ID —— 各自生成会把同一台设备算成多个。
|
|
56
|
+
|
|
45
57
|
## 完整示例
|
|
46
58
|
|
|
47
59
|
### 在 React 应用入口使用
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ declare class PvTracker {
|
|
|
23
23
|
private registerLifecycleListeners;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
declare function getDeviceId(): string;
|
|
27
|
+
|
|
26
28
|
declare const pvTracker: PvTracker;
|
|
27
29
|
|
|
28
|
-
export { PvTracker, type PvTrackerConfig, pvTracker };
|
|
30
|
+
export { PvTracker, type PvTrackerConfig, getDeviceId, pvTracker };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare class PvTracker {
|
|
|
23
23
|
private registerLifecycleListeners;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
declare function getDeviceId(): string;
|
|
27
|
+
|
|
26
28
|
declare const pvTracker: PvTracker;
|
|
27
29
|
|
|
28
|
-
export { PvTracker, type PvTrackerConfig, pvTracker };
|
|
30
|
+
export { PvTracker, type PvTrackerConfig, getDeviceId, pvTracker };
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED