-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle edge case with no callbackArgs #27
base: master
Are you sure you want to change the base?
Conversation
@dlh3 I'm not sure I want to make this change - it makes good sense to always get the return value, but I'm not sure there aren't contexts where the call back should have no arguments or where holding on to a return value might be an issue. I think I'd rather ensure that none of the mapped API functions are expected to return a value direct value. However, it's a good idea and I want to come back to it when I get some time to test it. |
So, I thought through that. Under the current implementation:
I did think through the consequences and perform quite a bit of testing when I developed this solution, so I have a high level of confidence in this approach. While #26 was a satisfactory – though admittedly hacky – workaround, it only mitigated the issue for a single known function ( Thanks @KeithHenry, but I do really hope you find time to revisit this PR. I am confident it is a much better approach than @26. |
This reverts commit ab19d0d. That was introduced in PR KeithHenry#26 as an alternative approach to KeithHenry#27. However with the more consistent solution of KeithHenry#27, `contextMenus.create` should be promisified, in order to ensure a consistent API (so it returns a Promise, like everything else).
This is an alternative approach to fixing KeithHenry#23. For chrome functions that pass no arguments to their callbacks, we should try to propagate the function's own return value. Honestly, I'm pretty confused about how it is even able to work. It makes sense, kind of, but I'm surprised that I can access the function return inside an arrow function defined as an inline function argument. In any case, I tested and confirmed that this works. Fixes KeithHenry#23 and closes KeithHenry#26.
This reverts commit ab19d0d. That was introduced in PR KeithHenry#26 as an alternative approach to KeithHenry#27. However with the more consistent solution of KeithHenry#27, `contextMenus.create` should be promisified, in order to ensure a consistent API (so it returns a Promise, like everything else).
This is an alternative approach to fixing #23. For chrome functions that pass no arguments to their callbacks, we should try to propagate the function's own return value.
Honestly, I'm pretty confused about how it is even able to work. It makes sense, kind of, but I'm surprised that I can access the function return inside an arrow function defined as an inline function argument. In any case, I tested and confirmed that this works.
Fixes #23 and closes #26.