From 0a27dfe259d498459f90f60899dc2f2b06766eeb Mon Sep 17 00:00:00 2001 From: Bryan Lee <38807139+liby@users.noreply.github.com> Date: Wed, 9 Nov 2022 10:07:39 +0800 Subject: [PATCH] :rotating_light: use `// @ts-check` in a JavaScript file [Type Checking JavaScript Files](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html) --- src-tauri/src/pake.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/pake.js b/src-tauri/src/pake.js index ca1b9d7..c089e21 100644 --- a/src-tauri/src/pake.js +++ b/src-tauri/src/pake.js @@ -1,3 +1,5 @@ +// @ts-check + /** * @typedef {string} KeyboardKey `event.key` 的代号, * 见 @@ -117,11 +119,11 @@ window.addEventListener('DOMContentLoaded', (_event) => { } }); - domEl.addEventListener('touchstart', (e) => { + domEl.addEventListener('touchstart', () => { window.ipc.postMessage('drag_window'); }); - domEl.addEventListener('dblclick', (e) => { + domEl.addEventListener('dblclick', () => { window.ipc.postMessage('fullscreen'); }); @@ -154,6 +156,9 @@ function setDefaultZoom() { } } +/** + * @param {(htmlZoom: string) => string} [zoomRule] + */ function zoomCommon(zoomRule) { const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%'; const html = document.getElementsByTagName('html')[0];