Merge pull request #463 from seyfeb/issue/462

Prevent img loaded event being handled twice
This commit is contained in:
Christian 2020-12-30 20:30:13 +01:00 коммит произвёл GitHub
Родитель 538a91cfd5 61e556d01d
Коммит 49c1568ded
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -102,6 +102,8 @@
[#447](https://github.com/nextcloud/cookbook/pull/447) @christianlupus
- Recipe-editing Vue components are not tightly coupled anymore
[#386](https://github.com/nextcloud/cookbook/pull/386/) @seyfeb
- Fixed trying to remove already removed img DOM nodes in image lazyloading, fixes #462
[#463](https://github.com/nextcloud/cookbook/pull/463/) @seyfeb
### Removed
- Travis build system

Просмотреть файл

@ -87,11 +87,14 @@ export default {
// callback for fully-loaded image event
const onThumbnailFullyLoaded = () => {
img.removeEventListener('load', onThumbnailFullyLoaded)
el.removeChild(imgPlaceholder)
$this.isLoading = false
}
// callback for preview-image-loaded event
const onThumbnailPreviewLoaded = () => {
imgPlaceholder.removeEventListener('load', onThumbnailPreviewLoaded)
img.addEventListener('load', onThumbnailFullyLoaded)
$this.$once('hook:destroyed', () => {
img.removeEventListener('load', onThumbnailFullyLoaded)