var Keyboard;
(function (Keyboard) {
    var Receiver = (function () {
        function Receiver(shortcuts) {
            var _this = this;
            this.shortcuts = shortcuts;
            this.enabled = true;
            this.callbacks = {};
            var key_handler_for = function (action) { return function () { return _this.dispatch_shortcut(action); }; };
            for (var _i = 0, _a = Object.keys(this.shortcuts); _i < _a.length; _i++) {
                var key = _a[_i];
                Mousetrap.bind(key, key_handler_for(this.shortcuts[key]));
            }
        }
        Receiver.prototype.on = function (action, callback) {
            this.callbacks[action] = callback;
        };
        Receiver.prototype.dispatch_shortcut = function (action) {
            if (this.enabled && action in this.callbacks) {
                this.callbacks[action]();
            }
        };
        return Receiver;
    }());
    Keyboard.Receiver = Receiver;
})(Keyboard || (Keyboard = {}));
//# sourceMappingURL=keyboard.js.map