GitHub PullRequestReviewCommentEvent at 2014-04-14 08:57:01
Repository: fxa-content-server
Actor: shane-tomlinson
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/11575511","id":11575511,"diff_hunk":"@@ -34,83 +34,12 @@ require.config({\n });\n \n require([\n-  'backbone',\n-  'router',\n-  'lib/constants',\n-  'lib/translator',\n-  'lib/session',\n-  'lib/url',\n-  'lib/channels/web',\n-  'lib/channels/fx-desktop'\n+  './lib/start-app'\n ],\n-function (\n-  Backbone,\n-  Router,\n-  Constants,\n-  Translator,\n-  Session,\n-  Url,\n-  WebChannel,\n-  FxDesktopChannel\n-) {\n-  function getChannel() {\n-    var context = Url.searchParam('context');\n-    var channel;\n-\n-    if (context === Constants.FX_DESKTOP_CONTEXT) {\n-      // Firefox for desktop native=>FxA glue code.\n-      channel = new FxDesktopChannel();\n-    } else {\n-      // default to the web channel that doesn't do anything yet.\n-      channel = new WebChannel();\n-    }\n-\n-    channel.init();\n-    return channel;\n-  }\n-\n-  function setSessionValueFromUrl(name) {\n-    var value = Url.searchParam(name);\n-    if (value) {\n-      Session.set(name, value);\n-    } else {\n-      Session.clear(name);\n-    }\n-  }\n-\n-  function initSessionFromUrl() {\n-    setSessionValueFromUrl('service');\n-    setSessionValueFromUrl('redirectTo');\n-    setSessionValueFromUrl('context');\n-  }\n-\n-  window.router = new Router();\n-\n-  initSessionFromUrl();\n-\n-  // Don't start backbone until we have our config and translations\n-  $.getJSON('/config', function (config) {\n-\n-    Session.set('config', config);\n-\n-    // IE uses navigator.browserLanguage, all others user navigator.language.\n-    var language = window.navigator.browserLanguage || window.navigator.language || 'en-US';\n-\n-    window.translator = new Translator(language,\n-                                       config.i18n.supportedLanguages,\n-                                       config.i18n.defaultLang);\n-\n-    Session.set('language', window.translator.language);\n-\n-    translator.fetch(function () {\n-      // Get the party started\n-      Backbone.history.start({ pushState: true });\n-\n-      // The channel must be initialized after Backbone.history so that the\n-      // Backbone does not override the page the channel sets.\n-      Session.set('channel', getChannel());\n-    });\n-  });\n+function (StartApp) {\n+  var startApp = new StartApp();\n+  startApp.initialize();\n+  startApp.start();","path":"app/scripts/main.js","position":85,"original_position":85,"commit_id":"90f71e7d6faf42554f745c0607df4206a9e27553","original_commit_id":"90f71e7d6faf42554f745c0607df4206a9e27553","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?","gravatar_id":"b7581393f6d1960ea7721789cbbe5c36","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":"This is for testing. We want to be able to initialize the app with mocks then start the app.  I could move initialization into the constructor, and then rename `start` to `startApp()`. This would make the intention clearer, esp with the module being renamed to `AppStart`.","created_at":"2014-04-14T08:57:01Z","updated_at":"2014-04-14T08:57:01Z","html_url":"https://github.com/mozilla/fxa-content-server/pull/884#discussion_r11575511","pull_request_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/884","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/11575511"},"html":{"href":"https://github.com/mozilla/fxa-content-server/pull/884#discussion_r11575511"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/884"}}}}