{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react-native/pulls/comments/69498449","id":69498449,"diff_hunk":"@@ -21,10 +21,101 @@ var {\n   AlertIOS,\n   Platform,\n   ToastAndroid,\n+  Text,\n   View,\n } = ReactNative;\n var TimerMixin = require('react-timer-mixin');\n var UIExplorerButton = require('./UIExplorerButton');\n+var performanceNow = require('fbjs/lib/performanceNow');\n+\n+function burnCPU(milliseconds) {\n+  const start = performanceNow();\n+  while (performanceNow() < (start + milliseconds)) {}\n+}\n+\n+var RequestIdleCallbackTester = React.createClass({\n+  _idleTimer: null,\n+  _iters: 0,\n+\n+  getInitialState() {\n+    return {\n+      message: '-',\n+    };\n+  },\n+\n+  componentWillUnmount() {\n+    cancelIdleCallback(this._idleTimer);\n+  },\n+\n+  render() {\n+    return (\n+      <View>\n+        {Platform.OS === 'ios' ? this._renderIOS() : this._renderAndroid()}\n+      </View>\n+    );\n+  },\n+\n+  _renderIOS() {\n+    return (\n+      <Text>Not implemented on iOS, falls back to requestAnimationFrame</Text>\n+    );\n+  },\n+\n+  _renderAndroid() {\n+    return (\n+      <View>\n+        <UIExplorerButton onPress={this._run.bind(this, false)}>\n+          Run requestIdleCallback\n+        </UIExplorerButton>\n+\n+        <UIExplorerButton onPress={this._run.bind(this, true)}>\n+          Burn CPU inside of requestIdleCallback\n+        </UIExplorerButton>\n+\n+        <UIExplorerButton onPress={this._runBackground}>\n+          Run background task\n+        </UIExplorerButton>\n+\n+        <UIExplorerButton onPress={this._stopBackground}>\n+          Stop background task\n+        </UIExplorerButton>\n+\n+        <Text>{this.state.message}</Text>\n+      </View>\n+    );\n+  },\n+\n+  _run(shouldBurnCPU) {\n+    cancelIdleCallback(this._idleTimer);\n+    this._idleTimer = requestIdleCallback((deadline) => {","path":"Examples/UIExplorer/TimerExample.js","position":70,"original_position":70,"commit_id":"9474b9cbe1355c775aa0ceeec1e7901800d93c4d","original_commit_id":"9474b9cbe1355c775aa0ceeec1e7901800d93c4d","user":{"login":"eslint-bot","id":16061708,"avatar_url":"https://avatars.githubusercontent.com/u/16061708?v=3","gravatar_id":"","url":"https://api.github.com/users/eslint-bot","html_url":"https://github.com/eslint-bot","followers_url":"https://api.github.com/users/eslint-bot/followers","following_url":"https://api.github.com/users/eslint-bot/following{/other_user}","gists_url":"https://api.github.com/users/eslint-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/eslint-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslint-bot/subscriptions","organizations_url":"https://api.github.com/users/eslint-bot/orgs","repos_url":"https://api.github.com/users/eslint-bot/repos","events_url":"https://api.github.com/users/eslint-bot/events{/privacy}","received_events_url":"https://api.github.com/users/eslint-bot/received_events","type":"User","site_admin":false},"body":"identifier `requestIdleCallback` Could not resolve name","created_at":"2016-07-05T01:20:41Z","updated_at":"2016-07-05T01:20:41Z","html_url":"https://github.com/facebook/react-native/pull/8569#discussion_r69498449","pull_request_url":"https://api.github.com/repos/facebook/react-native/pulls/8569","_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments/69498449"},"html":{"href":"https://github.com/facebook/react-native/pull/8569#discussion_r69498449"},"pull_request":{"href":"https://api.github.com/repos/facebook/react-native/pulls/8569"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/8569","id":76208468,"html_url":"https://github.com/facebook/react-native/pull/8569","diff_url":"https://github.com/facebook/react-native/pull/8569.diff","patch_url":"https://github.com/facebook/react-native/pull/8569.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/8569","number":8569,"state":"open","locked":false,"title":"Initial implementation of requestIdleCallback on Android","user":{"login":"janicduplessis","id":2677334,"avatar_url":"https://avatars.githubusercontent.com/u/2677334?v=3","gravatar_id":"","url":"https://api.github.com/users/janicduplessis","html_url":"https://github.com/janicduplessis","followers_url":"https://api.github.com/users/janicduplessis/followers","following_url":"https://api.github.com/users/janicduplessis/following{/other_user}","gists_url":"https://api.github.com/users/janicduplessis/gists{/gist_id}","starred_url":"https://api.github.com/users/janicduplessis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janicduplessis/subscriptions","organizations_url":"https://api.github.com/users/janicduplessis/orgs","repos_url":"https://api.github.com/users/janicduplessis/repos","events_url":"https://api.github.com/users/janicduplessis/events{/privacy}","received_events_url":"https://api.github.com/users/janicduplessis/received_events","type":"User","site_admin":false},"body":"This is a follow up of the work of @brentvatne in #5052. This addresses the feedback by @astreet.\r\n\r\n- Uses ReactChoreographer with a new callback type\r\n- Callback dispatch logic moved to JS\r\n- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.\r\n\r\n** Test plan **\r\nTested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.\r\n\r\nTested that native only calls into JS when there are pending idle callbacks.\r\n\r\nAlso tested that timers are executed before idle callback.\r\n```\r\nrequestIdleCallback(() => console.log(1));\r\nsetTimeout(() => console.log(2), 100);\r\nburnCPU(1000);\r\n// 2\r\n// 1\r\n```\r\n\r\nI did *not* test with webworkers but it should work as I'm using executor tokens.","created_at":"2016-07-05T01:15:01Z","updated_at":"2016-07-05T01:20:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f3b141087097bb8490996421f976766a17896e7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/8569/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/8569/comments","review_comment_url":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/8569/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/9474b9cbe1355c775aa0ceeec1e7901800d93c4d","head":{"label":"janicduplessis:idle-cb-android","ref":"idle-cb-android","sha":"9474b9cbe1355c775aa0ceeec1e7901800d93c4d","user":{"login":"janicduplessis","id":2677334,"avatar_url":"https://avatars.githubusercontent.com/u/2677334?v=3","gravatar_id":"","url":"https://api.github.com/users/janicduplessis","html_url":"https://github.com/janicduplessis","followers_url":"https://api.github.com/users/janicduplessis/followers","following_url":"https://api.github.com/users/janicduplessis/following{/other_user}","gists_url":"https://api.github.com/users/janicduplessis/gists{/gist_id}","starred_url":"https://api.github.com/users/janicduplessis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janicduplessis/subscriptions","organizations_url":"https://api.github.com/users/janicduplessis/orgs","repos_url":"https://api.github.com/users/janicduplessis/repos","events_url":"https://api.github.com/users/janicduplessis/events{/privacy}","received_events_url":"https://api.github.com/users/janicduplessis/received_events","type":"User","site_admin":false},"repo":{"id":33167181,"name":"react-native","full_name":"janicduplessis/react-native","owner":{"login":"janicduplessis","id":2677334,"avatar_url":"https://avatars.githubusercontent.com/u/2677334?v=3","gravatar_id":"","url":"https://api.github.com/users/janicduplessis","html_url":"https://github.com/janicduplessis","followers_url":"https://api.github.com/users/janicduplessis/followers","following_url":"https://api.github.com/users/janicduplessis/following{/other_user}","gists_url":"https://api.github.com/users/janicduplessis/gists{/gist_id}","starred_url":"https://api.github.com/users/janicduplessis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janicduplessis/subscriptions","organizations_url":"https://api.github.com/users/janicduplessis/orgs","repos_url":"https://api.github.com/users/janicduplessis/repos","events_url":"https://api.github.com/users/janicduplessis/events{/privacy}","received_events_url":"https://api.github.com/users/janicduplessis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/janicduplessis/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/janicduplessis/react-native","forks_url":"https://api.github.com/repos/janicduplessis/react-native/forks","keys_url":"https://api.github.com/repos/janicduplessis/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/janicduplessis/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/janicduplessis/react-native/teams","hooks_url":"https://api.github.com/repos/janicduplessis/react-native/hooks","issue_events_url":"https://api.github.com/repos/janicduplessis/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/janicduplessis/react-native/events","assignees_url":"https://api.github.com/repos/janicduplessis/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/janicduplessis/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/janicduplessis/react-native/tags","blobs_url":"https://api.github.com/repos/janicduplessis/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/janicduplessis/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/janicduplessis/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/janicduplessis/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/janicduplessis/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/janicduplessis/react-native/languages","stargazers_url":"https://api.github.com/repos/janicduplessis/react-native/stargazers","contributors_url":"https://api.github.com/repos/janicduplessis/react-native/contributors","subscribers_url":"https://api.github.com/repos/janicduplessis/react-native/subscribers","subscription_url":"https://api.github.com/repos/janicduplessis/react-native/subscription","commits_url":"https://api.github.com/repos/janicduplessis/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/janicduplessis/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/janicduplessis/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/janicduplessis/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/janicduplessis/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/janicduplessis/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/janicduplessis/react-native/merges","archive_url":"https://api.github.com/repos/janicduplessis/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/janicduplessis/react-native/downloads","issues_url":"https://api.github.com/repos/janicduplessis/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/janicduplessis/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/janicduplessis/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/janicduplessis/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/janicduplessis/react-native/labels{/name}","releases_url":"https://api.github.com/repos/janicduplessis/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/janicduplessis/react-native/deployments","created_at":"2015-03-31T05:43:42Z","updated_at":"2016-04-24T06:19:07Z","pushed_at":"2016-07-05T01:01:29Z","git_url":"git://github.com/janicduplessis/react-native.git","ssh_url":"git@github.com:janicduplessis/react-native.git","clone_url":"https://github.com/janicduplessis/react-native.git","svn_url":"https://github.com/janicduplessis/react-native","homepage":"http://facebook.github.io/react-native/","size":47204,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"facebook:master","ref":"master","sha":"2f400a663b778e1c1f46a78f4fdfc81455c4054c","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29028775,"name":"react-native","full_name":"facebook/react-native","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/react-native","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/facebook/react-native","forks_url":"https://api.github.com/repos/facebook/react-native/forks","keys_url":"https://api.github.com/repos/facebook/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react-native/teams","hooks_url":"https://api.github.com/repos/facebook/react-native/hooks","issue_events_url":"https://api.github.com/repos/facebook/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react-native/events","assignees_url":"https://api.github.com/repos/facebook/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react-native/tags","blobs_url":"https://api.github.com/repos/facebook/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react-native/languages","stargazers_url":"https://api.github.com/repos/facebook/react-native/stargazers","contributors_url":"https://api.github.com/repos/facebook/react-native/contributors","subscribers_url":"https://api.github.com/repos/facebook/react-native/subscribers","subscription_url":"https://api.github.com/repos/facebook/react-native/subscription","commits_url":"https://api.github.com/repos/facebook/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react-native/merges","archive_url":"https://api.github.com/repos/facebook/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react-native/downloads","issues_url":"https://api.github.com/repos/facebook/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react-native/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react-native/deployments","created_at":"2015-01-09T18:10:16Z","updated_at":"2016-07-05T01:05:27Z","pushed_at":"2016-07-05T01:15:01Z","git_url":"git://github.com/facebook/react-native.git","ssh_url":"git@github.com:facebook/react-native.git","clone_url":"https://github.com/facebook/react-native.git","svn_url":"https://github.com/facebook/react-native","homepage":"http://facebook.github.io/react-native/","size":110252,"stargazers_count":34394,"watchers_count":34394,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7253,"mirror_url":null,"open_issues_count":1042,"forks":7253,"open_issues":1042,"watchers":34394,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/8569"},"html":{"href":"https://github.com/facebook/react-native/pull/8569"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/8569"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/8569/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/8569/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react-native/pulls/8569/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/9474b9cbe1355c775aa0ceeec1e7901800d93c4d"}}}}
{"actor":{"display_login":"eslint-bot"}}