1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | const __chunk_1 = require('./stencilrouter-a3d77a87.js');
|
6 |
|
7 | class AsyncContent {
|
8 | constructor(hostRef) {
|
9 | __chunk_1.registerInstance(this, hostRef);
|
10 | this.content = '';
|
11 | }
|
12 | componentWillLoad() {
|
13 | if (this.documentLocation != null) {
|
14 | return this.fetchNewContent(this.documentLocation);
|
15 | }
|
16 | }
|
17 | fetchNewContent(newDocumentLocation) {
|
18 | return fetch(newDocumentLocation)
|
19 | .then(response => response.text())
|
20 | .then(data => {
|
21 | this.content = data;
|
22 | });
|
23 | }
|
24 | render() {
|
25 | return (__chunk_1.h("div", { innerHTML: this.content }));
|
26 | }
|
27 | static get watchers() { return {
|
28 | "documentLocation": ["fetchNewContent"]
|
29 | }; }
|
30 | }
|
31 |
|
32 | exports.stencil_async_content = AsyncContent;
|