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.

how to use @Emit for multiple parameters

See original GitHub issue

for example: ` @Emit(‘reset’) returnMultipleValue() { return a, b, c; }

/equivalent to/

this.$emit(‘reset’, a, b, c); ` And I can receive multiple parameters。

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Kingwlcommented, Mar 14, 2019

@foxbunny

return a, b, c; is not legal JavaScript

why that (comma expression) is not legal js?

1reaction
foxbunnycommented, Jan 2, 2019

@yunweb

return a, b, c; is not legal JavaScript. Normally, JavaScript parsers (including TypeScript) would throw a syntax error right there. What @jacobrabjohns suggests is the best way to do it.

Personally, I think it’s cleaner to just use this.$emit() anyway. It makes it clearer about when exactly it is going to be called and with what arguments, and decouples the implementation of your method from the stuff you want to emit. But that’s just me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How pass 2 parameters to EventEmitter in Angular?
If you look at the EventEmitter emit method @ angular.io, it can only take a single parameter of type T. emit(value?: T).
Read more >
VueJS Custom Event - Emit Multiple Values - Cody Bontecou
To emit more than one parameter, it's best to pass the data as an object: # · Access the parameters from the parent...
Read more >
Emit Multiple Values from Child to Parent in a Vue.js Custom ...
To emit more than one parameter, it's best to pass the data as an object: · Access the parameters from the parent component...
Read more >
How to pass two parameters to EventEmitter in Angular 9
EventEmitter allows us to emit any type of object, so we will take advantage of it. For passing the parameters, we will wrap...
Read more >
Livewire emit with multiple parameters - error - Laracasts
I am trying to emit an event that gets 2 parameters. I get the error: Unable to resolve dependency [Parameter #1 [ $id...
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