Allow adding function with a context access#34
Open
jaenyf wants to merge 1 commit into
Open
Conversation
- Context access is disabled by default - It has to be specified with related option when calling addFunction - It does not work with arrows functions (because of bind)
fdfefed to
6db17a5
Compare
6 tasks
Owner
|
Hi @jaenyf, thank you for raising #33 and contributing this PR. Really appreciate your patience while we worked through it. I've opened #40 with an implementation for the feature. Your write-up in #33 was what made the use case concrete, and you're credited as co-author on the implementation commit and called out in the CHANGELOG. A few specifics that might be worth your review:
Would value your eyes on #40 before I merge, especially anything that misses a corner of your original use case. Much better to know now than after release. Either way, thanks again for kicking this off. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows adding function with a shared context access
addFunctionSummary
This allow sharing a context, when allowed, across functions added with
addFunction.The context is accessed from inside the function with
this.context. Because of the this keyword, the function that access to this can't be an "arrow function" otherwise it will be undefined by default.Test plan
I added 3 tests :