Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

is there anyway to have an eventlistener listen to multiple types?

i want a single eventlistener to listen for either a swipe or a click. how do i do that?

thanks

— asked December 7th 2010 by sean oreilly
  • click
  • eventlistener
  • swipe
0 Comments

1 Answer

  • I don't think this is supported on Titanium, you can declare a common function from both events and then just call the same function from both, is not that big of a difference.

    function execute (parameter){
    
      //Do Something
    };
    
    view.addEventListener('click', function(e){
        execute(e.data)
    });
    
    view.addEventListener('swipe', function(e){
        execute(e.data)
    });
    
    — answered December 7th 2010 by Antonio Silveira
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.