Files
browser/src/tests/html/script/dynamic_import.html
Karl Seguin b692c5db60 nonblocking dynamic imports
Allows dynamic imports to be loading asynchronously. I know reddit isnt the
best example, since it doesn't fully load, but this reduced the load time from
~7.2s to ~4.8s.
2025-09-24 22:28:22 +08:00

33 lines
1005 B
HTML

<!DOCTYPE html>
<script src="../../testing.js"></script>
<script id=dynamic_import type=module>
const promise1 = new Promise((resolve) => {
Promise.all([
import('./import.js'),
import('./import.js'),
import('./import.js'),
import('./import.js'),
import('./import.js'),
import('./import.js'),
import('./import2.js'),
import('./import.js'),
import('./import.js'),
]).then(resolve);
});
testing.async(promise1, (res) => {
testing.expectEqual(9, res.length);
testing.expectEqual('hello', res[0].greeting);
testing.expectEqual('hello', res[1].greeting);
testing.expectEqual('hello', res[2].greeting);
testing.expectEqual('hello', res[3].greeting);
testing.expectEqual('hello', res[4].greeting);
testing.expectEqual('hello', res[5].greeting);
testing.expectEqual('world', res[6].greeting);
testing.expectEqual('hello', res[7].greeting);
testing.expectEqual('hello', res[8].greeting);
});
</script>