What does it mean when a function called Glitcher
is declared inside of an IIFE whose return value is assigned to the variable Glitcher
, i.e. the same name? I don’t know how I should understand this.
var Glitcher = (function() {
function Glitcher(options) {
this.canvas = document.createElement('canvas');
this.context = this.canvas.getContext('2d');
this.origCanvas = document.createElement('canvas');
this.origContext = this.origCanvas.getContext('2d');
this.options = options;
}
Glitcher.prototype.glitch = function(url, callback) {
var _this = this;
this.loadImage(url, function(img) {
_this.renderImage(img);
_this.process();
callback();
});
};
// deleted some code.....
return Glitcher;
})();