An environment object with all the implemented services.
Creates an environment module with all the default implementations and starts the load of properties.
import { createEnvironmentModule, EnvironmentModule, EnvironmentSource } from '@kuoki/environment';const source: EnvironmentSource = { load: () => [{ a: 0 }] };const environmentModule: EnvironmentModule = await createEnvironmentModule(source);environmentModule.query.get('a'); // 0
Below are examples of use cases.
If the source load asynchronous non required properties always use the async or reactive version of the methods to ensure that the call waits for the source to finish the load.
import { createEnvironmentModule, EnvironmentModule, EnvironmentSource } from '@kuoki/environment';// env.json = {a:0}const source: EnvironmentSource = { load: () => fetch('env.json').then((response: Response) => response.json())};const environmentModule: EnvironmentModule = await createEnvironmentModule(source);environmentModule.query.get('a'); // undefinedawait environmentModule.query.getAsync('a'); // 0
Generated using TypeDoc
Environment Module
createEnvironmentModule()
Creates an environment module with all the default implementations and starts the load of properties.
Use cases
Below are examples of use cases.
Table of Contents
Load of async properties
If the source load asynchronous non required properties always use the async or reactive version of the methods to ensure that the call waits for the source to finish the load.