blob: 025a6c8297bc1c193bb0d9d05c523dbacff2d929 [file] [log] [blame]
<!-- The <text-src> custom element declaration.
Displays text loaded from a URL in the same way an image
loads and displays from a URL.
Attributes:
src - The URL to read the text from.
Events:
None.
Methods:
None.
-->
<dom-module id="text-src">
<template>
<pre>[[ _text ]]</pre>
</template>
</dom-module>
<script>
Polymer({
is: "text-src",
properties: {
src: {
type: String,
value: "",
reflectToAttribute: true,
observer: "srcChange",
},
_text: {
type: String,
value: "",
}
},
srcChange: function() {
if (this.src == "") {
return
}
sk.get(this.src).then(function(text) {
this._text = text;
}.bind(this)).catch(function() {
this._text = "";
}.bind(this));
},
});
</script>