SyncMessage support for asynchronous listeners.

This commit is contained in:
hackademix 2019-10-01 22:46:43 +02:00
parent 0940fc84b3
commit 958bfba66c
1 changed files with 2 additions and 3 deletions

View File

@ -82,10 +82,9 @@
console.error(e, "Processing message %o from %o", msg, sender);
}
}
return {
redirectUrl: `data:application/json,${JSON.stringify(result)}`
};
return result instanceof Promise ? (async () => ret(await result)) : ret(result);
};
let ret = r => ({redirectUrl: `data:application/json,${JSON.stringify(r)}`})
let listeners = new Set();
browser.runtime.onSyncMessage = {