Fix AMD support and better AMD detection.

require.js was giving me `undefined` as toast wasn't being properly defined.