Skip to main content

Environment

A configuration object pushed from the cloud as an observable. The environment can be configured through the gateway OpenAPI or the Visual Studio Code extension.

The environment is cached locally in the settings to handle offline scenarios.

import { environment } from "@devicescript/cloud"

const env = await environment<{ target: number }>()

value

Reads the current value of the environment.

import { environment } from "@devicescript/cloud"
const env = await environment<{ target: number }>()

const { target } = await env.read()

subscribe

Subscribes to updates to the environment values.

import { environment } from "@devicescript/cloud"
const env = await environment<{ target: number }>()

env.subscribe(async ({ target }) => {
console.log(target)
})