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

docs (#2528): add references to help people new to getter functions i… #2817

Merged
merged 2 commits into from
May 1, 2024

Conversation

bencodezen
Copy link
Member

Description of Problem

Getter functions are referenced a lot in docs, but if you're new to JS, it is unclear whether this is a Vue thing or a JS thing.

Proposed Solution

Similar to how acronyms are defined at the beginning of each article before being used throughout the rest, adding a link referencing to what getters / setters are can help provide clarity to people newer to JavaScript and haven't encountered these concepts yet.

Additional Information

Related issue #2528

Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 2aaff24
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/66293f4a0a1ad2000875b892
😎 Deploy Preview https://deploy-preview-2817--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bencodezen bencodezen linked an issue Apr 23, 2024 that may be closed by this pull request
@brc-dd
Copy link
Member

brc-dd commented Apr 23, 2024

I don't think getter function in Vue's context is same as get syntax. It's more like any function that returns something.

That MDN link just shows things like const foo = { get bar() { return 1 } }. If one is reading that link and will try to apply that to, say, computed it won't work.

@AloisSeckar
Copy link
Contributor

I don't think getter function in Vue's context is same as get syntax.

Then perhaps a better approach would be to include it into Glossary under its own label? 🤔

@nielsbom
Copy link

Any idea why the term "getter function" is used so consistently?

Maybe use "value-returning-function" or "function that returns a value" instead to make it more clear that it's not a special concept?

@bencodezen
Copy link
Member Author

I don't think getter function in Vue's context is same as get syntax. It's more like any function that returns something.

That MDN link just shows things like const foo = { get bar() { return 1 } }. If one is reading that link and will try to apply that to, say, computed it won't work.

Further down in the description, there's the following snippet:

The getter syntax allows you to specify the getter function in an object initializer.

I believe this is the concept that we are referring to, though maybe I'm wrong.

@bencodezen bencodezen added state: review PR issued and under review and removed state: review PR issued and under review labels Apr 25, 2024
@NataliaTepluhina NataliaTepluhina merged commit 43761be into main May 1, 2024
5 checks passed
@NataliaTepluhina NataliaTepluhina deleted the 2528/add-references-for-getter-functions branch May 1, 2024 10:35
@nielsbom
Copy link

nielsbom commented May 1, 2024

W00t!

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.

Define "getter function"
5 participants