diepAPI icon indicating copy to clipboard operation
diepAPI copied to clipboard

Questioning use of _window

Open Cazka opened this issue 3 years ago • 2 comments

We are using the variable _window instead of window to reference the global object.

Using this one liner, we make sure that _window is referencing the real global object.

const _window = 'undefined' == typeof unsafeWindow ? window : unsafeWindow;

Problem is that this one liner is not included in the library and have to be placed manually.

Is it possible to include that one liner in the src folder so that it is included in the built library?

Cazka avatar Oct 02 '22 19:10 Cazka

we could also overwrite window to unsafeWindow at the start of the userscript.

if("undefined" != typeof unsafeWindow) {
    //trust me bro
    window = unsafeWindow;
}

this actually works

Cazka avatar Oct 03 '22 20:10 Cazka

we could also overwrite window to unsafeWindow at the start of the userscript.

if("undefined" != typeof unsafeWindow) {
    //trust me bro
    window = unsafeWindow;
}

this actually works

seems to be fixed in a new tampermonkey version

Cazka avatar Nov 04 '22 23:11 Cazka