pinafore/routes/_utils/events.js
2018-01-22 21:47:29 -08:00

19 lines
359 B
JavaScript

export function imgLoadError (node, callback) {
node.addEventListener('error', callback)
return {
teardown () {
node.removeEventListener('error', callback)
}
}
}
export function imgLoad (node, callback) {
node.addEventListener('load', callback)
return {
teardown () {
node.removeEventListener('load', callback)
}
}
}