whepts 1.0.2 → 1.0.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.
- package/.claude/settings.local.json +9 -0
- package/AGENTS.md +92 -0
- package/dist/core/codec.d.ts +11 -0
- package/dist/core/connection.d.ts +24 -0
- package/dist/core/http.d.ts +16 -0
- package/dist/core/track.d.ts +12 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/types.d.ts +33 -0
- package/dist/whep.d.ts +8 -98
- package/package.json +8 -9
- package/src/core/codec.ts +33 -0
- package/src/core/connection.ts +103 -0
- package/src/core/http.ts +93 -0
- package/src/core/track.ts +51 -0
- package/src/index.ts +3 -2
- package/src/types.ts +37 -0
- package/src/whep.ts +76 -305
- package/QWEN.md +0 -118
- package/dist/utils/observer.d.ts +0 -8
- package/src/utils/observer.ts +0 -28
package/src/utils/observer.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 可见性监测(确保回调执行完成后再处理后续,不丢弃任务)
|
|
3
|
-
*/
|
|
4
|
-
export default class VisibilityObserver {
|
|
5
|
-
private observer?: IntersectionObserver
|
|
6
|
-
|
|
7
|
-
start(element: HTMLElement, callback: (isIntersecting: boolean) => void) {
|
|
8
|
-
if (!element)
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
// 先停止之前的任务
|
|
12
|
-
this.stop()
|
|
13
|
-
|
|
14
|
-
this.observer = new IntersectionObserver(
|
|
15
|
-
([entry]) => callback(entry.isIntersecting),
|
|
16
|
-
{ threshold: 0.5 },
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
this.observer.observe(element)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
stop() {
|
|
23
|
-
if (this.observer) {
|
|
24
|
-
this.observer.disconnect()
|
|
25
|
-
this.observer = undefined
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|