{"action":"opened","number":665,"pull_request":{"url":"https://api.github.com/repos/Khan/live-editor/pulls/665","id":202895808,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyODk1ODA4","html_url":"https://github.com/Khan/live-editor/pull/665","diff_url":"https://github.com/Khan/live-editor/pull/665.diff","patch_url":"https://github.com/Khan/live-editor/pull/665.patch","issue_url":"https://api.github.com/repos/Khan/live-editor/issues/665","number":665,"state":"open","locked":false,"title":"Uses requestAnimationFrame to prevent frozen scripts while seeking","user":{"login":"scotchfield","id":5611966,"node_id":"MDQ6VXNlcjU2MTE5NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5611966?v=4","gravatar_id":"","url":"https://api.github.com/users/scotchfield","html_url":"https://github.com/scotchfield","followers_url":"https://api.github.com/users/scotchfield/followers","following_url":"https://api.github.com/users/scotchfield/following{/other_user}","gists_url":"https://api.github.com/users/scotchfield/gists{/gist_id}","starred_url":"https://api.github.com/users/scotchfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotchfield/subscriptions","organizations_url":"https://api.github.com/users/scotchfield/orgs","repos_url":"https://api.github.com/users/scotchfield/repos","events_url":"https://api.github.com/users/scotchfield/events{/privacy}","received_events_url":"https://api.github.com/users/scotchfield/received_events","type":"User","site_admin":false},"body":"### High-level description of change\r\n\r\nWe've had some reports about the screen locking up while seeking ahead. This is caused by processing commands and building the cache, which trap us in the single thread and prevent other behaviour.\r\n\r\nThis approach uses `window.requestAnimationFrame` to process a few commands and cache entries, then see if we need to update the browser before trying another pass.\r\n\r\nI played with the value of `animationStep` and this seemed okay! It might make sense to show more or less though, so that would be a value to play around with. There's also some place where it's possible to generate bad cache entries if you continue to seek while it's still processing stuff. You can see this if you visit a Khan page like http://localhost:8081/computing/computer-programming/programming/drawing-basics/p/making-drawings-with-code, seek ahead to the end, and while it's processing, start scrolling around the scrollbar. That might be a problem in our Khan `webapp` though; I wasn't sure if I missed returning out of somewhere here in `live-editor` while seeking like in the `play` function, or if this is coming from the scroll bar in `webapp`.\r\n\r\n### Are there performance implications for this change?\r\n\r\nI haven't profiled this code, but it leads to more responsive seeking in webapp. As a result, it might be slightly slower because of the extra work.\r\n\r\n### Have you added tests to cover this new/updated code?\r\n\r\nNo new tests, but I ran the old tests and they all passed.\r\n\r\n### Risks involved\r\n\r\nIt's possible to mess up the cache if the seek is interrupted or the editor state is changed from outside while seeking. I don't think this solution is complete yet as a result; there's something that could still affect the result during playback.\r\n\r\n### Are there any dependencies or blockers for merging this?\r\n\r\nNo.\r\n\r\n### How can we verify that this change works?\r\n\r\nMy testing so far has been with the test suite here and by verifying on live examples in the Khan Academy webapp on `localhost`.","created_at":"2018-07-20T16:18:15Z","updated_at":"2018-07-20T16:18:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"scotchfield","id":5611966,"node_id":"MDQ6VXNlcjU2MTE5NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5611966?v=4","gravatar_id":"","url":"https://api.github.com/users/scotchfield","html_url":"https://github.com/scotchfield","followers_url":"https://api.github.com/users/scotchfield/followers","following_url":"https://api.github.com/users/scotchfield/following{/other_user}","gists_url":"https://api.github.com/users/scotchfield/gists{/gist_id}","starred_url":"https://api.github.com/users/scotchfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotchfield/subscriptions","organizations_url":"https://api.github.com/users/scotchfield/orgs","repos_url":"https://api.github.com/users/scotchfield/repos","events_url":"https://api.github.com/users/scotchfield/events{/privacy}","received_events_url":"https://api.github.com/users/scotchfield/received_events","type":"User","site_admin":false},"assignees":[{"login":"scotchfield","id":5611966,"node_id":"MDQ6VXNlcjU2MTE5NjY=","avatar_url":"https://avatars1.githubusercontent.com/u/5611966?v=4","gravatar_id":"","url":"https://api.github.com/users/scotchfield","html_url":"https://github.com/scotchfield","followers_url":"https://api.github.com/users/scotchfield/followers","following_url":"https://api.github.com/users/scotchfield/following{/other_user}","gists_url":"https://api.github.com/users/scotchfield/gists{/gist_id}","starred_url":"https://api.github.com/users/scotchfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotchfield/subscriptions","organizations_url":"https://api.github.com/users/scotchfield/orgs","repos_url":"https://api.github.com/users/scotchfield/repos","events_url":"https://api.github.com/users/scotchfield/events{/privacy}","received_events_url":"https://api.github.com/users/scotchfield/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Khan/live-editor/pulls/665/commits","review_comments_url":"https://api.github.com/repos/Khan/live-editor/pulls/665/comments","review_comment_url":"https://api.github.com/repos/Khan/live-editor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Khan/live-editor/issues/665/comments","statuses_url":"https://api.github.com/repos/Khan/live-editor/statuses/209ac1033715120cde2c5e5bb9192fd27494d65c","head":{"label":"Khan:seek-with-animation-frames","ref":"seek-with-animation-frames","sha":"209ac1033715120cde2c5e5bb9192fd27494d65c","user":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"repo":{"id":2675949,"node_id":"MDEwOlJlcG9zaXRvcnkyNjc1OTQ5","name":"live-editor","full_name":"Khan/live-editor","owner":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Khan/live-editor","description":"A browser-based live coding environment.","fork":false,"url":"https://api.github.com/repos/Khan/live-editor","forks_url":"https://api.github.com/repos/Khan/live-editor/forks","keys_url":"https://api.github.com/repos/Khan/live-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Khan/live-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Khan/live-editor/teams","hooks_url":"https://api.github.com/repos/Khan/live-editor/hooks","issue_events_url":"https://api.github.com/repos/Khan/live-editor/issues/events{/number}","events_url":"https://api.github.com/repos/Khan/live-editor/events","assignees_url":"https://api.github.com/repos/Khan/live-editor/assignees{/user}","branches_url":"https://api.github.com/repos/Khan/live-editor/branches{/branch}","tags_url":"https://api.github.com/repos/Khan/live-editor/tags","blobs_url":"https://api.github.com/repos/Khan/live-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Khan/live-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Khan/live-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/Khan/live-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Khan/live-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/Khan/live-editor/languages","stargazers_url":"https://api.github.com/repos/Khan/live-editor/stargazers","contributors_url":"https://api.github.com/repos/Khan/live-editor/contributors","subscribers_url":"https://api.github.com/repos/Khan/live-editor/subscribers","subscription_url":"https://api.github.com/repos/Khan/live-editor/subscription","commits_url":"https://api.github.com/repos/Khan/live-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/Khan/live-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/Khan/live-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/Khan/live-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/Khan/live-editor/contents/{+path}","compare_url":"https://api.github.com/repos/Khan/live-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Khan/live-editor/merges","archive_url":"https://api.github.com/repos/Khan/live-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Khan/live-editor/downloads","issues_url":"https://api.github.com/repos/Khan/live-editor/issues{/number}","pulls_url":"https://api.github.com/repos/Khan/live-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/Khan/live-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/Khan/live-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Khan/live-editor/labels{/name}","releases_url":"https://api.github.com/repos/Khan/live-editor/releases{/id}","deployments_url":"https://api.github.com/repos/Khan/live-editor/deployments","created_at":"2011-10-30T16:39:46Z","updated_at":"2018-07-17T13:12:14Z","pushed_at":"2018-07-20T16:10:29Z","git_url":"git://github.com/Khan/live-editor.git","ssh_url":"git@github.com:Khan/live-editor.git","clone_url":"https://github.com/Khan/live-editor.git","svn_url":"https://github.com/Khan/live-editor","homepage":"","size":145632,"stargazers_count":583,"watchers_count":583,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":149,"mirror_url":null,"archived":false,"open_issues_count":223,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":149,"open_issues":223,"watchers":583,"default_branch":"master"}},"base":{"label":"Khan:master","ref":"master","sha":"c2d57e4a4765cdbd9a5c29e9cd30a1b22113e5f2","user":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"repo":{"id":2675949,"node_id":"MDEwOlJlcG9zaXRvcnkyNjc1OTQ5","name":"live-editor","full_name":"Khan/live-editor","owner":{"login":"Khan","id":15455,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NDU1","avatar_url":"https://avatars1.githubusercontent.com/u/15455?v=4","gravatar_id":"","url":"https://api.github.com/users/Khan","html_url":"https://github.com/Khan","followers_url":"https://api.github.com/users/Khan/followers","following_url":"https://api.github.com/users/Khan/following{/other_user}","gists_url":"https://api.github.com/users/Khan/gists{/gist_id}","starred_url":"https://api.github.com/users/Khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Khan/subscriptions","organizations_url":"https://api.github.com/users/Khan/orgs","repos_url":"https://api.github.com/users/Khan/repos","events_url":"https://api.github.com/users/Khan/events{/privacy}","received_events_url":"https://api.github.com/users/Khan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Khan/live-editor","description":"A browser-based live coding environment.","fork":false,"url":"https://api.github.com/repos/Khan/live-editor","forks_url":"https://api.github.com/repos/Khan/live-editor/forks","keys_url":"https://api.github.com/repos/Khan/live-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Khan/live-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Khan/live-editor/teams","hooks_url":"https://api.github.com/repos/Khan/live-editor/hooks","issue_events_url":"https://api.github.com/repos/Khan/live-editor/issues/events{/number}","events_url":"https://api.github.com/repos/Khan/live-editor/events","assignees_url":"https://api.github.com/repos/Khan/live-editor/assignees{/user}","branches_url":"https://api.github.com/repos/Khan/live-editor/branches{/branch}","tags_url":"https://api.github.com/repos/Khan/live-editor/tags","blobs_url":"https://api.github.com/repos/Khan/live-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Khan/live-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Khan/live-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/Khan/live-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Khan/live-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/Khan/live-editor/languages","stargazers_url":"https://api.github.com/repos/Khan/live-editor/stargazers","contributors_url":"https://api.github.com/repos/Khan/live-editor/contributors","subscribers_url":"https://api.github.com/repos/Khan/live-editor/subscribers","subscription_url":"https://api.github.com/repos/Khan/live-editor/subscription","commits_url":"https://api.github.com/repos/Khan/live-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/Khan/live-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/Khan/live-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/Khan/live-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/Khan/live-editor/contents/{+path}","compare_url":"https://api.github.com/repos/Khan/live-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Khan/live-editor/merges","archive_url":"https://api.github.com/repos/Khan/live-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Khan/live-editor/downloads","issues_url":"https://api.github.com/repos/Khan/live-editor/issues{/number}","pulls_url":"https://api.github.com/repos/Khan/live-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/Khan/live-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/Khan/live-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Khan/live-editor/labels{/name}","releases_url":"https://api.github.com/repos/Khan/live-editor/releases{/id}","deployments_url":"https://api.github.com/repos/Khan/live-editor/deployments","created_at":"2011-10-30T16:39:46Z","updated_at":"2018-07-17T13:12:14Z","pushed_at":"2018-07-20T16:10:29Z","git_url":"git://github.com/Khan/live-editor.git","ssh_url":"git@github.com:Khan/live-editor.git","clone_url":"https://github.com/Khan/live-editor.git","svn_url":"https://github.com/Khan/live-editor","homepage":"","size":145632,"stargazers_count":583,"watchers_count":583,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":149,"mirror_url":null,"archived":false,"open_issues_count":223,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":149,"open_issues":223,"watchers":583,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Khan/live-editor/pulls/665"},"html":{"href":"https://github.com/Khan/live-editor/pull/665"},"issue":{"href":"https://api.github.com/repos/Khan/live-editor/issues/665"},"comments":{"href":"https://api.github.com/repos/Khan/live-editor/issues/665/comments"},"review_comments":{"href":"https://api.github.com/repos/Khan/live-editor/pulls/665/comments"},"review_comment":{"href":"https://api.github.com/repos/Khan/live-editor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Khan/live-editor/pulls/665/commits"},"statuses":{"href":"https://api.github.com/repos/Khan/live-editor/statuses/209ac1033715120cde2c5e5bb9192fd27494d65c"}},"author_association":"MEMBER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":30,"deletions":6,"changed_files":1}}
{"actor":{"display_login":"scotchfield"}}