Package Exports
- be-a-beacon
- be-a-beacon/be-a-beacon.js
- be-a-beacon/childrenParsed.js
Readme
be-a-beacon
be-a-becon is an HTML Element behavior / decorator that causes the HTMLTemplate element it adorns to emit event 'i-am-here", the moment it is connected to the element.
Use cases
- be-a-beacon provides a similar, but slightly different solution to a current limitation of the platform -- we don't know when a DOM element has finished parsing. The solution this component provides is an alternative to the solution spelled out here.
The difference is that this solution gets applied to a template element, which can appear in many more places without violating HTML decorum. In particular, it can appear inside a table element without being rudely ejected:
<table>
<thead>
...
</thead>
<tbody>
...
</tbody>
<template be-a-beacon></template>
</table>If a div element (say) is populated by a (streaming) fetch request, and that populating is done numerous times based on user interaction / timing events, then the placement of the beacon at the end of the stream can be used instead of a mutation observer to indicate, for example, that some content that should derived from the contents of the DOM is ready to be generated.
If a component wishes to provide its own default light children, in the event that the consumer doesn't provide their own, a cue is needed to know when no light children will be provided.