1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/lib/createDnodeRemoteGetter.js
2020-02-15 17:04:21 -03:30

19 lines
337 B
JavaScript

export default createDnodeRemoteGetter
function createDnodeRemoteGetter (dnode) {
let remote
dnode.once('remote', (_remote) => {
remote = _remote
})
async function getRemote () {
if (remote) {
return remote
}
return await new Promise((resolve) => dnode.once('remote', resolve))
}
return getRemote
}