{"action":"created","comment":{"url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/comments/23120757","id":23120757,"diff_hunk":"@@ -0,0 +1,216 @@\n+# Tux/Stores\n+\n+## Table of Contents\n+<ol>\n+  <li><a href=\"#Premise\">Premise</a></li>\n+  <li><a href=\"#Implementation\">Implementation</a>\n+    <ol style=\"list-style-type:upper-alpha\">\n+      <li><a href=\"#Requiring-Stores\">Requiring Stores</a></li>\n+      <li><a href=\"#Creating-Stores\">Creating Stores</a>\n+        <ol style=\"list-style-type:upper-roman\">\n+          <li><a href=\"#create-store-example\">Create Stores Example</a></li>\n+          <li><a href=\"#Stores-createStore\">METHOD Stores.createStore</a></li>\n+          <li><a href=\"#storeReturn\">Return OBJECT: store</a>\n+            <ol style=\"list-style-type:lower-alpha\">\n+              <li><a href=\"#store-emitChange\">METHOD: store.emitChange</a></li>\n+              <li><a href=\"#store-addChangeListener\">METHOD: store.addChangeListener</a></li>\n+              <li><a href=\"#store-removeChangeListener\">METHOD: store.removeChangeListener</a></li>\n+            </ol>\n+          </li>\n+        </ol>\n+      </li>\n+    </ol>\n+  </li>\n+  <li><a href=\"#TuxStores-Complete-Example\">TuxStores Complete Example</a></li>\n+</ol>\n+\n+## <a id=\"Premise\"></a>Premise [#](#Premise)\n+>Tux Stores provides an interface for abstracting away common store methods in the Flux architecture.\n+\n+## <a id=\"Implementation\"></a>Implementation [#](#Implementation)\n+### <a id=\"Requiring-Stores\"></a>Requiring Stores [#](#Requiring-Stores)\n+Tux uses Facebook's [Flux](https://facebook.github.io/flux/) architecture and provides an interface for creating stores. This interface is exposed via:\n+\n+```\n+    var Stores = require('tux/Stores')\n+```\n+\n+### <a id=\"Creating-Stores\"></a>Creating Stores [#](#Creating-Stores)\n+The `Stores` object allows the user to create stores via invoking [Stores.createStore](#createStores). Stores are responsible for managing data and alerting views to when that data has changed in TuxedoJS. Pass in an object to the `createStore` method and it will return a new object that has been extended with the `emitChange`, `addChangeListener`, and `removeChangeListener` methods that are common to Flux stores. The Tux methods are added to the object being extended first, so if you want to overwrite Tux's implementation of one or all of those methods, you just need to provide your methods with those keys on the input object to `createStore`. Let's take a look at an example: [#](#create-store-example)\n+<a id=\"create-store-example\"></a>\n+\n+```\n+    var messageStore = Stores.createStore({\n+      _messages: {},\n+      getAll: function () {\n+        return Object.keys(this._messages);\n+      }\n+    });\n+```\n+\n+Below is the API documentation for this method.\n+\n+### <a id=\"Stores-createStore\"></a>Stores.createStore [#](#Stores-createStore)\n+\n+```\n+    var store = Stores.createStore(methods);\n+```\n+\n+#### <a id=\"methods\"></a>Parameter - `methods` - type: OBJECT - optional [#](#methods)\n+Methods and properties to extend the created store with. This object is optional and there are no expected keys. However normally, as in the case of the example above, a store will have properties associated with storing its data and methods for exposing that data to view components.\n+\n+#### <a id=\"storeReturn\"></a>Return - `store` - type: OBJECT [#](#storeReturn)\n+The `Stores.createStore` method returns a `store` instance which is described below.\n+\n+#### <a id=\"store\"></a>store - type: OBJECT [#](#store)","path":"docs/TuxStores.md","position":65,"original_position":65,"commit_id":"532388d1cba092bd455b0d531351d4542f29e9ef","original_commit_id":"532388d1cba092bd455b0d531351d4542f29e9ef","user":{"login":"drabinowitz","id":7275304,"avatar_url":"https://avatars.githubusercontent.com/u/7275304?v=3","gravatar_id":"","url":"https://api.github.com/users/drabinowitz","html_url":"https://github.com/drabinowitz","followers_url":"https://api.github.com/users/drabinowitz/followers","following_url":"https://api.github.com/users/drabinowitz/following{/other_user}","gists_url":"https://api.github.com/users/drabinowitz/gists{/gist_id}","starred_url":"https://api.github.com/users/drabinowitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drabinowitz/subscriptions","organizations_url":"https://api.github.com/users/drabinowitz/orgs","repos_url":"https://api.github.com/users/drabinowitz/repos","events_url":"https://api.github.com/users/drabinowitz/events{/privacy}","received_events_url":"https://api.github.com/users/drabinowitz/received_events","type":"User","site_admin":false},"body":"This should be `###` since it is a major category.","created_at":"2015-01-17T01:27:39Z","updated_at":"2015-01-17T01:27:39Z","html_url":"https://github.com/TuxedoJS/TuxedoJS/pull/108#discussion_r23120757","pull_request_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/comments/23120757"},"html":{"href":"https://github.com/TuxedoJS/TuxedoJS/pull/108#discussion_r23120757"},"pull_request":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108","id":27477004,"html_url":"https://github.com/TuxedoJS/TuxedoJS/pull/108","diff_url":"https://github.com/TuxedoJS/TuxedoJS/pull/108.diff","patch_url":"https://github.com/TuxedoJS/TuxedoJS/pull/108.patch","issue_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/108","number":108,"state":"open","locked":false,"title":"Add TuxStores documentation.","user":{"login":"Cheerazar","id":5581107,"avatar_url":"https://avatars.githubusercontent.com/u/5581107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cheerazar","html_url":"https://github.com/Cheerazar","followers_url":"https://api.github.com/users/Cheerazar/followers","following_url":"https://api.github.com/users/Cheerazar/following{/other_user}","gists_url":"https://api.github.com/users/Cheerazar/gists{/gist_id}","starred_url":"https://api.github.com/users/Cheerazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cheerazar/subscriptions","organizations_url":"https://api.github.com/users/Cheerazar/orgs","repos_url":"https://api.github.com/users/Cheerazar/repos","events_url":"https://api.github.com/users/Cheerazar/events{/privacy}","received_events_url":"https://api.github.com/users/Cheerazar/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-16T01:05:31Z","updated_at":"2015-01-17T01:27:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4bf28a6c45b62c171f51dd2c1d6358f4fdbd4e3","assignee":{"login":"Cheerazar","id":5581107,"avatar_url":"https://avatars.githubusercontent.com/u/5581107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cheerazar","html_url":"https://github.com/Cheerazar","followers_url":"https://api.github.com/users/Cheerazar/followers","following_url":"https://api.github.com/users/Cheerazar/following{/other_user}","gists_url":"https://api.github.com/users/Cheerazar/gists{/gist_id}","starred_url":"https://api.github.com/users/Cheerazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cheerazar/subscriptions","organizations_url":"https://api.github.com/users/Cheerazar/orgs","repos_url":"https://api.github.com/users/Cheerazar/repos","events_url":"https://api.github.com/users/Cheerazar/events{/privacy}","received_events_url":"https://api.github.com/users/Cheerazar/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108/commits","review_comments_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108/comments","review_comment_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/comments/{number}","comments_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/108/comments","statuses_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/statuses/532388d1cba092bd455b0d531351d4542f29e9ef","head":{"label":"Cheerazar:stores-doc","ref":"stores-doc","sha":"532388d1cba092bd455b0d531351d4542f29e9ef","user":{"login":"Cheerazar","id":5581107,"avatar_url":"https://avatars.githubusercontent.com/u/5581107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cheerazar","html_url":"https://github.com/Cheerazar","followers_url":"https://api.github.com/users/Cheerazar/followers","following_url":"https://api.github.com/users/Cheerazar/following{/other_user}","gists_url":"https://api.github.com/users/Cheerazar/gists{/gist_id}","starred_url":"https://api.github.com/users/Cheerazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cheerazar/subscriptions","organizations_url":"https://api.github.com/users/Cheerazar/orgs","repos_url":"https://api.github.com/users/Cheerazar/repos","events_url":"https://api.github.com/users/Cheerazar/events{/privacy}","received_events_url":"https://api.github.com/users/Cheerazar/received_events","type":"User","site_admin":false},"repo":{"id":28929804,"name":"TuxedoJS","full_name":"Cheerazar/TuxedoJS","owner":{"login":"Cheerazar","id":5581107,"avatar_url":"https://avatars.githubusercontent.com/u/5581107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cheerazar","html_url":"https://github.com/Cheerazar","followers_url":"https://api.github.com/users/Cheerazar/followers","following_url":"https://api.github.com/users/Cheerazar/following{/other_user}","gists_url":"https://api.github.com/users/Cheerazar/gists{/gist_id}","starred_url":"https://api.github.com/users/Cheerazar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cheerazar/subscriptions","organizations_url":"https://api.github.com/users/Cheerazar/orgs","repos_url":"https://api.github.com/users/Cheerazar/repos","events_url":"https://api.github.com/users/Cheerazar/events{/privacy}","received_events_url":"https://api.github.com/users/Cheerazar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Cheerazar/TuxedoJS","description":"","fork":true,"url":"https://api.github.com/repos/Cheerazar/TuxedoJS","forks_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/forks","keys_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/teams","hooks_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/hooks","issue_events_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/issues/events{/number}","events_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/events","assignees_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/assignees{/user}","branches_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/branches{/branch}","tags_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/tags","blobs_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/statuses/{sha}","languages_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/languages","stargazers_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/stargazers","contributors_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/contributors","subscribers_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/subscribers","subscription_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/subscription","commits_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/issues/comments/{number}","contents_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/contents/{+path}","compare_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/merges","archive_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/downloads","issues_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/issues{/number}","pulls_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/pulls{/number}","milestones_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/milestones{/number}","notifications_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/labels{/name}","releases_url":"https://api.github.com/repos/Cheerazar/TuxedoJS/releases{/id}","created_at":"2015-01-07T19:22:17Z","updated_at":"2015-01-16T04:10:42Z","pushed_at":"2015-01-17T01:13:32Z","git_url":"git://github.com/Cheerazar/TuxedoJS.git","ssh_url":"git@github.com:Cheerazar/TuxedoJS.git","clone_url":"https://github.com/Cheerazar/TuxedoJS.git","svn_url":"https://github.com/Cheerazar/TuxedoJS","homepage":null,"size":279,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TuxedoJS:master","ref":"master","sha":"6d714934c32e4c39b7cdce84110d78cfa5c2b180","user":{"login":"TuxedoJS","id":10237217,"avatar_url":"https://avatars.githubusercontent.com/u/10237217?v=3","gravatar_id":"","url":"https://api.github.com/users/TuxedoJS","html_url":"https://github.com/TuxedoJS","followers_url":"https://api.github.com/users/TuxedoJS/followers","following_url":"https://api.github.com/users/TuxedoJS/following{/other_user}","gists_url":"https://api.github.com/users/TuxedoJS/gists{/gist_id}","starred_url":"https://api.github.com/users/TuxedoJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TuxedoJS/subscriptions","organizations_url":"https://api.github.com/users/TuxedoJS/orgs","repos_url":"https://api.github.com/users/TuxedoJS/repos","events_url":"https://api.github.com/users/TuxedoJS/events{/privacy}","received_events_url":"https://api.github.com/users/TuxedoJS/received_events","type":"Organization","site_admin":false},"repo":{"id":28203450,"name":"TuxedoJS","full_name":"TuxedoJS/TuxedoJS","owner":{"login":"TuxedoJS","id":10237217,"avatar_url":"https://avatars.githubusercontent.com/u/10237217?v=3","gravatar_id":"","url":"https://api.github.com/users/TuxedoJS","html_url":"https://github.com/TuxedoJS","followers_url":"https://api.github.com/users/TuxedoJS/followers","following_url":"https://api.github.com/users/TuxedoJS/following{/other_user}","gists_url":"https://api.github.com/users/TuxedoJS/gists{/gist_id}","starred_url":"https://api.github.com/users/TuxedoJS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TuxedoJS/subscriptions","organizations_url":"https://api.github.com/users/TuxedoJS/orgs","repos_url":"https://api.github.com/users/TuxedoJS/repos","events_url":"https://api.github.com/users/TuxedoJS/events{/privacy}","received_events_url":"https://api.github.com/users/TuxedoJS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TuxedoJS/TuxedoJS","description":"","fork":false,"url":"https://api.github.com/repos/TuxedoJS/TuxedoJS","forks_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/forks","keys_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/teams","hooks_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/hooks","issue_events_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/events{/number}","events_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/events","assignees_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/assignees{/user}","branches_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/branches{/branch}","tags_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/tags","blobs_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/statuses/{sha}","languages_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/languages","stargazers_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/stargazers","contributors_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/contributors","subscribers_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/subscribers","subscription_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/subscription","commits_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/comments/{number}","contents_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/contents/{+path}","compare_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/merges","archive_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/downloads","issues_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues{/number}","pulls_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls{/number}","milestones_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/milestones{/number}","notifications_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/labels{/name}","releases_url":"https://api.github.com/repos/TuxedoJS/TuxedoJS/releases{/id}","created_at":"2014-12-18T21:58:57Z","updated_at":"2015-01-17T01:22:53Z","pushed_at":"2015-01-17T01:22:53Z","git_url":"git://github.com/TuxedoJS/TuxedoJS.git","ssh_url":"git@github.com:TuxedoJS/TuxedoJS.git","clone_url":"https://github.com/TuxedoJS/TuxedoJS.git","svn_url":"https://github.com/TuxedoJS/TuxedoJS","homepage":null,"size":982,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":36,"forks":4,"open_issues":36,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108"},"html":{"href":"https://github.com/TuxedoJS/TuxedoJS/pull/108"},"issue":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/108"},"comments":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/TuxedoJS/TuxedoJS/statuses/532388d1cba092bd455b0d531351d4542f29e9ef"}}}}