"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var animation_1 = require('../animations/animation');
var content_1 = require('../components/content/content');
var transition_1 = require('./transition');
var PageTransition = (function (_super) {
    __extends(PageTransition, _super);
    function PageTransition() {
        _super.apply(this, arguments);
    }
    PageTransition.prototype.init = function () {
        if (this.enteringView) {
            this.enteringPage = new animation_1.Animation(this.enteringView.pageRef());
            this.add(this.enteringPage.beforeAddClass('show-page'));
            this.beforeAddRead(this.readDimensions.bind(this));
            this.beforeAddWrite(this.writeDimensions.bind(this));
        }
    };
    PageTransition.prototype.readDimensions = function () {
        var content = this.enteringView.getContent();
        if (content && content instanceof content_1.Content) {
            content.readDimensions();
        }
    };
    PageTransition.prototype.writeDimensions = function () {
        var content = this.enteringView.getContent();
        if (content && content instanceof content_1.Content) {
            content.writeDimensions();
        }
    };
    PageTransition.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.enteringPage = null;
    };
    return PageTransition;
}(transition_1.Transition));
exports.PageTransition = PageTransition;
