From 08fb01062751445220196791865639d4c532f4c5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 1 Feb 2016 14:27:43 +0100 Subject: [PATCH] give 'onChange' a name --- www/vdom/main.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/www/vdom/main.js b/www/vdom/main.js index 4b66f5f78..349d866a7 100644 --- a/www/vdom/main.js +++ b/www/vdom/main.js @@ -49,19 +49,21 @@ define([ var vdom1 = Convert.dom.to.vdom(inner); + var onChange = function (shjson) { + var authDoc = JSON.parse(shjson); + var vdom2 = Convert.hjson.to.vdom(authDoc); + var patches = Vdom.diff(vdom1, vdom2); + Vdom.patch(inner, patches); + vdom1 = vdom2; + }; + window.rti = realtimeInput.start($textarea[0], Config.websocketURL, Crypto.rand64(8), key.channel, key.cryptKey, inner, - function (shjson) { - var authDoc = JSON.parse(shjson); - var vdom2 = Convert.hjson.to.vdom(authDoc); - var patches = Vdom.diff(vdom1, vdom2); - Vdom.patch(inner, patches); - vdom1 = vdom2; - }); + onChange); $textarea.val(JSON.stringify(Convert.dom.to.hjson(inner)));