add message layer for backward compatibility
This commit is contained in:
Родитель
6c5559d3cb
Коммит
4604ee022d
|
@ -8,6 +8,7 @@ import './index.css';
|
|||
import * as messageBus from './messageBus';
|
||||
import * as rxjs from 'rxjs';
|
||||
import * as monacoAdapterImpl from './monacoAdapterImpl';
|
||||
import { CommandCancelledType, CommandFailedType, CommandSucceededType, SubmitCodeType } from '@microsoft/dotnet-interactive';
|
||||
|
||||
if (window) {
|
||||
|
||||
|
@ -29,7 +30,21 @@ if (window) {
|
|||
const kernel = factory.createWasmProjectKernel();
|
||||
const tdnEditor = new tryDotNetEditor.TryDotNetEditor(mainWindowMessageBus, kernel);
|
||||
|
||||
// for messaging api backward compatibility
|
||||
kernel.subscribeToKernelEvents((event) => {
|
||||
if ((event.eventType === CommandSucceededType || event.eventType == CommandFailedType || event.eventType == CommandCancelledType) && event.command?.commandType === SubmitCodeType) {
|
||||
window.postMessage({
|
||||
type: "NOTIFY_HOST_RUN_READY"
|
||||
}, '*');
|
||||
}
|
||||
});
|
||||
|
||||
tdnEditor.editor = new monacoAdapterImpl.MonacoEditorAdapter(editor);
|
||||
|
||||
window['trydotnetEditor'] = tdnEditor;
|
||||
|
||||
// for messaging api backward compatibility
|
||||
window.postMessage({
|
||||
type: "NOTIFY_HOST_EDITOR_READY"
|
||||
}, '*');
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче