Skip to content

Commit

Permalink
style: code format
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Feb 24, 2025
1 parent 3f10681 commit 4b56ac4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const App = () => {
};
}, []);

// Handle shell window visibility changed event
// Handle shell window visibility changed event
React.useEffect(() => {
const onWindowVisibilityChanged = (state) => {
setWindowHidden(state.visible === false && state.visibility === 0);
Expand Down
20 changes: 9 additions & 11 deletions src/common/useShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ type ShellEvent = {
args: string[];
};



const createId = () => Math.floor(Math.random() * 9999) + 1;

const useShell = () => {
const on = (name: string, listener: (arg: any) => void) => {
events.on(name, listener);
};

const off = (name: string, listener: (arg: any) => void) => {
events.off(name, listener);
};

const send = (method: string, ...args: (string | number)[]) => {
try {
transport?.send(JSON.stringify({
Expand All @@ -31,19 +37,11 @@ const useShell = () => {
method: 'onEvent',
args: [method, ...args],
}));
} catch(e) {
} catch (e) {
console.error('Shell', 'Failed to send event', e);
}
};

const on = (name: string, listener: (arg: any) => void) => {
events.on(name, listener);
};

const off = (name: string, listener: (arg: any) => void) => {
events.off(name, listener);
};

useEffect(() => {
if (!transport) return;

Expand Down
2 changes: 1 addition & 1 deletion src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ declare global {
var qt: Qt | undefined;
}

export {}
export {};

0 comments on commit 4b56ac4

Please sign in to comment.