question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: something like Svelte actions

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gustavopchcommented, Jun 22, 2022

@aidenybai Thanks, just accepted

1reaction
aidenybaicommented, Jun 16, 2022

Thank you! Every hook provides the node, newVNode, and oldVNode:

create: (node, newVNode, oldVNode) => ...
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found