AMD version

This is a amd version of this plugin, the only problem is the "window" mock for return the global window object in the line 9