diff options
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/Repl.tsx | 8 | ||||
-rw-r--r-- | src/debug/Test.tsx | 35 |
2 files changed, 6 insertions, 37 deletions
diff --git a/src/debug/Repl.tsx b/src/debug/Repl.tsx index 4f4db13d2..fd6b47ff0 100644 --- a/src/debug/Repl.tsx +++ b/src/debug/Repl.tsx @@ -28,12 +28,8 @@ class Repl extends React.Component { if (!script.compiled) { this.executedCommands.push({ command: this.text, result: "Compile Error" }); } else { - const result = script.run({ makeInterface }); - if (result.success) { - this.executedCommands.push({ command: this.text, result: result.result }); - } else { - this.executedCommands.push({ command: this.text, result: result.error.message || result.error }); - } + const result = script.run({ makeInterface }, e => this.executedCommands.push({ command: this.text, result: e.message || e })); + result.success && this.executedCommands.push({ command: this.text, result: result.result }); } this.text = ""; } diff --git a/src/debug/Test.tsx b/src/debug/Test.tsx index 79f87f4ac..3baedce4b 100644 --- a/src/debug/Test.tsx +++ b/src/debug/Test.tsx @@ -2,39 +2,12 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { DocServer } from '../client/DocServer'; import { Doc } from '../new_fields/Doc'; +import * as Pdfjs from "pdfjs-dist"; +import "pdfjs-dist/web/pdf_viewer.css"; +import { Utils } from '../Utils'; +const PDFJSViewer = require("pdfjs-dist/web/pdf_viewer"); const protoId = "protoDoc"; const delegateId = "delegateDoc"; class Test extends React.Component { - onCreateClick = () => { - const proto = new Doc(protoId, true); - const delegate = Doc.MakeDelegate(proto, delegateId); - } - - onReadClick = async () => { - console.log("reading"); - const docs = await DocServer.GetRefFields([delegateId, protoId]); - console.log("done"); - console.log(docs); - } - - onDeleteClick = () => { - DocServer.DeleteDocuments([protoId, delegateId]); - } - - render() { - return ( - <div> - <button onClick={this.onCreateClick}>Create Docs</button> - <button onClick={this.onReadClick}>Read Docs</button> - <button onClick={this.onDeleteClick}>Delete Docs</button> - </div> - ); - } } - -DocServer.init(window.location.protocol, window.location.hostname, 4321, "test"); -ReactDOM.render( - <Test />, - document.getElementById('root') -);
\ No newline at end of file |