web-component-wrapper
Version:
Generic web-component base class and framework specific wrapper.
52 lines (34 loc) • 2.97 kB
Markdown
<!-- !/usr/bin/env markdown
-*- coding: utf-8 -*-
region header
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stand under a creative commons naming
3.0 unported license. See https://creativecommons.org/licenses/by/3.0/deed.de
endregion -->
Project status
--------------
[](https://www.npmjs.com/package/web-component-wrapper)
[](https://www.npmjs.com/package/web-component-wrapper)
[](https://github.com/thaibault/web-component-wrapper/actions/workflows/build.yaml)
[](https://github.com/thaibault/web-component-wrapper/actions/workflows/build-package-and-push.yaml)
[](https://github.com/thaibault/web-component-wrapper/actions/workflows/check-types.yaml)
[](https://github.com/thaibault/web-component-wrapper/actions/workflows/lint.yaml)
[](https://github.com/thaibault/web-component-wrapper/actions/workflows/test-coverage-report.yaml)
[](https://coveralls.io/github/thaibault/web-component-wrapper)
[](https://torben.website/web-component-wrapper)
Use case
--------
Encapsulate your components as web-components.
## Data-Flow
Data can flow into a component via
- External property set `instance.value = 'value'`
- Trigger Events `instance.triggerEvent('click')`
Data can be communicated back via:
- Properties `console.log(instance.value)`
- Observable events `instance.addEventListener('click', (event) => console.log(event.detail.value))`
### Configuring Data-Flow
A Web-Component-Wrapper component forwards (transformed) given properties into
a wrapped react component via `props` and reads data via provided callbacks
as part of `props` or as part of reacts `ref` object.