/// <summary>
 /// Allows the specified component type to be used as a custom element.
 /// </summary>
 /// <typeparam name="TComponent">The component type.</typeparam>
 /// <param name="configuration">The <see cref="IJSComponentConfiguration"/>.</param>
 /// <param name="customElementName">A unique name for the custom element. This must conform to custom element naming rules, so it must contain a dash character.</param>
 public static void RegisterAsCustomElement <TComponent>(this IJSComponentConfiguration configuration, string customElementName) where TComponent : IComponent
 => configuration.RegisterForJavaScript <TComponent>(customElementName, "registerBlazorCustomElement");
 public static void RegisterForJavaScript <[DynamicallyAccessedMembers(Component)] TComponent>(this IJSComponentConfiguration configuration, string identifier) where TComponent : IComponent
 => configuration.JSComponents.Add(identifier, typeof(TComponent));
Exemplo n.º 3
0
 public static void RegisterForJavaScript(this IJSComponentConfiguration configuration, [DynamicallyAccessedMembers(Component)] Type componentType, string identifier, string javaScriptInitializer)
 => configuration.JSComponents.Add(componentType, identifier, javaScriptInitializer);
Exemplo n.º 4
0
 /// <summary>
 /// Marks the specified component type as allowed for use as a custom element.
 /// </summary>
 /// <typeparam name="TComponent">The component type.</typeparam>
 /// <param name="configuration">The <see cref="IJSComponentConfiguration"/>.</param>
 /// <param name="identifier">A unique name for the custom element. This must conform to custom element naming rules, so it must contain a dash character.</param>
 public static void RegisterCustomElement <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>(this IJSComponentConfiguration configuration, string identifier) where TComponent : IComponent
 => configuration.RegisterForJavaScript <TComponent>(identifier, "registerBlazorCustomElement");
Exemplo n.º 5
0
 /// <summary>
 /// Marks the specified component type as allowed for instantiation from JavaScript.
 /// </summary>
 /// <typeparam name="TComponent">The component type.</typeparam>
 /// <param name="configuration">The <see cref="IJSComponentConfiguration"/>.</param>
 /// <param name="identifier">A unique identifier for the component type that will be used by JavaScript code.</param>
 /// <param name="javaScriptInitializer">Specifies an optional identifier for a JavaScript function that will be called to register the custom element.</param>
 public static void RegisterForJavaScript <[DynamicallyAccessedMembers(Component)] TComponent>(this IJSComponentConfiguration configuration, string identifier, string javaScriptInitializer) where TComponent : IComponent
 => RegisterForJavaScript(configuration, typeof(TComponent), identifier, javaScriptInitializer);