Tracks events that match the specified mask using the specified tracking handler until the tracking handler explicitly terminates tracking.
- macOS 10.10+
The event mask (see
NSEventfor possible values).
The maximum time interval the system waits for an event before passing
nilto the handler.
The run loop mode.
A block that is called to track the events. The block takes the following parameters:
The event to examine.
A Boolean value that indicates when tracking should stop.
You can use this method in a tracking loop to get pressure events when you add
NSEvent to the event mask. This method returns when tracking terminates.
Each event is removed from the event queue and then passed to the tracking handler. If a matching event does not exist in the event queue, the main thread blocks in the specified runloop mode until an event of the requested type is received or the specified timeout expires. If the timeout expires, the tracking handler is called with a
nil event (a negative timeout is interpreted as
NSEvent to prevent timing out. Tracking continues until you set
YES. Note that calls to
next are allowed inside the