1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 10:30:04 +01:00
metamask-extension/app/scripts/lib/createDnodeRemoteGetter.js

19 lines
337 B
JavaScript
Raw Normal View History

export default createDnodeRemoteGetter
function createDnodeRemoteGetter (dnode) {
let remote
dnode.once('remote', (_remote) => {
remote = _remote
})
async function getRemote () {
if (remote) {
return remote
}
2020-02-15 21:34:12 +01:00
return await new Promise((resolve) => dnode.once('remote', resolve))
}
return getRemote
}