Questions about ProcessAppleScript in Custom HTML Prompt

Currently, I'm working on something like this:

  1. type some search words in the input box in the HTML Prompt, hit Search.
  2. based on my input, the javascript creates a database query command
  3. javascript trigger a KM macro with the query string as parameter
  4. javascript waits until the query completes
  5. javascript reads the query result (saved into a KM variable), and shows it in the HTML Prompt window.

I already have two solutions for step 4:

  1. javascript uses a while loop, waiting until the query completes (i.e., KM variable value changes).
  2. to use the execute javascript in HTML Prompt window.

I'm ok with either of the two solutions above. Now, I'm just trying to explore if the new function in KM v10 can provide a third solution. I hope to learn something new as well, especially that ProcessAppleScript can do what javascript and window.KeyboardMaestro.Trigger('macro') combined cannot, or that ProcessAppleScript has more advantages.