{"action":"opened","number":1,"pull_request":{"url":"https://api.github.com/repos/Parity-JS/mobx/pulls/1","id":167118226,"html_url":"https://github.com/Parity-JS/mobx/pull/1","diff_url":"https://github.com/Parity-JS/mobx/pull/1.diff","patch_url":"https://github.com/Parity-JS/mobx/pull/1.patch","issue_url":"https://api.github.com/repos/Parity-JS/mobx/issues/1","number":1,"state":"open","locked":false,"title":"Reorganize store conventions","user":{"login":"amaurymartiny","id":1293565,"avatar_url":"https://avatars0.githubusercontent.com/u/1293565?v=4","gravatar_id":"","url":"https://api.github.com/users/amaurymartiny","html_url":"https://github.com/amaurymartiny","followers_url":"https://api.github.com/users/amaurymartiny/followers","following_url":"https://api.github.com/users/amaurymartiny/following{/other_user}","gists_url":"https://api.github.com/users/amaurymartiny/gists{/gist_id}","starred_url":"https://api.github.com/users/amaurymartiny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaurymartiny/subscriptions","organizations_url":"https://api.github.com/users/amaurymartiny/orgs","repos_url":"https://api.github.com/users/amaurymartiny/repos","events_url":"https://api.github.com/users/amaurymartiny/events{/privacy}","received_events_url":"https://api.github.com/users/amaurymartiny/received_events","type":"User","site_admin":false},"body":"Based on the previous version, the main ideas are the same, just made the following improvements on some conventions:\r\n- Now we get a store by doing:\r\n```javascript\r\nimport stores from '@parity/mobx';\r\n\r\n// Create a store listening to 'parity_nodeHealth'\r\nconst NodeHealthStore = stores.parity.nodeHealth(); // Returns a mobx class\r\nconst nodeHealthStore = NodeHealthStore.get(this.context.api); // An instance of the previous class\r\n// Idem for all other rpc methods.\r\n```\r\n- Manage singletons better: each `(namespace,method,params)` triplet returns the same singleton Mobx store\r\n```javascript\r\nimport stores from '@parity/mobx';\r\n\r\nconst store1 =  stores.parity.nodeHealth().get(api);\r\nconst store2 =  stores.parity.nodeHealth().get(api);\r\nconsole.log(store1 === store2); // True\r\n\r\nconst store3 =  stores.eth.getBalance('0x123').get(api);\r\nconst store4 =  stores.eth.getBalance('0x456').get(api);\r\nconsole.log(store3 === store4); // False\r\n```\r\n\r\n- Customize individual Mobx stores easily:\r\n  - Change default initial value of store: `null` by default, we can change it to `{}` by doing [so](https://github.com/Parity-JS/mobx/blob/am-reorganize/src/parity/index.js#L24-L26).\r\n  - Add `@computed`, other `@actions`, or more generally anything: see [this example](https://github.com/Parity-JS/mobx/blob/am-reorganize/src/parity/nodeHealth.js)\r\n\r\n---\r\n\r\n#### Rationale\r\n\r\nThis repo may not live long if we use Rxjs, but that's not a reason not to make it clean for the time it lives.","created_at":"2018-02-05T11:20:27Z","updated_at":"2018-02-05T11:20:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/Parity-JS/mobx/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Parity-JS/mobx/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Parity-JS/mobx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Parity-JS/mobx/issues/1/comments","statuses_url":"https://api.github.com/repos/Parity-JS/mobx/statuses/726792e059a0e44c4241b45f44d3f184a3944f85","head":{"label":"Parity-JS:am-reorganize","ref":"am-reorganize","sha":"726792e059a0e44c4241b45f44d3f184a3944f85","user":{"login":"Parity-JS","id":35567017,"avatar_url":"https://avatars0.githubusercontent.com/u/35567017?v=4","gravatar_id":"","url":"https://api.github.com/users/Parity-JS","html_url":"https://github.com/Parity-JS","followers_url":"https://api.github.com/users/Parity-JS/followers","following_url":"https://api.github.com/users/Parity-JS/following{/other_user}","gists_url":"https://api.github.com/users/Parity-JS/gists{/gist_id}","starred_url":"https://api.github.com/users/Parity-JS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parity-JS/subscriptions","organizations_url":"https://api.github.com/users/Parity-JS/orgs","repos_url":"https://api.github.com/users/Parity-JS/repos","events_url":"https://api.github.com/users/Parity-JS/events{/privacy}","received_events_url":"https://api.github.com/users/Parity-JS/received_events","type":"Organization","site_admin":false},"repo":{"id":118618198,"name":"mobx","full_name":"Parity-JS/mobx","owner":{"login":"Parity-JS","id":35567017,"avatar_url":"https://avatars0.githubusercontent.com/u/35567017?v=4","gravatar_id":"","url":"https://api.github.com/users/Parity-JS","html_url":"https://github.com/Parity-JS","followers_url":"https://api.github.com/users/Parity-JS/followers","following_url":"https://api.github.com/users/Parity-JS/following{/other_user}","gists_url":"https://api.github.com/users/Parity-JS/gists{/gist_id}","starred_url":"https://api.github.com/users/Parity-JS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parity-JS/subscriptions","organizations_url":"https://api.github.com/users/Parity-JS/orgs","repos_url":"https://api.github.com/users/Parity-JS/repos","events_url":"https://api.github.com/users/Parity-JS/events{/privacy}","received_events_url":"https://api.github.com/users/Parity-JS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Parity-JS/mobx","description":null,"fork":false,"url":"https://api.github.com/repos/Parity-JS/mobx","forks_url":"https://api.github.com/repos/Parity-JS/mobx/forks","keys_url":"https://api.github.com/repos/Parity-JS/mobx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Parity-JS/mobx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Parity-JS/mobx/teams","hooks_url":"https://api.github.com/repos/Parity-JS/mobx/hooks","issue_events_url":"https://api.github.com/repos/Parity-JS/mobx/issues/events{/number}","events_url":"https://api.github.com/repos/Parity-JS/mobx/events","assignees_url":"https://api.github.com/repos/Parity-JS/mobx/assignees{/user}","branches_url":"https://api.github.com/repos/Parity-JS/mobx/branches{/branch}","tags_url":"https://api.github.com/repos/Parity-JS/mobx/tags","blobs_url":"https://api.github.com/repos/Parity-JS/mobx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Parity-JS/mobx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Parity-JS/mobx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Parity-JS/mobx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Parity-JS/mobx/statuses/{sha}","languages_url":"https://api.github.com/repos/Parity-JS/mobx/languages","stargazers_url":"https://api.github.com/repos/Parity-JS/mobx/stargazers","contributors_url":"https://api.github.com/repos/Parity-JS/mobx/contributors","subscribers_url":"https://api.github.com/repos/Parity-JS/mobx/subscribers","subscription_url":"https://api.github.com/repos/Parity-JS/mobx/subscription","commits_url":"https://api.github.com/repos/Parity-JS/mobx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Parity-JS/mobx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Parity-JS/mobx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Parity-JS/mobx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Parity-JS/mobx/contents/{+path}","compare_url":"https://api.github.com/repos/Parity-JS/mobx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Parity-JS/mobx/merges","archive_url":"https://api.github.com/repos/Parity-JS/mobx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Parity-JS/mobx/downloads","issues_url":"https://api.github.com/repos/Parity-JS/mobx/issues{/number}","pulls_url":"https://api.github.com/repos/Parity-JS/mobx/pulls{/number}","milestones_url":"https://api.github.com/repos/Parity-JS/mobx/milestones{/number}","notifications_url":"https://api.github.com/repos/Parity-JS/mobx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Parity-JS/mobx/labels{/name}","releases_url":"https://api.github.com/repos/Parity-JS/mobx/releases{/id}","deployments_url":"https://api.github.com/repos/Parity-JS/mobx/deployments","created_at":"2018-01-23T14:02:47Z","updated_at":"2018-01-25T14:26:04Z","pushed_at":"2018-02-05T10:59:57Z","git_url":"git://github.com/Parity-JS/mobx.git","ssh_url":"git@github.com:Parity-JS/mobx.git","clone_url":"https://github.com/Parity-JS/mobx.git","svn_url":"https://github.com/Parity-JS/mobx","homepage":null,"size":72,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"Parity-JS:master","ref":"master","sha":"9c087e08c86120e37a98a71a33867edec8c8ce98","user":{"login":"Parity-JS","id":35567017,"avatar_url":"https://avatars0.githubusercontent.com/u/35567017?v=4","gravatar_id":"","url":"https://api.github.com/users/Parity-JS","html_url":"https://github.com/Parity-JS","followers_url":"https://api.github.com/users/Parity-JS/followers","following_url":"https://api.github.com/users/Parity-JS/following{/other_user}","gists_url":"https://api.github.com/users/Parity-JS/gists{/gist_id}","starred_url":"https://api.github.com/users/Parity-JS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parity-JS/subscriptions","organizations_url":"https://api.github.com/users/Parity-JS/orgs","repos_url":"https://api.github.com/users/Parity-JS/repos","events_url":"https://api.github.com/users/Parity-JS/events{/privacy}","received_events_url":"https://api.github.com/users/Parity-JS/received_events","type":"Organization","site_admin":false},"repo":{"id":118618198,"name":"mobx","full_name":"Parity-JS/mobx","owner":{"login":"Parity-JS","id":35567017,"avatar_url":"https://avatars0.githubusercontent.com/u/35567017?v=4","gravatar_id":"","url":"https://api.github.com/users/Parity-JS","html_url":"https://github.com/Parity-JS","followers_url":"https://api.github.com/users/Parity-JS/followers","following_url":"https://api.github.com/users/Parity-JS/following{/other_user}","gists_url":"https://api.github.com/users/Parity-JS/gists{/gist_id}","starred_url":"https://api.github.com/users/Parity-JS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parity-JS/subscriptions","organizations_url":"https://api.github.com/users/Parity-JS/orgs","repos_url":"https://api.github.com/users/Parity-JS/repos","events_url":"https://api.github.com/users/Parity-JS/events{/privacy}","received_events_url":"https://api.github.com/users/Parity-JS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Parity-JS/mobx","description":null,"fork":false,"url":"https://api.github.com/repos/Parity-JS/mobx","forks_url":"https://api.github.com/repos/Parity-JS/mobx/forks","keys_url":"https://api.github.com/repos/Parity-JS/mobx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Parity-JS/mobx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Parity-JS/mobx/teams","hooks_url":"https://api.github.com/repos/Parity-JS/mobx/hooks","issue_events_url":"https://api.github.com/repos/Parity-JS/mobx/issues/events{/number}","events_url":"https://api.github.com/repos/Parity-JS/mobx/events","assignees_url":"https://api.github.com/repos/Parity-JS/mobx/assignees{/user}","branches_url":"https://api.github.com/repos/Parity-JS/mobx/branches{/branch}","tags_url":"https://api.github.com/repos/Parity-JS/mobx/tags","blobs_url":"https://api.github.com/repos/Parity-JS/mobx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Parity-JS/mobx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Parity-JS/mobx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Parity-JS/mobx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Parity-JS/mobx/statuses/{sha}","languages_url":"https://api.github.com/repos/Parity-JS/mobx/languages","stargazers_url":"https://api.github.com/repos/Parity-JS/mobx/stargazers","contributors_url":"https://api.github.com/repos/Parity-JS/mobx/contributors","subscribers_url":"https://api.github.com/repos/Parity-JS/mobx/subscribers","subscription_url":"https://api.github.com/repos/Parity-JS/mobx/subscription","commits_url":"https://api.github.com/repos/Parity-JS/mobx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Parity-JS/mobx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Parity-JS/mobx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Parity-JS/mobx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Parity-JS/mobx/contents/{+path}","compare_url":"https://api.github.com/repos/Parity-JS/mobx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Parity-JS/mobx/merges","archive_url":"https://api.github.com/repos/Parity-JS/mobx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Parity-JS/mobx/downloads","issues_url":"https://api.github.com/repos/Parity-JS/mobx/issues{/number}","pulls_url":"https://api.github.com/repos/Parity-JS/mobx/pulls{/number}","milestones_url":"https://api.github.com/repos/Parity-JS/mobx/milestones{/number}","notifications_url":"https://api.github.com/repos/Parity-JS/mobx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Parity-JS/mobx/labels{/name}","releases_url":"https://api.github.com/repos/Parity-JS/mobx/releases{/id}","deployments_url":"https://api.github.com/repos/Parity-JS/mobx/deployments","created_at":"2018-01-23T14:02:47Z","updated_at":"2018-01-25T14:26:04Z","pushed_at":"2018-02-05T10:59:57Z","git_url":"git://github.com/Parity-JS/mobx.git","ssh_url":"git@github.com:Parity-JS/mobx.git","clone_url":"https://github.com/Parity-JS/mobx.git","svn_url":"https://github.com/Parity-JS/mobx","homepage":null,"size":72,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Parity-JS/mobx/pulls/1"},"html":{"href":"https://github.com/Parity-JS/mobx/pull/1"},"issue":{"href":"https://api.github.com/repos/Parity-JS/mobx/issues/1"},"comments":{"href":"https://api.github.com/repos/Parity-JS/mobx/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Parity-JS/mobx/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Parity-JS/mobx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Parity-JS/mobx/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Parity-JS/mobx/statuses/726792e059a0e44c4241b45f44d3f184a3944f85"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":3,"additions":1024,"deletions":803,"changed_files":54}}
{"actor":{"display_login":"amaurymartiny"}}