.watchers.remove
Removes one or more registered watchers from Lampix.

Arguments

  1. 1.
    ...registeredWatchers (RegisteredWatcher[]) Comma separated RegisteredWatcher objects

Returns

(Promise<void>): A promise that fulfills when all of the registered watchers have been removed from Lampix.

Example

1
import lampix from '@lampix/core';
2
3
const draw = (recognizedObjects) => {
4
// Drawing amazing effects
5
};
6
7
const watcher1 = {
8
name: 'DepthClassifier',
9
shape: lampix.helpers.rectangle(0, 0, window.innerWidth / 2, window.innerHeight),
10
onClassification: draw
11
};
12
13
const watcher2 = {
14
name: 'DepthClassifier',
15
shape: lampix.helpers.rectangle(window.innerWidth / 2, 0, window.innerWidth / 2, window.innerHeight),
16
onClassification: draw
17
};
18
19
lampix.watchers.add(watcher1, watcher2)
20
.then((registeredWatchers) => {
21
// Remove them right away!
22
// The removal expression below is equivalent to
23
// 1. lampix.watchers.remove.apply(null, registeredWatchers);
24
// 2. lampix.watchers.remove(registeredWatchers[0], registeredWatchers[1]);
25
return lampix.watchers.remove(...registeredWatchers);
26
})
27
.then(() => {
28
console.log('Registered watchers removed');
29
});
Copied!
Last modified 3yr ago
Copy link