check function exist
This commit is contained in:
parent
bd23763113
commit
1e63f3782a
|
@ -8,14 +8,14 @@ export class ServiceInvoker {
|
||||||
|
|
||||||
public invoke(className: string, methodName: string, params?: any): void {
|
public invoke(className: string, methodName: string, params?: any): void {
|
||||||
let classObj: Object = this.configMap.get(className);
|
let classObj: Object = this.configMap.get(className);
|
||||||
if (classObj === null) {
|
if (classObj === null || classObj === undefined) {
|
||||||
console.log('Error: Cannot find the class. [' + className + ']');
|
console.log('Error: Cannot find the class. [' + className + ']');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!classObj.hasOwnProperty(methodName)) {
|
if (classObj[methodName] === undefined) {
|
||||||
console.log('Error: Cannot find the method. [' + methodName + ']');
|
console.log('Error: Cannot find the method. [' + methodName + ']');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
classObj[methodName]();
|
classObj[methodName](params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user