Proof-of-concept app in Apple's App Store sent keystrokes to remote server.
If you want a function that will return the result of a PhantomJS script, you may find this handy.
It takes an array of options to be passed as arguments to the phantomJS file, executes it, and returns its results.
There are situations where you call a method which recalls itself multiple times, or calls other methods which recall the original method. But you want code of the original method execute only one time, and that, on the last call! What do you do?