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

Fix docs for JS return types in Window API #3247

Merged
merged 5 commits into from
Mar 24, 2024
Merged

Conversation

jangler
Copy link
Contributor

@jangler jangler commented Feb 8, 2024

Description

These Window API functions return promises, not raw values. This was not documented. Also fixed a typo in the relevant document.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Windows
  • macOS
  • Linux

Test Configuration

n/a

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Hopefully the PR number I predicted in the changelog edit turns out to be right.

Summary by CodeRabbit

  • New Features

    • Introduced the ability to exit the app via right-click on the dock icon.
  • Documentation

    • Updated the Window API documentation to correctly reflect return types and Promise-based behavior.

Copy link
Contributor

coderabbitai bot commented Feb 8, 2024

Walkthrough

The recent updates bring two significant enhancements: the addition of a right-click exit feature on the dock icon for better user interaction and a substantial overhaul to the Window API documentation. The documentation now emphasizes asynchronous operations by returning Promises, aligning the API with modern JavaScript practices for improved usability and clarity.

Changes

File Path Change Summary
website/src/pages/changelog.mdx - Added dock icon right-click exit handling.
- Fixed Window API documentation.
website/.../reference/runtime/window.mdx - Updated JavaScript functions to return Promise<boolean> instead of bool.

🐇✨
In the code's burrow, deep and wide,
Changes spring forth with a hopeful stride.
Promises kept, and exits now right-clicked,
Our digital warren, ever more slicked.
🌟🐾

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e29b375 and 941f605.
Files selected for processing (2)
  • website/src/pages/changelog.mdx (2 hunks)
  • website/versioned_docs/version-v2.7.0/reference/runtime/window.mdx (7 hunks)
Additional comments: 9
website/versioned_docs/version-v2.7.0/reference/runtime/window.mdx (7)
  • 35-35: The return type for WindowIsFullscreen is updated to Promise<boolean>. Ensure all examples and usage guides in the documentation are updated to reflect asynchronous handling of this function.
  • 113-113: The return type for WindowIsNormal is updated to Promise<boolean>. Similar to WindowIsFullscreen, verify that all related documentation sections correctly demonstrate handling promises.
  • 127-127: The return type for WindowGetSize is updated to Promise<Size>. This change requires updating any related examples to demonstrate how to work with the Size object returned by a promise.
  • 154-154: The WindowSetAlwaysOnTop function's documentation does not reflect a change to a promise-based return type, yet it's listed in the summary. Confirm whether this function should return a promise and update the documentation accordingly.
  • 168-168: The return type for WindowGetPosition is updated to Promise<Position>. Ensure that examples and usage guides are updated to reflect the asynchronous nature of this function.
  • 189-189: The return type for WindowIsMaximised is updated to Promise<boolean>. Verify that all related documentation sections correctly demonstrate handling promises for this function.
  • 217-217: The return type for WindowIsMinimised is updated to Promise<boolean>. Ensure that examples and usage guides in the documentation are updated to reflect asynchronous handling of this function.
website/src/pages/changelog.mdx (2)

@leaanthony
Copy link
Member

Thanks for this! Could you possibly edit the non-versioned docs as that means we'll get to keep it as the versions are cycled. Thank you.

@jangler
Copy link
Contributor Author

jangler commented Mar 2, 2024

And the "edit this page" button made it sound so easy...

I also noticed that the return type syntax is inconsistent on that page (colon vs. no colon), but I'm not planning on doing anything about that.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 941f605 and 05d6e5a.
Files selected for processing (1)
  • website/docs/reference/runtime/window.mdx (7 hunks)
Additional comments: 6
website/docs/reference/runtime/window.mdx (6)
  • 35-35: The documentation correctly updates WindowIsFullscreen() to return a Promise<boolean>, aligning with the PR's objective to accurately reflect the asynchronous nature of these functions.
  • 113-113: The update to WindowIsNormal() to return a Promise<boolean> is consistent with the PR's goal of clarifying the return types of functions to indicate their asynchronous behavior.
  • 154-154: The correction of the typo from Boolen to boolean in the WindowSetAlwaysOnTop() method improves the documentation's clarity and correctness.
  • 168-168: The documentation update for WindowGetPosition() to return a Promise<Position> is in line with the PR's objectives, ensuring developers are aware of the asynchronous nature of this function.
  • 189-189: Updating WindowIsMaximised() to return a Promise<boolean> correctly reflects the asynchronous behavior of the function, aligning with the PR's goal of improving documentation accuracy.
  • 217-217: The change to WindowIsMinimised() to return a Promise<boolean> is consistent with the PR's objectives, accurately indicating the function's asynchronous return type.

website/docs/reference/runtime/window.mdx Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 05d6e5a and bba362a.
Files selected for processing (1)
  • website/docs/reference/runtime/window.mdx (7 hunks)
Files skipped from review as they are similar to previous changes (1)
  • website/docs/reference/runtime/window.mdx

Copy link
Member

@leaanthony leaanthony left a comment

Choose a reason for hiding this comment

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

Thanks @jangler

@leaanthony leaanthony merged commit 311aee3 into wailsapp:master Mar 24, 2024
8 checks passed
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.

2 participants