From 09e8d4548361ece6151b914709c39e254eba65e3 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 9 Oct 2026 13:51:51 +0200 Subject: framework: use js symbol for object tagging --- src/z/App/object-store.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/z/App/object-store.js') 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(); -- cgit v1.2.3-70-g09d2