{"action":"closed","number":960,"pull_request":{"url":"https://api.github.com/repos/craftyjs/Crafty/pulls/960","id":46106054,"html_url":"https://github.com/craftyjs/Crafty/pull/960","diff_url":"https://github.com/craftyjs/Crafty/pull/960.diff","patch_url":"https://github.com/craftyjs/Crafty/pull/960.patch","issue_url":"https://api.github.com/repos/craftyjs/Crafty/issues/960","number":960,"state":"closed","locked":false,"title":"Handle restart more gracefully","user":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"body":"This fixes a bundle of bugs related to calling `Craft.stop()` and then `Crafty.init()`.\r\n\r\n- Clear global bound events on stop (regression caused by the new callback methods)\r\n- Add a `Crafty._preBind` method for internal use -- anything registered here will be bound when `Crafty.init()` is called (unless we did a soft stop).  This works around a problem where we bound some events only once, when crafty.js was loaded.  (Currently used in inputs.js and viewport.js)\r\n- Make sure that \"CraftyStop\" is triggered *before* we remove all event handlers!  (This was messing up cleanup of dom event handlers, which in turn messed up registering new ones.)\r\n- Delete references to previously created graphics layers\r\n- Have graphics layers set their initial values in their init functions\r\n\r\nSome of these are really work arounds for how we initialize graphics layers, the viewport, etc.  I think if we switch these to using the new systems idiom we can remove a lot of the changes above.  (Definitely the \"prebind\" hack.)","created_at":"2015-09-27T18:37:42Z","updated_at":"2015-10-03T17:06:20Z","closed_at":"2015-10-03T17:06:20Z","merged_at":"2015-10-03T17:06:20Z","merge_commit_sha":"024debb4f187b3353b103d85810d5faff17c9025","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/960/commits","review_comments_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/960/comments","review_comment_url":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/craftyjs/Crafty/issues/960/comments","statuses_url":"https://api.github.com/repos/craftyjs/Crafty/statuses/30fe086ed693bed6d4fcf67a27fc4b84226ceab3","head":{"label":"starwed:stop-start-fixes","ref":"stop-start-fixes","sha":"30fe086ed693bed6d4fcf67a27fc4b84226ceab3","user":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"repo":{"id":6802001,"name":"Crafty","full_name":"starwed/Crafty","owner":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/starwed/Crafty","description":"JavaScript Game Engine","fork":true,"url":"https://api.github.com/repos/starwed/Crafty","forks_url":"https://api.github.com/repos/starwed/Crafty/forks","keys_url":"https://api.github.com/repos/starwed/Crafty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starwed/Crafty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starwed/Crafty/teams","hooks_url":"https://api.github.com/repos/starwed/Crafty/hooks","issue_events_url":"https://api.github.com/repos/starwed/Crafty/issues/events{/number}","events_url":"https://api.github.com/repos/starwed/Crafty/events","assignees_url":"https://api.github.com/repos/starwed/Crafty/assignees{/user}","branches_url":"https://api.github.com/repos/starwed/Crafty/branches{/branch}","tags_url":"https://api.github.com/repos/starwed/Crafty/tags","blobs_url":"https://api.github.com/repos/starwed/Crafty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starwed/Crafty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starwed/Crafty/git/refs{/sha}","trees_url":"https://api.github.com/repos/starwed/Crafty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starwed/Crafty/statuses/{sha}","languages_url":"https://api.github.com/repos/starwed/Crafty/languages","stargazers_url":"https://api.github.com/repos/starwed/Crafty/stargazers","contributors_url":"https://api.github.com/repos/starwed/Crafty/contributors","subscribers_url":"https://api.github.com/repos/starwed/Crafty/subscribers","subscription_url":"https://api.github.com/repos/starwed/Crafty/subscription","commits_url":"https://api.github.com/repos/starwed/Crafty/commits{/sha}","git_commits_url":"https://api.github.com/repos/starwed/Crafty/git/commits{/sha}","comments_url":"https://api.github.com/repos/starwed/Crafty/comments{/number}","issue_comment_url":"https://api.github.com/repos/starwed/Crafty/issues/comments{/number}","contents_url":"https://api.github.com/repos/starwed/Crafty/contents/{+path}","compare_url":"https://api.github.com/repos/starwed/Crafty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starwed/Crafty/merges","archive_url":"https://api.github.com/repos/starwed/Crafty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starwed/Crafty/downloads","issues_url":"https://api.github.com/repos/starwed/Crafty/issues{/number}","pulls_url":"https://api.github.com/repos/starwed/Crafty/pulls{/number}","milestones_url":"https://api.github.com/repos/starwed/Crafty/milestones{/number}","notifications_url":"https://api.github.com/repos/starwed/Crafty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starwed/Crafty/labels{/name}","releases_url":"https://api.github.com/repos/starwed/Crafty/releases{/id}","created_at":"2012-11-21T19:50:34Z","updated_at":"2014-04-25T21:26:04Z","pushed_at":"2015-09-27T18:36:30Z","git_url":"git://github.com/starwed/Crafty.git","ssh_url":"git@github.com:starwed/Crafty.git","clone_url":"https://github.com/starwed/Crafty.git","svn_url":"https://github.com/starwed/Crafty","homepage":"http://craftyjs.com","size":7630,"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":"develop"}},"base":{"label":"craftyjs:develop","ref":"develop","sha":"120d2279bbb82f47f845ccf74bfe2435ab3e41c9","user":{"login":"craftyjs","id":1334729,"avatar_url":"https://avatars.githubusercontent.com/u/1334729?v=3","gravatar_id":"","url":"https://api.github.com/users/craftyjs","html_url":"https://github.com/craftyjs","followers_url":"https://api.github.com/users/craftyjs/followers","following_url":"https://api.github.com/users/craftyjs/following{/other_user}","gists_url":"https://api.github.com/users/craftyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/craftyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftyjs/subscriptions","organizations_url":"https://api.github.com/users/craftyjs/orgs","repos_url":"https://api.github.com/users/craftyjs/repos","events_url":"https://api.github.com/users/craftyjs/events{/privacy}","received_events_url":"https://api.github.com/users/craftyjs/received_events","type":"Organization","site_admin":false},"repo":{"id":1052675,"name":"Crafty","full_name":"craftyjs/Crafty","owner":{"login":"craftyjs","id":1334729,"avatar_url":"https://avatars.githubusercontent.com/u/1334729?v=3","gravatar_id":"","url":"https://api.github.com/users/craftyjs","html_url":"https://github.com/craftyjs","followers_url":"https://api.github.com/users/craftyjs/followers","following_url":"https://api.github.com/users/craftyjs/following{/other_user}","gists_url":"https://api.github.com/users/craftyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/craftyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftyjs/subscriptions","organizations_url":"https://api.github.com/users/craftyjs/orgs","repos_url":"https://api.github.com/users/craftyjs/repos","events_url":"https://api.github.com/users/craftyjs/events{/privacy}","received_events_url":"https://api.github.com/users/craftyjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/craftyjs/Crafty","description":"JavaScript Game Engine","fork":false,"url":"https://api.github.com/repos/craftyjs/Crafty","forks_url":"https://api.github.com/repos/craftyjs/Crafty/forks","keys_url":"https://api.github.com/repos/craftyjs/Crafty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craftyjs/Crafty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craftyjs/Crafty/teams","hooks_url":"https://api.github.com/repos/craftyjs/Crafty/hooks","issue_events_url":"https://api.github.com/repos/craftyjs/Crafty/issues/events{/number}","events_url":"https://api.github.com/repos/craftyjs/Crafty/events","assignees_url":"https://api.github.com/repos/craftyjs/Crafty/assignees{/user}","branches_url":"https://api.github.com/repos/craftyjs/Crafty/branches{/branch}","tags_url":"https://api.github.com/repos/craftyjs/Crafty/tags","blobs_url":"https://api.github.com/repos/craftyjs/Crafty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craftyjs/Crafty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craftyjs/Crafty/git/refs{/sha}","trees_url":"https://api.github.com/repos/craftyjs/Crafty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craftyjs/Crafty/statuses/{sha}","languages_url":"https://api.github.com/repos/craftyjs/Crafty/languages","stargazers_url":"https://api.github.com/repos/craftyjs/Crafty/stargazers","contributors_url":"https://api.github.com/repos/craftyjs/Crafty/contributors","subscribers_url":"https://api.github.com/repos/craftyjs/Crafty/subscribers","subscription_url":"https://api.github.com/repos/craftyjs/Crafty/subscription","commits_url":"https://api.github.com/repos/craftyjs/Crafty/commits{/sha}","git_commits_url":"https://api.github.com/repos/craftyjs/Crafty/git/commits{/sha}","comments_url":"https://api.github.com/repos/craftyjs/Crafty/comments{/number}","issue_comment_url":"https://api.github.com/repos/craftyjs/Crafty/issues/comments{/number}","contents_url":"https://api.github.com/repos/craftyjs/Crafty/contents/{+path}","compare_url":"https://api.github.com/repos/craftyjs/Crafty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craftyjs/Crafty/merges","archive_url":"https://api.github.com/repos/craftyjs/Crafty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craftyjs/Crafty/downloads","issues_url":"https://api.github.com/repos/craftyjs/Crafty/issues{/number}","pulls_url":"https://api.github.com/repos/craftyjs/Crafty/pulls{/number}","milestones_url":"https://api.github.com/repos/craftyjs/Crafty/milestones{/number}","notifications_url":"https://api.github.com/repos/craftyjs/Crafty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craftyjs/Crafty/labels{/name}","releases_url":"https://api.github.com/repos/craftyjs/Crafty/releases{/id}","created_at":"2010-11-04T23:02:09Z","updated_at":"2015-10-01T03:05:20Z","pushed_at":"2015-10-03T17:06:20Z","git_url":"git://github.com/craftyjs/Crafty.git","ssh_url":"git@github.com:craftyjs/Crafty.git","clone_url":"https://github.com/craftyjs/Crafty.git","svn_url":"https://github.com/craftyjs/Crafty","homepage":"http://craftyjs.com","size":11074,"stargazers_count":1892,"watchers_count":1892,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":462,"mirror_url":null,"open_issues_count":47,"forks":462,"open_issues":47,"watchers":1892,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/960"},"html":{"href":"https://github.com/craftyjs/Crafty/pull/960"},"issue":{"href":"https://api.github.com/repos/craftyjs/Crafty/issues/960"},"comments":{"href":"https://api.github.com/repos/craftyjs/Crafty/issues/960/comments"},"review_comments":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/960/comments"},"review_comment":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/craftyjs/Crafty/pulls/960/commits"},"statuses":{"href":"https://api.github.com/repos/craftyjs/Crafty/statuses/30fe086ed693bed6d4fcf67a27fc4b84226ceab3"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"starwed","id":34907,"avatar_url":"https://avatars.githubusercontent.com/u/34907?v=3","gravatar_id":"","url":"https://api.github.com/users/starwed","html_url":"https://github.com/starwed","followers_url":"https://api.github.com/users/starwed/followers","following_url":"https://api.github.com/users/starwed/following{/other_user}","gists_url":"https://api.github.com/users/starwed/gists{/gist_id}","starred_url":"https://api.github.com/users/starwed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starwed/subscriptions","organizations_url":"https://api.github.com/users/starwed/orgs","repos_url":"https://api.github.com/users/starwed/repos","events_url":"https://api.github.com/users/starwed/events{/privacy}","received_events_url":"https://api.github.com/users/starwed/received_events","type":"User","site_admin":false},"comments":1,"review_comments":1,"commits":1,"additions":71,"deletions":26,"changed_files":7}}