Make repl hooks optional (#1310)

`beforeByReplExec()` and `afterPyReplExec()` only called if they exist on a plugin
This commit is contained in:
Jeff Glass
2023-03-27 09:20:58 -05:00
committed by GitHub
parent e7c3b7bcfe
commit 03c79d5f2f

View File

@@ -189,13 +189,13 @@ export class PluginManager {
}
beforePyReplExec(options: { interpreter: InterpreterClient; src: string; outEl: HTMLElement; pyReplTag: any }) {
for (const p of this._plugins) p.beforePyReplExec(options);
for (const p of this._plugins) p.beforePyReplExec?.(options);
for (const p of this._pythonPlugins) p.beforePyReplExec?.callKwargs(options);
}
afterPyReplExec(options: { interpreter: InterpreterClient; src: string; outEl; pyReplTag; result }) {
for (const p of this._plugins) p.afterPyReplExec(options);
for (const p of this._plugins) p.afterPyReplExec?.(options);
for (const p of this._pythonPlugins) p.afterPyReplExec?.callKwargs(options);
}