gabrieldoty / simplify-scorm

Scorm 1.2 Javascript API
MIT License
230 stars 77 forks source link

Add IIFE to remove functions from the global environment #5

Closed xob closed 6 years ago

xob commented 6 years ago

While developing a Scorm 2004 v4 version of simplify-scorm (I will create a PR for that when I am done), I ran into problems because some of my function names were the same as the 1.2 version, and both APIs ended up using the same function.

To avoid the problem, I simply added an IIFE to the file, scoping everything and removing it from the global environment. API is still exposed because it is set on window.

I strongly suggest ignoring whitespace changes when viewing this PR. To do this, add ?w=1 to the URL to see the diff with whitespace ignored.