Merge branch 'diffdom'
This commit is contained in:
@@ -1,14 +1,16 @@
|
|||||||
define([
|
define([
|
||||||
|
'/common/virtual-dom.js',
|
||||||
'/common/hyperjson.js',
|
'/common/hyperjson.js',
|
||||||
'/common/hyperscript.js'
|
'/common/hyperscript.js'
|
||||||
], function (hyperjson, hyperscript) {
|
], function (vdom, hyperjson, hyperscript) {
|
||||||
// complain if you don't find the required APIs
|
// 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
|
// Generate a matrix of conversions
|
||||||
/*
|
/*
|
||||||
convert.dom.to.hjson, convert.hjson.to.dom,
|
convert.dom.to.hjson, convert.hjson.to.dom,
|
||||||
convert.dom.to.vdom, convert.vdom.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
|
and of course, identify functions in case you try to
|
||||||
convert a datatype to itself
|
convert a datatype to itself
|
||||||
@@ -20,16 +22,31 @@ define([
|
|||||||
methods = {
|
methods = {
|
||||||
dom:{
|
dom:{
|
||||||
dom: Self,
|
dom: Self,
|
||||||
hjson: hyperjson.fromDOM
|
hjson: hyperjson.fromDOM,
|
||||||
|
vdom: function (D) {
|
||||||
|
return hyperjson.callOn(hyperjson.fromDOM(D), vdom.h);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hjson:{
|
hjson:{
|
||||||
hjson: Self,
|
hjson: Self,
|
||||||
dom: function (H) {
|
dom: function (H) {
|
||||||
// hyperjson.fromDOM,
|
// hyperjson.fromDOM,
|
||||||
return hyperjson.callOn(H, hyperscript);
|
return hyperjson.callOn(H, hyperscript);
|
||||||
|
},
|
||||||
|
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 = {};
|
convert = {};
|
||||||
Object.keys(methods).forEach(function (method) {
|
Object.keys(methods).forEach(function (method) {
|
||||||
convert[method] = { to: methods[method] };
|
convert[method] = { to: methods[method] };
|
||||||
@@ -38,6 +55,7 @@ define([
|
|||||||
}());
|
}());
|
||||||
|
|
||||||
convert.core = {
|
convert.core = {
|
||||||
|
vdom: vdom,
|
||||||
hyperjson: hyperjson,
|
hyperjson: hyperjson,
|
||||||
hyperscript: hyperscript
|
hyperscript: hyperscript
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ define([
|
|||||||
|
|
||||||
var debug = function (x) { console.log(x); },
|
var debug = function (x) { console.log(x); },
|
||||||
warn = function (x) { console.error(x); },
|
warn = function (x) { console.error(x); },
|
||||||
verbose = function (x) { console.log(x); };
|
verbose = function (x) {
|
||||||
|
if (window.verboseLogging) {
|
||||||
|
console.log(x);
|
||||||
|
}
|
||||||
|
};
|
||||||
// verbose = function () {}; // comment out to enable verbose logging
|
// verbose = function () {}; // comment out to enable verbose logging
|
||||||
|
|
||||||
// ------------------ Trapping Keyboard Events ---------------------- //
|
// ------------------ Trapping Keyboard Events ---------------------- //
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ define([
|
|||||||
websocketURL: Config.websocketURL,
|
websocketURL: Config.websocketURL,
|
||||||
userName: Crypto.rand64(8),
|
userName: Crypto.rand64(8),
|
||||||
channel: key.channel,
|
channel: key.channel,
|
||||||
key.cryptKey
|
cryptKey: key.cryptKey
|
||||||
};
|
};
|
||||||
|
|
||||||
var rttext = RTText.start(config);
|
var rttext = RTText.start(config);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ define([
|
|||||||
var $textarea = $('textarea');
|
var $textarea = $('textarea');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
textarea: $textarea[0],
|
||||||
websocketURL: Config.websocketURL,
|
websocketURL: Config.websocketURL,
|
||||||
userName: Crypto.rand64(8),
|
userName: Crypto.rand64(8),
|
||||||
channel: key.channel,
|
channel: key.channel,
|
||||||
|
|||||||
Reference in New Issue
Block a user