hammerspoon2-docs
    Preparing search index...

    Class HSNetworkConfigurationWatcher

    A watcher for System Configuration dynamic store key changes. Create with hs.network.configurationWatcher().

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    typeName: string

    Always "HSNetworkConfigurationWatcher".

    Methods

    • Sets the callback invoked when a watched key changes. The callback receives (watcher, changedKeys) where changedKeys is an array of key strings that changed since the last notification. Call hs.network.configurationStore() inside the callback to read the updated values.

      Parameters

      Returns HSNetworkConfigurationWatcher

      This watcher for chaining.

    • Specifies which dynamic store keys (or key patterns) to watch for changes. Must be called before start(). Each element of keys is treated as a string literal when pattern is false (the default), or as a regular expression when pattern is true. Calling setKeys again replaces the previous set of watched keys.

      Parameters

      • keys: string[]

        An array of exact key strings (when pattern is false) or regular expressions (when pattern is true).

      • pattern: boolean

        Pass true to treat each element of keys as a regular expression; omit or pass false for literal key matching.

      Returns HSNetworkConfigurationWatcher

      This watcher for chaining.

    • Starts watching for dynamic store changes. The callback registered with setCallback() will be invoked whenever a key matching the patterns registered with setKeys() changes. Call setKeys() and setCallback() before calling start().

      Returns HSNetworkConfigurationWatcher

      This watcher for chaining.