UNPKG

@stencil/router

Version:
39 lines (34 loc) 959 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const __chunk_1 = require('./stencilrouter-a3d77a87.js'); const __chunk_2 = require('./chunk-94c92d88.js'); /** * Updates the document title when found. * * @name RouteTitle * @description */ class RouteTitle { constructor(hostRef) { __chunk_1.registerInstance(this, hostRef); this.titleSuffix = ''; this.pageTitle = ''; } updateDocumentTitle() { const el = this.el; if (el.ownerDocument) { el.ownerDocument.title = `${this.pageTitle}${this.titleSuffix || ''}`; } } componentWillLoad() { this.updateDocumentTitle(); } get el() { return __chunk_1.getElement(this); } static get watchers() { return { "pageTitle": ["updateDocumentTitle"] }; } } __chunk_2.ActiveRouter.injectProps(RouteTitle, [ 'titleSuffix', ]); exports.stencil_route_title = RouteTitle;