1.0.1 • Published 1 month ago
@hartings/la-example v1.0.1
\
This webcomponent follows the open-wc recommendation.
Installation
yarn add @hartings/la-example
Usage
If you want to use the web component directly in your html, you can use the following code:
<script>
import '@hartings/la-example';
</script>
<la-example></la-example>
<la-example header="My Custom Header"></la-example>
<la-example counter="20"></la-example>
If you want to get the web component class, you can do so by importing it. However, you have to add the custom element to your window as follows:
<script type="module">
import { LaExample } from '@hartings/la-example';
window.customElements.define('la-example', LaExample);
</script>
<la-example></la-example>
<la-example header="My Custom Header"></la-example>
<la-example counter="20"></la-example>
If you want to use the web component in an ECMAScript module and do not want to define the component yourself you can adjust the import:
<script type="module">
import '@hartings/la-example/dist/src/la-example.js';
</script>
<la-example></la-example>
<la-example header="My Custom Header"></la-example>
<la-example counter="20"></la-example>
Testing with Web Test Runner
To execute a single test run:
yarn test
To run the tests in interactive watch mode run:
yarn test:watch
Local Demo with web-dev-server
yarn start
To run a local development server that serves the basic demo located in demo/index.html