Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(151)

Unified Diff: present/static/playground.js

Issue 6721049: go.talks/present: hacks for 'inside present' talk
Patch Set: diff -r b59f77ef5cff https://code.google.com/p/go.talks Created 13 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: present/static/playground.js
===================================================================
--- a/present/static/playground.js
+++ b/present/static/playground.js
@@ -5,6 +5,8 @@
(function() {
"use strict";
+ var wire = document.getElementById('wire');
+
var websocket, outputs = {};
function showMessage(o, m, className) {
@@ -17,6 +19,7 @@
}
function onMessage(e) {
+ if (wire) wire.innerHTML += '<div class="recv">'+e.data+'</div>';
var m = JSON.parse(e.data);
var o = outputs[m.Id];
if (o === null) {
@@ -42,7 +45,9 @@
}
function sendMessage(m) {
- websocket.send(JSON.stringify(m));
+ var s = JSON.stringify(m)
+ if (wire) wire.innerHTML += '<div class="send">'+s+'</div>';
+ websocket.send(s);
}
var count = 0;
@@ -74,6 +79,7 @@
var outpre = document.createElement('pre');
function onRun() {
+ if (wire) wire.innerHTML = "";
outpre.innerHTML = "";
output.style.display = "block";
sendMessage({Id: id, Kind: "run", Body: text(code)});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b