A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
873 B

#nullable enable
using Avalonia.Controls.Platform;
using Microsoft.JSInterop;
namespace Avalonia.Web.Blazor
{
public class JSObjectControlHandle : INativeControlHostDestroyableControlHandle
{
internal const string ElementReferenceDescriptor = "JSObjectReference";
public JSObjectControlHandle(IJSObjectReference reference)
{
Object = reference;
}
public IJSObjectReference Object { get; }
public IntPtr Handle => throw new NotSupportedException();
public string? HandleDescriptor => ElementReferenceDescriptor;
public void Destroy()
{
if (Object is IJSInProcessObjectReference inProcess)
{
inProcess.Dispose();
}
else
{
_ = Object.DisposeAsync();
}
}
}
}