mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -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
|
// TODO: this should not be necessary
|
||||||
service BackendLauncherService {}
|
service BackendLauncherService {}
|
||||||
|
|
||||||
// TODO: codegen
|
enum Event { PTY_DATA = 0; }
|
||||||
enum Event {
|
|
||||||
TERM_INPUT = 0;
|
|
||||||
WINDOWS_READY = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message I18nResourcesRequest {
|
message I18nResourcesRequest {
|
||||||
repeated string modules = 1;
|
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::state::Kind as StateProtoKind;
|
||||||
use anki_proto::launcher::ChooseVersionRequest;
|
use anki_proto::launcher::ChooseVersionRequest;
|
||||||
use anki_proto::launcher::ChooseVersionResponse;
|
use anki_proto::launcher::ChooseVersionResponse;
|
||||||
|
use anki_proto::launcher::Event;
|
||||||
use anki_proto::launcher::GetLangsResponse;
|
use anki_proto::launcher::GetLangsResponse;
|
||||||
use anki_proto::launcher::GetMirrorsResponse;
|
use anki_proto::launcher::GetMirrorsResponse;
|
||||||
use anki_proto::launcher::I18nResourcesRequest;
|
use anki_proto::launcher::I18nResourcesRequest;
|
||||||
|
|
@ -184,7 +185,7 @@ pub async fn choose_version<R: Runtime>(
|
||||||
|
|
||||||
let version = input.version;
|
let version = input.version;
|
||||||
let on_pty_data = move |data| {
|
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 {
|
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 { Terminal } from "@xterm/xterm";
|
||||||
import { WebglAddon } from "@xterm/addon-webgl";
|
import { WebglAddon } from "@xterm/addon-webgl";
|
||||||
import "@xterm/xterm/css/xterm.css";
|
import "@xterm/xterm/css/xterm.css";
|
||||||
|
import { Event as BackendEvent } from "@generated/anki/launcher_pb";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
term = $bindable(),
|
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);
|
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);
|
const data = protoBase64.dec(e.payload);
|
||||||
open = true;
|
open = true;
|
||||||
term!.write(data);
|
term!.write(data);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue