Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/9645192 to your computer and use it in GitHub Desktop.
Save jasonLaster/9645192 to your computer and use it in GitHub Desktop.
define([], function() {
var breakOn = function(object, method) {
var originalMethod = object[method];
if (!originalMethod) {
throw new Error('Couldnt find method ' + method + ' to break on.');
}
return object[method] = function stopExecution() {
debugger;
return originalMethod.apply(this, arguments);
}
}
return {
breakOn: breakOn
};
});
@jasonLaster
Copy link
Author

This adds a DevTools module where we can add helpful utilities

  • Namespaced logging we can turn on/off
  • logCalls(obj, method) which could keep a registry of all the calls an object receives
  • watch(object) which could hold onto an object. maybe have some nice view stuff

Help us track down things like:

  • weird dependencies, memory leaks
  • weird interactions, event graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment