UNPKG

889 BJavaScriptView Raw
1import { r as registerInstance, g as getElement } from './stencilrouter-1307249c.js';
2import { A as ActiveRouter } from './chunk-cfc6485e.js';
3
4/**
5 * Updates the document title when found.
6 *
7 * @name RouteTitle
8 * @description
9 */
10class RouteTitle {
11 constructor(hostRef) {
12 registerInstance(this, hostRef);
13 this.titleSuffix = '';
14 this.pageTitle = '';
15 }
16 updateDocumentTitle() {
17 const el = this.el;
18 if (el.ownerDocument) {
19 el.ownerDocument.title = `${this.pageTitle}${this.titleSuffix || ''}`;
20 }
21 }
22 componentWillLoad() {
23 this.updateDocumentTitle();
24 }
25 get el() { return getElement(this); }
26 static get watchers() { return {
27 "pageTitle": ["updateDocumentTitle"]
28 }; }
29}
30ActiveRouter.injectProps(RouteTitle, [
31 'titleSuffix',
32]);
33
34export { RouteTitle as stencil_route_title };