UNPKG

@ogs-gmbh/ngx-utils

Version:

A lightweight collection of utility functions and helpers for Angular applications

49 lines 1.71 kB
import { EventEmitter, InputSignal } from '@angular/core'; import * as i0 from "@angular/core"; /** * Throttles click events on an HTML element. * * @remarks * Prevents rapid repeated clicks by allowing only one `(throttleClick)` event * to fire within the configured interval. Works with any clickable element. * * @example **Template (HTML)** * ```html * <button * (throttleClick)="onCounterClick($event)" * [throttleTimeMs]="300"> * Counter * </button> * ``` * * @example **Component (TypeScript)** * ```ts * @Component({ * standalone: true, * selector: 'app-foo', * imports: [ThrottleClickDirective] * }) * export class FooComponent { * onCounterClick(mouseEvent: MouseEvent): void { * // ... * } * } * ``` */ export declare class ThrottleClickDirective { private readonly _element; /** * Whether the first click is emitted - default is true */ leading: InputSignal<boolean>; /** * Whether the last click is emitted - default is true */ trailing: InputSignal<boolean>; throttleTimeMs: InputSignal<number>; readonly throttleClick: EventEmitter<MouseEvent>; constructor(); static ɵfac: i0.ɵɵFactoryDeclaration<ThrottleClickDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<ThrottleClickDirective, "[throttleClick]", never, { "leading": { "alias": "leading"; "required": false; "isSignal": true; }; "trailing": { "alias": "trailing"; "required": false; "isSignal": true; }; "throttleTimeMs": { "alias": "throttleTimeMs"; "required": false; "isSignal": true; }; }, { "throttleClick": "throttleClick"; }, never, never, true, never>; } //# sourceMappingURL=throttle-click.directive.d.ts.map