Source: sessionHandler/sessionHandler.js

  1. /**
  2. * @author Sloan Seaman
  3. * @copyright 2016 and on
  4. * @version .1
  5. * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  6. */
  7. /**
  8. * Interface for classes that can handle can act as a session handler
  9. *
  10. * @interface SessionHandler
  11. */
  12. /**
  13. * Returns the name of the SessionHandler. If not set, SkillVC will attempt to determine one for you and add the function
  14. * to your object
  15. *
  16. * @function
  17. * @name SessionHandler.getName
  18. * @return {String} The name of the SessionHandler
  19. */
  20. /**
  21. * Returns the order location in which the session handlers should be called.
  22. *
  23. * If not defined, the order will be assumed to be the order in which it was loaded
  24. *
  25. * @function
  26. * @name SessionHandler#getOrder
  27. * @return {Number} The place in execution order (index) of the session handler.
  28. */
  29. /**
  30. * Called when a session is started.
  31. *
  32. * A SessionHandler should implement either sessionStart or sessionEnd, it does not need to implement both.
  33. * If the SessionHandler has any async operations a `Promise` should be returned to SkillVC so that it will wait until
  34. * execution of the async operation has completed
  35. *
  36. * @function
  37. * @name SessionHandler#sessionStart
  38. * @param {Object} event The event for the skill (from lambda)
  39. * @param {OBject} context The context for the skill (from lambda)
  40. * @param {SVContext} svContext The context of the execution
  41. * @returns {Promise} The optional `Promise` that can be used to wait until this completes
  42. */
  43. /**
  44. * Called when a session has ended
  45. *
  46. * A essionHandler should implement either sessionStart or sessionEnd, it does not need to implement both.
  47. * If the SessionHandler has any async operations a `Promise` should be returned to SkillVC so that it will wait until
  48. * execution of the async operation has completed
  49. *
  50. * @function
  51. * @name SessionHandler#sessionEnd
  52. * @param {Object} event The event for the skill (from lambda)
  53. * @param {OBject} context The context for the skill (from lambda)
  54. * @param {SVContext} svContext The context of the execution
  55. * @returns {Promise} The optional `Promise` that can be used to wait until this completes
  56. */