aboutsummaryrefslogtreecommitdiff
path: root/src/z/App/object-store.js
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-09 13:51:51 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-09 13:51:51 +0200
commit09e8d4548361ece6151b914709c39e254eba65e3 (patch)
tree5a6038dd219110c53e699109e03a5490260c3560 /src/z/App/object-store.js
parentd0f90548f5edb32225af4a1f79413a2a56d186c8 (diff)
framework: use js symbol for object tagging
Diffstat (limited to 'src/z/App/object-store.js')
-rw-r--r--src/z/App/object-store.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/z/App/object-store.js b/src/z/App/object-store.js
index ae581f8..096d085 100644
--- a/src/z/App/object-store.js
+++ b/src/z/App/object-store.js
@@ -1,6 +1,4 @@
class ObjectStore {
- static id_name = "@id";
-
static types = Object.freeze({
0: "uninit",
1: "object",
@@ -42,8 +40,8 @@ class ObjectStore {
}
static free(target) {
- const id = target[ObjectStore.id_name];
- delete target[ObjectStore.id_name];
+ const id = target[ZsId];
+ delete target[ZsId];
delete ObjectStore.store[id];
}
@@ -118,7 +116,7 @@ class ObjectStore {
static registerObject(id, obj) {
ObjectStore.store[id] = obj;
- Object.defineProperty(obj, ObjectStore.id_name, {
+ Object.defineProperty(obj, ZsId, {
enumerable: false,
writable: false,
configurable: true,
@@ -131,7 +129,7 @@ class ObjectStore {
if (typeof value === 'object' || typeof value === 'function') {
mem.setUint8(0, ObjectStore.types['object'], true);
- let id = value == null ? 0 : value[ObjectStore.id_name];
+ let id = value == null ? 0 : value[ZsId];
if (id === undefined) {
id = ObjectStore.generateFreeId();