CPF/CPF.Razor/Core/ElementHandlerFactory.cs
2024-01-08 10:55:10 +08:00

23 lines
681 B
C#

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using System;
namespace CPF.BlazorBindings
{
internal class ElementHandlerFactory
{
private readonly Func<NativeComponentRenderer, IElementHandler, IElementHandler> _callback;
public ElementHandlerFactory(Func<NativeComponentRenderer, IElementHandler, IElementHandler> callback)
{
_callback = callback ?? throw new ArgumentNullException(nameof(callback));
}
public IElementHandler CreateElementHandler(ElementHandlerFactoryContext context)
{
return _callback(context.Renderer, context.ParentHandler);
}
}
}