gly-engine / gly-engine/core-native-html5

try mensure image not loaded with sycronous request

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```js
function getPngSize(url) {
const xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.responseType = "arraybuffer";
xhr.send();

const d = new DataView(xhr.response);
if (xhr.status !== 200 || d.getUint32(0) !== 0x89504E47) return null;

const width = d.getUint32(16, false);
const height = d.getUint32(20, false);
return { width, height };
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.