1
0
Fork 0
mirror of https://github.com/kou029w/quot.git synced 2025-01-31 06:18:01 +00:00
This commit is contained in:
Nebel 2022-09-01 10:03:59 +09:00
parent 3cd4337c04
commit a137a0a5c0
2 changed files with 2 additions and 4 deletions

View file

@ -1,6 +1,6 @@
function throttle<Fn extends (...args: any[]) => any>( function throttle<Fn extends (...args: any[]) => any>(
fn: Fn, fn: Fn,
ms: number ms: number = 333
): (...args: Parameters<Fn>) => void { ): (...args: Parameters<Fn>) => void {
let throttledFn = () => undefined; let throttledFn = () => undefined;
let throttled: boolean = false; let throttled: boolean = false;

View file

@ -4,7 +4,6 @@ import Editor from "../components/editor";
import beforeunload from "../helpers/beforeunload"; import beforeunload from "../helpers/beforeunload";
import throttle from "../helpers/throttle"; import throttle from "../helpers/throttle";
const intervalMs = 333;
const { block, unblock } = beforeunload(); const { block, unblock } = beforeunload();
async function updatePage( async function updatePage(
@ -50,8 +49,7 @@ export default (props: { id: number }) => {
`/${content.text ? id.toString(16) : "new"}` `/${content.text ? id.toString(16) : "new"}`
); );
} }
}, }
intervalMs
); );
function onUpdatePage(content: Pages.RequestContentPage) { function onUpdatePage(content: Pages.RequestContentPage) {