How could I call the class function from its string?
After I check if the function exists
if(typeof requestName == 'function') {
}
I need to call the class function, for example CreateJob inside class Foo. How could I do this?
var Foo = function(credentialsObject){
this.cred = credentialsObject;
};
Foo.prototype.SendRequest = function(requestName,dataObj) {
// If create requestName, job object exists and credentials have been setup, proceed with a requestName call
if(requestName && dataObj && (this.cred.userID && this.cred.apiKey)) {
// Check if the function exists
if(typeof requestName == 'function') {
}
}
};
Foo.prototype.CreateJob = function(dataObj) {
};
Foo.prototype.CancelJob = function(dataObj) {
};
Foo.prototype.JobStatus = function(dataObj) {
};
