{"action":"created","comment":{"url":"https://api.github.com/repos/selsamman/amorphic/pulls/comments/185862366","pull_request_review_id":117337966,"id":185862366,"diff_hunk":"@@ -0,0 +1,40 @@\n+const __controllerTemplate = 'Controller';\n+const __appVersion = __ver || 0;\n+\n+var controller = typeof(controller) === 'undefined' ? null : controller;\n+var firstTimeLoad = typeof(firstTimeLoad) === 'undefined';\n+\n+// Establish a new session whether first time or because of expiry / server restart\n+function __bindController (newController, sessionExpiration) {\n+    if (controller && typeof(controller.shutdown) === 'function') {\n+        controller.shutdown();\n+    }\n+    controller = newController;\n+    if (firstTimeLoad) {","path":"clientInit.js","position":13,"original_position":13,"commit_id":"df969b3b4bffdbdc380873678cfef73a8959510c","original_commit_id":"df969b3b4bffdbdc380873678cfef73a8959510c","user":{"login":"lysandros","id":5940668,"avatar_url":"https://avatars1.githubusercontent.com/u/5940668?v=4","gravatar_id":"","url":"https://api.github.com/users/lysandros","html_url":"https://github.com/lysandros","followers_url":"https://api.github.com/users/lysandros/followers","following_url":"https://api.github.com/users/lysandros/following{/other_user}","gists_url":"https://api.github.com/users/lysandros/gists{/gist_id}","starred_url":"https://api.github.com/users/lysandros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lysandros/subscriptions","organizations_url":"https://api.github.com/users/lysandros/orgs","repos_url":"https://api.github.com/users/lysandros/repos","events_url":"https://api.github.com/users/lysandros/events{/privacy}","received_events_url":"https://api.github.com/users/lysandros/received_events","type":"User","site_admin":false},"body":"It made sense sometime ago when controller.refresh() was the else {} part. \r\nWe can remove the variable and the check.","created_at":"2018-05-03T16:31:48Z","updated_at":"2018-05-03T16:31:48Z","html_url":"https://github.com/selsamman/amorphic/pull/55#discussion_r185862366","pull_request_url":"https://api.github.com/repos/selsamman/amorphic/pulls/55","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/comments/185862366"},"html":{"href":"https://github.com/selsamman/amorphic/pull/55#discussion_r185862366"},"pull_request":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/55"}},"in_reply_to_id":185834238},"pull_request":{"url":"https://api.github.com/repos/selsamman/amorphic/pulls/55","id":185475537,"html_url":"https://github.com/selsamman/amorphic/pull/55","diff_url":"https://github.com/selsamman/amorphic/pull/55.diff","patch_url":"https://github.com/selsamman/amorphic/pull/55.patch","issue_url":"https://api.github.com/repos/selsamman/amorphic/issues/55","number":55,"state":"open","locked":false,"title":"Amorphic client bootstrap - update on Lysandros' mr","user":{"login":"sshankar19","id":5633093,"avatar_url":"https://avatars0.githubusercontent.com/u/5633093?v=4","gravatar_id":"","url":"https://api.github.com/users/sshankar19","html_url":"https://github.com/sshankar19","followers_url":"https://api.github.com/users/sshankar19/followers","following_url":"https://api.github.com/users/sshankar19/following{/other_user}","gists_url":"https://api.github.com/users/sshankar19/gists{/gist_id}","starred_url":"https://api.github.com/users/sshankar19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sshankar19/subscriptions","organizations_url":"https://api.github.com/users/sshankar19/orgs","repos_url":"https://api.github.com/users/sshankar19/repos","events_url":"https://api.github.com/users/sshankar19/events{/privacy}","received_events_url":"https://api.github.com/users/sshankar19/received_events","type":"User","site_admin":false},"body":"From lysandros' mr\r\n\r\n> The scope of this PR is to set the groundwork for eliminating the dependency of amorphic to bindster.\r\nIn current applications we may not need to use Bindster anymore.\r\nHowever, the amorphic client was being initialized inside the bindster-amorphic.js which is inside the amorphic-bindster module. Thus, in those apps we're importing this file within index.html and using a hacky script to override the bindster methods:\r\n\r\n> <script> function Bindster() {} Bindster.prototype.start = function () {} Bindster.prototype.setModel = function() {} Bindster.prototype.setController = function() {} </script>\r\n> I created a new file called clientInit.js at the root of the amorphic project.\r\nImporting just this file is enough to initialize the amorphic client (the establishClientSession is invoked at the very end)\r\n> I went through some refactoring of that code as well. All of the bindster related code is removed and another variable is used instead (firstTimeLoad). Used consts were posssible, changed a log entry and pulled all the function arguments outside.\r\n> This change was tested in current applications (their index.html was modified to import the new file and the hacky script was removed).\r\n> ** A future PR could also stop serving bindster through amorphic all together. For this to happen, anything that uses amorphic and relies on that dependency to also use bindster should import bindster 'itself'.\r\n\r\nI've retested the change and also updated the package.json and package-lock.json\r\n\r\nOn top of that these are the new changes you will have to make in your app in order to use this approach.\r\n\r\nWhereas before if you had a non-bindster application using a different UI framework (such as angular) you might have to add these script tags to you index.html\r\n`  <script>\r\n        function Bindster() {}\r\n        Bindster.prototype.start = function () {}\r\n        Bindster.prototype.setModel = function() {}\r\n        Bindster.prototype.setController = function() {}\r\n    </script>`\r\n\r\nand \r\n`<script src=\"/bindster/bindster-amorphic.js\"></script>`\r\n\r\nNow you can delete the both blocks. Instead of the latter block which includes bindster-amorphic, you should replace that with this instead\r\n`<script src=\"/amorphic/clientInit.js\"></script>`\r\n","created_at":"2018-05-02T15:27:41Z","updated_at":"2018-05-03T16:31:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbde145d271ac18772ae76acf4e42b725efee0ce","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/selsamman/amorphic/pulls/55/commits","review_comments_url":"https://api.github.com/repos/selsamman/amorphic/pulls/55/comments","review_comment_url":"https://api.github.com/repos/selsamman/amorphic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/selsamman/amorphic/issues/55/comments","statuses_url":"https://api.github.com/repos/selsamman/amorphic/statuses/df969b3b4bffdbdc380873678cfef73a8959510c","head":{"label":"sshankar19:amorphic-client-bootstrap","ref":"amorphic-client-bootstrap","sha":"df969b3b4bffdbdc380873678cfef73a8959510c","user":{"login":"sshankar19","id":5633093,"avatar_url":"https://avatars0.githubusercontent.com/u/5633093?v=4","gravatar_id":"","url":"https://api.github.com/users/sshankar19","html_url":"https://github.com/sshankar19","followers_url":"https://api.github.com/users/sshankar19/followers","following_url":"https://api.github.com/users/sshankar19/following{/other_user}","gists_url":"https://api.github.com/users/sshankar19/gists{/gist_id}","starred_url":"https://api.github.com/users/sshankar19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sshankar19/subscriptions","organizations_url":"https://api.github.com/users/sshankar19/orgs","repos_url":"https://api.github.com/users/sshankar19/repos","events_url":"https://api.github.com/users/sshankar19/events{/privacy}","received_events_url":"https://api.github.com/users/sshankar19/received_events","type":"User","site_admin":false},"repo":{"id":121668506,"name":"amorphic","full_name":"sshankar19/amorphic","owner":{"login":"sshankar19","id":5633093,"avatar_url":"https://avatars0.githubusercontent.com/u/5633093?v=4","gravatar_id":"","url":"https://api.github.com/users/sshankar19","html_url":"https://github.com/sshankar19","followers_url":"https://api.github.com/users/sshankar19/followers","following_url":"https://api.github.com/users/sshankar19/following{/other_user}","gists_url":"https://api.github.com/users/sshankar19/gists{/gist_id}","starred_url":"https://api.github.com/users/sshankar19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sshankar19/subscriptions","organizations_url":"https://api.github.com/users/sshankar19/orgs","repos_url":"https://api.github.com/users/sshankar19/repos","events_url":"https://api.github.com/users/sshankar19/events{/privacy}","received_events_url":"https://api.github.com/users/sshankar19/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sshankar19/amorphic","description":"A front-to-back isomorphic framework for developing applications with node.js and mongoDB","fork":true,"url":"https://api.github.com/repos/sshankar19/amorphic","forks_url":"https://api.github.com/repos/sshankar19/amorphic/forks","keys_url":"https://api.github.com/repos/sshankar19/amorphic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sshankar19/amorphic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sshankar19/amorphic/teams","hooks_url":"https://api.github.com/repos/sshankar19/amorphic/hooks","issue_events_url":"https://api.github.com/repos/sshankar19/amorphic/issues/events{/number}","events_url":"https://api.github.com/repos/sshankar19/amorphic/events","assignees_url":"https://api.github.com/repos/sshankar19/amorphic/assignees{/user}","branches_url":"https://api.github.com/repos/sshankar19/amorphic/branches{/branch}","tags_url":"https://api.github.com/repos/sshankar19/amorphic/tags","blobs_url":"https://api.github.com/repos/sshankar19/amorphic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sshankar19/amorphic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sshankar19/amorphic/git/refs{/sha}","trees_url":"https://api.github.com/repos/sshankar19/amorphic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sshankar19/amorphic/statuses/{sha}","languages_url":"https://api.github.com/repos/sshankar19/amorphic/languages","stargazers_url":"https://api.github.com/repos/sshankar19/amorphic/stargazers","contributors_url":"https://api.github.com/repos/sshankar19/amorphic/contributors","subscribers_url":"https://api.github.com/repos/sshankar19/amorphic/subscribers","subscription_url":"https://api.github.com/repos/sshankar19/amorphic/subscription","commits_url":"https://api.github.com/repos/sshankar19/amorphic/commits{/sha}","git_commits_url":"https://api.github.com/repos/sshankar19/amorphic/git/commits{/sha}","comments_url":"https://api.github.com/repos/sshankar19/amorphic/comments{/number}","issue_comment_url":"https://api.github.com/repos/sshankar19/amorphic/issues/comments{/number}","contents_url":"https://api.github.com/repos/sshankar19/amorphic/contents/{+path}","compare_url":"https://api.github.com/repos/sshankar19/amorphic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sshankar19/amorphic/merges","archive_url":"https://api.github.com/repos/sshankar19/amorphic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sshankar19/amorphic/downloads","issues_url":"https://api.github.com/repos/sshankar19/amorphic/issues{/number}","pulls_url":"https://api.github.com/repos/sshankar19/amorphic/pulls{/number}","milestones_url":"https://api.github.com/repos/sshankar19/amorphic/milestones{/number}","notifications_url":"https://api.github.com/repos/sshankar19/amorphic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sshankar19/amorphic/labels{/name}","releases_url":"https://api.github.com/repos/sshankar19/amorphic/releases{/id}","deployments_url":"https://api.github.com/repos/sshankar19/amorphic/deployments","created_at":"2018-02-15T18:54:09Z","updated_at":"2018-04-30T15:40:42Z","pushed_at":"2018-05-02T15:30:18Z","git_url":"git://github.com/sshankar19/amorphic.git","ssh_url":"git@github.com:sshankar19/amorphic.git","clone_url":"https://github.com/sshankar19/amorphic.git","svn_url":"https://github.com/sshankar19/amorphic","homepage":null,"size":1165,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"selsamman:master","ref":"master","sha":"25e0b78523a317a8667811d7548c5137fd4f8694","user":{"login":"selsamman","id":1441870,"avatar_url":"https://avatars0.githubusercontent.com/u/1441870?v=4","gravatar_id":"","url":"https://api.github.com/users/selsamman","html_url":"https://github.com/selsamman","followers_url":"https://api.github.com/users/selsamman/followers","following_url":"https://api.github.com/users/selsamman/following{/other_user}","gists_url":"https://api.github.com/users/selsamman/gists{/gist_id}","starred_url":"https://api.github.com/users/selsamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selsamman/subscriptions","organizations_url":"https://api.github.com/users/selsamman/orgs","repos_url":"https://api.github.com/users/selsamman/repos","events_url":"https://api.github.com/users/selsamman/events{/privacy}","received_events_url":"https://api.github.com/users/selsamman/received_events","type":"User","site_admin":false},"repo":{"id":19862604,"name":"amorphic","full_name":"selsamman/amorphic","owner":{"login":"selsamman","id":1441870,"avatar_url":"https://avatars0.githubusercontent.com/u/1441870?v=4","gravatar_id":"","url":"https://api.github.com/users/selsamman","html_url":"https://github.com/selsamman","followers_url":"https://api.github.com/users/selsamman/followers","following_url":"https://api.github.com/users/selsamman/following{/other_user}","gists_url":"https://api.github.com/users/selsamman/gists{/gist_id}","starred_url":"https://api.github.com/users/selsamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selsamman/subscriptions","organizations_url":"https://api.github.com/users/selsamman/orgs","repos_url":"https://api.github.com/users/selsamman/repos","events_url":"https://api.github.com/users/selsamman/events{/privacy}","received_events_url":"https://api.github.com/users/selsamman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/selsamman/amorphic","description":"A front-to-back isomorphic framework for developing applications with node.js and mongoDB","fork":false,"url":"https://api.github.com/repos/selsamman/amorphic","forks_url":"https://api.github.com/repos/selsamman/amorphic/forks","keys_url":"https://api.github.com/repos/selsamman/amorphic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/selsamman/amorphic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/selsamman/amorphic/teams","hooks_url":"https://api.github.com/repos/selsamman/amorphic/hooks","issue_events_url":"https://api.github.com/repos/selsamman/amorphic/issues/events{/number}","events_url":"https://api.github.com/repos/selsamman/amorphic/events","assignees_url":"https://api.github.com/repos/selsamman/amorphic/assignees{/user}","branches_url":"https://api.github.com/repos/selsamman/amorphic/branches{/branch}","tags_url":"https://api.github.com/repos/selsamman/amorphic/tags","blobs_url":"https://api.github.com/repos/selsamman/amorphic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/selsamman/amorphic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/selsamman/amorphic/git/refs{/sha}","trees_url":"https://api.github.com/repos/selsamman/amorphic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/selsamman/amorphic/statuses/{sha}","languages_url":"https://api.github.com/repos/selsamman/amorphic/languages","stargazers_url":"https://api.github.com/repos/selsamman/amorphic/stargazers","contributors_url":"https://api.github.com/repos/selsamman/amorphic/contributors","subscribers_url":"https://api.github.com/repos/selsamman/amorphic/subscribers","subscription_url":"https://api.github.com/repos/selsamman/amorphic/subscription","commits_url":"https://api.github.com/repos/selsamman/amorphic/commits{/sha}","git_commits_url":"https://api.github.com/repos/selsamman/amorphic/git/commits{/sha}","comments_url":"https://api.github.com/repos/selsamman/amorphic/comments{/number}","issue_comment_url":"https://api.github.com/repos/selsamman/amorphic/issues/comments{/number}","contents_url":"https://api.github.com/repos/selsamman/amorphic/contents/{+path}","compare_url":"https://api.github.com/repos/selsamman/amorphic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/selsamman/amorphic/merges","archive_url":"https://api.github.com/repos/selsamman/amorphic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/selsamman/amorphic/downloads","issues_url":"https://api.github.com/repos/selsamman/amorphic/issues{/number}","pulls_url":"https://api.github.com/repos/selsamman/amorphic/pulls{/number}","milestones_url":"https://api.github.com/repos/selsamman/amorphic/milestones{/number}","notifications_url":"https://api.github.com/repos/selsamman/amorphic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/selsamman/amorphic/labels{/name}","releases_url":"https://api.github.com/repos/selsamman/amorphic/releases{/id}","deployments_url":"https://api.github.com/repos/selsamman/amorphic/deployments","created_at":"2014-05-16T16:07:05Z","updated_at":"2018-04-25T19:43:10Z","pushed_at":"2018-05-02T15:30:19Z","git_url":"git://github.com/selsamman/amorphic.git","ssh_url":"git@github.com:selsamman/amorphic.git","clone_url":"https://github.com/selsamman/amorphic.git","svn_url":"https://github.com/selsamman/amorphic","homepage":null,"size":1091,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":13,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/55"},"html":{"href":"https://github.com/selsamman/amorphic/pull/55"},"issue":{"href":"https://api.github.com/repos/selsamman/amorphic/issues/55"},"comments":{"href":"https://api.github.com/repos/selsamman/amorphic/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/selsamman/amorphic/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/selsamman/amorphic/statuses/df969b3b4bffdbdc380873678cfef73a8959510c"}},"author_association":"NONE"}}
{"actor":{"display_login":"lysandros"}}