@smals-belgium/myhealth-wc-integration-angular v2.0.2
MyHealth - Web Component Integration for Angular
Collection of Angular goodies to help build MyHealth Web Components.
Based on Angular v19
This library is published to the NPM registry at: https://www.npmjs.com/package/@smals-belgium/myhealth-wc-integration-angular
Documentation
BaseWebComponent
(component class)
Abstract base component class that can be used as a base class to implement MyHealth web components.
This class defines the inputs and outputs according to the MyHealth specification and provides the following goodies:
- validate the given version info and ensure it is compatible with the version of the spec used by this component
- validate the inputs to ensure they have been set and have the right content
- possibity to add extra required input that needs to be validated using
extraRequiredFields
- provides a onPropsChanged() method as a convenience to handle input changes
BaseDataFetchHelper<T>
(helper class)
Absract base helper class that can be used to manage fetching data from either the cache, the offline store or the actual backend.
When getting data, the logic is to:
- look in the cache first (using the provided cacheKey),
- look in the offline store (if provided and using the provided offlineKey)
- finally fetch the data from the backend (by way of the abstract getDataFromBackend() method)
After having retrieved the data, this class will also properly populate the cache and offline store (if provided)
Utilities
const delay = async function<T>(ms:number, fn:()=>Promise<T>): Promise<T>
Return a promise that will be resolved with the value (of type T
) returned by fn()
, which is invoked after ms
milliseconds
const isMobileNative = (): boolean
Return true if embedded in a mobile native application (e.g. Ionic)
const isTouchDevice = (): boolean
Return true if this is a touch device (smartphone, tablet, etc.)