I'm a bit new to lightning component and i'm trying to understand how can I use the settimeout function inside my component.
I'm trying to do this, but always getting errors and the component is crashing.
Thanks for the help !
My code:
({
init : function(component, event, helper) {
helper.showSpinner(component);
var isValid;
var recordId = component.get("v.recordId");
var action = component.get("c.functionFromClass");
action.setParams({
Id : recordId
});
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS"){
isValid = response.getReturnValue();
alert(isValid);
$A.get("e.force:closeQuickAction").fire();
$A.get('e.force:refreshView').fire();
}
else{
console.log("Unknown error");
component.set("v.errorMessage", "Unknown error");
}
helper.hideSpinner(component);
});
$A.enqueueAction(action);
}
}