{"action":"created","comment":{"url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/comments/56770428","id":56770428,"diff_hunk":"@@ -0,0 +1,71 @@\n+import * as React from 'react'\n+import {Component, PropTypes} from 'react'\n+import {bindActionCreators} from 'redux'\n+import {connect} from 'react-redux'\n+import Post from '../domains/Post'\n+import Setting from '../domains/Setting'\n+import * as PostAction from '../actions/PostAction'\n+import GlobalRepository from '../domains/GlobalRepository'\n+import {\n+  AUTO_RELOAD_MSEC,\n+  AUTO_RELOAD_RECHECK_MSEC\n+} from '../app.const'\n+\n+interface Props {\n+  post?: Post\n+  setting?: Setting\n+  postAction?: {\n+    connectSlack: (token: string)=>void,\n+  }\n+  route?: {\n+    path: string,\n+  }\n+  children?: Array<Component<any,any>>\n+}\n+\n+class MainContainer extends Component<Props, any> {\n+  render() {\n+    return (\n+      <div className=\"MainContainer\">\n+        {this.props.children}\n+      </div>\n+    )\n+  }\n+\n+  componentDidMount() {\n+    const {route, setting} = this.props\n+    if (route.path === '/') {\n+      // redirect @todo use react-router?\n+      location.hash = `/${setting.notifyType}`\n+    }\n+    const {connectSlack} = this.props.postAction\n+    if (connectSlack) {\n+      connectSlack(setting.slackToken)\n+    }\n+    this.startAutoReload()\n+  }\n+\n+  private startAutoReload() {\n+    new Promise((resolve, reject) => setTimeout(resolve, AUTO_RELOAD_MSEC)).\n+    then(() => {\n+      const check = () => {\n+        const {post} = this.props\n+        if (post.letters.length === 0) {\n+          GlobalRepository.mainWindow.reload()\n+        }\n+        setTimeout(check, AUTO_RELOAD_RECHECK_MSEC)\n+      }\n+      check()\n+    })","path":"src/containers/MainContainer.tsx","position":59,"original_position":59,"commit_id":"02ea0e0c5bd21d729f407ce3c9761d623375c7a9","original_commit_id":"02ea0e0c5bd21d729f407ce3c9761d623375c7a9","user":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"body":"通知が表示されていないタイミングを見計らって、リロードを掛ける。\r\n通知がある場合は、1秒後に再チェック。","created_at":"2016-03-20T19:40:55Z","updated_at":"2016-03-20T19:40:55Z","html_url":"https://github.com/namikingsoft/electron-sandbox/pull/30#discussion_r56770428","pull_request_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/comments/56770428"},"html":{"href":"https://github.com/namikingsoft/electron-sandbox/pull/30#discussion_r56770428"},"pull_request":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30","id":63504964,"html_url":"https://github.com/namikingsoft/electron-sandbox/pull/30","diff_url":"https://github.com/namikingsoft/electron-sandbox/pull/30.diff","patch_url":"https://github.com/namikingsoft/electron-sandbox/pull/30.patch","issue_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/30","number":30,"state":"open","locked":false,"title":"自動リロード実装とコンポーネント周りのリファクタリング","user":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"body":"定期的にBrowserWindowのリフレッシュを図る。\r\nCloses #25 ","created_at":"2016-03-20T19:37:33Z","updated_at":"2016-03-20T19:40:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6e499eecb7a27026b2a8dea6c74115fc74fc738","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30/commits","review_comments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30/comments","review_comment_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/30/comments","statuses_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/statuses/02ea0e0c5bd21d729f407ce3c9761d623375c7a9","head":{"label":"namikingsoft:fix/memory/support-auto-reload","ref":"fix/memory/support-auto-reload","sha":"02ea0e0c5bd21d729f407ce3c9761d623375c7a9","user":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"repo":{"id":53323813,"name":"electron-sandbox","full_name":"namikingsoft/electron-sandbox","owner":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/namikingsoft/electron-sandbox","description":"","fork":false,"url":"https://api.github.com/repos/namikingsoft/electron-sandbox","forks_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/forks","keys_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/teams","hooks_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/hooks","issue_events_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/events{/number}","events_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/events","assignees_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/assignees{/user}","branches_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/branches{/branch}","tags_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/tags","blobs_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/statuses/{sha}","languages_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/languages","stargazers_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/stargazers","contributors_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/contributors","subscribers_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/subscribers","subscription_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/subscription","commits_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/contents/{+path}","compare_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/merges","archive_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/downloads","issues_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues{/number}","pulls_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls{/number}","milestones_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/milestones{/number}","notifications_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/labels{/name}","releases_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/releases{/id}","deployments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/deployments","created_at":"2016-03-07T12:26:50Z","updated_at":"2016-03-09T14:30:48Z","pushed_at":"2016-03-20T19:37:33Z","git_url":"git://github.com/namikingsoft/electron-sandbox.git","ssh_url":"git@github.com:namikingsoft/electron-sandbox.git","clone_url":"https://github.com/namikingsoft/electron-sandbox.git","svn_url":"https://github.com/namikingsoft/electron-sandbox","homepage":null,"size":115,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"namikingsoft:master","ref":"master","sha":"cdc655a0f8ccc9da4fb4ff96f4b25d75fcc6ed26","user":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"repo":{"id":53323813,"name":"electron-sandbox","full_name":"namikingsoft/electron-sandbox","owner":{"login":"namikingsoft","id":3187220,"avatar_url":"https://avatars.githubusercontent.com/u/3187220?v=3","gravatar_id":"","url":"https://api.github.com/users/namikingsoft","html_url":"https://github.com/namikingsoft","followers_url":"https://api.github.com/users/namikingsoft/followers","following_url":"https://api.github.com/users/namikingsoft/following{/other_user}","gists_url":"https://api.github.com/users/namikingsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/namikingsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namikingsoft/subscriptions","organizations_url":"https://api.github.com/users/namikingsoft/orgs","repos_url":"https://api.github.com/users/namikingsoft/repos","events_url":"https://api.github.com/users/namikingsoft/events{/privacy}","received_events_url":"https://api.github.com/users/namikingsoft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/namikingsoft/electron-sandbox","description":"","fork":false,"url":"https://api.github.com/repos/namikingsoft/electron-sandbox","forks_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/forks","keys_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/teams","hooks_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/hooks","issue_events_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/events{/number}","events_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/events","assignees_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/assignees{/user}","branches_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/branches{/branch}","tags_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/tags","blobs_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/statuses/{sha}","languages_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/languages","stargazers_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/stargazers","contributors_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/contributors","subscribers_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/subscribers","subscription_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/subscription","commits_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/contents/{+path}","compare_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/merges","archive_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/downloads","issues_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues{/number}","pulls_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls{/number}","milestones_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/milestones{/number}","notifications_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/labels{/name}","releases_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/releases{/id}","deployments_url":"https://api.github.com/repos/namikingsoft/electron-sandbox/deployments","created_at":"2016-03-07T12:26:50Z","updated_at":"2016-03-09T14:30:48Z","pushed_at":"2016-03-20T19:37:33Z","git_url":"git://github.com/namikingsoft/electron-sandbox.git","ssh_url":"git@github.com:namikingsoft/electron-sandbox.git","clone_url":"https://github.com/namikingsoft/electron-sandbox.git","svn_url":"https://github.com/namikingsoft/electron-sandbox","homepage":null,"size":115,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30"},"html":{"href":"https://github.com/namikingsoft/electron-sandbox/pull/30"},"issue":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/30"},"comments":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/namikingsoft/electron-sandbox/statuses/02ea0e0c5bd21d729f407ce3c9761d623375c7a9"}}}}