Skip to content

Once

Name Mandatory Description Default Type
⬅️ Input The input of the shard, if any Any
Output ➡️ The resulting output of the shard Any
Action No The shard or sequence of shards to execute. none Shard[Shard]
Every No The number of seconds to wait until repeating the action, if 0 the action will happen only once per wire flow execution. none FloatVar(Float)

Executes the shard or sequence of shards with the desired frequency in a wire flow execution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
@wire(main-wire {

  Once({
    0 >= counter
    counter | Log("counter set to 0 only once")
    ; ; => 0
  })
  Math.Inc(counter)
  counter | Log("counter incremented every time wire executes")
  ; ; => 1, 2, 3, 4, 5
} Looped: true)

@mesh(main)
@schedule(main main-wire)
@run(main)


 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
@wire(main-wire {

  "Hello World, every 1.5s during a wire flow execution" = string1
  "Hello World, once during every wire flow execution" = string2

  string1
  Once(
    Action: Log
    Every: 1.5
  )

  string2
  Once(
    Action: Log
  )

} Looped: true)

@mesh(main)
@schedule(main main-wire)
@run(main)