Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created September 1, 2021 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinZikmund/afc3c9470dad357218552e1d884acc97 to your computer and use it in GitHub Desktop.
Save MartinZikmund/afc3c9470dad357218552e1d884acc97 to your computer and use it in GitHub Desktop.
public partial class BadgeUpdater
{
private const string JsType = "Windows.UI.Notifications.BadgeUpdater";
partial void SetBadge(string? value)
{
if (int.TryParse(value, out var number))
{
WebAssemblyRuntime.InvokeJS($"{JsType}.setNumber({number})");
}
else
{
WebAssemblyRuntime.InvokeJS($"{JsType}.clear()");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment