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.

Make events.action More Functional

See original GitHub issue

Today the following default events may return a value to be used by the app in some way: events.load, events.resolve, events.update, and events.render. The astute among you may have already noticed that events.action was missing from that list, which is because today its return value is completely thrown away and so it can only be used for the purpose of side effects.

So what might a return value from events.action be used for? Well, the name of the action has already picked which action function to call, so it doesn’t really make sense to allow returning a different name. However, since data was what was passed to the original action function, it might make sense for events.action to allow returning a different set of data to act as a sort of middleware for action data. A bonus feature would be allowing the return of false to completely cancel an action (perhaps due to some value in state that makes the action invalid), but I’m not sure if false would ever legitimately be used as the data value for an action.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
okwolfcommented, Sep 16, 2017

Technically events.resolve can already be used to cancel everything an action does except for calling other actions as side effects, so that’s probably not needed.

0reactions
okwolfcommented, Sep 22, 2017

@JorgeBucaran I don’t really have a simple proposal for using resolve unless we want to allow for multiple data parameters to emit. Probably not worth it.

I’m torn about this issue since events.action is needed for some devtool/test use cases, but not as useful in production. 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and triggering events - MDN Web Docs - Mozilla
This article demonstrates how to create and dispatch DOM events. Such events are commonly called synthetic events, as opposed to the events ......
Read more >
Take action after standard events action is completed
Take action after standard events action is completed ... $contentEditable.on('paste', function (event) { setTimeout(function () { // do whatever ...
Read more >
Creating events
Choose Events from the Actions tab in the Start Organizing menu to start creating your event. Fill out the event's title.
Read more >
VIDEO TUTORIAL: Events – Action Network
... Automatic event reminders and functions · Redirecting when event RSVP limit is reached · Uploading events via spreadsheet ...
Read more >
How to Plan an Event: a Complete Guide
At what point do you get to do something more exciting next time? ... Make sure you have the three major functions of...
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