"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var busy_1 = require("../../busy/busy");
var baseButton_1 = require("../baseButton");
exports.asyncInputs = baseButton_1.baseInputs.concat(['action']);
var ButtonAsyncComponent = (function (_super) {
    __extends(ButtonAsyncComponent, _super);
    function ButtonAsyncComponent() {
        var _this = _super.call(this) || this;
        if (!_this.action) {
            _this.action = function () { return rxjs_1.Observable.empty(); };
        }
        return _this;
    }
    ButtonAsyncComponent.prototype.triggerAction = function ($event) {
        // subscribes to kick off the action
        var waitValue = this.action($event);
        this.busySpinner.waitOn(waitValue).subscribe();
    };
    return ButtonAsyncComponent;
}(baseButton_1.BaseButtonComponent));
__decorate([
    core_1.ViewChild(busy_1.BusyComponent),
    __metadata("design:type", busy_1.BusyComponent)
], ButtonAsyncComponent.prototype, "busySpinner", void 0);
ButtonAsyncComponent = __decorate([
    core_1.Component({
        selector: 'rlButtonAsync',
        template: require('./buttonAsync.html'),
        inputs: exports.asyncInputs,
    }),
    __metadata("design:paramtypes", [])
], ButtonAsyncComponent);
exports.ButtonAsyncComponent = ButtonAsyncComponent;
//# sourceMappingURL=data:application/json;base64,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