liquid-tank
Advanced tools
Comparing version 0.0.10 to 0.0.11
(function() { | ||
function LiquidTank(element, options) { | ||
this._destroyed = false; | ||
this.element = | ||
@@ -35,15 +36,3 @@ typeof element === "string" ? document.querySelector(element) : element; | ||
LiquidTank.prototype.clear = function() { | ||
this.canvas | ||
.getContext("2d") | ||
.clearRect(0, 0, this.canvas.width, this.canvas.height); | ||
this.element.removeChild(this.canvas); | ||
if (window.hasOwnProperty("ResizeObserver")) { | ||
if (this._resizeObserver) { | ||
this._resizeObserver.unobserve(this.element); | ||
this._resizeObserver.disconnect(); | ||
this._resizeObserver; | ||
} | ||
} else { | ||
window.removeEventListener("resize", this.onResize); | ||
} | ||
this.destroy(); | ||
}; | ||
@@ -59,2 +48,22 @@ | ||
LiquidTank.prototype.destroy = function() { | ||
if (!this._destroyed) { | ||
this._destroyed = true; | ||
this.canvas | ||
.getContext("2d") | ||
.clearRect(0, 0, this.canvas.width, this.canvas.height); | ||
if (window.hasOwnProperty("ResizeObserver")) { | ||
if (this._resizeObserver) { | ||
this._resizeObserver.unobserve(this.element); | ||
this._resizeObserver.disconnect(); | ||
this._resizeObserver = null; | ||
} | ||
} else { | ||
window.removeEventListener("resize", this.onResize); | ||
} | ||
this.element.removeChild(this.canvas); | ||
this.canvas = null; | ||
} | ||
}; | ||
LiquidTank.prototype.render = function() { | ||
@@ -61,0 +70,0 @@ this.canvas.height = _getActualHeight(this.element); |
{ | ||
"name": "liquid-tank", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "liquid-tank.js", |
16890
347