Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using function not only on first nesting level in action(use:) #5426

Closed
MarkTanashchuk opened this issue Sep 18, 2020 · 3 comments
Closed

Using function not only on first nesting level in action(use:) #5426

MarkTanashchuk opened this issue Sep 18, 2020 · 3 comments

Comments

@MarkTanashchuk
Copy link

MarkTanashchuk commented Sep 18, 2020

Are there plans to implement a possibility to use a function in an object as an action function?

At the moment, if I have a function in an object or in an IIFE module(Revealing module, etc.) that I want to use as an action function, I need to put it in a separate variable:

https://svelte.dev/repl/54dfee99c74a43bda2a74146b3eb685f?version=3.25.1

It would be nice to have the possibility to use function which can be located not only on the first nesting level in use:

For example, in case of an object, the syntax can be like this:

<script>
  let object = {
    func: function(node) {
      console.log(node.textContent
    }
  }
</script>

<div use:object:func>
  Text
</div>
@MarkTanashchuk MarkTanashchuk changed the title Using functions not only on the first nesting level in actions(use:) Using function not only on first nesting level in action(use:) Sep 18, 2020
@Conduitry
Copy link
Member

Duplicate of #3935 - This is coming in the next version of Svelte with the syntax use:obj.method

@MarkTanashchuk
Copy link
Author

Also duplicate of #5395

@MarkTanashchuk
Copy link
Author

Just now I noticed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants