-
Notifications
You must be signed in to change notification settings - Fork 954
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_navigate_listener #676
base: master
Are you sure you want to change the base?
Conversation
Is generic event listener code possible? I don't think we want to add individual event listeners for every possible event. |
That progress is being tracked over at #659. I think it is possible for mac and linux, but it looks very difficult for windows, especially with our current architecture. I was going to just add this navigate listener and a window destroy listener so that the app can show a confirm dialogue and cancel the window close if the user changes his mind. dandeto@e4ef6e3 I still think we should ideally add a completely generic way to create any listener. If that is not possible, we should expose the platform specific event system. I'm still working on it. Bottom-line, a navigate event listener is 100% necessary for a webview library, whether or not we create a more robust event system. |
Looking over this again, I agree that it should be added. But it needs to support macOS first. Help porting it would be much appreciated. |
inspired by webview#676 provide a callback in case of navigation completed with a custom argument provided at registration time.
inspired by webview#676 provide a callback in case of navigation completed with a custom argument provided at registration time.
inspired by webview#676 provide a callback in case of navigation completed with a custom argument provided at registration time.
inspired by webview#676 provide a callback in case of navigation completed with a custom argument provided at registration time.
inspired by webview#676 provide a callback in case of navigation completed with a custom argument provided at registration time.
This is my first stab at creating several cross-platform event listeners! I do not have a Mac, so this only works on Linux GTK and Windows webview2. Hopefully this will inspire someone to port it to Mac.
The add_navigate_listener is a dead-simple function. When a new webpage has loaded, this listener calls whatever handler the user specified and passes it the current url. Here is an example:
Feedback appreciated!