@colyseus/schema
Advanced tools
Comparing version 2.0.19 to 2.0.20
@@ -11,5 +11,5 @@ import { Ref } from "./ChangeTree"; | ||
addRef(refId: number, ref: Ref, incrementCount?: boolean): void; | ||
removeRef(refId: any): void; | ||
removeRef(refId: number): void; | ||
clearRefs(): void; | ||
garbageCollectDeletedRefs(): void; | ||
} |
@@ -28,3 +28,12 @@ "use strict"; | ||
removeRef(refId) { | ||
this.refCounts[refId] = this.refCounts[refId] - 1; | ||
const refCount = this.refCounts[refId]; | ||
if (refCount === undefined) { | ||
console.warn(`trying to remove reference ${refId} that doesn't exist`); | ||
return; | ||
} | ||
if (refCount === 0) { | ||
console.warn(`trying to remove reference ${refId} with 0 refCount`); | ||
return; | ||
} | ||
this.refCounts[refId] = refCount - 1; | ||
this.deletedRefs.add(refId); | ||
@@ -31,0 +40,0 @@ } |
{ | ||
"name": "@colyseus/schema", | ||
"version": "2.0.19", | ||
"version": "2.0.20", | ||
"description": "Binary state serializer with delta encoding for games", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -30,4 +30,14 @@ import { Schema } from "../Schema"; | ||
// for decoding | ||
removeRef(refId) { | ||
this.refCounts[refId] = this.refCounts[refId] - 1; | ||
removeRef(refId: number) { | ||
const refCount = this.refCounts[refId]; | ||
if (refCount === undefined) { | ||
console.warn(`trying to remove reference ${refId} that doesn't exist`); | ||
return; | ||
} | ||
if (refCount === 0) { | ||
console.warn(`trying to remove reference ${refId} with 0 refCount`); | ||
return; | ||
} | ||
this.refCounts[refId] = refCount - 1; | ||
this.deletedRefs.add(refId); | ||
@@ -34,0 +44,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1640048
20348