Created
January 8, 2022 09:51
-
-
Save bbenetskyy/7d3f8930264466822673c6282ce29b7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomWebView : WebView | |
{ | |
public void Cleanup() | |
{ | |
_displayJSTextAction = null; | |
} | |
#region DisplayJSTextAction | |
private Action<string> _displayJSTextAction; | |
public void RegisterDisplayJSTextAction(Action<string> callback) | |
{ | |
_displayJSTextAction = callback; | |
} | |
public void InvokeDisplayJSTextAction(string text) | |
{ | |
_displayJSTextAction?.Invoke(text); | |
} | |
#endregion DisplayJSTextAction | |
#region XFAppText | |
public void SetXFAppText(string text) => Device.BeginInvokeOnMainThread(async () => await EvaluateJavaScriptAsync($"DisplayXFText('{text}')")); | |
#endregion XFAppText | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment