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

Manually adding / removing call backs #15

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

IeuanWalker
Copy link

Sorry same draft PR as before, when i tried syncing my main branch it auto deleted my commits #1

Hi, great work on this control.

Thought I'd just do a draft PR to show an implementation I prefer. I'm not a big fan JSInvokeTarget, think it could add some complexity to some simpler use cases.

So I propose adding 2 methods to Add/ Remove JS callback methods.

That way to don't need a completely separate class that contain all the call back methods, you could simply do this -

// Register in the constructor or anywhere else
myHybridWebView.AddLocalCallback(this, nameof(AddLocalCallBackTest));

private async void AddLocalCallBackTest(string message, int value)
{
    WriteToLog($"I'm a .NET method called from JavaScript with message='{message}' and value={value}, using a local registration");
}

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.

1 participant