I have a recursive helper function that checks every 5 seconds for the status of a queueable job.
Upon the first recursive call, the helper method throws
Uncaught Error in $A.getCallback() [component.get is not a function]
The helper function:
checkUploadStatus: function(component, event, helper, jobId, cdId) {
let action = component.get('c.checkUploadJobStatus');
action.setParams({'jobId': jobId, 'cdId': cdId});
action.setCallback(this, function(response) {
let state = response.getState();
if (state === "SUCCESS") {
let returnVal = response.getReturnValue();
console.log('returnVal', returnVal);
if (returnVal === null) {
window.setTimeout(
$A.getCallback(helper.checkUploadStatus.bind(component, helper, jobId, cdId)),
5000
);
} else {
// do work
}
} else {
// handle error
}
})
$A.enqueueAction(action);
}
How come component
is not recognized?