simplify filter expression for GUN message logging
This commit is contained in:
parent
d329f005da
commit
d37cb4a67f
|
|
@ -10,19 +10,17 @@ $(function (){
|
||||||
peers: ['https://jessemcdonald.info/gun'],
|
peers: ['https://jessemcdonald.info/gun'],
|
||||||
});
|
});
|
||||||
|
|
||||||
gun._.on('in', function(msg) {
|
gun.on('in', function(msg) {
|
||||||
if (window.logGunIn &&
|
const filter = window.logGunIn;
|
||||||
(typeof window.logGunIn !== 'function' ||
|
if (filter && ((typeof filter !== 'function') || filter(msg)))
|
||||||
window.logGunIn(msg)))
|
|
||||||
{
|
{
|
||||||
console.log('in msg: ', msg);
|
console.log('in msg: ', msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gun._.on('out', function(msg) {
|
gun.on('out', function(msg) {
|
||||||
if (window.logGunOut &&
|
const filter = window.logGunOut;
|
||||||
(typeof window.logGunOut !== 'function' ||
|
if (filter && ((typeof filter !== 'function') || filter(msg)))
|
||||||
window.logGunOut(msg)))
|
|
||||||
{
|
{
|
||||||
console.log('out msg: ', msg);
|
console.log('out msg: ', msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue