Skip to content

Commit

Permalink
Pass element to the JS preEvaluate renderer hook
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Sep 14, 2022
1 parent 39d13fe commit 4f706ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/notebook-renderers/src/index.ts
Expand Up @@ -25,7 +25,7 @@ interface JavaScriptRenderingHook {
*
* @return A new string of JavaScript or `undefined` to continue using the provided string.
*/
preEvaluate(outputItem: OutputItem, element: string, signal: AbortSignal): string | undefined | Promise<string | undefined>;
preEvaluate(outputItem: OutputItem, element: HTMLElement, script: string, signal: AbortSignal): string | undefined | Promise<string | undefined>;
}

function clearContainer(container: HTMLElement) {
Expand Down Expand Up @@ -103,7 +103,7 @@ async function renderJavascript(outputInfo: OutputItem, container: HTMLElement,
let scriptText = outputInfo.text();

for (const hook of hooks) {
scriptText = (await hook.preEvaluate(outputInfo, scriptText, signal)) ?? scriptText;
scriptText = (await hook.preEvaluate(outputInfo, container, scriptText, signal)) ?? scriptText;
if (signal.aborted) {
return;
}
Expand Down

0 comments on commit 4f706ca

Please sign in to comment.