"use strict"; var CloudExperienceHost; (function (CloudExperienceHost) { var AppView = (function () { function AppView(document, htmlRoot, view, progress, progressControl, progressText) { this._document = document; this._head = document.head; this._view = view; this._progress = progress; this._progressControl = progressControl; this._progressText = progressText; this._htmlRoot = htmlRoot; this._htmlRoot.setAttribute('dir', CloudExperienceHost.Globalization.Language.getReadingDirection()); } AppView.prototype.createWebView = function () { var webViewCtrl; webViewCtrl = document.createElement("x-ms-webview"); if (CloudExperienceHost.Environment.getPlatform() === CloudExperienceHost.TargetPlatform.XBOX) { webViewCtrl.addEventListener("MSWebViewDOMContentLoaded", function () { webViewCtrl.invokeScriptAsync("eval", "navigator.gamepadInputEmulation = \"keyboard\";").start(); }); } webViewCtrl.style.height = "100%"; webViewCtrl.style.width = "100%"; this._webViewCtrl = webViewCtrl; this._webViewCtrl.setAttribute("aria-hidden", "true"); return webViewCtrl; }; AppView.prototype.cleanView = function () { WinJS.Utilities.empty(this._view); }; AppView.prototype.getView = function () { return this._view; }; AppView.prototype.showView = function () { this._progressControl.setAttribute("aria-hidden", "true"); this._progressText.setAttribute("aria-hidden", "true"); this._webViewCtrl.removeAttribute("aria-hidden"); if (!this._document.activeElement || (this._document.activeElement == this._document.body)) { this._webViewCtrl.focus(); } if (this._progressTextTimerID) { clearTimeout(this._progressTextTimerID); this._progressTextTimerID = null; } return WinJS.UI.Animation.crossFade(this._view, this._progress); }; AppView.prototype.showProgress = function () { this._progressControl.removeAttribute("aria-hidden"); this._progressText.removeAttribute("aria-hidden"); if (this._webViewCtrl) { this._webViewCtrl.setAttribute("aria-hidden", "true"); } return new WinJS.Promise(function (completeDispatch, errorDispatch ) { WinJS.UI.Animation.crossFade(this._progress, this._view).done(function () { this._progressText.focus(); this._progressTextTimerID = setTimeout(function(){ this._progressText.textContent = this._progressText.textContent }, 3000); completeDispatch(); }.bind(this), errorDispatch); }.bind(this)); }; AppView.prototype.loadCss = function () { var cssList = CloudExperienceHost.GetCssList(".", CloudExperienceHost.getContext()); for (var i = 0; i < cssList.length; i++) { CloudExperienceHost.AddCssToHead(this._head, cssList[i]); } }; AppView.prototype.getBoundingClientRect = function () { return this._view.getBoundingClientRect(); }; return AppView; })(); CloudExperienceHost.AppView = AppView; })(CloudExperienceHost || (CloudExperienceHost = {}));