Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

js: add MakeFullWrapper to expose exported methods and struct fields. #1112

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

Merged
merged 4 commits into from
Apr 18, 2022
Merged

Conversation

JounQin
Copy link
Contributor

@JounQin JounQin commented Apr 4, 2022

rebase for #790

close #790


Currently the documentation for js.MakeWrapper is:

"MakeWrapper creates a JavaScript object which has wrappers for the
exported methods of i. Use explicit getter and setter methods to expose
struct fields to JavaScript."

Where the value a struct value (or more
interestingly a pointer to a struct value) we can actually auto-generate
getters and setters for exported fields in the JavaScript world, rather
than requiring explicit getters and setters to be defined on the Go
side.

We do this via a new MakeFullWrapper method.

@nevkontakte
Copy link
Member

Thanks for doing the rebase! Upon the first pass the change looks good, but it is a part of the codebase I'm not very familiar with. I'll need a day or two more to understand this change in more detail.

Please disregard the failed check, it appears to be a bug in the check itself, unrelated to this PR.

Copy link
Member

@nevkontakte nevkontakte left a comment

Choose a reason for hiding this comment

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

@JounQin sorry for the delay, I had a very busy week at work. I left a few minor comments to improve code readability. I also pushed a fix for the failed GitHub Action, if you rebase on the latest master, the check should pass.

js/js.go Outdated Show resolved Hide resolved
js/js.go Outdated Show resolved Hide resolved
js/js.go Outdated Show resolved Hide resolved
js/js.go Outdated Show resolved Hide resolved
js/js.go Show resolved Hide resolved
@nevkontakte
Copy link
Member

@JounQin I'd like to merge this pull request and make a GopherJS release with it. If you need help with addressing the comments I left, you could enable "Allow edits and access to secrets by maintainers" on this PR, and I could give it a go.

@JounQin
Copy link
Contributor Author

JounQin commented Apr 17, 2022

@nevkontakte

image

I've already enabled this feature when PR open, feel free to change.

@nevkontakte
Copy link
Member

Strange, I get an error when I try to push commits to it:

$ git push JounQuin getters -f
ERROR: Permission to JounQin/gopherjs.git denied to nevkontakte.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I'll try to figure out what I'm going wrong :)

@nevkontakte
Copy link
Member

@JounQin I figured out the issue. Your repository is a fork of https://github.com/myitcv/gopherjs, not this repository. Apparently, in GitHub's eyes this disqualifies me from being able to edit this pull request contents:

You can only make commits on pull request branches that:

  • are opened in a repository that you have push access to and that were created from a fork of that repository.

Do you need my assistance to address the review comments? I could take your branch and make yet another PR from it if so.

myitcv and others added 4 commits April 18, 2022 09:45
Currently the documentation for js.MakeWrapper is:

> "MakeWrapper creates a JavaScript object which has wrappers for the
exported methods of i. Use explicit getter and setter methods to expose
struct fields to JavaScript."

Where the value a struct value (or more
interestingly a pointer to a struct value) we can actually auto-generate
getters and setters for exported fields in the JavaScript world, rather
than requiring explicit getters and setters to be defined on the Go
side.

We do this via a new MakeFullWrapper method.
@JounQin
Copy link
Contributor Author

JounQin commented Apr 18, 2022

@nevkontakte Please help to review again.

@nevkontakte
Copy link
Member

@JounQin thanks for addressing the comments, and thanks for the contribution!

@nevkontakte nevkontakte merged commit be12844 into gopherjs:master Apr 18, 2022
@JounQin JounQin deleted the getters branch April 18, 2022 12:59
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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.