Merge pull request #1088 from lightpanda-io/nonblocking_dynamic_imports

nonblocking dynamic imports
This commit is contained in:
Karl Seguin
2025-09-30 12:30:31 +08:00
committed by GitHub
6 changed files with 376 additions and 76 deletions

View File

@@ -5,15 +5,28 @@
<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('world', res[2].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>