2018-01-23 06:47:29 +01:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
2018-02-01 03:20:30 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 07:29:29 +01:00
|
|
|
export function mouseover (node, callback) {
|
|
|
|
function onMouseEnter () {
|
|
|
|
callback(true) // eslint-disable-line
|
2018-02-01 03:20:30 +01:00
|
|
|
}
|
2018-02-09 07:29:29 +01:00
|
|
|
function onMouseLeave () {
|
|
|
|
callback(false) // eslint-disable-line
|
2018-02-01 03:20:30 +01:00
|
|
|
}
|
|
|
|
node.addEventListener('mouseenter', onMouseEnter)
|
|
|
|
node.addEventListener('mouseleave', onMouseLeave)
|
|
|
|
return {
|
|
|
|
teardown () {
|
|
|
|
node.removeEventListener('mouseenter', onMouseEnter)
|
|
|
|
node.removeEventListener('mouseleave', onMouseLeave)
|
|
|
|
}
|
|
|
|
}
|
2018-02-09 07:29:29 +01:00
|
|
|
}
|