UNPKG

@dooboostore/dom-render

Version:
60 lines (59 loc) 2.31 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var ComponentRouterBase_exports = {}; __export(ComponentRouterBase_exports, { ComponentRouterBase: () => ComponentRouterBase, isOnCreatedOutlet: () => isOnCreatedOutlet, isOnCreatedOutletDebounce: () => isOnCreatedOutletDebounce }); module.exports = __toCommonJS(ComponentRouterBase_exports); var import_ComponentBase = require("./ComponentBase"); var import_OnDrThisUnBind = require("../lifecycle/dr-this/OnDrThisUnBind"); var import_RouterOutlet = require("../components/router/RouterOutlet"); const isOnCreatedOutlet = (obj) => typeof obj?.onCreatedOutlet === "function"; const isOnCreatedOutletDebounce = (obj) => typeof obj?.onCreatedOutletDebounce === "function"; class ComponentRouterBase extends import_ComponentBase.ComponentBase { constructor(_config) { super(_config); } // get child() { // return this._child; // } setChild(child) { console.log("setChild!!", child, this.name); if (child) { this.child = child; } else { this.child = void 0; } const routerOutletChildren = this.getChildren(import_RouterOutlet.RouterOutlet.RouterOutlet); routerOutletChildren.forEach((it) => { it.setValue(this.child); }); } onDrThisUnBind() { super.onDrThisUnBind(); if (this.child && (0, import_OnDrThisUnBind.isOnDrThisUnBind)(this.child?.obj)) { this.child.obj.onDrThisUnBind(); } } onCreatedThisChildDebounce(childrenSet) { super.onCreatedThisChildDebounce(childrenSet); } } //# sourceMappingURL=ComponentRouterBase.js.map