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

JQuery object isn't loaded/detected with new_instance enabled #7419

Closed
anesuc opened this issue Mar 21, 2020 · 16 comments
Closed

JQuery object isn't loaded/detected with new_instance enabled #7419

anesuc opened this issue Mar 21, 2020 · 16 comments
Assignees

Comments

@anesuc
Copy link

anesuc commented Mar 21, 2020

NWJS Version : 0.44.5
Operating System : Linux

Expected behavior

All functions in other javascript scripts should be able to perform jquery tasks including $(...).addClass(....) etc.

Actual behavior

$ is not defined, bootstrap.js even reports that "Bootstrap's JavaScript requires jQuery" meaning it can't find it either. None of my scripts can.

No, I don't use the require() way, I use the <script> tag to load jQuery. Saw this being a problem from me looking into this anyway.

I am assuming this is some side effect with the implementation of contexts?

How to reproduce

Create a new window using new_instance = true
import jQuery as <script>
Try anything jquery related in your js file thats also loaded using <script> tag in the html file

Ok here is a complete code to test with:
jquery demo.zip

@gpetrov
Copy link

gpetrov commented Mar 21, 2020

Related to #7344

@anesuc anesuc changed the title JQuery object isn't loaded/detected with new_instance enabled [NW2] JQuery object isn't loaded/detected with new_instance enabled Apr 26, 2020
@anesuc
Copy link
Author

anesuc commented Apr 26, 2020

I am pretty sure this is related to #7230 as well.

@rogerwang
Copy link
Member

Could you please provide a full sample (not code snippets) so I can reproduce?

@anesuc
Copy link
Author

anesuc commented May 9, 2020

This error was happening on a relatively big project, so I'll create a new one for the purposes of the demo. Give me a sec

@anesuc
Copy link
Author

anesuc commented May 9, 2020

@rogerwang Ok I've updated the post with a complete set of code to use

@rogerwang
Copy link
Member

Thanks. I can reproduce the issue. But it shouldn't block #7230 as it fails in nw1 mode too...

@anesuc
Copy link
Author

anesuc commented May 9, 2020

@rogerwang Interesting. Thought it worked before for some reason. It probably did and broke at one point in NW1 phase

@rogerwang rogerwang changed the title [NW2] JQuery object isn't loaded/detected with new_instance enabled JQuery object isn't loaded/detected with new_instance enabled Jun 21, 2020
@rogerwang rogerwang self-assigned this Jun 21, 2020
@anesuc
Copy link
Author

anesuc commented Jul 10, 2020

Any potential updates on this? Don't want to be pushy or anything, just wondering if it will be anytime soon or if it's long down the queue. I'm working on something that relies on loading other Devs' work which could freeze or crash everything else if that window freezes

@rogerwang
Copy link
Member

will look to fix it soon

@anesuc
Copy link
Author

anesuc commented Jul 10, 2020

Awesome! Keep up the good work!

@rogerwang
Copy link
Member

This is fixed in #7344

@anesuc
Copy link
Author

anesuc commented Aug 23, 2020

Something is still broken with this. I'm still investigating. Just got to update just now and tested it out and seems to be working fine at first, but there is some weird behaviour. Will update once I've figured it out

@anesuc
Copy link
Author

anesuc commented Aug 23, 2020

Update: It's setTimeout(function(){ for some reason it's not working in my main project's iframe thats appended on runtime. I'm trying to reproduce it out on a new project but not having any luck with that yet, so thats strange.

@anesuc
Copy link
Author

anesuc commented Aug 23, 2020

After a lot of debgugging a lot of code, I figured out at least one problem. Might be the only problem but setTimeout does not execute (or executes in some other context that I can't observe) in require('child_process');. Only happens with new_instance: true. You can see this demonstrated with the console.log in the attached file. Should I start another issue for this? Because it is technically linked to this. I can't re-open this issue (I assume it's a permissions thing?)
new_instance_demo.zip

@anesuc
Copy link
Author

anesuc commented Aug 23, 2020

I forgot to tag @rogerwang

@rogerwang
Copy link
Member

Please file another issue. Thanks.

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

No branches or pull requests

3 participants