mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-23 13:09:44 +02:00
chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 (#1228)
* chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 * actually apply the rules lol * rebuild --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <fabianlars@fabianlars.de>
This commit is contained in:
@@ -124,7 +124,7 @@ async function execute<O extends IOPayload>(
|
||||
const onEvent = new Channel<CommandEvent<O>>();
|
||||
onEvent.onmessage = onEventHandler;
|
||||
|
||||
return invoke<number>("plugin:shell|execute", {
|
||||
return await invoke<number>("plugin:shell|execute", {
|
||||
program,
|
||||
args,
|
||||
options,
|
||||
@@ -237,6 +237,7 @@ class EventEmitter<E extends Record<string, any>> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
removeAllListeners<N extends keyof E>(event?: N): this {
|
||||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
||||
if (event) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete,security/detect-object-injection
|
||||
delete this.eventListeners[event];
|
||||
@@ -354,7 +355,7 @@ class Child {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async write(data: IOPayload): Promise<void> {
|
||||
return invoke("plugin:shell|stdin_write", {
|
||||
await invoke("plugin:shell|stdin_write", {
|
||||
pid: this.pid,
|
||||
// correctly serialize Uint8Arrays
|
||||
buffer: typeof data === "string" ? data : Array.from(data),
|
||||
@@ -369,7 +370,7 @@ class Child {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async kill(): Promise<void> {
|
||||
return invoke("plugin:shell|kill", {
|
||||
await invoke("plugin:shell|kill", {
|
||||
cmd: "killChild",
|
||||
pid: this.pid,
|
||||
});
|
||||
@@ -512,7 +513,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async spawn(): Promise<Child> {
|
||||
return execute<O>(
|
||||
return await execute<O>(
|
||||
(event) => {
|
||||
switch (event.event) {
|
||||
case "Error":
|
||||
@@ -552,7 +553,7 @@ class Command<O extends IOPayload> extends EventEmitter<CommandEvents> {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async execute(): Promise<ChildProcess<O>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
return await new Promise((resolve, reject) => {
|
||||
this.on("error", reject);
|
||||
|
||||
const stdout: O[] = [];
|
||||
@@ -644,7 +645,7 @@ type CommandEvent<O extends IOPayload> =
|
||||
* @since 2.0.0
|
||||
*/
|
||||
async function open(path: string, openWith?: string): Promise<void> {
|
||||
return invoke("plugin:shell|open", {
|
||||
await invoke("plugin:shell|open", {
|
||||
path,
|
||||
with: openWith,
|
||||
});
|
||||
|
||||
@@ -5,27 +5,27 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
// open <a href="..."> links with the API
|
||||
function openLinks() {
|
||||
function openLinks(): void {
|
||||
document.querySelector("body")?.addEventListener("click", function (e) {
|
||||
let target = e.target as HTMLElement;
|
||||
let target: HTMLElement | null = e.target as HTMLElement;
|
||||
while (target != null) {
|
||||
if (target.matches("a")) {
|
||||
const t = target as HTMLAnchorElement;
|
||||
if (
|
||||
t.href &&
|
||||
t.href !== "" &&
|
||||
["http://", "https://", "mailto:", "tel:"].some((v) =>
|
||||
t.href.startsWith(v),
|
||||
) &&
|
||||
t.target === "_blank"
|
||||
) {
|
||||
invoke("plugin:shell|open", {
|
||||
void invoke("plugin:shell|open", {
|
||||
path: t.href,
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
}
|
||||
target = target.parentElement as HTMLElement;
|
||||
target = target.parentElement;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user