restriction

The restriction of term.
This project has been created by Vessel CLI.
For a simple and quick reference about it, click here.
About
νλ‘μ νΈ κ°λ°μ μ¬μ©λλ λͺ¨λλ€μ λν΄ μ§ν©μ μΈ ννλ‘ μ 곡λλ ν¨ν€μ§.
Installation
ν΄λΉ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ© ν νλ‘μ νΈμμλ μλμ κ°μ΄ μμ‘΄μ± λͺ¨λλ‘ μ€μΉνλ€.
$ npm install --save restriction
or
$ yarn add restriction
Modules in the package
λ³Έ ν¨ν€μ§μλ μλμ κ°μ λͺ¨λλ€μ ν¬ν¨νλ€.
μ 곡λλ λͺ¨λκ³Ό λ©μλ μ¬μ©λ² λ±μ μ½λ μ€λνμ μ°Έκ³ νλ€.
Restriction module
μν λͺ¨λμ λ€μκ³Ό κ°μ λ©μλλ€μ μ 곡νλ€.
debounce
μ°μμ μΈ λΉ λ₯Έ μ΄λ²€νΈ μ½λ°±λ€μ μ μ½μ κ±Έμ΄ μ΄λ²€νΈ νΈμΆ νμλ₯Ό κ°μμν¨λ€.
type AnyFunction = (...args: any[]) => any;
type DebounceOption = {
ms?: number; // milliseconds
immediate?: boolean; // debounce μ€ν μ¦μ λ°μμ¬λΆ
};
type DebouncedFunction<F extends AnyFunction> = {
handler(...args: Parameters<F>): void;
stop(): void;
};
function debounce<F extends AnyFunction>(
callback: F,
debounceOption?: DebounceOption,
): DebouncedFunction<F> {}
throttle
μ°μμ μΈ λΉ λ₯Έ μ΄λ²€νΈ μ½λ°±λ€μ μ μ½μ κ±Έμ΄ μΌμ μ£ΌκΈ°λ§λ€ νΈμΆνλλ‘ νλ€.
type AnyFunction = (...args: any[]) => any;
type ThrottleOption = {
ms?: number; // milliseconds
immediate?: boolean; // throttle μ€ν μ¦μ λ°μμ¬λΆ
};
type ThrottledFunction<F extends AnyFunction> = {
handler(...args: Parameters<F>): void;
stop(): void;
};
function throttle<F extends AnyFunction>(
callback: F,
throttleOption?: ThrottleOption,
): ThrottledFunction<F> {}
Change Log
νλ‘μ νΈ λ³κ²½μ¬νμ CHANGELOG.md νμΌ μ°Έμ‘°.
License
νλ‘μ νΈ λΌμ΄μΌμ€λ LICENSE νμΌ μ°Έμ‘°.