我如何从外部 Controller 功能中调用 Controller 内部的功能,例如电话间隙回调功能
这是 Controller 外部定义的功能
function onDeviceReady() {
//do ALL your localstorage stuff here
console.log('In onDeviceReady() function');
somefunction();// this is not working
}
这是 Controller 类
Ext.define('FCELB.controller.LoginController', {
extend: 'Ext.app.Controller',
config: {
refs: {
username: '#username',
password: '#password'
},
}
},
init: function () {
console.log('Login controller');
document.addEventListener("deviceready", onDeviceReady, false);
//onDeviceReady();
},
somefunction:function(){
//some functionality
}
});
如何从上面的onDeviceready()函数调用
somefunction()
?
最佳答案
FCELB.app.getController('LoginController').somefunction();
其中
FCELB-应用程序名称
LoginController- Controller 名称
somefunction-函数名称
关于extjs - 如何从外部 Controller 功能(如sencha touch中的全局功能)调用 Controller 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17877539/