magic-akari/seamless-scroll-polyfill

TypeError: Can only call Performance.now on instances of Performance

stami opened this issue · 1 comments

stami commented

Hi, the latest version breaks on Safari browsers, and probably all others where the polyfill is used.

In the last commit, the optional chaining will probably be transpiled to some equivalent of the following example, that can be replicated in Safari console:

> performance.now()
// prints out the value

const myNow = performance.now
myNow()
// TypeError: Can only call Performance.now on instances of Performance

It crashes also on Chrome console with TypeError: Illegal invocation, but the polyfill won't get applied on Chrome...

The original pull request line runs fine as is:

(performance && performance.now ? performance : Date).now();

My bad. Thanks.