Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Executejs arguments #780

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hughtroeger
Copy link

I want to be able to pass arguments into executeJS. It seems this functionality would be useful to others based on #429. I found this approach in #284, which appears to have been rejected because of the other changes it included.

I searched the tests for executeJS and serializeFunc, but was unable to find an obvious place to add new tests for this feature. If this looks ok, please let me know where I should add tests.

@@ -392,7 +392,7 @@ function replaceStack(error, stack) {
}

function serializeFunc(func) {
return '(' + func.toString() + '(window));';
return '(' + func.toString() + ').apply(null, [window].concat(Array.prototype.slice.call(arguments)));';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you use null instead of window?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. null should get replaced with the global object, which in the browser is window, so I believe they're equivalent. I can change it to window.

@levonet levonet added the review label Aug 14, 2017
@jacobwindsor
Copy link

Will this be merged anytime soon?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants