Skip to content

Instantly share code, notes, and snippets.

@brianmriley
Last active December 23, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmriley/6686219 to your computer and use it in GitHub Desktop.
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.
////////////////////////////////////////////////////////////////////////////////
// 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