{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/sense/pulls/comments/44435768","id":44435768,"diff_hunk":"@@ -0,0 +1,46 @@\n+import { throttle } from 'lodash';\n+\n+module.exports = function (editor) {\n+  let resize = editor.resize;\n+  let lastDemensions = [];\n+\n+  let checkDelay = 250;\n+  let recheckDelay = 500;\n+  let stableAfter = 5000;\n+  let timeouts = [];\n+\n+  let stableChecks = 0;\n+  let maxStableChecks = stableAfter / recheckDelay;\n+\n+  function exec() {\n+    timeouts.splice(0).map(clearTimeout);","path":"public/src/smart_resize.js","position":16,"original_position":16,"commit_id":"2606cdc6653b38d773d61b30c426c4645bb9b73e","original_commit_id":"2606cdc6653b38d773d61b30c426c4645bb9b73e","user":{"login":"bleskes","id":1006375,"avatar_url":"https://avatars.githubusercontent.com/u/1006375?v=3","gravatar_id":"","url":"https://api.github.com/users/bleskes","html_url":"https://github.com/bleskes","followers_url":"https://api.github.com/users/bleskes/followers","following_url":"https://api.github.com/users/bleskes/following{/other_user}","gists_url":"https://api.github.com/users/bleskes/gists{/gist_id}","starred_url":"https://api.github.com/users/bleskes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bleskes/subscriptions","organizations_url":"https://api.github.com/users/bleskes/orgs","repos_url":"https://api.github.com/users/bleskes/repos","events_url":"https://api.github.com/users/bleskes/events{/privacy}","received_events_url":"https://api.github.com/users/bleskes/received_events","type":"User","site_admin":false},"body":"this made my head heart. Really. If we just check every 250ms ,max 5000 we can just have one timer no? then only difference between requestResize and scheduleRecheck will be resetting the counter...","created_at":"2015-11-10T17:21:35Z","updated_at":"2015-11-10T17:21:35Z","html_url":"https://github.com/elastic/sense/pull/71#discussion_r44435768","pull_request_url":"https://api.github.com/repos/elastic/sense/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/elastic/sense/pulls/comments/44435768"},"html":{"href":"https://github.com/elastic/sense/pull/71#discussion_r44435768"},"pull_request":{"href":"https://api.github.com/repos/elastic/sense/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/sense/pulls/71","id":49208219,"html_url":"https://github.com/elastic/sense/pull/71","diff_url":"https://github.com/elastic/sense/pull/71.diff","patch_url":"https://github.com/elastic/sense/pull/71.patch","issue_url":"https://api.github.com/repos/elastic/sense/issues/71","number":71,"state":"open","locked":false,"title":"use more resiliant resize method","user":{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},"body":"Fixes #70 \r\n\r\nSince some browsers may not flex the elements which hold the editors immediately, allow calls to editor.resize() to re-run if their container changes size soon after resize occurred.","created_at":"2015-10-29T22:20:40Z","updated_at":"2015-11-10T17:21:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14ab6f11cff4e58dc5923f5faee7ad019211a68c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/sense/pulls/71/commits","review_comments_url":"https://api.github.com/repos/elastic/sense/pulls/71/comments","review_comment_url":"https://api.github.com/repos/elastic/sense/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/sense/issues/71/comments","statuses_url":"https://api.github.com/repos/elastic/sense/statuses/2606cdc6653b38d773d61b30c426c4645bb9b73e","head":{"label":"spalger:fixSlowResize","ref":"fixSlowResize","sha":"2606cdc6653b38d773d61b30c426c4645bb9b73e","user":{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},"repo":{"id":45214093,"name":"sense","full_name":"spalger/sense","owner":{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spalger/sense","description":"A JSON aware developer's interface to ElasticSearch. Comes with handy machinery such as syntax highlighting, autocomplete, formatting and code folding.","fork":true,"url":"https://api.github.com/repos/spalger/sense","forks_url":"https://api.github.com/repos/spalger/sense/forks","keys_url":"https://api.github.com/repos/spalger/sense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spalger/sense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spalger/sense/teams","hooks_url":"https://api.github.com/repos/spalger/sense/hooks","issue_events_url":"https://api.github.com/repos/spalger/sense/issues/events{/number}","events_url":"https://api.github.com/repos/spalger/sense/events","assignees_url":"https://api.github.com/repos/spalger/sense/assignees{/user}","branches_url":"https://api.github.com/repos/spalger/sense/branches{/branch}","tags_url":"https://api.github.com/repos/spalger/sense/tags","blobs_url":"https://api.github.com/repos/spalger/sense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spalger/sense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spalger/sense/git/refs{/sha}","trees_url":"https://api.github.com/repos/spalger/sense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spalger/sense/statuses/{sha}","languages_url":"https://api.github.com/repos/spalger/sense/languages","stargazers_url":"https://api.github.com/repos/spalger/sense/stargazers","contributors_url":"https://api.github.com/repos/spalger/sense/contributors","subscribers_url":"https://api.github.com/repos/spalger/sense/subscribers","subscription_url":"https://api.github.com/repos/spalger/sense/subscription","commits_url":"https://api.github.com/repos/spalger/sense/commits{/sha}","git_commits_url":"https://api.github.com/repos/spalger/sense/git/commits{/sha}","comments_url":"https://api.github.com/repos/spalger/sense/comments{/number}","issue_comment_url":"https://api.github.com/repos/spalger/sense/issues/comments{/number}","contents_url":"https://api.github.com/repos/spalger/sense/contents/{+path}","compare_url":"https://api.github.com/repos/spalger/sense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spalger/sense/merges","archive_url":"https://api.github.com/repos/spalger/sense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spalger/sense/downloads","issues_url":"https://api.github.com/repos/spalger/sense/issues{/number}","pulls_url":"https://api.github.com/repos/spalger/sense/pulls{/number}","milestones_url":"https://api.github.com/repos/spalger/sense/milestones{/number}","notifications_url":"https://api.github.com/repos/spalger/sense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spalger/sense/labels{/name}","releases_url":"https://api.github.com/repos/spalger/sense/releases{/id}","created_at":"2015-10-29T22:19:15Z","updated_at":"2015-10-29T22:19:53Z","pushed_at":"2015-11-09T18:17:28Z","git_url":"git://github.com/spalger/sense.git","ssh_url":"git@github.com:spalger/sense.git","clone_url":"https://github.com/spalger/sense.git","svn_url":"https://github.com/spalger/sense","homepage":null,"size":7137,"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":"elastic:master","ref":"master","sha":"09216ea9a9d2027692da439c3a5491868774ea0b","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":37426031,"name":"sense","full_name":"elastic/sense","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/sense","description":"A JSON aware developer's interface to Elasticsearch. Comes with handy machinery such as syntax highlighting, autocomplete, formatting and code folding.","fork":false,"url":"https://api.github.com/repos/elastic/sense","forks_url":"https://api.github.com/repos/elastic/sense/forks","keys_url":"https://api.github.com/repos/elastic/sense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/sense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/sense/teams","hooks_url":"https://api.github.com/repos/elastic/sense/hooks","issue_events_url":"https://api.github.com/repos/elastic/sense/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/sense/events","assignees_url":"https://api.github.com/repos/elastic/sense/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/sense/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/sense/tags","blobs_url":"https://api.github.com/repos/elastic/sense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/sense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/sense/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/sense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/sense/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/sense/languages","stargazers_url":"https://api.github.com/repos/elastic/sense/stargazers","contributors_url":"https://api.github.com/repos/elastic/sense/contributors","subscribers_url":"https://api.github.com/repos/elastic/sense/subscribers","subscription_url":"https://api.github.com/repos/elastic/sense/subscription","commits_url":"https://api.github.com/repos/elastic/sense/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/sense/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/sense/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/sense/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/sense/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/sense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/sense/merges","archive_url":"https://api.github.com/repos/elastic/sense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/sense/downloads","issues_url":"https://api.github.com/repos/elastic/sense/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/sense/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/sense/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/sense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/sense/labels{/name}","releases_url":"https://api.github.com/repos/elastic/sense/releases{/id}","created_at":"2015-06-14T19:19:02Z","updated_at":"2015-11-09T18:12:30Z","pushed_at":"2015-11-10T17:10:28Z","git_url":"git://github.com/elastic/sense.git","ssh_url":"git@github.com:elastic/sense.git","clone_url":"https://github.com/elastic/sense.git","svn_url":"https://github.com/elastic/sense","homepage":"","size":7614,"stargazers_count":63,"watchers_count":63,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":22,"forks":8,"open_issues":22,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/sense/pulls/71"},"html":{"href":"https://github.com/elastic/sense/pull/71"},"issue":{"href":"https://api.github.com/repos/elastic/sense/issues/71"},"comments":{"href":"https://api.github.com/repos/elastic/sense/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/sense/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/sense/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/sense/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/sense/statuses/2606cdc6653b38d773d61b30c426c4645bb9b73e"}}}}