OutsideClickHandler 0.1.0

dotnet add package OutsideClickHandler --version 0.1.0                
NuGet\Install-Package OutsideClickHandler -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OutsideClickHandler" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OutsideClickHandler --version 0.1.0                
#r "nuget: OutsideClickHandler, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OutsideClickHandler as a Cake Addin
#addin nuget:?package=OutsideClickHandler&version=0.1.0

// Install OutsideClickHandler as a Cake Tool
#tool nuget:?package=OutsideClickHandler&version=0.1.0                

OutsideClickHandler

Detect click outside of element for Blazor. <br> An improvement of Blazor.OutsideClickHandler. <br>

What's different?

  • There's an issue that after OnClickOutside is invoked, it creates a new addeventlistener everytime creating a flood unused event listeners. This does not, it only creates one and stores OutsideClickHandler instances on a list on first render and removes it when StopPropagation is true or when the component is disposed.
  • There's also an issue when OnClickOutside is continuously triggered when unneeded. StopPropagation mitigates that.

Usage

  1. Intall nuget package.
  2. Add @using OutsideClickHandler.Component to the desired component/page or in _Imports.razor. <br> Step1 <br>
  3. Add js src on index.html in wwwroot folder. Step2 <br>
  4. That's it! You may now use it. Step3-1Step3-2

Parameters

  • OnOutsideClick
    • Accepts void function to be called on outside click.
    • Executed first when both OnOutsideClick and OnOutsideClickTask have value.
  • OnOutsideClickTask
    • Accepts awaitable function to be called on outside click.
  • StopPropagation
    • Stops <c>OnOutsideClick</c> and <c>OnOutsideClickTask</c> from executing when <c>true</c>.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 838 12/2/2022