didDisconnect util
This commit is contained in:
parent
e7610ebc24
commit
db884955fe
1 changed files with 18 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
const { getUser, mySEA: SEA } = require('../../Mediator')
|
const { getUser, mySEA: SEA, getGun } = require('../../Mediator')
|
||||||
const ErrorCode = require('../errorCode')
|
const ErrorCode = require('../errorCode')
|
||||||
const Key = require('../key')
|
const Key = require('../key')
|
||||||
|
|
||||||
|
|
@ -288,6 +288,21 @@ const dataHasSoul = listenerData =>
|
||||||
*/
|
*/
|
||||||
const defaultName = pub => 'anon' + pub.slice(0, 8)
|
const defaultName = pub => 'anon' + pub.slice(0, 8)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} pub
|
||||||
|
* @param {string} incomingID
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
const didDisconnect = async (pub, incomingID) => {
|
||||||
|
const feed = await getGun()
|
||||||
|
.user(pub)
|
||||||
|
.get(Key.OUTGOINGS)
|
||||||
|
.get(incomingID)
|
||||||
|
.then()
|
||||||
|
|
||||||
|
return feed === null
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
asyncMap,
|
asyncMap,
|
||||||
asyncFilter,
|
asyncFilter,
|
||||||
|
|
@ -303,5 +318,6 @@ module.exports = {
|
||||||
currHandshakeAddress,
|
currHandshakeAddress,
|
||||||
tryAndWait,
|
tryAndWait,
|
||||||
mySecret,
|
mySecret,
|
||||||
promisifyGunNode: require('./promisifygun')
|
promisifyGunNode: require('./promisifygun'),
|
||||||
|
didDisconnect
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue