Skip to content

Commit bef1951

Browse files
committed
add interval in sample
1 parent 9c5dc10 commit bef1951

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { delay } from "@devicescript/core"
22
import { createData, publishData, startAdafruitIOMQTTClient } from "."
3+
import { schedule } from "@devicescript/runtime"
34

45
console.log(`post data using http`)
56
await createData(123)
67

78
console.log(`post data using mqtt in 5s`)
89
await delay(5000)
910
const client = await startAdafruitIOMQTTClient()
10-
await publishData(client, 456)
11+
12+
schedule(
13+
async () => {
14+
await publishData(client, 456)
15+
},
16+
{ interval: 5000 }
17+
)

0 commit comments

Comments
 (0)