Refs: https://github.com/nodejs/node/pull/43363#discussion_r894366025 PR-URL: https://github.com/nodejs/node/pull/43374 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
10 lines
273 B
JavaScript
10 lines
273 B
JavaScript
export function load(url, context, next) {
|
|
let thenAlreadyAccessed = false;
|
|
return {
|
|
get then() {
|
|
if (thenAlreadyAccessed) throw new Error('must not call');
|
|
thenAlreadyAccessed = true;
|
|
return (resolve) => resolve(next(url, context));
|
|
}
|
|
};
|
|
}
|