Skip to content

Commit 11acb3f

Browse files
Use eventlisteners instead of inline events
1 parent 99d95e7 commit 11acb3f

File tree

3 files changed

+753
-781
lines changed

3 files changed

+753
-781
lines changed

index.next.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { add } from 'bianco.events'
12
import domToArray from 'bianco.dom-to-array'
23

34
/**
@@ -15,8 +16,8 @@ export function loadImage(img) {
1516
// the image reference will set to null
1617
// to avoid memory leaks
1718
return new Promise((resolve, reject) => {
18-
i.onload = () => resolve(i)
19-
i.onerror = i.onabort = reject
19+
add(i, 'load', () => resolve(i), { once: true })
20+
add(i, 'error abort', reject)
2021
if (isUrl) i.src = img
2122
})
2223
}

0 commit comments

Comments
 (0)