feat: add helper to wrap a function in a task
See original GitHub issueWould you be interested in a helper that, accepting a function, returns an action that wraps that function? This is a pattern that’s come up in the application I maintain at work, where a component yields an async function.
I’m imagining something like this:
<SomeComponentThatYieldsAnAction as |someAction|>
{{#let (action-to-task someAction) as |someTask|}}
<button {{action (perform someTask)}}>
{{if someTask.isRunning 'Running!' 'No running!'}}
</button>
{{/let}}
</SomeComponentThatYieldsAnAction>
If that’s of interest, I’m happy to PR an implementation!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to Correctly Wrap a JavaScript Function - TrackJS
Wrapping JavaScript functions lets you add common logic to functions you do not control, like native and external functions. Many JavaScript libraries ...
Read more >How to use an object of a wrapped class as an argument in a ...
1) It should be Helper.PyMyFunction(mySettings) in run.py. 2) It should be def instead of cdef in front of PyMyFunction because I definitely ...
Read more >Add wrapper functions for validation helper without Diagnostics
What we tried to do in our plugin was create function that wraps existing validation helpers and returns diag.Diagnostics instead of errors.
Read more >Python | functools.wraps() function - GeeksforGeeks
wraps () is a decorator that is applied to the wrapper function of a decorator. It updates the wrapper function to look like...
Read more >Async IO in Python: A Complete Walkthrough
Other Top-Level asyncio Functions; The Precedence of await. Conclusion; Resources. Python Version Specifics; Articles; Related PEPs; Libraries That Work ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I don’t see it being too different than the lifecycle with regard to a component.
Maybe this would be worth prototyping as a separate add-on (or permanently being something separate) to work out mechanics before potentially upstreaming to this package.
I actually ended up able to support the task modifiers without separate helpers for each of them: