Skip to content

addEventListenerOnce method #473

@cvisto

Description

@cvisto

I was faced with the need to add the same listener function to different objects while listener of one object has to fire once and listener of another object has to fire any time event is created.

Now I should resolve this task like this:

myFunc(){
alert('clicked');
}

myFunc_Once(){
marker1.removeEventListener('click', myFunc_Once);
myFunc();
}

Init(){
marker1.addEventListener('click', myFunc_Once);
marker2.addEventListener('click', myFunc);
}

It would be more easy to use addEventListenerOnce wich will make event listener to remove itself after firing.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions