0.0.28 • Published 1 month ago
be-scoped v0.0.28
be-scoped
Create an EventTarget associated with the adorned element that can hold scoped state.
<div id="scoped" be-scoped='{"count": 30}'></div>
...results in:
console.log(scoped.beEnhanced.beScoped.scope.count === 30)
//true
To subscribe to changes to the scope:
await customElements.whenDefined('be-enhanced');
const beScoped = await scoped.beEnhanced.whenResolved('be-scoped');
beScoped.scope.addEventListener('count', e => {
console.log(e.detail);
});
Adorning a custom element
If the desire is to add "scoping" to a custom element, use be-propagating instead.
Size of package, including custom element behavior framework (be-enhanced/be-hive):
Size of new code in this package:
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-exportable/be-scoped.js';
Using from CDN:
<script type=module crossorigin=anonymous>
import 'https://esm.run/be-scoped';
</script>
0.0.27
1 month ago
0.0.28
1 month ago
0.0.26
1 month ago
0.0.25
1 month ago
0.0.24
2 months ago
0.0.23
3 months ago
0.0.22
4 months ago
0.0.21
5 months ago
0.0.20
5 months ago
0.0.16
10 months ago
0.0.17
10 months ago
0.0.18
8 months ago
0.0.19
8 months ago
0.0.15
10 months ago
0.0.11
11 months ago
0.0.12
11 months ago
0.0.13
11 months ago
0.0.14
11 months ago
0.0.10
12 months ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.3
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.2
1 year ago
0.0.1
2 years ago
0.0.0
2 years ago