teamplay 0.3.9 → 0.3.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teamplay",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Full-stack signals ORM with multiplayer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@nx-js/observer-util": "^4.1.3",
|
|
26
|
-
"@teamplay/backend": "^0.3.
|
|
27
|
-
"@teamplay/cache": "^0.3.
|
|
28
|
-
"@teamplay/channel": "^0.3.
|
|
29
|
-
"@teamplay/debug": "^0.3.
|
|
30
|
-
"@teamplay/schema": "^0.3.
|
|
31
|
-
"@teamplay/utils": "^0.3.
|
|
26
|
+
"@teamplay/backend": "^0.3.11",
|
|
27
|
+
"@teamplay/cache": "^0.3.11",
|
|
28
|
+
"@teamplay/channel": "^0.3.11",
|
|
29
|
+
"@teamplay/debug": "^0.3.11",
|
|
30
|
+
"@teamplay/schema": "^0.3.11",
|
|
31
|
+
"@teamplay/utils": "^0.3.11",
|
|
32
32
|
"diff-match-patch": "^1.0.5",
|
|
33
33
|
"events": "^3.3.0",
|
|
34
34
|
"json0-ot-diff": "^1.1.2",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"license": "MIT",
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "c40eae765f07bc2a91d2c5b7151d8f845fc14708"
|
|
67
67
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const REGISTRY_SWEEP_INTERVAL = 10_000
|
|
2
|
+
export const MOCK_FINALIZATION_TIMEOUT = 10_000
|
|
2
3
|
const PERMANENT = false
|
|
3
4
|
|
|
4
5
|
// This is a mock implementation of FinalizationRegistry which doesn't actually
|
|
@@ -29,6 +30,7 @@ export class PermanentFinalizationRegistry {
|
|
|
29
30
|
// track the target objects. It's used in environments where FinalizationRegistry
|
|
30
31
|
// is not available but WeakRef is (e.g. React Native >=0.75 on New Architecture).
|
|
31
32
|
export class WeakRefBasedFinalizationRegistry {
|
|
33
|
+
counter = 0
|
|
32
34
|
registrations = new Map()
|
|
33
35
|
sweepTimeout
|
|
34
36
|
|
|
@@ -38,15 +40,20 @@ export class WeakRefBasedFinalizationRegistry {
|
|
|
38
40
|
|
|
39
41
|
// Token is actually required with this impl
|
|
40
42
|
register (target, value, token) {
|
|
41
|
-
this.registrations.set(
|
|
43
|
+
this.registrations.set(this.counter, {
|
|
42
44
|
targetRef: new WeakRef(target),
|
|
45
|
+
tokenRef: token && new WeakRef(token),
|
|
43
46
|
value
|
|
44
47
|
})
|
|
48
|
+
this.counter++
|
|
45
49
|
this.scheduleSweep()
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
unregister (token) {
|
|
49
|
-
this.registrations.
|
|
53
|
+
this.registrations.forEach((registration, key) => {
|
|
54
|
+
if (registration?.tokenRef.deref() !== token) return
|
|
55
|
+
this.registrations.delete(key)
|
|
56
|
+
})
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
// Bound so it can be used directly as setTimeout callback.
|
|
@@ -54,10 +61,11 @@ export class WeakRefBasedFinalizationRegistry {
|
|
|
54
61
|
clearTimeout(this.sweepTimeout)
|
|
55
62
|
this.sweepTimeout = undefined
|
|
56
63
|
|
|
57
|
-
this.registrations.forEach((registration,
|
|
64
|
+
this.registrations.forEach((registration, key) => {
|
|
58
65
|
if (registration.targetRef.deref() !== undefined) return
|
|
59
|
-
|
|
60
|
-
this.registrations.delete(
|
|
66
|
+
const value = registration.value
|
|
67
|
+
this.registrations.delete(key)
|
|
68
|
+
setTimeout(() => this.finalize(value), MOCK_FINALIZATION_TIMEOUT)
|
|
61
69
|
})
|
|
62
70
|
|
|
63
71
|
if (this.registrations.size > 0) this.scheduleSweep()
|