teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

チョウセイ

2019/09/30 05:03

投稿

yambejp
yambejp

スコア117892

answer CHANGED
@@ -5,16 +5,12 @@
5
5
  [].forEach.call(document.querySelectorAll('img'),x=>{
6
6
  x.addEventListener('click',e=>{
7
7
  var t=e.target;
8
- fetch(t.src).then(res=>{
9
- new Promise(resolve=>resolve(res.blob())).then(blob=>{
8
+ fetch(t.src).then(res=>new Promise(resolve=>resolve(res.blob())).then(blob=>new Object({
10
- console.log({
11
- type:res.headers.get("content-type"),
9
+ type:res.headers.get("content-type"),
12
- size:blob.size,
10
+ size:blob.size,
13
- width:t.naturalWidth,
11
+ width:t.naturalWidth,
14
- height:t.naturalHeight,
12
+ height:t.naturalHeight,
15
- });
13
+ }))).then(console.log);
16
- });
17
- });
18
14
  });
19
15
  });
20
16
  });