/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Directive, ElementRef, Renderer2, Input } from '@angular/core';
var StopPropagationDirective = /** @class */ (function () {
    function StopPropagationDirective(elementRef, renderer) {
        this.elementRef = elementRef;
        this.renderer = renderer;
        this.callbacks = [];
    }
    /**
     * @return {?}
     */
    StopPropagationDirective.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        if (typeof this.uiStopPropagation === 'string') {
            this.addEvent(this.uiStopPropagation || 'click');
        }
        else {
            this.uiStopPropagation.forEach(function (eventType) {
                _this.addEvent(eventType);
            });
        }
    };
    /**
     * @return {?}
     */
    StopPropagationDirective.prototype.ngOnDestroy = /**
     * @return {?}
     */
    function () {
        this.callbacks.forEach(function (fn) {
            fn();
        });
    };
    /**
     * @param {?} eventType
     * @return {?}
     */
    StopPropagationDirective.prototype.addEvent = /**
     * @param {?} eventType
     * @return {?}
     */
    function (eventType) {
        var /** @type {?} */ fn = this.renderer.listen(this.elementRef.nativeElement, eventType, function (ev) {
            ev.stopPropagation();
        });
        this.callbacks.push(fn);
    };
    StopPropagationDirective.decorators = [
        { type: Directive, args: [{
                    selector: '[ui-stop-propagation]'
                },] },
    ];
    /** @nocollapse */
    StopPropagationDirective.ctorParameters = function () { return [
        { type: ElementRef, },
        { type: Renderer2, },
    ]; };
    StopPropagationDirective.propDecorators = {
        "uiStopPropagation": [{ type: Input, args: ['ui-stop-propagation',] },],
    };
    return StopPropagationDirective;
}());
export { StopPropagationDirective };
function StopPropagationDirective_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    StopPropagationDirective.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    StopPropagationDirective.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    StopPropagationDirective.propDecorators;
    /** @type {?} */
    StopPropagationDirective.prototype.uiStopPropagation;
    /** @type {?} */
    StopPropagationDirective.prototype.callbacks;
    /** @type {?} */
    StopPropagationDirective.prototype.elementRef;
    /** @type {?} */
    StopPropagationDirective.prototype.renderer;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcC1wcm9wYWdhdGlvbi5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AdGFuYm8vdWktbmF0aXZlLyIsInNvdXJjZXMiOlsibGliL290aGVyL3N0b3AtcHJvcGFnYXRpb24uZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxTQUFTLEVBQWEsS0FBSyxFQUFVLE1BQU0sZUFBZSxDQUFDOztJQVd6RixrQ0FBb0IsVUFBc0IsRUFBVSxRQUFtQjtRQUFuRCxlQUFVLEdBQVYsVUFBVSxDQUFZO1FBQVUsYUFBUSxHQUFSLFFBQVEsQ0FBVzt5QkFGdkMsRUFBRTtLQUdqQzs7OztJQUVELDJDQUFROzs7SUFBUjtRQUFBLGlCQVFDO1FBUEMsRUFBRSxDQUFDLENBQUMsT0FBTyxJQUFJLENBQUMsaUJBQWlCLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQztZQUMvQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxpQkFBaUIsSUFBSSxPQUFPLENBQUMsQ0FBQztTQUNsRDtRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sSUFBSSxDQUFDLGlCQUFpQixDQUFDLE9BQU8sQ0FBQyxVQUFBLFNBQVM7Z0JBQ3RDLEtBQUksQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLENBQUM7YUFDMUIsQ0FBQyxDQUFDO1NBQ0o7S0FDRjs7OztJQUVELDhDQUFXOzs7SUFBWDtRQUNFLElBQUksQ0FBQ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