echo icon indicating copy to clipboard operation
echo copied to clipboard

root.addEventListener is not a function

Open mr-xiao opened this issue 6 years ago • 4 comments

root.addEventListener is not a function

mr-xiao avatar Apr 03 '18 06:04 mr-xiao

I'm also running into this issue when I am updating my app to use Webpack. I am using the ES6 import to include the npm package I installed.

import echo from "echo-js";

kentjas1 avatar Apr 23 '18 13:04 kentjas1

Also got this issue not using es6 import but with webpack

zlokomatic avatar Nov 13 '18 14:11 zlokomatic

Hi @zlokomatic @kentjas1 I have the same issue with webpack. What is the solution ?

pierre-dickinson avatar Feb 22 '20 15:02 pierre-dickinson

@pierre-dickinson It's probably due to this and webpack bundling in 'strict mode' as this may be undefined and therefore throw an error as addEventListener won't exist:

https://github.com/toddmotto/echo/blob/master/dist/echo.js#L12

You can change the this to window and that should solve it.

toddmotto avatar Feb 22 '20 16:02 toddmotto