mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 04:46:10 +01:00
19 lines
337 B
JavaScript
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
|
|
}
|