操作:actionXXX
拦截action方法。
for (var property in this) {
if (typeof this[property] == "function"
&& property.indexOf("action") == 0) {
var interceptor = function() {
return this.target.checkActionPermission(this.actionName);
};
interceptor.actionName = property;
var newFunc = Ext.Function.createInterceptor(this[property], interceptor,
interceptor, null)
actionMap.add(property, newFunc);
}
}
actionMap.each(function(key, value) {
this[key] = value;
}, this);
--------------------------------------------------------------------------------------------------------------------------------
checkActionPermission : function(actionName) {
//TODO 校验权限
console.log("Call " + actionName + "...");
return true;
},
另一种方式是,若无此action权限,则删除action方法,不过如果其它地方用到action方法监听则运行可能报错,还需再intercept一把。