Giter VIP home page Giter VIP logo

Comments (2)

deegles avatar deegles commented on July 20, 2024

Hi Craig,

We chose 'handler' vs 'handlers' since the function returns a single object that maps to a single state, even though it can contain multiple listeners. You then register event listener functions inside of that object. Providing an object as a parameter to CreateStateHandler is a convenience.

For example, the following is valid:

var inProgressHandler = Alexa.CreateStateHandler('InProgress');

inProgressHandler['LaunchRequest'] = function(){ ... }

Does that make sense?

As to your other question, in the example, newSessionHandlers would be equivalent to

var newSessionHandlers = Alexa.CreateStateHandler(); // The 'null' state

inProgressHandler['NewSession'] = function(){ ... }

You would still need to have something like the above to catch the first-ever invocation of the skill, before any attributes (including the state string) have been set.

Of course, you don't have to use the state feature at all, especially if it is a simpler skill. It just helps to manage complexity as the number of intents go up.

from alexa-skills-kit-sdk-for-nodejs.

craigbilner avatar craigbilner commented on July 20, 2024

Thanks @deegles,

I guess when I first came to it I didn't see them as "listeners" but rather "handlers", ta.

Still not sure on the "new session being a special case" thing, perhaps if state was the second argument it would have worked out. I actually like the declarative state handley stuff and would have liked to see it used for all states but ok, ta.

from alexa-skills-kit-sdk-for-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.