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

Window resize event returns undefined for height #4993

Closed
vzamanillo opened this issue Jun 16, 2016 · 7 comments
Closed

Window resize event returns undefined for height #4993

vzamanillo opened this issue Jun 16, 2016 · 7 comments
Assignees

Comments

@vzamanillo
Copy link

Nwjs 0.15.2
Ubuntu Linux 64 bit

window.on('resize', function(width, height)){
});

height is always undefined.

@joshterrill
Copy link
Contributor

What are you using to define window?

@vzamanillo
Copy link
Author

Hi joshterrill,

is the main app window.

win = nw.Window.get();

thank you!

@joshterrill
Copy link
Contributor

Interesting, I'm getting the same results. So I was looking into some of the included JS libraries for webkit, and when I put a breakpoint on line 283 of extensions::nw.Window, the height is shown in a callback passed back to Window (this). So I'm not really sure where the height is getting lost in translation. Below is a screenshot.

Imgur

@vzamanillo
Copy link
Author

Thank you very much for your feedback.

@fcard
Copy link

fcard commented Jul 5, 2016

I am pretty sure this is the problem line.

callback.call(self.width, self.height);

Since callback.call should take this/self as its first argument.

edit: Oops, missed that you already tracked the line. Still, isn't that the problem?

@joshterrill
Copy link
Contributor

@fcard yes I believe it is!

@ghostoy
Copy link
Member

ghostoy commented Jul 7, 2016

I will fix it soon.

@ghostoy ghostoy self-assigned this Jul 7, 2016
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 7, 2016
Two bugs brings from commit bc016d4:
* missing `height` argument to `resize` event (fixed nwjs#4993)
* should use `self` instead of `this` in `navigation` event callbacks
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 7, 2016
Two bugs brings from commit 556e027:
* missing `height` argument to `resize` event (fixed nwjs#4993)
* should use `self` instead of `this` in `navigation` event callbacks
wanghongjuan added a commit to wanghongjuan/nw.js that referenced this issue May 16, 2018
- Add test for issue nwjs#4993
- This test is failed on v0.15.4, passed on v0.30.4
@wanghongjuan wanghongjuan self-assigned this May 16, 2018
rogerwang pushed a commit that referenced this issue Jun 14, 2018
- Add test for issue #4993
- This test is failed on v0.15.4, passed on v0.30.4
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

6 participants