UNPKG

@mondora/microfrontends

Version:

Library for embedding frontends into one another

28 lines 980 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const penpal_1 = require("penpal"); const constants_1 = require("./constants"); class ChildApp { constructor(options) { // State this.childMethods = null; this.iframe = options.iframe; this.onLaunched = options.onLaunched; this.childOrigin = options.childOrigin; this.suppliedMethods = options.suppliedMethods; this.launchData = options.launchData; } async launch() { const connection = penpal_1.connectToChild({ iframe: this.iframe, childOrigin: this.childOrigin, methods: this.suppliedMethods }); const childMethods = await connection.promise; this.childMethods = childMethods; await this.childMethods[constants_1.SET_LAUNCH_DATA](this.launchData); this.onLaunched.call(this); } } exports.default = ChildApp; //# sourceMappingURL=ChildApp.js.map