Closed OzySky closed 4 years ago
@OzySky Are you sure this is the cause of your bug? What JS environment are you using?
let bar = false;
let foo = bar == null ? true : bar;
In both the browser and in Node.js (v11) foo
is false.
AFAIK, only null
and undefined
are loosely equal to null
. A lot of linters allow for myVar == null
for this reason.
So it means I'm setting disconnectOnUnload back to undefined somewhere. Closing this and going back to the debugger. Sorry :)
change to a strict equality check against undefined.
This fixes a really annoying bug with the current implementation. Currently we check to see if disconnectOnUnload is undefined by comparing to null. But because we are using loose equality check, this means disconnectOnUnload will always evaluate to true, because false is also loosely equal to null! This is really annoying as it will always call the handler, even when disconnectOnUnload is set to false. Drove me crazy trying to find the source of the problem