{"action":"created","comment":{"url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/comments/75710468","id":75710468,"diff_hunk":"@@ -231,12 +232,48 @@ function mixin(target, source) {\n   }\n }\n \n-// There should never be more than\n-// one instance of `FastDom` in an app\n-var exports = win.fastdom = (win.fastdom || new FastDom()); // jshint ignore:line\n+/**\n+ * Exports\n+ *\n+ * In order for fastdom to work in the most\n+ * performant way it must be a global singleton\n+ * within each app. If two fastdom's are operating\n+ * at the same time, they can collide and force\n+ * additional reflows.\n+ *\n+ * To circumvent this we:\n+ *\n+ * 1. Check for any pre-existing `fastdom`\n+ * 2. Test if the major versions are the same\n+ * 3. If compatible, we export the existing instance\n+ * 4. If not compatible we console.warn and create a new instance\n+ *\n+ * This assumes that instances of the same semver\n+ * major version have the same public API. Any\n+ * minor or patch versions are disregarded.\n+ * The first fastdom loaded wins.\n+ */\n \n-// Expose to CJS & AMD\n+var exports = (function() {\n+  var existing = win['fastdom'] || win['__fastdom__'];\n+\n+  if (existing) {\n+    var version = existing.version || (existing.defer ? 0 : 1);\n+    var compatible = version === FastDom.prototype.version;\n+    var exports = compatible ? existing : new FastDom();\n+    if (compatible) return existing;\n+    console.warn('[fastdom] Multiple incompatible versions detected (this could impact performance)');","path":"fastdom.js","position":46,"original_position":46,"commit_id":"c5caec28f1ec41091c76310a5587e484f75c440c","original_commit_id":"c5caec28f1ec41091c76310a5587e484f75c440c","user":{"login":"indianburger","id":449090,"avatar_url":"https://avatars.githubusercontent.com/u/449090?v=3","gravatar_id":"","url":"https://api.github.com/users/indianburger","html_url":"https://github.com/indianburger","followers_url":"https://api.github.com/users/indianburger/followers","following_url":"https://api.github.com/users/indianburger/following{/other_user}","gists_url":"https://api.github.com/users/indianburger/gists{/gist_id}","starred_url":"https://api.github.com/users/indianburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indianburger/subscriptions","organizations_url":"https://api.github.com/users/indianburger/orgs","repos_url":"https://api.github.com/users/indianburger/repos","events_url":"https://api.github.com/users/indianburger/events{/privacy}","received_events_url":"https://api.github.com/users/indianburger/received_events","type":"User","site_admin":false},"body":"How about adding a link to the issue in the warning? ","created_at":"2016-08-22T16:27:55Z","updated_at":"2016-08-22T16:27:55Z","html_url":"https://github.com/wilsonpage/fastdom/pull/91#discussion_r75710468","pull_request_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/comments/75710468"},"html":{"href":"https://github.com/wilsonpage/fastdom/pull/91#discussion_r75710468"},"pull_request":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91","id":81720857,"html_url":"https://github.com/wilsonpage/fastdom/pull/91","diff_url":"https://github.com/wilsonpage/fastdom/pull/91.diff","patch_url":"https://github.com/wilsonpage/fastdom/pull/91.patch","issue_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/91","number":91,"state":"open","locked":false,"title":"90 version compat","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-17T21:33:57Z","updated_at":"2016-08-22T16:27:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"caebd1e26b9baa4261a285dc41ce0330f826a150","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91/commits","review_comments_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91/comments","review_comment_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/91/comments","statuses_url":"https://api.github.com/repos/wilsonpage/fastdom/statuses/c5caec28f1ec41091c76310a5587e484f75c440c","head":{"label":"wilsonpage:90-version-compat","ref":"90-version-compat","sha":"c5caec28f1ec41091c76310a5587e484f75c440c","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"repo":{"id":8135625,"name":"fastdom","full_name":"wilsonpage/fastdom","owner":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilsonpage/fastdom","description":"Eliminates layout thrashing by batching DOM measurement and mutation tasks","fork":false,"url":"https://api.github.com/repos/wilsonpage/fastdom","forks_url":"https://api.github.com/repos/wilsonpage/fastdom/forks","keys_url":"https://api.github.com/repos/wilsonpage/fastdom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilsonpage/fastdom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilsonpage/fastdom/teams","hooks_url":"https://api.github.com/repos/wilsonpage/fastdom/hooks","issue_events_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/events{/number}","events_url":"https://api.github.com/repos/wilsonpage/fastdom/events","assignees_url":"https://api.github.com/repos/wilsonpage/fastdom/assignees{/user}","branches_url":"https://api.github.com/repos/wilsonpage/fastdom/branches{/branch}","tags_url":"https://api.github.com/repos/wilsonpage/fastdom/tags","blobs_url":"https://api.github.com/repos/wilsonpage/fastdom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilsonpage/fastdom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilsonpage/fastdom/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilsonpage/fastdom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilsonpage/fastdom/statuses/{sha}","languages_url":"https://api.github.com/repos/wilsonpage/fastdom/languages","stargazers_url":"https://api.github.com/repos/wilsonpage/fastdom/stargazers","contributors_url":"https://api.github.com/repos/wilsonpage/fastdom/contributors","subscribers_url":"https://api.github.com/repos/wilsonpage/fastdom/subscribers","subscription_url":"https://api.github.com/repos/wilsonpage/fastdom/subscription","commits_url":"https://api.github.com/repos/wilsonpage/fastdom/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilsonpage/fastdom/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilsonpage/fastdom/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilsonpage/fastdom/contents/{+path}","compare_url":"https://api.github.com/repos/wilsonpage/fastdom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilsonpage/fastdom/merges","archive_url":"https://api.github.com/repos/wilsonpage/fastdom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilsonpage/fastdom/downloads","issues_url":"https://api.github.com/repos/wilsonpage/fastdom/issues{/number}","pulls_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls{/number}","milestones_url":"https://api.github.com/repos/wilsonpage/fastdom/milestones{/number}","notifications_url":"https://api.github.com/repos/wilsonpage/fastdom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilsonpage/fastdom/labels{/name}","releases_url":"https://api.github.com/repos/wilsonpage/fastdom/releases{/id}","deployments_url":"https://api.github.com/repos/wilsonpage/fastdom/deployments","created_at":"2013-02-11T09:45:41Z","updated_at":"2016-08-21T14:16:11Z","pushed_at":"2016-08-17T21:36:50Z","git_url":"git://github.com/wilsonpage/fastdom.git","ssh_url":"git@github.com:wilsonpage/fastdom.git","clone_url":"https://github.com/wilsonpage/fastdom.git","svn_url":"https://github.com/wilsonpage/fastdom","homepage":"","size":220,"stargazers_count":3452,"watchers_count":3452,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":137,"mirror_url":null,"open_issues_count":6,"forks":137,"open_issues":6,"watchers":3452,"default_branch":"master"}},"base":{"label":"wilsonpage:master","ref":"master","sha":"aa3c897bcdff0ee182f29d9a45a03e709f529c8f","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"repo":{"id":8135625,"name":"fastdom","full_name":"wilsonpage/fastdom","owner":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilsonpage/fastdom","description":"Eliminates layout thrashing by batching DOM measurement and mutation tasks","fork":false,"url":"https://api.github.com/repos/wilsonpage/fastdom","forks_url":"https://api.github.com/repos/wilsonpage/fastdom/forks","keys_url":"https://api.github.com/repos/wilsonpage/fastdom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilsonpage/fastdom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilsonpage/fastdom/teams","hooks_url":"https://api.github.com/repos/wilsonpage/fastdom/hooks","issue_events_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/events{/number}","events_url":"https://api.github.com/repos/wilsonpage/fastdom/events","assignees_url":"https://api.github.com/repos/wilsonpage/fastdom/assignees{/user}","branches_url":"https://api.github.com/repos/wilsonpage/fastdom/branches{/branch}","tags_url":"https://api.github.com/repos/wilsonpage/fastdom/tags","blobs_url":"https://api.github.com/repos/wilsonpage/fastdom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilsonpage/fastdom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilsonpage/fastdom/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilsonpage/fastdom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilsonpage/fastdom/statuses/{sha}","languages_url":"https://api.github.com/repos/wilsonpage/fastdom/languages","stargazers_url":"https://api.github.com/repos/wilsonpage/fastdom/stargazers","contributors_url":"https://api.github.com/repos/wilsonpage/fastdom/contributors","subscribers_url":"https://api.github.com/repos/wilsonpage/fastdom/subscribers","subscription_url":"https://api.github.com/repos/wilsonpage/fastdom/subscription","commits_url":"https://api.github.com/repos/wilsonpage/fastdom/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilsonpage/fastdom/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilsonpage/fastdom/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilsonpage/fastdom/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilsonpage/fastdom/contents/{+path}","compare_url":"https://api.github.com/repos/wilsonpage/fastdom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilsonpage/fastdom/merges","archive_url":"https://api.github.com/repos/wilsonpage/fastdom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilsonpage/fastdom/downloads","issues_url":"https://api.github.com/repos/wilsonpage/fastdom/issues{/number}","pulls_url":"https://api.github.com/repos/wilsonpage/fastdom/pulls{/number}","milestones_url":"https://api.github.com/repos/wilsonpage/fastdom/milestones{/number}","notifications_url":"https://api.github.com/repos/wilsonpage/fastdom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilsonpage/fastdom/labels{/name}","releases_url":"https://api.github.com/repos/wilsonpage/fastdom/releases{/id}","deployments_url":"https://api.github.com/repos/wilsonpage/fastdom/deployments","created_at":"2013-02-11T09:45:41Z","updated_at":"2016-08-21T14:16:11Z","pushed_at":"2016-08-17T21:36:50Z","git_url":"git://github.com/wilsonpage/fastdom.git","ssh_url":"git@github.com:wilsonpage/fastdom.git","clone_url":"https://github.com/wilsonpage/fastdom.git","svn_url":"https://github.com/wilsonpage/fastdom","homepage":"","size":220,"stargazers_count":3452,"watchers_count":3452,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":137,"mirror_url":null,"open_issues_count":6,"forks":137,"open_issues":6,"watchers":3452,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91"},"html":{"href":"https://github.com/wilsonpage/fastdom/pull/91"},"issue":{"href":"https://api.github.com/repos/wilsonpage/fastdom/issues/91"},"comments":{"href":"https://api.github.com/repos/wilsonpage/fastdom/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wilsonpage/fastdom/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/wilsonpage/fastdom/statuses/c5caec28f1ec41091c76310a5587e484f75c440c"}}}}
{"actor":{"display_login":"indianburger"}}