diff options
author | bobzel <zzzman@gmail.com> | 2022-12-21 19:38:29 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-12-21 19:38:29 -0500 |
commit | 631826f13c67aef760bc7e76665e152f1f63bf5b (patch) | |
tree | 8733aac0da4fcdf12277bf204a63c68ac7ac20aa /src/fields/Doc.ts | |
parent | e373e66f8ed06f4501e00af8348f15ad113c7424 (diff) | |
parent | 4c0de84cf9a3d5be2f5058d514c8ca58e2004a4b (diff) |
cleaning up proxys and getFieldRef hopefully to be more understandable and efficient
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 51313a8df..6762665a2 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -276,7 +276,7 @@ export class Doc extends RefField { } constructor(id?: FieldId, forceSave?: boolean) { super(id); - const doc = new Proxy<this>(this, { + const docProxy = new Proxy<this>(this, { set: setter, get: getter, // getPrototypeOf: (target) => Cast(target[SelfProxy].proto, Doc) || null, // TODO this might be able to replace the proto logic in getter @@ -305,11 +305,11 @@ export class Doc extends RefField { throw new Error("Currently properties can't be defined on documents using Object.defineProperty"); }, }); - this[SelfProxy] = doc; + this[SelfProxy] = docProxy; if (!id || forceSave) { - DocServer.CreateField(doc); + DocServer.CreateField(docProxy); } - return doc; + return docProxy; } proto: Opt<Doc>; |