MCPcopy Index your code
hub / github.com/codecombat/codecombat / init

Function init

app/core/initialize.js:109–147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109var init = function () {
110 if (app) { return }
111 if (!(window.userObject != null ? window.userObject._id : undefined)) {
112 const options = { cache: false }
113 options.data = _.pick(utils.getQueryVariables(), 'preferredLanguage')
114 $.ajax('/auth/whoami', options).then(function (res) {
115 window.userObject = res
116 return init()
117 })
118 return
119 }
120
121 marked.setOptions({ gfm: true, sanitize: true, smartLists: true, breaks: false })
122 app = require('core/application')
123 setupConsoleLogging()
124 watchForErrors()
125 setUpIOSLogging()
126 const path = document.location.pathname
127 app.testing = _.string.startsWith(path, '/test')
128 app.demoing = _.string.startsWith(path, '/demo')
129 setUpBackboneMediator(app)
130 app.initialize()
131 if (!app.isProduction()) { loadOfflineFonts() }
132 if (utils.isCodeCombat) {
133 // We always want to load this font.
134 $('head').prepend('<link rel="stylesheet" type="text/css" href="/fonts/vt323.css">')
135 }
136 Backbone.history.start({ pushState: true })
137 handleNormalUrls()
138 setUpMoment() // Set up i18n for moment
139 setUpTv4()
140 installVueI18n()
141 if (utils.isOzaria) {
142 checkAndLogBrowserCrash()
143 checkAndRegisterHocModalInterval()
144 }
145 if (me.isAdmin() || !app.isProduction() || (typeof serverSession !== 'undefined' && serverSession !== null ? serverSession.amActually : undefined) || (typeof serverSession !== 'undefined' && serverSession !== null ? serverSession.switchingUserActualId : undefined)) { window.globalVar = globalVar }
146 if (self !== parent) { return parent.globalVar = globalVar }
147}
148
149module.exports.init = init
150

Callers 1

initialize.jsFile · 0.70

Calls 12

setupConsoleLoggingFunction · 0.85
watchForErrorsFunction · 0.85
setUpIOSLoggingFunction · 0.85
setUpBackboneMediatorFunction · 0.85
loadOfflineFontsFunction · 0.85
handleNormalUrlsFunction · 0.85
setUpMomentFunction · 0.85
setUpTv4Function · 0.85
checkAndLogBrowserCrashFunction · 0.85
isAdminMethod · 0.80
initializeMethod · 0.45

Tested by

no test coverage detected