mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-24 23:05:22 +02:00
Fix all res/ files with ESLint rules with 0 errors.
This commit is contained in:
@@ -9,7 +9,7 @@ function FastImageRender(canvasElement, options) {
|
||||
this.timeoutId = null
|
||||
|
||||
if (that.options.raf) {
|
||||
that.animLoop = function () {
|
||||
that.animLoop = function() {
|
||||
that.raf = window.requireAnimationFrame(that.animLoop)
|
||||
|
||||
// separate render from drawing
|
||||
@@ -19,19 +19,19 @@ function FastImageRender(canvasElement, options) {
|
||||
|
||||
// Loader
|
||||
this.loader = new Image()
|
||||
this.loader.onload = function () {
|
||||
this.loader.onload = function() {
|
||||
if (that.options.timeout) {
|
||||
clearTimeout(that.timeoutId)
|
||||
}
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(this)
|
||||
}
|
||||
}
|
||||
this.loader.onerror = function () {
|
||||
this.loader.onerror = function() {
|
||||
if (that.options.timeout) {
|
||||
clearTimeout(that.timeoutId)
|
||||
}
|
||||
if (typeof(that.onError) === 'function') {
|
||||
if (typeof (that.onError) === 'function') {
|
||||
that.onError(this)
|
||||
}
|
||||
}
|
||||
@@ -47,19 +47,19 @@ function FastImageRender(canvasElement, options) {
|
||||
|
||||
}
|
||||
|
||||
FastImageRender.prototype.destroy = function () {
|
||||
FastImageRender.prototype.destroy = function() {
|
||||
|
||||
window.cancelAnimationFrame(this.raf)
|
||||
|
||||
// delete onLoad & onError
|
||||
}
|
||||
|
||||
FastImageRender.prototype.load = function (url, type) {
|
||||
FastImageRender.prototype.load = function(url, type) {
|
||||
var that = this
|
||||
|
||||
if (that.options.timeout) {
|
||||
that.timeoutId = setTimeout(function () {
|
||||
if (typeof(that.onError) === 'function') {
|
||||
that.timeoutId = setTimeout(function() {
|
||||
if (typeof (that.onError) === 'function') {
|
||||
that.onError('timeout')
|
||||
}
|
||||
}, that.options.timeout)
|
||||
@@ -72,14 +72,14 @@ FastImageRender.prototype.load = function (url, type) {
|
||||
var texture = null
|
||||
if (type) {
|
||||
texture = this.render.ctx.createTexture()
|
||||
this.textureLoader.loadEx(url, texture, true, function () {
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
this.textureLoader.loadEx(url, texture, true, function() {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(texture)
|
||||
}
|
||||
}, type)
|
||||
} else {
|
||||
this.textureLoader.load(url, function (texture) {
|
||||
if (typeof(that.onLoad) === 'function') {
|
||||
this.textureLoader.load(url, function(texture) {
|
||||
if (typeof (that.onLoad) === 'function') {
|
||||
that.onLoad(texture)
|
||||
}
|
||||
})
|
||||
@@ -91,19 +91,19 @@ FastImageRender.prototype.load = function (url, type) {
|
||||
}
|
||||
}
|
||||
|
||||
FastImageRender.prototype.draw = function (image) {
|
||||
FastImageRender.prototype.draw = function(image) {
|
||||
this.render.draw(image)
|
||||
}
|
||||
|
||||
FastImageRender.prototype.clear = function () {
|
||||
FastImageRender.prototype.clear = function() {
|
||||
this.render.clear()
|
||||
}
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.width
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width
|
||||
@@ -113,10 +113,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasWidth', {
|
||||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.height
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height
|
||||
@@ -126,10 +126,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasHeight', {
|
||||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.width
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
if (width !== this.canvasElement.width) {
|
||||
this.canvasElement.width = width
|
||||
@@ -139,10 +139,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayWidth', {
|
||||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return this.canvasElement.height
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
if (height !== this.canvasElement.height) {
|
||||
this.canvasElement.height = height
|
||||
@@ -152,10 +152,10 @@ Object.defineProperty(FastImageRender.prototype, 'displayHeight', {
|
||||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return parseInt(this.canvasElement.style.width, 10)
|
||||
},
|
||||
set: function (width) {
|
||||
set: function(width) {
|
||||
if (width) {
|
||||
var styleWidth = width + 'px'
|
||||
if (styleWidth !== this.canvasElement.style.width) {
|
||||
@@ -166,10 +166,10 @@ Object.defineProperty(FastImageRender.prototype, 'canvasStyleWidth', {
|
||||
})
|
||||
|
||||
Object.defineProperty(FastImageRender.prototype, 'canvasStyleHeight', {
|
||||
get: function () {
|
||||
get: function() {
|
||||
return parseInt(this.canvasElement.style.height, 10)
|
||||
},
|
||||
set: function (height) {
|
||||
set: function(height) {
|
||||
if (height) {
|
||||
var styleHeight = height + 'px'
|
||||
if (styleHeight !== this.canvasElement.style.height) {
|
||||
|
||||
Reference in New Issue
Block a user