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

Method loadImage

app/models/ThangType.js:915–933  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

913 }
914
915 loadImage () {
916 const imageURL = this.get('image')
917 if (this.loadingImage) { return true }
918 if (this.loadedImage) { return false }
919 if (!imageURL) { return false }
920 this.image = $(`<img crossOrigin='Anonymous', src='/file/${imageURL}' />`)
921 this.loadingImage = true
922 this.image.one('load', () => {
923 this.loadingImage = false
924 this.loadedImage = true
925 this.buildSpriteSheet()
926 return this.trigger('image-loaded', this)
927 })
928 this.image.one('error', () => {
929 this.loadingImage = false
930 return this.trigger('image-load-error', this)
931 })
932 return true
933 }
934
935 buildSpriteSheet () {
936 this.spriteSheet = new createjs.SpriteSheet({

Callers

nothing calls this directly

Calls 2

buildSpriteSheetMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected