add some logging options for GUN messages
This commit is contained in:
parent
72650faded
commit
2e324b180c
|
|
@ -10,15 +10,40 @@ $(function (){
|
||||||
peers: ['https://jessemcdonald.info/gun'],
|
peers: ['https://jessemcdonald.info/gun'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gun._.on('in', function(msg) {
|
||||||
|
if (window.logGunIn &&
|
||||||
|
(typeof window.logGunIn !== 'function' ||
|
||||||
|
window.logGunIn(msg)))
|
||||||
|
{
|
||||||
|
console.log('in msg: ', msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gun._.on('out', function(msg) {
|
||||||
|
if (window.logGunOut &&
|
||||||
|
(typeof window.logGunOut !== 'function' ||
|
||||||
|
window.logGunOut(msg)))
|
||||||
|
{
|
||||||
|
console.log('out msg: ', msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function debug() {
|
||||||
|
if (window.logDebug) {
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.logGunIn = false;
|
||||||
|
window.logGunOut = false;
|
||||||
|
window.logDebug = false;
|
||||||
|
|
||||||
const PS = window.PacoSako;
|
const PS = window.PacoSako;
|
||||||
let currentGame = new PS.Game();
|
let currentGame = new PS.Game();
|
||||||
let visibleGame = new PS.Game(currentGame);
|
let visibleGame = new PS.Game(currentGame);
|
||||||
let cancelGameCallback = function() {};
|
let cancelGameCallback = function() {};
|
||||||
let cancelMetaCallback = function() {};
|
let cancelMetaCallback = function() {};
|
||||||
|
|
||||||
//function debug() { console.log.apply(console, arguments); }
|
|
||||||
function debug() {}
|
|
||||||
|
|
||||||
function pieceTypeCode(type) {
|
function pieceTypeCode(type) {
|
||||||
if (type === PS.KING) {
|
if (type === PS.KING) {
|
||||||
return 'k';
|
return 'k';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue