[quickjs-devel] GC and async JS question

  • From: JM <jeevhi@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Thu, 23 Jan 2020 08:29:28 +0530

I have a custom class that does  async operations. I like to understand
when does GC fires and cleans up variables, how to prevent GC from cleaning
the variable which is doing async operation and then once again enable GC
after the async task is over.

Here is the complete script. I would like to GC to preserve the variable
'task' till the async task is executing. However, after onDone is called,
GC is free to take whatever action necessary.

var task = new AsyncTask;
task.data  = "some data";
task.onDone = function(task) {

}
task.execute();

Please suggest.

Other related posts: