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

Method initialize

app/models/CocoModel.js:44–60  ·  view source on GitHub ↗
(attributes, options)

Source from the content-addressed store, hash-verified

42 }
43
44 initialize (attributes, options) {
45 super.initialize(...arguments)
46 if (options == null) { options = {} }
47 this.setProjection(options.project)
48 if (!this.constructor.className) {
49 console.error(`${this} needs a className set.`)
50 }
51 this.on('sync', this.onLoaded, this)
52 this.on('error', this.onError, this)
53 this.on('add', this.onLoaded, this)
54 this.saveBackup = _.debounce(this.saveBackup, 500)
55 this.usesVersions = (__guard__(__guard__(this.schema(), x1 => x1.properties), x => x.version) != null)
56 if (globalVar.application != null ? globalVar.application.testing : undefined) {
57 this.fakeRequests = []
58 return this.on('request', function () { return this.fakeRequests.push(jasmine.Ajax.requests.mostRecent()) })
59 }
60 }
61
62 created () { return new Date(parseInt(this.id.substring(0, 8), 16) * 1000) }
63

Callers

nothing calls this directly

Calls 4

setProjectionMethod · 0.95
schemaMethod · 0.95
__guard__Function · 0.70
errorMethod · 0.45

Tested by

no test coverage detected