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

Method initialize

app/views/editor/level/tasks/TasksTabView.js:94–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92 this.level.set('tasks', _.clone(this.defaultTasks))
93 const Task = Backbone.Model.extend({
94 initialize () {
95 // We want to keep track of the revertAttributes easily without digging back into the level every time.
96 // So per TaskModel we check to see if there is a revertAttribute associated with the task's name.
97 // If there is a reversion available, we use it, otherwise (e.g. new tasks without a reversion) we just use the Task's current name/completion status.
98 if (__guard__(__guard__(e != null ? e.level : undefined, x1 => x1._revertAttributes), x => x.tasks) != null) {
99 if (_.find(e.level._revertAttributes.tasks, { name: arguments[0].name })) {
100 return this.set('revert', _.find(e.level._revertAttributes.tasks, { name: arguments[0].name }))
101 } else {
102 return this.set('revert', arguments[0])
103 }
104 } else {
105 return this.set('revert', arguments[0])
106 }
107 }
108 })
109 const TaskList = Backbone.Collection.extend({
110 model: Task

Callers

nothing calls this directly

Calls 2

__guard__Function · 0.70
setMethod · 0.45

Tested by

no test coverage detected