Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questioning use of _window #42

Open
Cazka opened this issue Oct 2, 2022 · 2 comments
Open

Questioning use of _window #42

Cazka opened this issue Oct 2, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Cazka
Copy link
Owner

Cazka commented Oct 2, 2022

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
Copy link
Owner Author

Cazka commented Oct 3, 2022

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 Cazka added the enhancement New feature or request label Oct 9, 2022
@Cazka
Copy link
Owner Author

Cazka commented Nov 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant