Loading topic
setTimeout and clearTimeout, and how to attach a DOM event listener. You will build a trailing-edge debounce. That is a wrapper that waits until calls stop arriving, then runs the wrapped function once.2 min readthis is set at call time, rest parameters, and Function.prototype.apply. It also builds on the trailing-edge debounce from the previous chapter.2 min readsetTimeout, DOM event listeners, rest parameters, and Function.prototype.apply. It also assumes you have built the trailing-edge debounce from the earlier chapter. In this chapter you build a throttle that uses a stored timestamp in place of a timer.2 min readdebounce and timestamp-based throttle functions from the earlier chapters. You should also understand how setTimeout schedules work on the event loop. Here the question is which of the two to use for a given event.2 min readsetTimeout/clearTimeout, and fn.apply(this, args).2 min readsetTimeout, clearTimeout, and Function.prototype.apply.3 min readthis and the arguments with fn.apply(this, args). It also assumes you are comfortable with closures and clearTimeout.2 min readsetTimeout and clearTimeout work and how fn.apply(this, args) passes on context and arguments.2 min readthis and arguments. You should also know roughly how the browser event loop schedules rendering.2 min readtest, expect, and jest.fn(). It also assumes you have the trailing-edge debounce and the timestamp-based throttle from earlier chapters.2 min readcancel and flush, and maxWait from earlier chapters. It also assumes you can install npm packages and use either import or require.2 min readuseState, useMemo, useEffect, and useRef hooks, and the Lodash debounce function with its cancel method from the previous chapter.2 min read