hammerspoon2-docs
    Preparing search index...

    Function on

    • Register a listener for AX events on a specific element

      Parameters

      • element: HSAXElement

        An HSAXElement to watch. Passing an application's element causes matching notifications to bubble up from anywhere in that application's hierarchy (e.g. AXWindowCreated for any window in the app, not just one); passing a specific descendant element scopes the notification to just that element

      • notification: string | string[]

        An event name, or an array of event names, to watch for with the same listener

      • listener: (notification: string, element: HSAXElement) => void

        A function called with the notification name and the accessibility element it applies to

      Returns void

      When notification is an array, registration is all-or-nothing: if any one of them fails, none are left registered.

      Throws an Error on failure; wrap calls in try/catch to handle it.