Skip to content
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

Implement support for callback interfaces #172

Merged
merged 7 commits into from
Apr 3, 2020

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Mar 7, 2020

This adds support for callback interfaces.

Needed for jsdom/jsdom#2869 (jsdom/jsdom#2884).

To do:

  • Update README

Supersedes and closes #178.

review?(@domenic, @TimothyGu): I’ve now rebased this on top of #182.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

Very cool; this will be great to have.

test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/test.js.snap Outdated Show resolved Hide resolved
@ExE-Boss ExE-Boss force-pushed the feat/constructs/callback-interface branch 2 times, most recently from 698c85b to 9cd8797 Compare March 9, 2020 06:41
@ExE-Boss ExE-Boss requested a review from domenic March 9, 2020 07:05
@domenic
Copy link
Member

domenic commented Mar 14, 2020

I cannot push my fixes to this branch. It would be really nice if you could avoid this separate-organization business and just use personal forks, if you are going to contribute to jsdom.

@ExE-Boss
Copy link
Contributor Author

It says you still haven’t accepted the invite: https://github.com/EB-Forks/jsdom/invitations

@domenic
Copy link
Member

domenic commented Mar 14, 2020

The invitation has expired.

Regardless, I don't want to have to join another organization to collaborate on my own projects.

@ExE-Boss ExE-Boss changed the title feat(constructs): Add support for callback interfaces Implement support for callback interfaces Mar 27, 2020
@ExE-Boss ExE-Boss force-pushed the feat/constructs/callback-interface branch from e1e5075 to 422d016 Compare March 30, 2020 04:46
Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

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

More to come later.

lib/types.js Outdated Show resolved Hide resolved
lib/types.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/constructs/callback-interface.js Show resolved Hide resolved
@ExE-Boss ExE-Boss requested a review from TimothyGu April 1, 2020 17:17
Co-Authored-By: Timothy Gu <[email protected]>
lib/constructs/callback-interface.js Show resolved Hide resolved
lib/constructs/callback-interface.js Outdated Show resolved Hide resolved
lib/constructs/callback-interface.js Outdated Show resolved Hide resolved
lib/constructs/callback-interface.js Show resolved Hide resolved
README.md Outdated

Performs the Web IDL conversion algorithm for this callback interface, converting _value_ into a function that performs [call a user object’s operation](https://heycam.github.io/webidl/#call-a-user-objects-operation) when called, with `thisArg` being the `this` value of the converted function.

The resulting function has an `objectReference` property, which is the same object as `value` and can be used to perform identity checks, as `convert` returns a new function object every time.
Copy link
Member

Choose a reason for hiding this comment

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

Also mention that we don't implement the callback context yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The callback context is used to ensure that the callbacks are executed in the correct realm, which is handled for us by the platform.

@ExE-Boss ExE-Boss requested a review from TimothyGu April 2, 2020 10:14
@TimothyGu TimothyGu merged commit 06eb4ae into jsdom:master Apr 3, 2020
@TimothyGu TimothyGu deleted the feat/constructs/callback-interface branch April 3, 2020 13:22
@TimothyGu
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants