Access non-decorated function
See original GitHub issueFirst of all, thanks for this sweet library!
I start using it and I don’t get one thing. I have the following:
makeAwsomeString(): string {
}
@Action({ rawError: true })
async doSomething(data: { email: string }) {
this.makeAwsomeString() /// this causes an error
}
When I call makeAwsomeString
from an Action
I’m getting:
error in v-on handler (promise/async): "typeerror: makeAwsomeString is not a function"
Whats the issue here and how can I solve it?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
How to strip decorators from a function in Python
This is untrue. The decorated function only has a __wrapped__ attribute if you decorate it with functools.wraps . Also, the link is dead....
Read more >Primer on Python Decorators
The @register decorator simply stores a reference to the decorated function in the global PLUGINS dict. Note that you do not have to...
Read more >Function Decorators — wrapt 1.13.0rc2 documentation
Supplying a boolean value for the enabled option when defining a decorator provides control over whether the decorator should be applied or not....
Read more >How to Create and Use Decorators in Python With Examples
Accessing the function from the variable I assigned it to. ... To create a decorator function in Python, I create an outer function...
Read more >Decorators with parameters in Python - GeeksforGeeks
Now, func_name() can be used to call the function with decorator applied on ... parameters can be accessed by the enclosed inner function....
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
This is should be considered a bug, for two main reasons:
this
, for instance to call getters, without being an action. So the solution proposed by @fen89 has its limits.makeAwsomeString
method should be callable fromdoSomething
. It is not obvious at all when looking at the code that such a thing is not possible.Stripping code from the original class seems like a terrible idea that can only cause headaches to the users. At the very least, private methods should be kept, since their very purpose is to be called by other methods.
I’m not sure the work around works when you want to call non-decorated private functions from a mutation rather than from an action. I’ve got some helper functions that need to be able to both get and set state and I can’t call them from my mutation