diff options
| author | Henry Jameson <me@hjkos.com> | 2018-02-03 19:55:45 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-03-12 01:30:27 +0300 |
| commit | 3257991f4196cb6c2c77b3f81ec9f1850e243211 (patch) | |
| tree | d257c08c0fa7244fe01a5ca7fe0ed110e19f4b5d /src/components/still-image/still-image.js | |
| parent | b10787d23ca645932e89383ebb39402d1eb84700 (diff) | |
unfinished fetch() version that doesn't work
Diffstat (limited to 'src/components/still-image/still-image.js')
| -rw-r--r-- | src/components/still-image/still-image.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js index fa027bc4..e674b932 100644 --- a/src/components/still-image/still-image.js +++ b/src/components/still-image/still-image.js @@ -12,16 +12,27 @@ const StillImage = { } }, computed: { - animated () { - return this.mimetype === 'image/gif' + animated: { + get () { + // If mimetype is gif then it is certainly animated, if it's undefined - we don't know YET + return this.mimetype === 'image/gif' ? true : this.mimetype == null ? 'maybe' : false + }, + set (val) { + this.mimetype = val + } } }, methods: { - drawCanvas() { + onLoad () { const canvas = this.$refs.canvas if (!canvas) return - const ctx = canvas.getContext('2d') - ctx.drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height) + canvas.getContext('2d').drawImage(this.$refs.src, 1, 1, canvas.width, canvas.height) + if (this.animated === 'maybe') { + fetch(this.src).then((data) => { + console.log(data) + this.animated = data.type + }) + } } } } |
