From 8258018c1d8097dc7fc00041d062ee67637afbc2 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 9 Mar 2016 10:32:57 +0100 Subject: [PATCH] Revert "fix undefined reference" This reverts commit 7d65540123285addf0e27f3689a15b64f32f9afa. To restore functionality in convert.js --- www/common/convert.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/www/common/convert.js b/www/common/convert.js index 3363cf384..b95591e93 100644 --- a/www/common/convert.js +++ b/www/common/convert.js @@ -1,14 +1,16 @@ define([ + '/common/virtual-dom.js', '/common/hyperjson.js', '/common/hyperscript.js' -], function (hyperjson, hyperscript) { +], function (vdom, hyperjson, hyperscript) { // complain if you don't find the required APIs - if (!(hyperjson && hyperscript)) { throw new Error(); } - + if (!(vdom && hyperjson && hyperscript)) { throw new Error(); } + // Generate a matrix of conversions /* convert.dom.to.hjson, convert.hjson.to.dom, convert.dom.to.vdom, convert.vdom.to.dom, + convert.vdom.to.hjson, convert.hjson.to.vdom and of course, identify functions in case you try to convert a datatype to itself @@ -34,8 +36,17 @@ define([ vdom: function (H) { return hyperjson.callOn(H, vdom.h); } + }, + vdom:{ + vdom: Self, + dom: function (V) { + return vdom.create(V); + }, + hjson: function (V) { + return hyperjson.fromDOM(vdom.create(V)); + } } - }, + }, convert = {}; Object.keys(methods).forEach(function (method) { convert[method] = { to: methods[method] }; @@ -44,6 +55,7 @@ define([ }()); convert.core = { + vdom: vdom, hyperjson: hyperjson, hyperscript: hyperscript };