by arm on 6/1/22, 8:27 AM with 6 comments
by xg15 on 6/2/22, 12:00 PM
I think most people know this in the context of callbacks or lambdas, but it's useful to keep in mind that this is how all functions in JS work: A function is an object with support for a special "call" operation and () is an operator that invokes that operation on whatever object is given.
So Application('System Events').processes() is invoking "call" on the object contained in the "processes" property.
But because it's an object, it also supports all the other operations of objects, such as attaching properties - which can contain other callable objects.
So Application('System Events').processes.name() is fetching the "name" property of the same object and invoking "call" on that value.
by Sharlin on 6/1/22, 10:30 PM
Also, the "x of every y whose z is w" is a list comprehension :)
by justsomeuser on 6/2/22, 2:53 PM
I know JS very well, but it takes me 20x longer than web stuff to workout how to do something as it’s just pure trial and error.
Each script run is slow as it must actually do the actions in the GUI.
JS is more useful than AppleScript in my opinion as it supports JSON data and functions.
by gowld on 6/1/22, 9:49 PM
properties like `foo` are objects with rich API of methods and properties
methods like `foo()` give a data serialization