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

Method constructor

app/views/play/modal/PlayItemsModal.js:82–111  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

80 }
81
82 constructor (options) {
83 super(options)
84 this.showVisibleItemImages = _.throttle(_.bind(this.showVisibleItemImages, this), 200)
85 this.items = new Backbone.Collection()
86 this.itemCategoryCollections = {}
87
88 const project = [
89 'name',
90 'components.config',
91 'components.original',
92 'slug',
93 'original',
94 'rasterIcon',
95 'gems',
96 'tier',
97 'description',
98 'i18n',
99 'heroClass',
100 'subscriber'
101 ]
102
103 const itemFetcher = new CocoCollection([], { url: '/db/thang.type?view=items', project, model: ThangType })
104 itemFetcher.skip = 0
105 itemFetcher.fetch({ data: { skip: 0, limit: PAGE_SIZE } })
106 this.listenTo(itemFetcher, 'sync', this.onItemsFetched)
107 this.stopListening(this.supermodel, 'loaded-all')
108 this.supermodel.loadCollection(itemFetcher, 'items')
109 this.idToItem = {}
110 this.trackTimeVisible()
111 }
112
113 onItemsFetched (itemFetcher) {
114 const gemsOwned = me.gems()

Callers

nothing calls this directly

Calls 1

fetchMethod · 0.95

Tested by

no test coverage detected