sindresorhus/screenfull

why my screenfull.off looks not work?

vbird-coder opened this issue · 1 comments

image
it is not console.log when i leave this page
vue version:2.6.0
screen full : 5.0.0

It's because you are using anonymous functions. When an anonymous function passed or executed it has a unique ID associated with it. Irrespective of how many times you use the same anonymous function it will have different ID. A named function tends to preserve its ID with means it can be fetched my the screenfull.off function and then background process can act on it.

HINT: screenfull.off inherits all from element.removeEventListener which means it works the same!