Issue
I have added an eventListener and is being called multiple times. Is there any way to call it only once?
Here is my code snippet.
this.elements.on('done', function (event) {
console.log(event);
})
Solution
If you're using Angular you should really look into rxjs. However, for the provided code snippet, a simple solution would be:
const handled = false;
this.elements.on('done', function (event) {
if (!handled) {
// do things
handled = true;
}
})
Answered By - Nathan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.