diff options
| author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-04-23 01:05:12 -0400 |
|---|---|---|
| committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-04-23 01:05:12 -0400 |
| commit | 5ffb2f404a6a3da851c0fe7318b73f5c7723c3d7 (patch) | |
| tree | 8838a7123ff82d73924e7b1855bab43aa7e59f92 /src/new_fields/util.ts | |
| parent | 27b514747188f12e0b0eeeb124576c556316923d (diff) | |
Did most of Documents and some other stuff
Diffstat (limited to 'src/new_fields/util.ts')
| -rw-r--r-- | src/new_fields/util.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/new_fields/util.ts b/src/new_fields/util.ts index 3806044bd..2d9721b2e 100644 --- a/src/new_fields/util.ts +++ b/src/new_fields/util.ts @@ -2,6 +2,7 @@ import { UndoManager } from "../client/util/UndoManager"; import { Update, OnUpdate, Parent, ObjectField, RefField, Doc, Id, Field } from "./Doc"; import { SerializationHelper } from "../client/util/SerializationHelper"; import { ProxyField } from "./Proxy"; +import { FieldValue } from "./Types"; export function setter(target: any, prop: string | symbol | number, value: any, receiver: any): boolean { if (SerializationHelper.IsSerializing()) { @@ -61,11 +62,16 @@ export function getField(target: any, prop: string | number, ignoreProto: boolea return field.value(callback); } if (field === undefined && !ignoreProto) { - const proto = getField(target, "prototype", true); + const proto = getField(target, "proto", true); if (proto instanceof Doc) { let field = proto[prop]; - callback && callback(field === null ? undefined : field); - return field; + if (field instanceof Promise) { + callback && field.then(callback); + return undefined; + } else { + callback && callback(field); + return field; + } } } callback && callback(field); |
