2017-12-15 21:39:18 +00:00
|
|
|
import Helper from '@ember/component/helper';
|
2017-09-26 18:57:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Lazy Click Event
|
|
|
|
*
|
|
|
|
* Usage: {{lazy-click action}}
|
|
|
|
*
|
|
|
|
* Calls the provided action only if the target isn't an anchor
|
|
|
|
* that should be handled instead.
|
|
|
|
*/
|
|
|
|
export function lazyClick([onClick, event]) {
|
2020-06-17 07:16:42 +00:00
|
|
|
if (!['a', 'button'].includes(event.target.tagName.toLowerCase())) {
|
2017-09-26 18:57:46 +00:00
|
|
|
onClick(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Helper.helper(lazyClick);
|