Compare commits

...

6 Commits

Author SHA1 Message Date
81d208b964 default 2025-08-01 00:14:45 +07:00
4590d0924f default 2025-08-01 00:14:21 +07:00
cef9bf9b97 i am dolboeb 2025-07-08 23:47:46 +07:00
4ae317e36d i am dolboeb 2025-07-08 23:46:57 +07:00
e8f1f534be i am a dumbass 2025-07-08 23:14:40 +07:00
69cb4416f2 i am a dumbass 2025-07-08 23:14:13 +07:00
2 changed files with 6 additions and 6 deletions

View File

@@ -33,4 +33,4 @@
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/export function damper(e,p=300,t){let s;return(...i)=>new Promise(((r,u)=>{clearTimeout(s),"number"==typeof t&&i[t]?("number"==typeof t&&(i=[...i.splice(0,t),...i.splice(t+1)]),i.push(r,u),e.apply(this,i)):("number"==typeof t&&(i=[...i.splice(0,t),...i.splice(t+1)]),i.push(r,u),s=setTimeout((()=>e.apply(this,i)),p))}))}
*/export default function damper(e,p=300,t){let s;return(...i)=>new Promise(((r,u)=>{clearTimeout(s),"number"==typeof t&&i[t]?("number"==typeof t&&(i=[...Array.from(i).splice(0,t),...Array.from(i).splice(t + 1)]),i.push(r,u),e.apply(this,i)):("number"==typeof t&&(i=[...Array.from(i).splice(0,t),...Array.from(i).splice(t + 1)]),i.push(r,u),s=setTimeout((()=>e.apply(this,i)),p))}))}

View File

@@ -35,7 +35,7 @@
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
export function damper(func, timeout = 300, force) {
export default function damper(func, timeout = 300, force) {
// Declaring the timer for executing the function
let timer;
@@ -49,8 +49,8 @@ export function damper(func, timeout = 300, force) {
// Deleting the force argument
if (typeof force === "number") args = [
...args.splice(0, force),
...args.splice(force + 1)
...Array.from(args).splice(0, force),
...Array.from(args).splice(force + 1)
];
// Writing promise handlers into the arguments variable
@@ -63,8 +63,8 @@ export function damper(func, timeout = 300, force) {
// Deleting the force argument
if (typeof force === "number") args = [
...args.splice(0, force),
...args.splice(force + 1)
...Array.from(args).splice(0, force),
...Array.from(args).splice(force + 1)
];
// Writing promise handlers into the arguments variable