Background Task || Help me understand this please.
-
I have a heavy token parsing function that crashes when I query large directories. I was told to execute this function on a 'background thread' so I've been looking into it. I just need some clarification from someone with experience with this please.
I have this function:
inline function onbtnFindTokenControl(component, value) { // Search files here } btnFindToken.setControlCallback(onbtnFindTokenControl);This function is triggered with a Button on my interface labeled "LOAD".
Based on what i've read so far....is this pretty much how you do this?
inline function onbtnFindTokenControl(component, value) { // Search files here } btnFindToken.setControlCallback(onbtnFindTokenControl); BackgroundTask.callOnBackgroundThread(onbtnFindTokenControl); // I could put this into the button callback and changed my button callback to // a regular inline function.....is this correct? -
@Chazrox place your parsing code in a separated function. Then in the button callback, call the background task for the parsing function.
You shouldn't pass the button callback itself