be-link-valued
v0.0.3
Published
<!-- [![Playwright Tests](https://github.com/bahrus/be-intl/actions/workflows/CI.yml/badge.svg?branch=baseline)](https://github.com/bahrus/be-intl/actions/workflows/CI.yml) --> [![How big is this package in your project?](https://img.shields.io/bundlepho
Downloads
8
Maintainers
Readme
be-link-valued
Monitor href attribute for enumerated values.
Microdata provides boolean / enumerated type status values via urls. For example:
<link itemprop="availability" href="https://schema.org/InStock" />In stock
What be-link-valued does is watch for changing values of the href, and broadcasts updates:
<link id=availabilityLink itemprop="availability" href="https://schema.org/InStock" be-link-valued />In stock
would result in:
availabilityLink.beEnhanced.beLinkValued.value = 'InStock';
availabilityLink.beEnhanced.beLinkValued.addEventListener('value-changed', e => {
//fires anytime href changes
})
So the value is derived from the string after the last slash of the URL. One exception:
https://schema.org/True , https://Schema.org/False automatically maps to boolean values true/false.
Viewing Locally
- Install git.
- Fork/clone this repo.
- Install node.
- Open command window to folder where you cloned this repo.
npm install
npm run serve
- Open http://localhost:3030/demo in a modern browser.
Importing in ES Modules:
import 'be-intl/be-link-valued.js';
Using from CDN:
<script type=module crossorigin=anonymous>
import 'https://esm.run/be-link-valued';
</script>