Commit ec3287f6 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Completed parsec integration!

parent ddc8f623
......@@ -4,10 +4,14 @@
<!-- Parsec widget -->
<script>
// Only load this script once.
var kernel = IPython.notebook.kernel;
var initialized = kernel !== undefined && kernel != null;
if (initialized && window.parsecWidgetRegistered === undefined) {
// Do not load this script again.
window.parsecWidgetRegistered = true;
// Register the comm target.
var ParsecWidget = function (comm) {
this.comm = comm;
......
......@@ -40,7 +40,7 @@
" float = do\n",
" value <- many1 $ oneOf \"0123456789\"\n",
" char '.'\n",
" after <- many $ oneOf \"0123456789\"\n",
" after <- many1 $ oneOf \"0123456789\"\n",
" optional $ char ','\n",
" whitespace\n",
" return (read (value ++ \".\" ++ after) :: Float)\n",
......@@ -70,10 +70,14 @@
"\n",
"<!-- Parsec widget -->\n",
"<script>\n",
"// Only load this script once.\n",
"var kernel = IPython.notebook.kernel;\n",
"var initialized = kernel !== undefined && kernel != null;\n",
"if (initialized && window.parsecWidgetRegistered === undefined) {\n",
"\n",
"// Do not load this script again.\n",
"window.parsecWidgetRegistered = true;\n",
"\n",
"// Register the comm target.\n",
"var ParsecWidget = function (comm) {\n",
" this.comm = comm;\n",
......@@ -121,11 +125,13 @@
" // Update every key press.\n",
" editor.on(\"keyup\", function() {\n",
" var text = editor.getDoc().getValue();\n",
" console.log(\"Sent\",text); \n",
" comm.send({\"text\": text});\n",
" });\n",
"};\n",
"\n",
"ParsecWidget.prototype.handler = function(msg) {\n",
" console.log(\"Handler\", msg); \n",
" var data = msg.content.data;\n",
" this.hasError = data[\"status\"] == \"error\";\n",
" if (this.hasError) {\n",
......@@ -171,10 +177,14 @@
"\n",
"<!-- Parsec widget -->\n",
"<script>\n",
"// Only load this script once.\n",
"var kernel = IPython.notebook.kernel;\n",
"var initialized = kernel !== undefined && kernel != null;\n",
"if (initialized && window.parsecWidgetRegistered === undefined) {\n",
"\n",
"// Do not load this script again.\n",
"window.parsecWidgetRegistered = true;\n",
"\n",
"// Register the comm target.\n",
"var ParsecWidget = function (comm) {\n",
" this.comm = comm;\n",
......@@ -222,11 +232,13 @@
" // Update every key press.\n",
" editor.on(\"keyup\", function() {\n",
" var text = editor.getDoc().getValue();\n",
" console.log(\"Sent\",text); \n",
" comm.send({\"text\": text});\n",
" });\n",
"};\n",
"\n",
"ParsecWidget.prototype.handler = function(msg) {\n",
" console.log(\"Handler\", msg); \n",
" var data = msg.content.data;\n",
" this.hasError = data[\"status\"] == \"error\";\n",
" if (this.hasError) {\n",
......@@ -253,7 +265,7 @@
"output_type": "display_data"
}
],
"prompt_number": 2
"prompt_number": 3
},
{
"cell_type": "code",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment