1export function getNaturalSize(imgElement) { 2 return new Promise((resolve, reject) => { 3 if (!imgElement) reject("imgElement is null"); 4 5 // si déjà chargé 6 if (imgElement.complete && imgElement.naturalWidth > 0) { 7 resolve({ 8 width: imgElement.naturalWidth, 9 height: imgElement.naturalHeight 10 }); 11 return; 12 } 13 14 // sinon attendre le load 15 imgElement.addEventListener("load", () => { 16 resolve({ 17 width: imgElement.naturalWidth, 18 height: imgElement.naturalHeight 19 }); 20 }, { once: true }); 21 22 imgElement.addEventListener("error", () => { 23 reject("Image failed to load"); 24 }, { once: true }); 25 }); 26}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.