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.

Feature request: global/universal actions

See original GitHub issue

These might better be defined as ‘hooks’.

I spent a while trying to create my own prehook on actions, something that would get run against every action. Something like the following:

old_action = prog.action.bind(prog);
prog.action = function () {
    always_gets_called_on_every_action();
    return old_action.apply(prog, arguments)
}

The problem is there’s still no way to get at the opts argument in this prog.action overwrite, which is what I need.

Use case: change the config file for every action (-c, --config) without manually baking it into every action.

I decided to stop wasting time on this and make hooks or something like that an actual feature request, or at least a point of conversation.

Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
arxpoeticacommented, Nov 11, 2019

@tunnckoCore

But it’s working right?

I couldn’t get Object.assign to work, no, but I don’t have that code anymore to really compare notes…

Regardless…

@lukeed your wrapper suggestion worked great. Still trying to wrap my mind around it (no pun intended), but it’s a working solution, so closing.

2reactions
lukeedcommented, Nov 11, 2019

If you wanted to do the prog.action route, it’d have to look like this:

// save the old
const add_action = prog.action.bind(prog);

prog.action = function (handler) {
  add_action(
    // use the same `wrapper` util before
    // because it actually wraps the handler
    wrapper(handler)
  );
}

What you had modified sade’s construct. All that method does is build the tree, but what you (originally) showed was trying to execute/wrap the handler on initialization

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Global Pokedex · Issue #68 - GitHub
Is your feature request related to a problem? Please describe. Nope. Describe the solution you'd like A Pokedex that is automatically updated with...
Read more >
Universal Actions for Adaptive Cards - Teams - Microsoft Learn
Universal Actions for Adaptive Cards bring the bot as the common backend for handling actions and introduces a new action type, Action.Execute , ......
Read more >
Universal Actions - Alfred
Take any text, URLs or files and perform actions on them from anywhere within Alfred or on your Mac using your Universal Action...
Read more >
Universal Profile - Actions Overview
Grants ability to view and take action upon Performance (EPM) items on the Action Items page and in the Your Action Items widget....
Read more >
10 Tips to Improve Your Feature Request Responses - Nicereply
Feature requests are the best way to improve your product. Here are ten tips to make the most out of them.
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