From 523aff306706a0dfabcb66320bec4489a6a81ab4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 9 May 2016 15:50:19 +0200 Subject: [PATCH] use upstream chainpad.js --- www/common/chainpad.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index e7823bc58..c54189ca5 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -558,7 +558,7 @@ var Common = require('./Common'); var Operation = module.exports.Operation = require('./Operation'); var Patch = require('./Patch'); var Message = require('./Message'); -var Sha = require('./SHA256'); +var Sha = module.exports.Sha = require('./SHA256'); var ChainPad = {}; @@ -574,7 +574,9 @@ var enterChainPad = function (realtime, func) { }; var debug = function (realtime, msg) { - console.log("[" + realtime.userName + "] " + msg); + if (realtime.logLevel > 0) { + console.log("[" + realtime.userName + "] " + msg); + } }; var schedule = function (realtime, func, timeout) { @@ -707,12 +709,16 @@ var onPong = function (realtime, msg) { var create = ChainPad.create = function (userName, authToken, channelId, initialState, config) { + config = config || {}; + var realtime = { type: 'ChainPad', authDoc: '', - config: config || {}, + config: config, + + logLevel: typeof(config.logLevel) !== 'undefined'? config.logLevel: 1, userName: userName, authToken: authToken,