1.0.0 • Published 3 years ago

svelte-action-outclick v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Installation

npm install svelte-action-outclick

Usage

<script>
  import { aOutClick } from "svelte-action-outclick";
</script>

<div use:aOutClick={{ excludeSelection : "button.blue, div.red", rightClick: true }} on:outclick={()=> doSomething()}>Don't click</div>

<div class="blue">blue div</div>
<div class="red">red div will be excluded</div>
<div class="green">green div</div>

<button class="blue">blue button will be excluded</button>
<button class="red">red button</button>
<button class="green">green button</button>

<style>
  .blue {
    background-color: blue;
    color: white;
  }
  .red {
    background-color: red;
    color: white;
  }
  .green {
    background-color: green;
    color: white;
  }
</style>

Action Parameters

ParameterTypeDescription
excludeSelectionstringOptional. A css selector of excluded elements
rightClickbooleanOptional. Allow right clicks as a trigger to an outclick event

License

Distributed under the MIT License.