UNPKG

959 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5const __chunk_1 = require('./stencilrouter-a3d77a87.js');
6const __chunk_2 = require('./chunk-94c92d88.js');
7
8/**
9 * Updates the document title when found.
10 *
11 * @name RouteTitle
12 * @description
13 */
14class RouteTitle {
15 constructor(hostRef) {
16 __chunk_1.registerInstance(this, hostRef);
17 this.titleSuffix = '';
18 this.pageTitle = '';
19 }
20 updateDocumentTitle() {
21 const el = this.el;
22 if (el.ownerDocument) {
23 el.ownerDocument.title = `${this.pageTitle}${this.titleSuffix || ''}`;
24 }
25 }
26 componentWillLoad() {
27 this.updateDocumentTitle();
28 }
29 get el() { return __chunk_1.getElement(this); }
30 static get watchers() { return {
31 "pageTitle": ["updateDocumentTitle"]
32 }; }
33}
34__chunk_2.ActiveRouter.injectProps(RouteTitle, [
35 'titleSuffix',
36]);
37
38exports.stencil_route_title = RouteTitle;