aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Document.ts
diff options
context:
space:
mode:
authortschicke-brown <tyler_schicke@brown.edu>2019-02-07 23:50:47 -0500
committerGitHub <noreply@github.com>2019-02-07 23:50:47 -0500
commit35574735a60fbc7b1c7051c59db56a8485f50a21 (patch)
tree42dc1f8fbe639d53e7c6d3db144bd30d984c21de /src/fields/Document.ts
parent8d264be35a511204449c22d0a4b1754e241a3421 (diff)
parent90296f23320df43e73fb1bd936428f19f0f705a9 (diff)
Merge pull request #5 from browngraphicslab/schema
Schema
Diffstat (limited to 'src/fields/Document.ts')
-rw-r--r--src/fields/Document.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/fields/Document.ts b/src/fields/Document.ts
index cc81ff4a7..546c89e04 100644
--- a/src/fields/Document.ts
+++ b/src/fields/Document.ts
@@ -1,4 +1,4 @@
-import { Field, Cast, Opt, FieldWaiting, FIELD_ID } from "./Field"
+import { Field, Cast, Opt, FieldWaiting, FIELD_ID, FieldValue } from "./Field"
import { Key, KeyStore } from "./Key"
import { NumberField } from "./NumberField";
import { ObservableMap, computed, action, observable } from "mobx";
@@ -16,8 +16,8 @@ export class Document extends Field {
return this.GetText(KeyStore.Title, "<untitled>");
}
- Get(key: Key, ignoreProto: boolean = false): Opt<Field> {
- let field: Opt<Field>;
+ Get(key: Key, ignoreProto: boolean = false): FieldValue<Field> {
+ let field: FieldValue<Field>;
if (ignoreProto) {
if (this.fields.has(key)) {
field = this.fields.get(key);
@@ -25,7 +25,7 @@ export class Document extends Field {
field = Server.GetDocumentField(this, key);
}
} else {
- let doc: Opt<Document> = this;
+ let doc: FieldValue<Document> = this;
while (doc && doc != FieldWaiting && field != FieldWaiting) {
if (!doc.fields.has(key)) {
if (doc._proxies.has(key)) {
@@ -46,7 +46,7 @@ export class Document extends Field {
return field;
}
- GetT<T extends Field = Field>(key: Key, ctor: { new(...args: any[]): T }, ignoreProto: boolean = false): Opt<T> {
+ GetT<T extends Field = Field>(key: Key, ctor: { new(...args: any[]): T }, ignoreProto: boolean = false): FieldValue<T> {
var getfield = this.Get(key, ignoreProto);
if (getfield != FieldWaiting) {
return Cast(getfield, ctor);
@@ -119,13 +119,13 @@ export class Document extends Field {
this.SetData(key, value, NumberField, replaceWrongType);
}
- GetPrototype(): Opt<Document> {
+ GetPrototype(): FieldValue<Document> {
return this.GetT(KeyStore.Prototype, Document, true);
}
GetAllPrototypes(): Document[] {
let protos: Document[] = [];
- let doc: Opt<Document> = this;
+ let doc: FieldValue<Document> = this;
while (doc && doc != FieldWaiting) {
protos.push(doc);
doc = doc.GetPrototype();
@@ -141,6 +141,10 @@ export class Document extends Field {
return delegate;
}
+ ToScriptString(): string {
+ return "";
+ }
+
TrySetValue(value: any): boolean {
throw new Error("Method not implemented.");
}