Fixed typo

This commit is contained in:
inaseem 2021-11-02 17:53:01 +05:30
parent f3172ca397
commit 5aab10c613
3 changed files with 17 additions and 16 deletions

View File

@ -1,4 +1,5 @@
import MonacoEditor from "@monaco-editor/react"; import MonacoEditor from "@monaco-editor/react";
import { import {
createConnection, createConnection,
MonacoLanguageClient, MonacoLanguageClient,
@ -36,7 +37,7 @@ const RijuEditor = (props) => {
} }
}); });
() => { () => {
EventEmitter.unsubcribe(token1, token2); EventEmitter.unsubscribe(token1, token2);
if (clientDisposable) { if (clientDisposable) {
clientDisposable.dispose(); clientDisposable.dispose();
clientDisposable = null; clientDisposable = null;
@ -58,16 +59,16 @@ const RijuEditor = (props) => {
// const newURI = `file://${message.root}/${config.main}`; // const newURI = `file://${message.root}/${config.main}`;
// const oldModel = editor.getModel(); // const oldModel = editor.getModel();
// if (oldModel.uri.toString() !== newURI) { // if (oldModel.uri.toString() !== newURI) {
// This code is likely to be buggy as it will probably // // This code is likely to be buggy as it will probably
// never run and has thus never been tested. // // never run and has thus never been tested.
// editor.setModel( // editor.setModel(
// monaco.editor.createModel( // monaco.editor.createModel(
// oldModel?.getValue(), // oldModel?.getValue(),
// undefined, // undefined,
// monaco.Uri.parse(newURI) // monaco.Uri.parse(newURI)
// ) // )
// ); // );
// oldModel.dispose(); // oldModel.dispose();
// } // }
const connection = createMessageConnection( const connection = createMessageConnection(

View File

@ -42,7 +42,7 @@ function RijuTerminal() {
EventEmitter.dispatch("send", { event: "terminalInput", input: data }); EventEmitter.dispatch("send", { event: "terminalInput", input: data });
}); });
() => EventEmitter.unsubcribe(token1, token2); () => EventEmitter.unsubscribe(token1, token2);
}, []); }, []);
return ( return (

View File

@ -15,11 +15,11 @@ export const EventEmitter = {
this.events[event][token] = callback; this.events[event][token] = callback;
return token; return token;
}, },
unsubcribe: function (...tokens) { unsubscribe: function (...tokens) {
for (let k of Object.keys(events)) { for (let k of Object.keys(this.events)) {
let toks = Object.keys(events[k]); let toks = Object.keys(this.events[k]);
for (let tok of toks) { for (let tok of toks) {
if (tokens.includes(tok)) delete events[k][tok]; if (tokens.includes(tok)) delete this.events[k][tok];
} }
} }
}, },