Created
January 8, 2019 19:19
-
-
Save troutacular/5e00f6c8749df846ac01c1d4d24559a9 to your computer and use it in GitHub Desktop.
Console Messages
This file contains hidden or 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
/** | |
* Checks if console exists and allows command types for output. | |
* | |
* @param {comman.['log', 'warn', 'error', 'info']} console command type | |
* @param {message.string} Message to be passed to the console type | |
* @return cosole.[command]([message]) if console available | |
*/ | |
function consoleMessage(command, message) { | |
'use strict'; | |
if (window.console) { | |
switch (command) { | |
case 'log': | |
window.console.log(message); | |
break; | |
case 'warn': | |
window.console.warn(message); | |
break; | |
case 'error': | |
window.console.error(message); | |
break; | |
case 'info': | |
window.console.info(message); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment