B4J Question [BANano] How to get all events linked to an element?

Discussion in 'B4J Questions' started by Mashiane, Apr 22, 2019.

  1. Mashiane

    Mashiane Expert Licensed User

    Ola

    I'm trying to debug my app as its not firing any of the assigned events. How can I get a listing of all events linked to an element using BANano?

    I have found this on stack-overflow..

    Code:
    function getEvents(element) {
        var elemEvents = $._data(element, 
    "events");
        var allDocEvnts = $._data(document, 
    "events");
        
    for(var evntType in allDocEvnts) {
            
    if(allDocEvnts.hasOwnProperty(evntType)) {
                var evts = allDocEvnts[evntType];
                
    for(var i = 0; i < evts.length; i++) {
                    
    if($(element).is(evts[i].selector)) {
                        
    if(elemEvents == null) {
                            elemEvents = {
    };
                        }
                        if(!elemEvents.hasOwnProperty(evntType)) {
                            elemEvents[evntType] = [];
                        }
                        elemEvents[evntType].push(evts[i]);
                    }
                }
            }
        }
        return elemEvents;
    }
    Usage

    Code:
    getEvents($('#myElemId')[0])
    Not tested though... Do we have an equivalent for BANano?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice