Loads the environment properties from the provided asynchronous sources.
The environment loader is an interface that must be implemented to load the properties to the environment. Can be integrated into any application using the provided default implementation or a custom one.
environmentLoader .load() .then(() => { /* Do something after all required properties are loaded */ }) .catch(<E>(error: E) => { /* Do something on required load error */ });
Middleware to modify properties before be stored. Its's executed after EnvironmentSource.mapFn().
// Modifies all 'date' properties to be ISO string environmentLoader.preAddProperties = (properties) => { if (properties?.date != null) { properties.date = newDate(properties.date).toISOString(); }
Environment Loader
The environment loader is an interface that must be implemented to load the properties to the environment. Can be integrated into any application using the provided default implementation or a custom one.
DefaultEnvironmentLoader
A basic implementation that can be instantiated from...
DefaultEnvironmentQuery
.Use cases
There are more examples of use in the EnvironmentSource and LyfecycleHooks documentation.
Table of Contents
Load
preAddProperties()
Middleware to modify properties before be stored. Its's executed after
EnvironmentSource.mapFn()
.getSourceById()
resolveLoad()
Use this method to resolve load if a condition is true.
rejectLoad()
Use this method to reject the load if a condition is true.
completeAllSources()
Complete ongoing and future source loads if a condition is true.
completeSource()
Complete an specific source if a condition is true.
onDestroy()
Destroy the loader, completes all observables to avoid memory leaks and resolves the load.
Avoid concurrent loads