Sha256: be5e816ef49922b64325a5fc774b615b6a12aa399089adf8c230ed8f2d0e0fea

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

define("dijit/Viewport", [
	"dojo/Evented",
	"dojo/on",
	"dojo/ready",
	"dojo/sniff",
	"dojo/_base/window", // global
	"dojo/window" // getBox()
], function(Evented, on, ready, has, win, winUtils){

	// module:
	//		dijit/Viewport

	/*=====
	return {
		// summary:
		//		Utility singleton to watch for viewport resizes, avoiding duplicate notifications
		//		which can lead to infinite loops.
		// description:
		//		Usage: Viewport.on("resize", myCallback).
		//
		//		myCallback() is called without arguments in case it's _WidgetBase.resize(),
		//		which would interpret the argument as the size to make the widget.
	};
	=====*/

	var Viewport = new Evented();

	ready(200, function(){
		var oldBox = winUtils.getBox();
		Viewport._rlh = on(win.global, "resize", function(){
			var newBox = winUtils.getBox();
			if(oldBox.h == newBox.h && oldBox.w == newBox.w){ return; }
			oldBox = newBox;
			Viewport.emit("resize");
		});

		// Also catch zoom changes on IE8, since they don't naturally generate resize events
		if(has("ie") == 8){
			var deviceXDPI = screen.deviceXDPI;
			setInterval(function(){
				if(screen.deviceXDPI != deviceXDPI){
					deviceXDPI = screen.deviceXDPI;
					Viewport.emit("resize");
				}
			}, 500);
		}
	});

	return Viewport;
});

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
dojo_rails-0.0.2 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dojo_rails-0.0.1 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.11.0 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.10.4 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.10.3 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.10.2 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.10.1 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js
dijit-rails-0.10.0 vendor/assets/javascripts/dijit/Viewport.js.uncompressed.js