MCPcopy Create free account
hub / github.com/codecombat/codecombat / constructor

Method constructor

app/views/play/SpectateView.js:71–99  ·  view source on GitHub ↗
(options, levelID)

Source from the content-addressed store, hash-verified

69 }
70
71 constructor (options, levelID) {
72 super(options)
73 this.onSupermodelLoadedOne = this.onSupermodelLoadedOne.bind(this)
74 this.saveScreenshot = this.saveScreenshot.bind(this)
75 this.levelID = levelID
76 if (PROFILE_ME) {
77 if (typeof console.profile === 'function') {
78 console.profile()
79 }
80 }
81
82 this.isEditorPreview = utils.getQueryVariable('dev')
83 this.sessionOne = utils.getQueryVariable('session-one')
84 this.sessionTwo = utils.getQueryVariable('session-two')
85 this.tournament = utils.getQueryVariable('tournament')
86 if (options.spectateSessions) {
87 this.sessionOne = options.spectateSessions.sessionOne
88 this.sessionTwo = options.spectateSessions.sessionTwo
89 }
90
91 if (this.isEditorPreview) {
92 this.supermodel.shouldSaveBackups = model => // Make sure to load possibly changed things from localStorage.
93 ['Level', 'LevelComponent', 'LevelSystem', 'ThangType'].includes(model.constructor.className)
94 const f = () => { if (!this.levelLoader) { return (typeof this.loadRandomSessions === 'function' ? this.loadRandomSessions() : undefined) } } // Wait to see if it's just given to us through setLevel.
95 setTimeout(f, 100)
96 } else {
97 this.loadRandomSessions()
98 }
99 }
100
101 loadRandomSessions () {
102 if (!this.sessionOne || !this.sessionTwo) {

Callers

nothing calls this directly

Calls 1

loadRandomSessionsMethod · 0.95

Tested by

no test coverage detected