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

Amplify backend actions for webviews #1731

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

Conversation

drkameleon
Copy link
Collaborator

Description

Right now, one of the different "access points" we have, so that our webviews communicate with the Arturo are backend actions. That is: named, function-like calls, available exclusively in this context (Webview <-> Arturo message passing) and are normally meant to offer system- or UI-specific functionality (e.g. "maximize the main window" ➡️ window.maximize).

Here, we'll attempt adding a few more of these actions and, thus, amplify a bit the spectrum of what can be done/accessed through the webview itself! 😉

Type of change

  • Code cleanup
  • Enhancement (implementation update, or general performance enhancements)
  • New feature (non-breaking change which adds functionality)

@drkameleon drkameleon added enhancement New feature or request helpers Issues related to Helper modules ui Issues related to the UI new feature New feature/addition labels Sep 24, 2024
@github-actions github-actions bot added library Issues related to the standard library → Ui labels Dec 6, 2024
@github-actions github-actions bot added vm Issues related to the Virtual Machine implementation error handling Issues related to Error handling labels Dec 7, 2024
@drkameleon
Copy link
Collaborator Author

drkameleon commented Dec 7, 2024

Rough draft of what I'm thinking about a possible Window implementation (that's gonna be internal!):
and using our new... .safe getters/setters... #1821

(EDIT: This has been over-simplified in the end, but still following the idea of an "internal" custom type)

define :window [
    _isVisible: true
    _isFullscreen: false
    _isMaximized: false
    _title: ""
    
    ; placeholders
    _show: function [][]
    _hide: function [][]
    _fullscreen: function [][]
    _unfullscreen: function [][]
    _maximize: function [][]
    _unmaximize: function [][]
    _settitle: function [title][]
    
    close: function [][]
    evaluate: function [code][]

    get: method [what][
        case what [
            'visible?       -> return get.safe this '_isVisible
            'fullscreen?    -> return get.safe this '_isFullscreen
            'maximized?     -> return get.safe this '_isMaximized
            'title          -> return get.safe this '_title
            any             -> throw "Unrecognized field"
        ]
    ]

    set: method [what, value][
        case what [
            'visible?       [
                set.safe this '_isVisible value
                (value)? -> \show
                         -> \hide
            ]
            'fullscreen?    [
                set.safe this '_isFullscreen value
                (value)? -> \fullscreen
                         -> \unfullscreen
            ]
            'maximized?    [
                set.safe this '_isMaximized value
                (value)? -> \maximize
                         -> \unmaximize
            ]
            'title          [
                set.safe this '_title value
                \settitle value
            ]
        ]
    ]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd-party Issues related to 3rd-party libraries and code → Collections enhancement New feature or request helpers Issues related to Helper modules library Issues related to the standard library new feature New feature/addition ui Issues related to the UI → Ui vm Issues related to the Virtual Machine implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant