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

Function initialize

app/core/application.js:50–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48
49const Application = {
50 initialize () {
51 let i18nextInstance
52 const { me } = require('core/auth')
53 const i18next = require('i18next')
54 const jqueryI18next = require('jquery-i18next')
55 const CocoModel = require('models/CocoModel')
56 const FacebookHandler = require('core/social-handlers/FacebookHandler')
57 const GPlusHandler = require('core/social-handlers/GPlusHandler')
58 const SchoologyHandler = require('core/social-handlers/SchoologyHandler')
59 const ClassLinkHandler = require('core/social-handlers/ClassLinkHandler')
60 const locale = require('locale/locale')
61 const Tracker = require('core/Tracker2').default
62 const api = require('core/api')
63 const utils = require('core/utils')
64 const userUtils = require('../lib/user-utils')
65 const wsBus = require('lib/wsBus')
66
67 const Router = require('core/Router')
68 Vue.config.devtools = !this.isProduction()
69 Vue.config.ignoredElements = ['stream'] // Used for Cloudflare Cutscene Player and would throw Vue warnings
70
71 // propagate changes from global 'me' User to 'me' vuex module
72 const store = require('core/store')
73
74 if (utils.useWebsocket) {
75 // eslint-disable-next-line no-new
76 this.wsBus = new wsBus()
77 }
78 me.on('change', () => store.commit('me/updateUser', me.changedAttributes()))
79 store.commit('me/updateUser', me.attributes)
80 store.commit('updateFeatures', features)
81 if (utils.isOzaria) {
82 store.dispatch('layoutChrome/syncSoundToAudioSystem')
83 }
84
85 this.store = store
86 this.api = api
87
88 this.isIPadApp = ((typeof webkit !== 'undefined' && webkit !== null ? webkit.messageHandlers : undefined) != null) && ((navigator.userAgent != null ? navigator.userAgent.indexOf('CodeCombat-iPad') : undefined) !== -1)
89 if (this.isIPadApp) { $('body').addClass('ipad') }
90 if ($.browser.msie && (parseInt($.browser.version) === 10)) {
91 $('html').addClass('ie10')
92 }
93
94 this.tracker = new Tracker(store)
95 window.tracker = this.tracker
96 locale.load(me.get('preferredLanguage', true))
97 .then(() => this.tracker.initialize())
98 .catch(e => console.error('Tracker initialization failed', e))
99
100 if (me.useSocialSignOn()) {
101 this.facebookHandler = new FacebookHandler()
102 this.gplusHandler = new GPlusHandler()
103 this.schoologyHandler = new SchoologyHandler()
104 this.classlinkHandler = new ClassLinkHandler()
105 }
106 // @githubHandler = new GitHubHandler(@) # Currently unused
107 $(document).bind('keydown', preventBackspace)

Callers

nothing calls this directly

Calls 9

onIdleChangedFunction · 0.85
useSocialSignOnMethod · 0.80
pollAchievementsMethod · 0.80
loadMethod · 0.45
getMethod · 0.45
initializeMethod · 0.45
errorMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected