{"action":"created","comment":{"url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/comments/36716359","id":36716359,"diff_hunk":"@@ -0,0 +1,237 @@\n+(function(exports) {\n+  'use strict';\n+\n+  exports.classic = exports.classic || {};\n+  exports.classic.backend = exports.classic.backend || {};\n+\n+  var ui = exports.classic.ui;\n+  var backend = exports.classic.backend;\n+\n+  backend.BluetoothManagerTab = function(tabsManager) {\n+    this._tabsManager = tabsManager;\n+    this._tab = new ui.Tab({}, 'BluetoothManager');\n+    this._adapterBlocks = [];\n+\n+    this._tabsManager.addTab(this._tab);\n+\n+    var events = ['adapteradded', 'adapterremoved', 'attributechanged'];\n+    for (var i = 0; i < events.length; ++i) {\n+      navigator.mozBluetooth.addEventListener(\n+          events[i], this._updateBlocks.bind(this));\n+    }\n+  };\n+\n+  backend.BluetoothManagerTab.prototype = {\n+    _updateBlocks: function() {\n+      for (var i = 0; i < this._adapterBlocks.length; ++i) {\n+        this._adapterBlocks[i].destroy();\n+      }\n+      this._adapterBocks = [];\n+      var adapters = navigator.mozBluetooth.getAdapters();\n+      for (i = 0; i < adapters.length; ++i) {\n+        this._adapterBlocks.push(new backend.BluetoothManagerTab.AdapterBlock(\n+            this._tabsManager, this._tab, adapters[i]));\n+      }\n+    }\n+  };\n+\n+  backend.BluetoothManagerTab.AdapterBlock = function(\n+      tabsManager, tab, adapter) {\n+    this._tabsManager = tabsManager;\n+    this._tab = tab;\n+    this._adapter = adapter;\n+    this._block = new ui.PlayButtonBlock(\n+        {onPlay: this._onPlayHandler.bind(this)}, '', '', true);\n+    this._attributeChangedHandler = this._generateAttributeChangedHandler();\n+\n+    this._tab.addBlock(this._block, this._tab.numBlocks);\n+    this._adapter.addEventListener('attributechanged',\n+                                   this._attributeChangedHandler);\n+    this._attributeChangedHandler({attrs: ['address']});","path":"js/classic/backend.js","position":50,"original_position":50,"commit_id":"2e03586d8c5da5b00ce1f9fce3c7e6abd3b12c13","original_commit_id":"2e03586d8c5da5b00ce1f9fce3c7e6abd3b12c13","user":{"login":"dwi2","id":644741,"avatar_url":"https://avatars.githubusercontent.com/u/644741?v=3","gravatar_id":"","url":"https://api.github.com/users/dwi2","html_url":"https://github.com/dwi2","followers_url":"https://api.github.com/users/dwi2/followers","following_url":"https://api.github.com/users/dwi2/following{/other_user}","gists_url":"https://api.github.com/users/dwi2/gists{/gist_id}","starred_url":"https://api.github.com/users/dwi2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwi2/subscriptions","organizations_url":"https://api.github.com/users/dwi2/orgs","repos_url":"https://api.github.com/users/dwi2/repos","events_url":"https://api.github.com/users/dwi2/events{/privacy}","received_events_url":"https://api.github.com/users/dwi2/received_events","type":"User","site_admin":false},"body":"why do we need to trigger `_attributeChangedHandler` here?","created_at":"2015-08-11T07:01:56Z","updated_at":"2015-08-11T07:01:56Z","html_url":"https://github.com/fxos-bt-squad/bt-test/pull/13#discussion_r36716359","pull_request_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/comments/36716359"},"html":{"href":"https://github.com/fxos-bt-squad/bt-test/pull/13#discussion_r36716359"},"pull_request":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13","id":42002825,"html_url":"https://github.com/fxos-bt-squad/bt-test/pull/13","diff_url":"https://github.com/fxos-bt-squad/bt-test/pull/13.diff","patch_url":"https://github.com/fxos-bt-squad/bt-test/pull/13.patch","issue_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/13","number":13,"state":"open","locked":false,"title":"Bug 1192757 - Implement test app backend of classic API (part1)","user":{"login":"cathook","id":5891613,"avatar_url":"https://avatars.githubusercontent.com/u/5891613?v=3","gravatar_id":"","url":"https://api.github.com/users/cathook","html_url":"https://github.com/cathook","followers_url":"https://api.github.com/users/cathook/followers","following_url":"https://api.github.com/users/cathook/following{/other_user}","gists_url":"https://api.github.com/users/cathook/gists{/gist_id}","starred_url":"https://api.github.com/users/cathook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathook/subscriptions","organizations_url":"https://api.github.com/users/cathook/orgs","repos_url":"https://api.github.com/users/cathook/repos","events_url":"https://api.github.com/users/cathook/events{/privacy}","received_events_url":"https://api.github.com/users/cathook/received_events","type":"User","site_admin":false},"body":"Now it can do enable, disable, setDiscoverable.","created_at":"2015-08-10T09:45:32Z","updated_at":"2015-08-11T07:01:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da39f05e9e374c42a2f12e8edf7957f831a81755","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13/commits","review_comments_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13/comments","review_comment_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/13/comments","statuses_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/statuses/2e03586d8c5da5b00ce1f9fce3c7e6abd3b12c13","head":{"label":"cathook:classic_api_test_backend","ref":"classic_api_test_backend","sha":"2e03586d8c5da5b00ce1f9fce3c7e6abd3b12c13","user":{"login":"cathook","id":5891613,"avatar_url":"https://avatars.githubusercontent.com/u/5891613?v=3","gravatar_id":"","url":"https://api.github.com/users/cathook","html_url":"https://github.com/cathook","followers_url":"https://api.github.com/users/cathook/followers","following_url":"https://api.github.com/users/cathook/following{/other_user}","gists_url":"https://api.github.com/users/cathook/gists{/gist_id}","starred_url":"https://api.github.com/users/cathook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathook/subscriptions","organizations_url":"https://api.github.com/users/cathook/orgs","repos_url":"https://api.github.com/users/cathook/repos","events_url":"https://api.github.com/users/cathook/events{/privacy}","received_events_url":"https://api.github.com/users/cathook/received_events","type":"User","site_admin":false},"repo":{"id":39115590,"name":"bt-test","full_name":"cathook/bt-test","owner":{"login":"cathook","id":5891613,"avatar_url":"https://avatars.githubusercontent.com/u/5891613?v=3","gravatar_id":"","url":"https://api.github.com/users/cathook","html_url":"https://github.com/cathook","followers_url":"https://api.github.com/users/cathook/followers","following_url":"https://api.github.com/users/cathook/following{/other_user}","gists_url":"https://api.github.com/users/cathook/gists{/gist_id}","starred_url":"https://api.github.com/users/cathook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathook/subscriptions","organizations_url":"https://api.github.com/users/cathook/orgs","repos_url":"https://api.github.com/users/cathook/repos","events_url":"https://api.github.com/users/cathook/events{/privacy}","received_events_url":"https://api.github.com/users/cathook/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cathook/bt-test","description":"A test app for WebBluetooth v2 API","fork":true,"url":"https://api.github.com/repos/cathook/bt-test","forks_url":"https://api.github.com/repos/cathook/bt-test/forks","keys_url":"https://api.github.com/repos/cathook/bt-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cathook/bt-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cathook/bt-test/teams","hooks_url":"https://api.github.com/repos/cathook/bt-test/hooks","issue_events_url":"https://api.github.com/repos/cathook/bt-test/issues/events{/number}","events_url":"https://api.github.com/repos/cathook/bt-test/events","assignees_url":"https://api.github.com/repos/cathook/bt-test/assignees{/user}","branches_url":"https://api.github.com/repos/cathook/bt-test/branches{/branch}","tags_url":"https://api.github.com/repos/cathook/bt-test/tags","blobs_url":"https://api.github.com/repos/cathook/bt-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cathook/bt-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cathook/bt-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/cathook/bt-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cathook/bt-test/statuses/{sha}","languages_url":"https://api.github.com/repos/cathook/bt-test/languages","stargazers_url":"https://api.github.com/repos/cathook/bt-test/stargazers","contributors_url":"https://api.github.com/repos/cathook/bt-test/contributors","subscribers_url":"https://api.github.com/repos/cathook/bt-test/subscribers","subscription_url":"https://api.github.com/repos/cathook/bt-test/subscription","commits_url":"https://api.github.com/repos/cathook/bt-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/cathook/bt-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/cathook/bt-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/cathook/bt-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/cathook/bt-test/contents/{+path}","compare_url":"https://api.github.com/repos/cathook/bt-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cathook/bt-test/merges","archive_url":"https://api.github.com/repos/cathook/bt-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cathook/bt-test/downloads","issues_url":"https://api.github.com/repos/cathook/bt-test/issues{/number}","pulls_url":"https://api.github.com/repos/cathook/bt-test/pulls{/number}","milestones_url":"https://api.github.com/repos/cathook/bt-test/milestones{/number}","notifications_url":"https://api.github.com/repos/cathook/bt-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cathook/bt-test/labels{/name}","releases_url":"https://api.github.com/repos/cathook/bt-test/releases{/id}","created_at":"2015-07-15T04:06:18Z","updated_at":"2015-07-16T09:25:08Z","pushed_at":"2015-08-10T09:45:13Z","git_url":"git://github.com/cathook/bt-test.git","ssh_url":"git@github.com:cathook/bt-test.git","clone_url":"https://github.com/cathook/bt-test.git","svn_url":"https://github.com/cathook/bt-test","homepage":null,"size":146,"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":"fxos-bt-squad:master","ref":"master","sha":"2a0f0b2d3879f33d17b11f18a74d30c1c978087d","user":{"login":"fxos-bt-squad","id":13671159,"avatar_url":"https://avatars.githubusercontent.com/u/13671159?v=3","gravatar_id":"","url":"https://api.github.com/users/fxos-bt-squad","html_url":"https://github.com/fxos-bt-squad","followers_url":"https://api.github.com/users/fxos-bt-squad/followers","following_url":"https://api.github.com/users/fxos-bt-squad/following{/other_user}","gists_url":"https://api.github.com/users/fxos-bt-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/fxos-bt-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxos-bt-squad/subscriptions","organizations_url":"https://api.github.com/users/fxos-bt-squad/orgs","repos_url":"https://api.github.com/users/fxos-bt-squad/repos","events_url":"https://api.github.com/users/fxos-bt-squad/events{/privacy}","received_events_url":"https://api.github.com/users/fxos-bt-squad/received_events","type":"Organization","site_admin":false},"repo":{"id":39068102,"name":"bt-test","full_name":"fxos-bt-squad/bt-test","owner":{"login":"fxos-bt-squad","id":13671159,"avatar_url":"https://avatars.githubusercontent.com/u/13671159?v=3","gravatar_id":"","url":"https://api.github.com/users/fxos-bt-squad","html_url":"https://github.com/fxos-bt-squad","followers_url":"https://api.github.com/users/fxos-bt-squad/followers","following_url":"https://api.github.com/users/fxos-bt-squad/following{/other_user}","gists_url":"https://api.github.com/users/fxos-bt-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/fxos-bt-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxos-bt-squad/subscriptions","organizations_url":"https://api.github.com/users/fxos-bt-squad/orgs","repos_url":"https://api.github.com/users/fxos-bt-squad/repos","events_url":"https://api.github.com/users/fxos-bt-squad/events{/privacy}","received_events_url":"https://api.github.com/users/fxos-bt-squad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fxos-bt-squad/bt-test","description":"A test app for WebBluetooth v2 API","fork":false,"url":"https://api.github.com/repos/fxos-bt-squad/bt-test","forks_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/forks","keys_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/teams","hooks_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/hooks","issue_events_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/events{/number}","events_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/events","assignees_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/assignees{/user}","branches_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/branches{/branch}","tags_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/tags","blobs_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/statuses/{sha}","languages_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/languages","stargazers_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/stargazers","contributors_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/contributors","subscribers_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/subscribers","subscription_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/subscription","commits_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/contents/{+path}","compare_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/merges","archive_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/downloads","issues_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues{/number}","pulls_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls{/number}","milestones_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/milestones{/number}","notifications_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/labels{/name}","releases_url":"https://api.github.com/repos/fxos-bt-squad/bt-test/releases{/id}","created_at":"2015-07-14T10:15:20Z","updated_at":"2015-08-06T03:46:22Z","pushed_at":"2015-08-10T09:45:32Z","git_url":"git://github.com/fxos-bt-squad/bt-test.git","ssh_url":"git@github.com:fxos-bt-squad/bt-test.git","clone_url":"https://github.com/fxos-bt-squad/bt-test.git","svn_url":"https://github.com/fxos-bt-squad/bt-test","homepage":null,"size":332,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13"},"html":{"href":"https://github.com/fxos-bt-squad/bt-test/pull/13"},"issue":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/13"},"comments":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/fxos-bt-squad/bt-test/statuses/2e03586d8c5da5b00ce1f9fce3c7e6abd3b12c13"}}}}