Dear Ari,
I have tried to implement it and the code seems ok and builds ok but it does not work as expected,
so I have opened a new issue for it:
https://github.com/webview/webview/issues/951
There you can see the proposed code. Lets see what they say