github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/helpers/lazy-click.js (about)

     1  import Helper from '@ember/component/helper';
     2  
     3  /**
     4   * Lazy Click Event
     5   *
     6   * Usage: {{lazy-click action}}
     7   *
     8   * Calls the provided action only if the target isn't an anchor
     9   * that should be handled instead.
    10   */
    11  export function lazyClick([onClick, event]) {
    12    if (!['a', 'button'].includes(event?.target.tagName.toLowerCase())) {
    13      onClick(event);
    14    }
    15  }
    16  
    17  export default Helper.helper(lazyClick);