Skip to content

Commit

Permalink
Merge pull request #1 from legendar/master
Browse files Browse the repository at this point in the history
use native fetch().text() instead FileReader
  • Loading branch information
ospfranco authored Nov 7, 2016
2 parents 7424a11 + 636fa85 commit 5e3422c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ export default class LinkPreview {

if(detectedUrl) {
fetch(detectedUrl)
.then(response => {
let html = response._bodyInit
let myReader = new FileReader()
myReader.onload = () => {
resolve(this._parseResponse(myReader.result, detectedUrl))
}
myReader.readAsText(html)
.then(response => response.text())
.then(text => {
resolve(this._parseResponse(text, detectedUrl))
})
.catch(err => reject(err))
} else {
Expand Down

0 comments on commit 5e3422c

Please sign in to comment.