# sys::Watch

    sys::Obj
      sys::Virtual
        sys::Watch

`public abstract class Watch`

Watch is used to manage an event queue of component changes. Every component is allocated a byte per potential watch determined by the Watch.max define. To use the watch framework:

      - Create your own subclass of Watch
      - In your service create an array of your Watch subclass
      - Call App.initWatches() on service startup with your subclass array
      - To allocate a watch call App.openWatch() passing in the
        array of your subclasses
      - When you close a watch, make sure you call App.closeWatch()

closed

  `public bool closed`

  Is this watch open or closed

eventAll

  `public static const define int eventAll`

  Watch bitmask for all change event bits

eventConfig

  `public static const define int eventConfig`

  Watch bitmask indicating a pending config property change event

eventLinks

  `public static const define int eventLinks`

  Watch bitmask indicating a pending link change event

eventRuntime

  `public static const define int eventRuntime`

  Watch bitmask indicating a pending runtime property change event

eventTree

  `public static const define int eventTree`

  Watch bitmask indicating a pending tree change event

index

  `public byte index`

  Bottom byte of the id is the index into App.watches

max

  `public static const define int max`

  Number of concurrent watches to support

rand

  `public byte rand`

  The top byte of the id is randomized to prevent id collisions

subAll

  `public static const define int subAll`

  Watch bitmask for all subscription bits

subConfig

  `public static const define int subConfig`

  Watch bitmask indicating a subscription to config property changes

subLinks

  `public static const define int subLinks`

  Watch bitmask indicating a subscription to link changes

subRuntime

  `public static const define int subRuntime`

  Watch bitmask indicating a subscription to runtime property changes

subTree

  `public static const define int subTree`

  Watch bitmask indicating a subscription to tree changes

fromSubBit

  `public static int fromSubBit(int subBit)`

  Map a subscription bit to its ASCII code.

id

  `public int id()`

  The watch id is a combination of the count in the high byte and the index in the low byte.

toEventBit

  `public static int toEventBit(int what)`

  Map ASCII codes to event bit:

       't' = eventTree
       'c' = eventConfig
       'r' = eventRuntime
       'l' = eventLink
       '*' = eventAll

toSubBit

  `public static int toSubBit(int what)`

  Map ASCII codes to subscription bit:

       't' = subTree
       'c' = subConfig
       'r' = subRuntime
       'l' = subLink
       '*' = subAll