# RegisteredWatcher

Registered watcher objects are plain objects with a few convenience methods and properties. These objects can only be obtained via the [`.watchers.add`](https://api.lampix.co/application-development/lampixjs/api/watchers.add) method (for the time being), and **all watcher management is done through the interface they provide**. If watcher management (e.g pausing, resuming, removing, updating) is required by an application, they should be saved in the app's state.

## Properties

* `source` (*Object*): A replica of the object provided to `.watchers.add`.
* `state` (*Object*): An object representing the current state of the registered watcher.
  * `active` (*boolean*): Represents whether computer vision processes are active for the watcher in question. Changed by `pause` and `resume` methods.
* `onClassification` (*Function*): Configurable handler for the classification event. See [Watcher](https://api.lampix.co/application-development/lampixjs/api/watcher) for details.
* `onLocation` (*Function*, Optional): Configurable handler for the location event. See [Watcher](https://api.lampix.co/application-development/lampixjs/api/watcher) for details.
* `channel` (*Object*): Channel to use to send data to the watcher past the point of initialization

## Methods

Note that all of these methods return a promise with no resolve value.

### [`pause()`](#pause) <a href="#pause" id="pause"></a>

Pauses computer vision activity (classification, location) for the registered watcher.

### [`resume()`](#resume) <a href="#resume" id="resume"></a>

Resumes computer vision activity (classification, location) for the registered watcher.

### [`remove()`](#remove) <a href="#remove" id="remove"></a>

Removes the registered watcher.

### [`channel.send(data)`](#watcher-channel) <a href="#watcher-channel" id="watcher-channel"></a>

Sends data to be acted upon by all listeners registered in the watcher. Mainly for use with custom watchers. Can be anything valid according to the [`JSON.stringify`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) method

#### Notes

Adding and removing watchers can have an impact on performance. If you intend to reuse the same watcher, consider using the [`pause`](#pause) and [`resume`](#resume) methods instead.

### [`updateShape(shape)`](#updateShape) <a href="#updateshape" id="updateshape"></a>

Replaces the shape of a registered watcher with the new one provided.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.lampix.co/application-development/lampixjs/api/registered-watcher.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
