Ejemplo n.º 1
0
		}
	},

	/**
	* onpopstate handler
	*
	* @private
	*/
	handlePop: function (event) {
		if (this.enabled) {
			this.processState(event.state);
		}
	},

	/**
	* onkeyup handler
	*
	* @private
	*/
	handleKeyUp: function (sender, event) {
		var current = this.peek();
		if (event.keySymbol == 'back' && current && current.context.getShowing()) {
			this.pop();
		}
		return true;
	}

});

dispatcher.listen(global, 'popstate', EnyoHistory.handlePop.bind(EnyoHistory));
Ejemplo n.º 2
0
	
		{kind: Signals, onpixelratiochange: "handlePixelRatioChange"}
	
	`calcPixelRatio()` when invoked, will update window.devicePixelRatio manually if needed. This is
	automatically done when the device orientation changes as well as whenever the window is resized (to check for
	browser zoom level changes).
*/

var
	Signals = require("enyo/Signals"),
	platform = require("enyo/platform"),
	dispatcher = require("enyo/dispatcher");

var calcPixelRatio = function() {
	var ratio = window.devicePixelRatio;
	if(platform.ie) {
		window.devicePixelRatio = window.devicePixelRatio = window.screen.deviceXDPI / window.screen.logicalXDPI;
	} else if(platform.windowsPhone) {
		window.devicePixelRatio = ((window.matchMedia("(orientation: portrait)").matches ? screen.width : screen.height)/document.documentElement.clientWidth);
	}
	if(window.devicePixelRatio != ratio) {
		Signals.send("onpixelratiochange");
	}
};

//* @protected
dispatcher.listen(document, "orientationchange", calcPixelRatio);
dispatcher.listen(document, "MSOrientationChange", calcPixelRatio);
dispatcher.listen(window, "resize", calcPixelRatio);
calcPixelRatio();