Added persistent logging methods

This commit is contained in:
Uwe Oestermeier 2019-06-17 17:21:47 +02:00
parent 6ec0e9631a
commit 909ef9d242
2 changed files with 34 additions and 1 deletions

View File

@ -20,4 +20,20 @@ export default class Logging {
console.log(message) console.log(message)
} }
} }
static warn(message) {
if (ipc) {
ipc.send('warn', message)
} else {
console.warn(message)
}
}
static error(message) {
if (ipc) {
ipc.send('error', message)
} else {
console.error(message)
}
}
} }

View File

@ -198,13 +198,30 @@ export default class Tile extends PIXI.Sprite {
return null return null
} }
/**
* Specialized renderWebGL to avoid freezing system
*
* @param {*} renderer
* @memberof Tile
*/
renderWebGL(renderer) {
try {
super.renderWebGL(renderer)
}
catch (e) {
// We want persistent logging here
Logging.error("Error in Tile.renderWebGL: " + e.message)
}
}
/** /**
* Texture received too late. We do not need it. * Texture received too late. We do not need it.
* @param {*} url * @param {*} url
* @param {*} texture * @param {*} texture
*/ */
static lateTexture(url, texture) { static lateTexture(url, texture) {
let destroyBase = !registeredTiles.has(url) let destroyBase = Tile.isObsolete(url)
console.log("Tile.lateTexture", destroyBase)
texture.destroy(destroyBase) texture.destroy(destroyBase)
} }