alexa-ability-lambda-handler
Advanced tools
+9
-7
@@ -6,13 +6,15 @@ "use strict"; | ||
| }); | ||
| exports.default = createAbilityHandler; | ||
| function createAbilityHandler(ability) { | ||
| exports.handleAbility = handleAbility; | ||
| function handleAbility(ability) { | ||
| return function (event, context) { | ||
| return function abilityHandler(event, context) { | ||
| ability.handle(event).then(function (req) { | ||
| console.log(req.toJSON()), context.succeed(req.toJSON()); | ||
| }, function (err) { | ||
| return context.fail(err); | ||
| ability.handle(event, function (err, req) { | ||
| if (err) { | ||
| context.fail(err); | ||
| } else { | ||
| context.succeed(req.toJSON()); | ||
| } | ||
| }); | ||
| }; | ||
| } |
+2
-2
| { | ||
| "name": "alexa-ability-lambda-handler", | ||
| "version": "0.2.0", | ||
| "version": "0.3.0", | ||
| "description": "", | ||
@@ -30,4 +30,4 @@ "main": "lib/index.js", | ||
| "peerDependencies": { | ||
| "alexa-ability": "^0.3.4" | ||
| "alexa-ability": "^0.5.0" | ||
| } | ||
| } |
+3
-3
@@ -7,11 +7,11 @@ # alexa-ability-lambda-handler | ||
| import { Ability, events } from 'alexa-ability'; | ||
| import handle from 'alexa-ability-lambda-handler'; | ||
| import { handleAbility } from 'alexa-ability-lambda-handler'; | ||
| const ability = new Ability(); | ||
| ability.on(events.LAUNCH, function(req) { | ||
| ability.on(events.launch, function(req) { | ||
| req.say("Testing testing one two three.").end(); | ||
| }); | ||
| export const handler = handle(ability); | ||
| export const handler = handleAbility(ability); | ||
| ``` |
2629
1.08%15
15.38%