Attach event listeners in OS X JavaScript for Automation (JXA)
问题 How is it possible to listen for events in OS X JavaScript for automation. In the scripting Library for the Messages application there is a list of event handlers, such as messageSent and messageReceived . However, I cannot figure out how to use them. Trying to pass a function yields an error, and trying to set these variables to new functions causes the REPL to hang. What is the proper way to set up these event handlers? 回答1: You would create a script that you then select from the