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'],
|
||||
});
|
||||
|
||||
gun._.on('in', function(msg) {
|
||||
if (window.logGunIn &&
|
||||
(typeof window.logGunIn !== 'function' ||
|
||||
window.logGunIn(msg)))
|
||||
gun.on('in', function(msg) {
|
||||
const filter = window.logGunIn;
|
||||
if (filter && ((typeof filter !== 'function') || filter(msg)))
|
||||
{
|
||||
console.log('in msg: ', msg);
|
||||
}
|
||||
});
|
||||
|
||||
gun._.on('out', function(msg) {
|
||||
if (window.logGunOut &&
|
||||
(typeof window.logGunOut !== 'function' ||
|
||||
window.logGunOut(msg)))
|
||||
gun.on('out', function(msg) {
|
||||
const filter = window.logGunOut;
|
||||
if (filter && ((typeof filter !== 'function') || filter(msg)))
|
||||
{
|
||||
console.log('out msg: ', msg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue