"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Connector_1 = require("./Connector");
var Page_1 = require("./Page");
function init() {
    try {
        // initialize page when the current document seems to be a IGD Page
        if (!window || window.parent === window) {
            return;
        }
        document.addEventListener("DOMContentLoaded", function (event) {
            var tTmpConnector = new Connector_1.Connector(function (cb) {
                tTmpConnector.destroy();
                var pageclass;
                if (document.body.dataset) {
                    pageclass = document.body.dataset["igdPage"];
                }
                else {
                    pageclass = document.body.getAttribute("data-igd-page");
                }
                if (pageclass) {
                    Page_1.Page.createPage(pageclass);
                }
                else {
                    console.warn("IGD.Core: no pageclass given for initialization.");
                }
            });
        });
    }
    catch (err) { }
}
exports.init = init;
