Skip to content
Prev Previous commit
Next Next commit
fixup! doc: add synchronous hooks proposal
Co-authored-by: Geoffrey Booth <[email protected]>
  • Loading branch information
joyeecheung and GeoffreyBooth authored Jul 1, 2024
commit a7fd7006fb247bab23cbbcd81f39f1e20fcae299
5 changes: 3 additions & 2 deletions doc/design/proposal-synchronous-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ Notes:
4. This may allow us to finally deprecate `Module.wrap` properly.
5. It may be useful to provide the computed extension in the context. An important use case is module format override (based on extensions?).

Example mock of pirates:
Example migration for Pirates:

```js
function addHook(hook, options) {
// Preserve Pirates’ existing public API where users call `addHook` to register a function
export function addHook(hook, options) {
function load(url, context, nextLoad) {
const loaded = nextLoad(url, context);
const index = url.lastIndexOf('.');
Expand Down