#16763 closed defect (worksforme)
on(window, 'resize', ...) not working
Reported by: | Alexander Kläser | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Events | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
As suggested in ticket #15861, I am opening a new one for this problem. Trying to hook to window.onresize event with dojo/on directly on the console does not seem to work using Chrome 24:
on = require("dojo/on") on(window, 'resize', function() { console.log('window on resize') })
Could it be due to window.onresize being null initially?
Change History (4)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
True, dijit/Viewport is working correctly. I think I have it now, using window was wrong, it should be this or dojo/_base/window::global. The following works in the code, however not directly live in the console:
on = require("dojo/on") win = require("dojo/_base/window") on(win.global, 'resize', function() { console.log('window on resize') })
comment:3 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Well, glad you have it working. Using window works fine for me, I just typed:
require("dojo/on")(window, "resize", function(){ console.log("got resize"); })
into my chrome/mac console (while running dijit/tests/form/test_Select.html) and resizing the browser window prints the message. Perhaps you redefined the window variable to something else.
comment:4 Changed 8 years ago by
Now I understand, window was not the problem, it was on. The following lines are working as expected:
_on = require("dojo/on") _on(window, "resize", function() { console.log('window on resize') })
It's strange, it's working in dijit/Viewport.js.