snippets
- introduction
- copy text with selector
- copy text via a selector with messaging
- copy with quick copy
- debounce a signal
- forward an element as a sender
- get random numbers
- load data from a url
- load templates from a url
- map a key to a signal
- match elements from parent
- measure performance
- poll data
- receive multiple signals
- render an svg
- run an init function
- send and receive from the same element
- send multiple signals at the same time
- send to multiple receivers
- shuffle an array
- style SVGs
- switch
- switch with init
- update the content of an element
- use a template from the page
- use an alternate listener
- use innerHTML as a number
send to multiple receivers
waiting...
waiting...
waiting...
- Multiple elements can use the same
data-rvalue to receive the same signal.
html
<div data-r="snippet">waiting...</div>
<div data-r="snippet">waiting...</div>
<div data-r="snippet">waiting...</div>
<button data-s="snippet">send signal</button>javascript
export const b = {};
export function snippet(_, __, el) {
el.innerHTML = b.time();
}