]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/Viewport.js.uncompressed.js
1 define("dijit/Viewport", [
6 "dojo/_base/window", // global
7 "dojo/window" // getBox()
8 ], function(Evented
, on
, ready
, has
, win
, winUtils
){
16 // Utility singleton to watch for viewport resizes, avoiding duplicate notifications
17 // which can lead to infinite loops.
19 // Usage: Viewport.on("resize", myCallback).
21 // myCallback() is called without arguments in case it's _WidgetBase.resize(),
22 // which would interpret the argument as the size to make the widget.
26 var Viewport
= new Evented();
28 ready(200, function(){
29 var oldBox
= winUtils
.getBox();
30 Viewport
._rlh
= on(win
.global
, "resize", function(){
31 var newBox
= winUtils
.getBox();
32 if(oldBox
.h
== newBox
.h
&& oldBox
.w
== newBox
.w
){ return; }
34 Viewport
.emit("resize");
37 // Also catch zoom changes on IE8, since they don't naturally generate resize events
39 var deviceXDPI
= screen
.deviceXDPI
;
40 setInterval(function(){
41 if(screen
.deviceXDPI
!= deviceXDPI
){
42 deviceXDPI
= screen
.deviceXDPI
;
43 Viewport
.emit("resize");