@corux/ask-extensions
Version:
Extensions to improve development with Alexa Skills Kit SDK
30 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var ExtendedHandlerInput_1 = require("./ExtendedHandlerInput");
/**
* RequestHandler with canHandle implemented by decorators.
*/
var BaseRequestHandler = /** @class */ (function () {
function BaseRequestHandler() {
}
BaseRequestHandler.prototype.canHandle = function (handlerInput) {
if (this.canHandleByDecorators(handlerInput)) {
ExtendedHandlerInput_1.extendHandlerInput(handlerInput);
return true;
}
return false;
};
BaseRequestHandler.prototype.canHandleByDecorators = function (handlerInput) {
if (this.isFallback) {
return true;
}
var request = handlerInput.requestEnvelope.request;
if (this.intents && request.type === "IntentRequest") {
return this.intents.indexOf(request.intent.name) !== -1;
}
return this.types && this.types.indexOf(request.type) !== -1;
};
return BaseRequestHandler;
}());
exports.BaseRequestHandler = BaseRequestHandler;
//# sourceMappingURL=BaseRequestHandler.js.map