JavaScript, stop additional event listeners

前端 未结 5 1567
盖世英雄少女心
盖世英雄少女心 2021-01-12 01:41

Imagine I have this code:

var myFunc1 = function(event) {
    alert(1);
}
var myFunc2 = function(event) {
    alert(2);
}

element.addEventListener(\'click\'         


        
5条回答
  •  星月不相逢
    2021-01-12 02:23

    I second the outis solution, sounds like you need to decorate or adapt the existing DOM event dispatching model with your own event dispatcher.

    Did some searching and found this link, which may or may not suit your needs, based on an actionscript dispatcher implementation, dated 2007.

    http://positionabsolute.net/blog/2007/06/event-dispatcher.php

    Of course I'm not really a javascripter, so give me a heads up if this is not relevant.

提交回复
热议问题