Closed SumukhPrasad closed 4 months ago
Do you know what this
refers to in these contexts? Is in null, undefined, or some other object?
Is in null, undefined, or some other object?
In this context it actually ends up being undefined.
Thanks. In that case I'll use this || window
since there are non-browser enviornments where window
doesn't exist and we need this
. I've committed 824d8331cc4b72c09ca3e0f1b3a6ed7914cf16c6 which makes this change in both JS-Interpreter and Acorn.
We may need to revisit this issue in the future if people find more exotic environments. Here's what claims to be a complete solution:
https://mathiasbynens.be/notes/globalthis
I'm hopeful that in the real world the growing prevalence of globalThis
will make this issue fade away.
Here's what claims to be a complete solution: https://mathiasbynens.be/notes/globalthis
Wow, that is both impressive and appalling in equal measure.
Changed line 190 in interpreter.js to fix a bug with "this" not referring to the browser in Svelte-based npm contexts.