Skip to content

Add onStartup() function #3998

@rina23q

Description

@rina23q

Is your feature improvement request related to a problem? Please describe.
Add a function onStartup(), which is triggered when the tedge-flows process starts.
This would be helpful when user wants to do specific initialization only on the startup, like adding specific items to the KV store.

Describe the solution you'd like
Below shows the example how to initialize the mapper KV store for the main device on the startup.

export function onStartup(time, context) {
  // Set main device property to KV store
  context.mapper.set("key::device/main//", "mainDeviceName");
  context.mapper.set("rev::mainDeviceName", "device/main//");
}

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions