placing the constructors outside of the IIFE was something i saw done several times within some of Kadokawa's additional plugins and so i adapted it to my personal plugins because i did not see anything wrong with it; it is just a preference.
Yeah, they do it for no reason too. That's not a good argument for why you should do it.
Here's how I see it. It's like you got a buddy with a beautiful workshop that he has divided up where one side is for working with wood and the other is for working metal. He's over on the metal side slapping dead tree carcasses together and he keeps having to cross the room to get his tools. So you say, partner, why not move the work closer to the tools? He's says, that's just my preference. Nothing wrong with it, mind. "Just because" isn't a good argument for working that way and at most it just confuses people from the outside looking in (me).
So I'm saying the implementation code for the constructor has no reason to be inside the IIFE for the same reason the tree carcass should be butchered on the side of the shop with the needed tools.
i include access to private variables because i never know which project i may end up using this plugin for and where i might want to reference it from a separate plugin; as a general rule for myself, i include functions for providing access to those variables for this reason. as far as the underscore naming convention goes, that is another one of those things i see used often to help private instance variables stand out; just another practice that i adopted.
Your practice is to never use the methods in the prototype methods and always use them for outside code. It's just that it doesn't make any sense because JavaScript can have "private instance variables." Why make pretend "private instance variables" and not the real kind?
those suggestions are very generic in my opinion, and to ensure maximum compatibility i try not to give my aliases a name that has a moderate chance of being duplicated by another plugin that aliases the same function.
The alias names are local to the IIFE. They can't conflict with the names other plugins use. The code is protecting something for no reason which is confusing.
i had to search online through mozilla's official JavaScript reference to find the method for generating a random number, and so i copied and pasted the practical example from there; i did not feel the need to shorthand it.
I find myself going to Mozilla's web docs time and time again for that exact piece of code! That's not what I'm talking about though.
var min = Math.ceil(0);
So this says declare a variable named min then assign to min the return value of a method that rounds 0 up. What do you get when you round 0 up? It's 0. So simply write:
var min = 0;
Similarly:
var max = Math.floor(100);
Says declare a variable named max and then assign to max the return value of a method that rounds 100 down. What do you get when rounding 100 down? 100. So this should simply be:
var max = 100;
Finally:
var max = Math.floor(data.length);
The length property will be a whole number. When rounding a whole number you get the exact same number back. If we had a length of 0 then rounding it down will return 0 and if we had 300 then rounded down it would be 300. Simply write:
var max = data.length;
The code is shortened by removing the needless rounding.