148
rated 0 times
[
155]
[
7]
/ answers: 1 / hits: 77988
/ 7 Years ago, mon, september 25, 2017, 12:00:00
Temp.js
export default class Temp {
async addImageProcess(src){
let img = new Image();
img.src = src;
return img.onload = await function(){
return this.height;
}
}
}
anotherfile.js
import Temp from '../../classes/Temp'
let tmp = new Temp()
imageUrl =https://www.google.co.in/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png
let image = tmp.addImageProcess(imageUrl);
console.log(image)
Above is my code. I have a image url and tried to get image's properties using async await but it's not working, don't understand what I missed.
More From » ecmascript-6