I was looking at this code here and encountered a style I don't quite understand. I'm fairly new to Javascript, but this style of declaration strikes me as very different from how it's done in the various tutorials I've read.
Basically what I'd like to know is what is being accomplished by doing it like this?
var Spriter;
(function (Spriter) {
. . .
})(Spriter || (Spriter = {}));
var Spriter;
(function (Spriter) {
. . .
})(Spriter || (Spriter = {}));
.
.
.
Why is function stuck between parenthesis? Whats the (Spriter || (Spriter={})) appended to the (function(Spriter){ } doing? And why is 'var Spriter;' written multiple times? I would think multiple 'var Spriter' would be redundant.
As far as WHAT this is for, it allows you to use animations created in Spriter (an animator suite notable for using bones in 2d animation), in Phaser (a game engine).