Skip to content

Commit

Permalink
Merge pull request #12 from suresh-gangumalla/master
Browse files Browse the repository at this point in the history
Fixed @loaded and @error events are firing only once
  • Loading branch information
michielvandergeest authored Oct 18, 2023
2 parents 827e3c3 + d3ad81e commit 837f336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ const Element = {

if (props['@loaded']) {
const event = props.__textnode ? 'textLoaded' : 'txLoaded'
this.node.once(event, (el, { width: w, height: h }) => {
this.node.on(event, (el, { width: w, height: h }) => {
props['@loaded']({ w, h }, this)
})
}

if (props['@error']) {
const event = props.__textnode ? 'textFailed' : 'txFailed'
this.node.once(event, (el, error) => {
this.node.on(event, (el, error) => {
props['@error'](error, this)
})
}
Expand Down

0 comments on commit 837f336

Please sign in to comment.