use upstream chainpad.js

pull/1/head
ansuz 9 years ago
parent dcd130cd9d
commit 523aff3067

@ -558,7 +558,7 @@ var Common = require('./Common');
var Operation = module.exports.Operation = require('./Operation'); var Operation = module.exports.Operation = require('./Operation');
var Patch = require('./Patch'); var Patch = require('./Patch');
var Message = require('./Message'); var Message = require('./Message');
var Sha = require('./SHA256'); var Sha = module.exports.Sha = require('./SHA256');
var ChainPad = {}; var ChainPad = {};
@ -574,7 +574,9 @@ var enterChainPad = function (realtime, func) {
}; };
var debug = function (realtime, msg) { 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) { 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) { var create = ChainPad.create = function (userName, authToken, channelId, initialState, config) {
config = config || {};
var realtime = { var realtime = {
type: 'ChainPad', type: 'ChainPad',
authDoc: '', authDoc: '',
config: config || {}, config: config,
logLevel: typeof(config.logLevel) !== 'undefined'? config.logLevel: 1,
userName: userName, userName: userName,
authToken: authToken, authToken: authToken,

Loading…
Cancel
Save