Skip to content

Commit

Permalink
Remove ctx.disableToast() and ctx.enableToast() which were introduced…
Browse files Browse the repository at this point in the history
… in #636 because the `disableProgressToasts` and `disableErrorToasts` options play the same role
  • Loading branch information
whitphx committed Jan 17, 2024
1 parent b1472ec commit 6f3d94a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/mountable/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,27 @@ export function mount(
);

const kernelWithToast = new StliteKernelWithToast(kernel);
let currentKernel: StliteKernel | StliteKernelWithToast = kernelWithToast;

return {
unmount: () => {
kernel.dispose();
ReactDOM.unmountComponentAtNode(container);
},
install: (requirements: string[]) => {
return currentKernel.install(requirements);
return kernelWithToast.install(requirements);
},
writeFile: (
path: string,
data: string | ArrayBufferView,
opts?: Record<string, any>
) => {
return currentKernel.writeFile(path, data, opts);
return kernelWithToast.writeFile(path, data, opts);
},
renameFile: (oldPath: string, newPath: string) => {
return currentKernel.renameFile(oldPath, newPath);
return kernelWithToast.renameFile(oldPath, newPath);
},
unlink: (path: string) => {
return currentKernel.unlink(path);
},
enableToast: (): void => {
currentKernel = kernelWithToast;
},
disableToast: (): void => {
currentKernel = kernel;
return kernelWithToast.unlink(path);
},
};
}
Expand Down

0 comments on commit 6f3d94a

Please sign in to comment.