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

Add WebView.MessageReceived #2675

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

camnewnham
Copy link

Hello! Initial draft for discussion.

The goal of this PR is to create a uniform approach to sending events from JS to Eto. Combined with the existing ExecuteScript it should allow for bi-directional communication (without polling).

Since each browser implementation significantly differs this approach is intended to keeps it simple by adding a single object /method to the global JavaScript context.

Example usage:

function isRunningInEto() {
  return window.eto !== undefined;
}

function onButtonClick() {
   window.eto.postMessage("The button was clicked!");
}

Supported Implementations:

  • WebView (legacy) (Wpf and WinForms)
  • WebView2 (Wpf and WinForms)
  • WebKit.WKWebView (Mac64 and MacOS)

Not implemented:

  • WebKit.WebView (legacy)
  • GTK

@camnewnham camnewnham marked this pull request as draft August 19, 2024 00:55
@cwensley
Copy link
Member

Hey @camnewnham, this is looking great! This will help a lot of custom script scenarios.

Do you need help with the GTK implementation or is that something you'll be able to do?

@camnewnham
Copy link
Author

Do you need help with the GTK implementation or is that something you'll be able to do?

That would be appreciated - I don't currently have a Linux machine (or is this testable on other platforms?)

Is a legacy WebKit.WebView implementation required?

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