{"action":"created","comment":{"url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/comments/33918962","id":33918962,"diff_hunk":"@@ -445,13 +520,31 @@\n     requireKey.registerTouch = function (name, data, cb) {\n         AT._log('info', 'registerTouch()');\n \n-        var dataPrep = AT._prepareData(data);\n+        // Let's work out what's what\n+        if (Object.prototype.toString.call(name) === '[object Object]') {\n+            cb = data;\n+            data = name;\n+            name = null;\n+        }\n+\n+        if (typeof name === 'function') {\n+            cb = name;\n+            name = null;\n+            data = null;\n+        }\n+\n+        if (typeof data === 'function') {","path":"src/sdk.js","position":186,"original_position":186,"commit_id":"e5291cc622769dfd4ead68ff59b802d40a6157c0","original_commit_id":"e5291cc622769dfd4ead68ff59b802d40a6157c0","user":{"login":"jabclab","id":225286,"avatar_url":"https://avatars.githubusercontent.com/u/225286?v=3","gravatar_id":"","url":"https://api.github.com/users/jabclab","html_url":"https://github.com/jabclab","followers_url":"https://api.github.com/users/jabclab/followers","following_url":"https://api.github.com/users/jabclab/following{/other_user}","gists_url":"https://api.github.com/users/jabclab/gists{/gist_id}","starred_url":"https://api.github.com/users/jabclab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jabclab/subscriptions","organizations_url":"https://api.github.com/users/jabclab/orgs","repos_url":"https://api.github.com/users/jabclab/repos","events_url":"https://api.github.com/users/jabclab/events{/privacy}","received_events_url":"https://api.github.com/users/jabclab/received_events","type":"User","site_admin":false},"body":"What about `name` in this scenario? Are we going to do with if it's of the wrong type (e.g. `Array`) the method will just fall over?","created_at":"2015-07-06T09:41:43Z","updated_at":"2015-07-06T09:41:43Z","html_url":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55#discussion_r33918962","pull_request_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/comments/33918962"},"html":{"href":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55#discussion_r33918962"},"pull_request":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55","id":37912650,"html_url":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55","diff_url":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55.diff","patch_url":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55.patch","issue_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/55","number":55,"state":"open","locked":false,"title":"Share token storage","user":{"login":"nbrl","id":7620088,"avatar_url":"https://avatars.githubusercontent.com/u/7620088?v=3","gravatar_id":"","url":"https://api.github.com/users/nbrl","html_url":"https://github.com/nbrl","followers_url":"https://api.github.com/users/nbrl/followers","following_url":"https://api.github.com/users/nbrl/following{/other_user}","gists_url":"https://api.github.com/users/nbrl/gists{/gist_id}","starred_url":"https://api.github.com/users/nbrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbrl/subscriptions","organizations_url":"https://api.github.com/users/nbrl/orgs","repos_url":"https://api.github.com/users/nbrl/repos","events_url":"https://api.github.com/users/nbrl/events{/privacy}","received_events_url":"https://api.github.com/users/nbrl/received_events","type":"User","site_admin":false},"body":"On `createToken` we now store the array of token data `[ { token: ...} ... ]` in session storage in addition to `AT.shareTokens`. This allows the possible scenario of:\r\n\r\n* navigate to page A and create a token\r\n* navigate to page B (*e.g.* logged in) and we want update that token without referring to it. Not a behaviour we should keep, but useful for now. This should be addresses by `updateAllTokens` when it is written.\r\n\r\n`createToken`, `updateToken`, `consumeToken` and `registerTouch` will now fallback to using `window.advocate_things_data` if `data` is `undefined`.\r\n\r\nOn a side note, fixes #29.\r\nNow fixes #58.","created_at":"2015-06-17T15:20:23Z","updated_at":"2015-07-06T09:41:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"506027167368589ef57537933e8e99b645deb1a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55/commits","review_comments_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55/comments","review_comment_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/55/comments","statuses_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/statuses/e5291cc622769dfd4ead68ff59b802d40a6157c0","head":{"label":"nbrl:share-token-storage","ref":"share-token-storage","sha":"e5291cc622769dfd4ead68ff59b802d40a6157c0","user":{"login":"nbrl","id":7620088,"avatar_url":"https://avatars.githubusercontent.com/u/7620088?v=3","gravatar_id":"","url":"https://api.github.com/users/nbrl","html_url":"https://github.com/nbrl","followers_url":"https://api.github.com/users/nbrl/followers","following_url":"https://api.github.com/users/nbrl/following{/other_user}","gists_url":"https://api.github.com/users/nbrl/gists{/gist_id}","starred_url":"https://api.github.com/users/nbrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbrl/subscriptions","organizations_url":"https://api.github.com/users/nbrl/orgs","repos_url":"https://api.github.com/users/nbrl/repos","events_url":"https://api.github.com/users/nbrl/events{/privacy}","received_events_url":"https://api.github.com/users/nbrl/received_events","type":"User","site_admin":false},"repo":{"id":32318178,"name":"advocate-things-js-sdk","full_name":"nbrl/advocate-things-js-sdk","owner":{"login":"nbrl","id":7620088,"avatar_url":"https://avatars.githubusercontent.com/u/7620088?v=3","gravatar_id":"","url":"https://api.github.com/users/nbrl","html_url":"https://github.com/nbrl","followers_url":"https://api.github.com/users/nbrl/followers","following_url":"https://api.github.com/users/nbrl/following{/other_user}","gists_url":"https://api.github.com/users/nbrl/gists{/gist_id}","starred_url":"https://api.github.com/users/nbrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbrl/subscriptions","organizations_url":"https://api.github.com/users/nbrl/orgs","repos_url":"https://api.github.com/users/nbrl/repos","events_url":"https://api.github.com/users/nbrl/events{/privacy}","received_events_url":"https://api.github.com/users/nbrl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nbrl/advocate-things-js-sdk","description":" Advocate Things SDK for JavaScript ","fork":true,"url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk","forks_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/forks","keys_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/teams","hooks_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/events","assignees_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/tags","blobs_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/languages","stargazers_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/subscription","commits_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/merges","archive_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/downloads","issues_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/nbrl/advocate-things-js-sdk/releases{/id}","created_at":"2015-03-16T10:42:13Z","updated_at":"2015-04-30T14:57:04Z","pushed_at":"2015-07-06T09:30:47Z","git_url":"git://github.com/nbrl/advocate-things-js-sdk.git","ssh_url":"git@github.com:nbrl/advocate-things-js-sdk.git","clone_url":"https://github.com/nbrl/advocate-things-js-sdk.git","svn_url":"https://github.com/nbrl/advocate-things-js-sdk","homepage":"","size":678,"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":"digitalanimal:master","ref":"master","sha":"3b1a4452ab6433db08e262ba256cd065621dceeb","user":{"login":"digitalanimal","id":2040430,"avatar_url":"https://avatars.githubusercontent.com/u/2040430?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalanimal","html_url":"https://github.com/digitalanimal","followers_url":"https://api.github.com/users/digitalanimal/followers","following_url":"https://api.github.com/users/digitalanimal/following{/other_user}","gists_url":"https://api.github.com/users/digitalanimal/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalanimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalanimal/subscriptions","organizations_url":"https://api.github.com/users/digitalanimal/orgs","repos_url":"https://api.github.com/users/digitalanimal/repos","events_url":"https://api.github.com/users/digitalanimal/events{/privacy}","received_events_url":"https://api.github.com/users/digitalanimal/received_events","type":"Organization","site_admin":false},"repo":{"id":32318170,"name":"advocate-things-js-sdk","full_name":"digitalanimal/advocate-things-js-sdk","owner":{"login":"digitalanimal","id":2040430,"avatar_url":"https://avatars.githubusercontent.com/u/2040430?v=3","gravatar_id":"","url":"https://api.github.com/users/digitalanimal","html_url":"https://github.com/digitalanimal","followers_url":"https://api.github.com/users/digitalanimal/followers","following_url":"https://api.github.com/users/digitalanimal/following{/other_user}","gists_url":"https://api.github.com/users/digitalanimal/gists{/gist_id}","starred_url":"https://api.github.com/users/digitalanimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digitalanimal/subscriptions","organizations_url":"https://api.github.com/users/digitalanimal/orgs","repos_url":"https://api.github.com/users/digitalanimal/repos","events_url":"https://api.github.com/users/digitalanimal/events{/privacy}","received_events_url":"https://api.github.com/users/digitalanimal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digitalanimal/advocate-things-js-sdk","description":"Advocate Things SDK for JavaScript","fork":false,"url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk","forks_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/forks","keys_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/teams","hooks_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/events","assignees_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/tags","blobs_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/languages","stargazers_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/subscription","commits_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/merges","archive_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/downloads","issues_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/releases{/id}","created_at":"2015-03-16T10:41:51Z","updated_at":"2015-06-17T14:33:16Z","pushed_at":"2015-07-06T09:30:47Z","git_url":"git://github.com/digitalanimal/advocate-things-js-sdk.git","ssh_url":"git@github.com:digitalanimal/advocate-things-js-sdk.git","clone_url":"https://github.com/digitalanimal/advocate-things-js-sdk.git","svn_url":"https://github.com/digitalanimal/advocate-things-js-sdk","homepage":"","size":641,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":16,"forks":2,"open_issues":16,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55"},"html":{"href":"https://github.com/digitalanimal/advocate-things-js-sdk/pull/55"},"issue":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/55"},"comments":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/digitalanimal/advocate-things-js-sdk/statuses/e5291cc622769dfd4ead68ff59b802d40a6157c0"}}}}