feat: something like Svelte actions
See original GitHub issueIs your feature request related to a problem? Please describe. Not applicable.
Describe the solution you’d like I’d like to use something like Svelte actions in Million, e.g.:
// This is an action
const tooltip = (node, { text }) => {
// Mount the tooltip (i.e. create)
return {
update: ({ text }) => {
// Update the tooltip with its new text
},
destroy: () => {
// Unmount the tooltip
},
}
}
// This is the action being used
html`<button ${tooltip({ text: 'Some explanation' })}>Do something</button>`
Describe alternatives you’ve considered Maybe it can be implemented with a driver? Not sure yet, I discovered Million less than 24h ago.
Additional context https://svelte.dev/docs#template-syntax-element-directives-use-action
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
[TypeScript] Action Type · Issue #6538 · sveltejs/svelte - GitHub
Describe the bug. An action type should be available to developers. One is available if you stay within a *.svelte file, but isn't...
Read more >Actions / The use directive • Svelte Tutorial
Actions are essentially element-level lifecycle functions. They're useful for things like: interfacing with third-party libraries; lazy-loaded images ...
Read more >Introduction to Svelte Actions - LogRocket Blog
Svelte actions are a very powerful, function-based feature that are important to understand. Get started with this simple, in-depth intro.
Read more >swyx on Twitter: "Released v0.1.0 of svelte-actions - a ...
v0.1.0 release Actions now available: name description clickOutside Demo - Call callback when user clicks outside a given element. longpress Demo - Creates ......
Read more >New Magidoc library to render markdown into Svelte ... - Reddit
I've put some work on extracting the markdown rendering engine into a separate standalone Svelte library after receiving some feedback from ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aidenybai Thanks, just accepted
Thank you! Every hook provides the node, newVNode, and oldVNode: