Added AMD loading code.

Needed some additional code to use the lib with requirejs.