Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The function after throttle does not respect this like debounce #1470

@rod24574575

Description

@rod24574575
import { debounce, throttle } from "https://esm.sh/es-toolkit";

const obj = {
  msg: 'hello world',
  logWithDebounce: debounce(function () {
    console.log(this?.msg);
  }, 100),
  logWithThrottle: throttle(function () {
    console.log(this?.msg);
  }, 100),
};

obj.logWithDebounce();  // 'hello world'
obj.logWithThrottle();  // undefined

https://codepen.io/rod24574575/pen/dPGZXop?editors=1111

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions