Last active
December 23, 2015 19:59
-
-
Save brianmriley/6686219 to your computer and use it in GitHub Desktop.
WebStorm will not hit break points inside of an IIFE with parameters. The following example shows an example that won't work followed by an example that will work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////// | |
// NOTE: This specific use case had leverages AngularJS and RequireJS so it's | |
// possible these had something to do with it as well, but it seems that there's | |
// an issue with breakpoints and V8: | |
// | |
// * http://mariuszprzydatek.com/2013/07/21/angularjs-karma-and-debugging-unit-tests-in-webstorm-or-intellij-idea/ | |
// * http://www.andrejkoelewijn.com/blog/2013/05/07/debugging-with-webstorm-and-karma/ | |
// * http://tommytcchan.com/blog/2013/03/18/example-how-to-set-up-debugging-with-karma-formerly-testacular-and-webstorm/ | |
//////////////////////////////////////////////////////////////////////////////// | |
//////////////////////////////////////////////////////////////////////////////// | |
// FAIL | |
// Note the use of the params `define` & `angular` | |
/////////////////////////////////////////////////////////////////////////////// | |
// breakpoint not hit if put inside login(). breakpoint ends up being hit on last line of IIFE wrapper | |
(function(define, angular) | |
{ | |
"use strict"; | |
var dependencies = [ | |
]; | |
/** | |
* Register the LoginController class with RequireJS. | |
*/ | |
define( dependencies, function() | |
{ | |
var | |
LoginController = function($scope) | |
{ | |
var | |
login = function() | |
{ | |
console.log("login"); | |
}; | |
}; | |
return [ "$scope", LoginController ]; | |
}); | |
}(define, angular)); | |
//////////////////////////////////////////////////////////////////////////////// | |
// SUCCESS | |
// Note the removal of the params `define` & `angular` | |
/////////////////////////////////////////////////////////////////////////////// | |
// breakpoint not hit if put inside login(). breakpoint ends up being hit on last line of IIFE wrapper | |
(function() | |
{ | |
"use strict"; | |
var dependencies = [ | |
]; | |
/** | |
* Register the LoginController class with RequireJS. | |
*/ | |
define( dependencies, function() | |
{ | |
var | |
LoginController = function($scope) | |
{ | |
var | |
login = function() | |
{ | |
console.log("login"); | |
}; | |
}; | |
return [ "$scope", LoginController ]; | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment