mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
Make repl hooks optional (#1310)
`beforeByReplExec()` and `afterPyReplExec()` only called if they exist on a plugin
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user