Uncaught TypeError: Cannot read property ‘setDefaults’ of undefined