+ Start a Discussion
Pramodh KumarPramodh Kumar 

need help to fire escape event in lightning

I want to fire escape event trigger in lightning
var esc = $.Event("keydown", { keyCode: 27 });
$("body").trigger(esc);
just like above trigger code. I used the event methods to fire the escape 
({
    doInit : function(cmp, event, helper) {
        var divId = cmp.find("error");
        var recordId = cmp.get("v.recordId");
        var action = cmp.get("c.InviteAction");
        var errorMsg = '';
        action.setParams({"meetingId" : recordId});
        action.setCallback(this,function(res){
            var state = res.getState();
            console.log(state);
            if(state === 'SUCCESS'){
                var result = res.getReturnValue();
                console.log('result   '+result);
                if (result != null || result !='' || result != undefined) {
                    event.fire('escape');
                    var urlEvent = $A.get("e.force:navigateToURL");
                    urlEvent.setParams({
                      "url": result
                    });
                    urlEvent.fire();
                }
                else{
                    cmp.set("v.errorMsg", result);
                }
            }
            else
                cmp.set("v.errorMsg", 'There was an error please contact system administrator');
        });
        $A.enqueueAction(action);
    }
})
event, unfortunately I am getting error "Uncaught Assertion Failed!: Event.fire(): Unable to fire event. Event has already been fired. : false"

please let me know how to