Expose as AMD module if AMD-loader is present

This is the same approach used by jQuery to make this usable in 
AMD-loaders like requirejs.