rksm / paredit.js

Generic reader and editor for s-expressions.
MIT License
107 stars 21 forks source link

Await `Promise.all` for parallel module loading #23

Closed thepeoplesbourgeois closed 4 years ago

thepeoplesbourgeois commented 4 years ago

Noticed that this process would be blocked in the for loop as each module being loaded was awaited in sequence, thought I'd suggest getting the promises back from reload() via map so that the modules could be loaded in parallel and the function could finish when await Promise.all completed.

Not sure if this breaks the function or not; not a Paredit user, just arrived here as I traversed down a rabbit hole from Gitlab's Web IDE documentation page

rksm commented 4 years ago

Thank you for the suggestion and welcome to the bottom of the stack :)

Making the loading parallel would break paredit as index.js defines window.paredit (https://github.com/rksm/paredit.js/blob/master/index.js#L9) and the other modules expect the global to be present.