On the problem of transmitting anonymous functions by requestAnimationFrame

fragment A

const moveHandler = function() {
  // do something...
}

dom.addEventListener("mousemove", function() {
  window.requestAnimationFrame(moveHandler)
})

is there any difference between the two writing methods? This is the problem I encountered when dragging a dom effect

Sep.10,2021

    In
  1. fragment A, you can use document.removeEventListener remove to drop the moveHandler event, but fragment B cannot;
  2. requestAnimationFrame whether it is an anonymous function or passing in a specific method, there is no difference

personally, I think it is more recommended to write segment A:

1. removeEventListener
2. 
3.  -- 

in terms of the effect achieved, there is no difference

Menu