{"action":"created","issue":{"url":"https://api.github.com/repos/TalAter/annyang/issues/60","labels_url":"https://api.github.com/repos/TalAter/annyang/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/TalAter/annyang/issues/60/comments","events_url":"https://api.github.com/repos/TalAter/annyang/issues/60/events","html_url":"https://github.com/TalAter/annyang/issues/60","id":20873698,"number":60,"title":"Asking for ideas: Allow annyang to support external plugins","user":{"login":"TalAter","id":926653,"avatar_url":"https://avatars.githubusercontent.com/u/926653?v=3","gravatar_id":"","url":"https://api.github.com/users/TalAter","html_url":"https://github.com/TalAter","followers_url":"https://api.github.com/users/TalAter/followers","following_url":"https://api.github.com/users/TalAter/following{/other_user}","gists_url":"https://api.github.com/users/TalAter/gists{/gist_id}","starred_url":"https://api.github.com/users/TalAter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TalAter/subscriptions","organizations_url":"https://api.github.com/users/TalAter/orgs","repos_url":"https://api.github.com/users/TalAter/repos","events_url":"https://api.github.com/users/TalAter/events{/privacy}","received_events_url":"https://api.github.com/users/TalAter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TalAter/annyang/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/TalAter/annyang/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"TalAter","id":926653,"avatar_url":"https://avatars.githubusercontent.com/u/926653?v=3","gravatar_id":"","url":"https://api.github.com/users/TalAter","html_url":"https://github.com/TalAter","followers_url":"https://api.github.com/users/TalAter/followers","following_url":"https://api.github.com/users/TalAter/following{/other_user}","gists_url":"https://api.github.com/users/TalAter/gists{/gist_id}","starred_url":"https://api.github.com/users/TalAter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TalAter/subscriptions","organizations_url":"https://api.github.com/users/TalAter/orgs","repos_url":"https://api.github.com/users/TalAter/repos","events_url":"https://api.github.com/users/TalAter/events{/privacy}","received_events_url":"https://api.github.com/users/TalAter/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2013-10-11T14:57:57Z","updated_at":"2015-12-28T16:30:45Z","closed_at":"2015-12-28T16:30:45Z","body":"I am looking for ideas, suggestions or known patterns on how to open up annyang to support external plug-ins.\r\n \r\nThese plugins should allow us to keep annyang as small and tight as possible, while still allowing the user to get additional features by picking and choosing the plugins they want.\r\n\r\nHere are some things plugins might want to do:\r\n* Add logging support to the library's basic methods. Allowing us to remove all console.log calls from the code, and let the user include an annyang.plugin.debug.js file if he wants it (#59)\r\n* A UI plugin that will give drop-in functionality for visual cues and effects. For example, just include the plugin to get a visual indicator when annyang is listening, when speech was recognized, when permission to use the mic is needed, etc. Similar to the visuals on Google (#47)\r\n* Your ideas...\r\n\r\nMy first instinct would be to extend the current addCallback method, making it more pub/sub like. Perhaps allowing plugins to subscribe to events, and adding more events that the library can publish.\r\n\r\n````javascript\r\nrecognition.onresult  = function(event) {\r\n  var results = event.results[event.resultIndex];\r\n  publish('result', results);\r\n  // ...\r\n  if (commandMatched) {\r\n    publish('resultMatch', {command: command, parameters: paramsers});\r\n  } else {\r\n    publish('resultNoMatch', results);\r\n  }\r\n}\r\n````\r\n\r\nBut might this later grow into a huge mess, forcing more and more events to be added to support new plugin features? Also, it doesn't allow for a plugin to extend a functionality I didn't anticipate (I'm still unsure whether that is a bad thing or not).\r\n\r\nWhat do you say?"},"comment":{"url":"https://api.github.com/repos/TalAter/annyang/issues/comments/167599521","html_url":"https://github.com/TalAter/annyang/issues/60#issuecomment-167599521","issue_url":"https://api.github.com/repos/TalAter/annyang/issues/60","id":167599521,"user":{"login":"TalAter","id":926653,"avatar_url":"https://avatars.githubusercontent.com/u/926653?v=3","gravatar_id":"","url":"https://api.github.com/users/TalAter","html_url":"https://github.com/TalAter","followers_url":"https://api.github.com/users/TalAter/followers","following_url":"https://api.github.com/users/TalAter/following{/other_user}","gists_url":"https://api.github.com/users/TalAter/gists{/gist_id}","starred_url":"https://api.github.com/users/TalAter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TalAter/subscriptions","organizations_url":"https://api.github.com/users/TalAter/orgs","repos_url":"https://api.github.com/users/TalAter/repos","events_url":"https://api.github.com/users/TalAter/events{/privacy}","received_events_url":"https://api.github.com/users/TalAter/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T16:30:45Z","updated_at":"2015-12-28T16:30:45Z","body":"The first library to offer this kind of functionality is now available: [SpeechKITT](https://github.com/TalAter/SpeechKITT)"}}