Skip to content

Commit

Permalink
Import modules in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Mar 30, 2021
1 parent a60d462 commit 48f044d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions extension/data/es6compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
// themselves. Note that these values are only guaranteed to be available
// after the document receives the `esCompatReady` event.
(async () => {
window.TBApi = await import(browser.runtime.getURL('data/tbapi.js'));
window.TBui = await import(browser.runtime.getURL('data/tbui.js'));
const [
TBApi,
TBui,
] = await Promise.all([
import(browser.runtime.getURL('data/tbapi.js')),
import(browser.runtime.getURL('data/tbui.js')),
]);

window.TBApi = TBApi;
window.TBui = TBui;

window.document.dispatchEvent(new CustomEvent('esCompatReady'));
})();

0 comments on commit 48f044d

Please sign in to comment.