1. 程式人生 > >egret addEventListener處理函式新增引數

egret addEventListener處理函式新增引數

egret中使用addEventListener是要新增引數使用bind

private mainFunction(){
    let param1 = '引數1';
    let param2 = '引數2';
    let param3 = '引數3';
    Btn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.clickFunction.bind(this, param1, param2, param3 ,false), this);
}

private clickFunction(param1, param2, param3){
    console.log(param1);
    console.log(param2);
    console.log(param3);
}