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.

emit payload overwritten

See original GitHub issue

Hi, @kbrsh… when you emit something like:

instance.emit('doSomething', {product: 'cheese', type: 'cheddar'});

// emit overwrites the property 'type' with emit eventName param 'doSomething'
console.log(payload); // {product: 'cheese', type: 'doSomething'}

I think that emit payload could be:

{
  data: {product: 'cheese', type: 'cheddar'},
  type: 'doSomething'
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kbrshcommented, Sep 20, 2017

How about something like:

instance.on("foo", (type, data) => {
  console.log(type, data);
});

instance.emit("foo", {bar: 3}); // note: data doesn't have to be an object
0reactions
AndresSeparcommented, Sep 23, 2017

Great idea!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding socket.io's emit and on? - node.js - Stack Overflow
There is a module called socket.io-wildcard which allows using wildcards on client and server side, no need to overwrite anything anymore
Read more >
ndctl−wait−overwrite(1) - NDCTL User Guide - PMem.io
The kernel provides a POLL(2) capable sysfs file (security) to indicate the state of overwrite. This command waits for a change in the...
Read more >
Emit data child to parent component - Get Help - Vue Forum
I would like to emit selectPosition from my child component to my ... //Payload to update tha data property SetPosition(payload){ this.
Read more >
Types of event broadcasts | Moleculer - GitHub Pages
Emit balanced events. The event Listeners are arranged to logical groups. It means that only one listener is triggered in every group. Example....
Read more >
aedes/Aedes.md at main · moscajs/aedes - GitHub
Emitted when the client registers itself to server. ... 'bbb') { packet.payload = Buffer.from('overwrite packet payload') } callback(null) }.
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