-
-
Save frxstrem/81b2347a1a731d3798170e59d4b15dd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from './test.txt' | |
class A { | |
constructor() { } | |
async loadFile(filename) { | |
// let data = await (await fetch(filename)) | |
// return data | |
return fetch(filename) | |
} | |
} | |
class B extends A { | |
//constructor() { | |
// super() | |
// this.contents = '' | |
//} | |
async loadFile(filename) { | |
//let data = await super.loadFile(filename) | |
//data.text().then( text => { | |
// console.log('Text: ', text) | |
// this.parse(text) | |
//}).catch( error => { | |
// console.log('Error: ', error) | |
//}) | |
try { | |
return super.loadFile(filename) | |
} catch (e) { | |
console.log('Error: ', error) | |
} | |
} | |
//parse (data) { | |
// this.contents = data | |
// console.log('Parsing data: ', data) | |
//} | |
} | |
let b = new B() | |
//b.loadFile(test).then( () => { | |
// console.log('Got data now: ', b.contents) | |
//}) | |
b.loadFile(test).then( contents => { | |
console.log('Got data now: ', contents) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment