Skip to content

Instantly share code, notes, and snippets.

@kariudo
Created September 23, 2015 13:50
Show Gist options
  • Save kariudo/dc99cd278872cbf646e1 to your computer and use it in GitHub Desktop.
Save kariudo/dc99cd278872cbf646e1 to your computer and use it in GitHub Desktop.
Javascript "Todo" Warning (With Caller) Function
// Used as a UI indicaiton that a feature is not complete. Warns to log.
var TODO = function () {
var callerName = "";
try { //noinspection ExceptionCaughtLocallyJS
throw new Error(); }
catch (e) { callerName = /TODO.+\n\s+at (.+) \(/.exec(e.stack)[1]; }
console.warn('Feature not complete:', callerName);
};
@kariudo
Copy link
Author

kariudo commented Sep 23, 2015

I use this for alerting in console when I have used a UI feature that has not yet had its functionality completed in the backend

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