Monday, December 23, 2013

React to window.onresize within a dojo widget!

Following on the heels of what I offer here, I have visited this and found that the suggested way of using window.onresize (by way of AMD modules wrapping the functionality) worked best, used in a dojo widget, when set at the postCreate method like so:

postCreate: function() {
   on(win.global, 'resize', function() {
      console.log('whatever');
   });
},

 
 

You may leave the view and return, and the act of dragging around the window will still put "whatever" to the console. For all this to work on needs to correspond to dojo/on at the AMD signature "up top" while win needs to correspond to dojo/_base/window additionally.

No comments:

Post a Comment