• 0 Posts
  • 32 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle















  • If you use JavaScript, you’ve probably seen a monad, since Promise is a monad. Unit is Promise.resolve(), bind is Promise.then(). As required, Promise.resolve(x).then(y) === y(x) (unit forms a left identity of bind), y.then(Promise.resolve) === y (unit forms a right identity of bind), and x.then(y.then(z)) === x.then(y).then(z) (bind is essentially associative).

    You even have the equivalent of Haskell’s fancy do-notation (a form of syntactic sugar to save writing unit and bind all over the place) in the form of async/await. It’s just not generalized the way it is in Haskell.


  • Rather than messing with the EventListener, wouldn’t it be easier to just throttle the function that it calls? You can find a bunch of articles online that will explain how to implement a throttle (and also a debouncer, which is similar, but not quite what you’re looking for; a throttle allows a function to be called immediately unless it’s already been called too recently, while a debouncer waits every time before calling the function and restarts the wait timer every time someone tried to call the function).



  • Check what your testing organization is using first. We’re using Selenium at work, except for one small team that used Cypress because they couldn’t be bothered to find out what the test of us were using, so now that team is faced with either maintaining their own version of the CI pipeline and their own tooling (and not having anyone to ask for advice) or rewriting all of their tests. Not an enjoyable choice to have to make.