{"id":20340042,"url":"https://github.com/enpit/echo-state","last_synced_at":"2026-06-05T12:31:26.332Z","repository":{"id":78156485,"uuid":"102098040","full_name":"enpit/echo-state","owner":"enpit","description":"Tiny state management helper for Amazon Alexa","archived":false,"fork":false,"pushed_at":"2018-04-20T07:16:58.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-14T18:08:58.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enpit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-01T09:39:01.000Z","updated_at":"2018-04-20T07:16:59.000Z","dependencies_parsed_at":"2023-07-27T10:30:42.635Z","dependency_job_id":null,"html_url":"https://github.com/enpit/echo-state","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enpit%2Fecho-state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enpit%2Fecho-state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enpit%2Fecho-state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enpit%2Fecho-state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enpit","download_url":"https://codeload.github.com/enpit/echo-state/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241867649,"owners_count":20033815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T21:19:30.078Z","updated_at":"2026-06-05T12:31:26.320Z","avatar_url":"https://github.com/enpit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# echo-state\n\nThis is a tiny library that contains some useful functionality when dealing with states in an Amazon Alexa skill.\n\n## Installation\n\nSince we did not bother to publish to npm, you have to run \n\n- `npm install git+https://github.com/enpit/echo-state.git`\n- and then you can `require('echo-state')`.\n\n## Usage\n\necho-state exposes a really simple API that let's you interact with a hierarchy of application states.\n\n```javascript\n\n// create a new instance of the StateStore\nvar store = new StateStore();\n\n// create a state and define intent handlers\nvar rootState = store.create('root', {\n\n\tHelpIntent: function () {\n\t\t// ...\n\t},\n\tUnhandled: function () {\n\t\t// ...\n\t}\n\n});\n\n// create a child state that inherits all handlers from the parent state\nvar childState = store.create('child', 'root', {\n\n\t// override the HelpIntent handler function\n\tHelpIntent: function () {\n\t\t// ...\n\t}\n\n});\n```\n\nThat's it basically. You can create a hierarchy of states and by default, states inherit handlers from their parents.\n\n**You still have to register the state handlers by calling `alexa.registerHandlers( ...(store.getHandlers()) );`.**\n\nYou can access states using `getState('root-\u003echild')` or `getState('child')` if there is only one state with that name. The search string is matched against the longest matching state \"path\". The `-\u003e` notation can be configured to be something else when instantiating the store with something like `new StateStore('.')`.\n\nTo add handlers to an existing state, you can call a state's `addHandler` method:\n\n```javascript\nstore.getState('mystate').addHandler({\n\tUnhandled: function () {\n\t\t// ...\n\t}\n});\n```\n\n## Contributing\n\n**If you feel like adding functionality or tests or suggestions to this library, feel free to do so!** 🙂\n\nFor your implemented features, send us a PR, for requests and discussions, open up an issue. We are happy to answer questions, listen to feedback and talk about suggestions for additional features.\n\n## License\n\nThe MIT License (MIT)\nCopyright © 2017-2018 enpit GmbH \u0026 Co. KG\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenpit%2Fecho-state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenpit%2Fecho-state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenpit%2Fecho-state/lists"}