simplify filter expression for GUN message logging

This commit is contained in:
Jesse D. McDonald 2020-03-30 00:05:48 -05:00
parent d329f005da
commit d37cb4a67f
1 changed files with 6 additions and 8 deletions

View File

@ -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);
}