UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

94 lines (84 loc) 2.45 kB
// Generated by github.com/steida/coffee2closure 900.1.18 /** @fileoverview este.app.screen.Base. */ var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.superClass_ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; goog.provide('este.app.screen.Base'); goog.require('este.ui.Component'); /** @constructor @extends {este.ui.Component} */ este.app.screen.Base = function() { este.app.screen.Base.superClass_.constructor.call(this); } extend(este.app.screen.Base, superClass); /** @type {este.app.View} @protected */ este.app.screen.Base.prototype.previousView = null; /** @type {este.app.View} @protected */ este.app.screen.Base.prototype.currentView = null; /** @param {este.app.View} view @param {boolean} isNavigation */ este.app.screen.Base.prototype.show = goog.abstractMethod; /** @param {este.app.View} view */ este.app.screen.Base.prototype.hide = goog.abstractMethod; /** @protected */ este.app.screen.Base.prototype.removePreviousView = function() { if (!this.previousView) { return; } return this.dom_.removeNode(this.previousView.getElement()); }; /** @param {este.app.View} view @protected */ este.app.screen.Base.prototype.setCurrentView = function(view) { this.currentView = view; return this.getElement().setAttribute('e-app-screen-active-view', this.currentView.className); }; /** @protected */ este.app.screen.Base.prototype.lazyRenderView = function() { if (this.currentView.getElement()) { this.getElement().appendChild(this.currentView.getElement()); this.currentView.enterDocument(); } else { this.currentView.render(this.getElement()); } }; /** @protected */ este.app.screen.Base.prototype.rememberPreviousView = function() { return this.previousView = this.currentView; }; /** Iphone needs explicit window.scrollTo 0, 0 to reset actual scroll. Ipad is ok. Both iphone and ipad needs setTimeout 0 for window.scrollTo, to prevent ugly scroll jumps and fixed positioned elements flickering. @param {number} x @param {number} y @protected */ este.app.screen.Base.prototype.scrollTo = function(x, y) { return setTimeout((function(_this) { return function() { return window.scrollTo(0, 0); }; })(this), 0); };