MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / start

Method start

examples/io/streams/modules/sensorstream.js:9–22  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

7 constructor(dictionary) {
8 super({
9 start(controller) {
10 const sensor = new Base({
11 ...dictionary
12 });
13 System.setInterval(() => {
14 const samples = sensor.sample();
15 if (samples) {
16 if (Array.isArray(samples))
17 samples.forEach(sample => controller.enqueue(sample));
18 else
19 controller.enqueue(samples);
20 }
21 }, dictionary.interval);
22 }
23 })
24 }
25 };

Callers

nothing calls this directly

Calls 3

setIntervalMethod · 0.80
sampleMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected