github.com/hernad/nomad@v1.6.112/ui/app/helpers/lazy-click.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Helper from '@ember/component/helper'; 7 8 /** 9 * Lazy Click Event 10 * 11 * Usage: {{lazy-click action}} 12 * 13 * Calls the provided action only if the target isn't an anchor 14 * that should be handled instead. 15 */ 16 export function lazyClick([onClick, event]) { 17 if (!['a', 'button'].includes(event?.target.tagName.toLowerCase())) { 18 onClick(event); 19 } 20 } 21 22 export default Helper.helper(lazyClick);