mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
unhardcode pty-data event name
This commit is contained in:
parent
6f0865efda
commit
326f57820d
3 changed files with 5 additions and 7 deletions
|
|
@ -33,11 +33,7 @@ service LauncherService {
|
|||
// TODO: this should not be necessary
|
||||
service BackendLauncherService {}
|
||||
|
||||
// TODO: codegen
|
||||
enum Event {
|
||||
TERM_INPUT = 0;
|
||||
WINDOWS_READY = 1;
|
||||
}
|
||||
enum Event { PTY_DATA = 0; }
|
||||
|
||||
message I18nResourcesRequest {
|
||||
repeated string modules = 1;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use anki_proto::launcher::get_mirrors_response;
|
|||
use anki_proto::launcher::state::Kind as StateProtoKind;
|
||||
use anki_proto::launcher::ChooseVersionRequest;
|
||||
use anki_proto::launcher::ChooseVersionResponse;
|
||||
use anki_proto::launcher::Event;
|
||||
use anki_proto::launcher::GetLangsResponse;
|
||||
use anki_proto::launcher::GetMirrorsResponse;
|
||||
use anki_proto::launcher::I18nResourcesRequest;
|
||||
|
|
@ -184,7 +185,7 @@ pub async fn choose_version<R: Runtime>(
|
|||
|
||||
let version = input.version;
|
||||
let on_pty_data = move |data| {
|
||||
let _ = app.emit("pty-data", data);
|
||||
let _ = app.emit(Event::PtyData.as_str_name(), data);
|
||||
};
|
||||
|
||||
if !input.keep_existing || paths.pyproject_modified_by_user {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import { Terminal } from "@xterm/xterm";
|
||||
import { WebglAddon } from "@xterm/addon-webgl";
|
||||
import "@xterm/xterm/css/xterm.css";
|
||||
import { Event as BackendEvent } from "@generated/anki/launcher_pb";
|
||||
|
||||
let {
|
||||
term = $bindable(),
|
||||
|
|
@ -41,7 +42,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
console.log("WebGL addon threw an exception during load", e);
|
||||
}
|
||||
|
||||
const unlisten = listen<string>("pty-data", (e) => {
|
||||
const unlisten = listen<string>(BackendEvent[BackendEvent.PTY_DATA], (e) => {
|
||||
const data = protoBase64.dec(e.payload);
|
||||
open = true;
|
||||
term!.write(data);
|
||||
|
|
|
|||
Loading…
Reference in a new issue