UNPKG

@mhqc7c/siedim

Version:

SIEmens Digital Industry Marketing js library

28 lines (26 loc) 1.14 kB
/** SIEmens Disgital Industry Marketing (SIEDIM) shared JS */ export const siedim = { datetime: function() { var n = new Date(), y=n.getFullYear(), m=n.getMonth()+1,d=n.getDate(), hh=n.getHours(), mm=n.getMinutes(), ss=n.getSeconds(); var ds = y + '/' + m + '/' + d + ' ' + hh + ':' + mm + ':' + ss; return ds; }, isIE: function() { return !(window.ActiveXObject) && 'ActiveXObject' in window; }, LOG: { info: function(mesg, prompt) { var dtMsg = (prompt || siedim.datetime()) + '>' + mesg; console.log('INFO %c' + dtMsg, 'color: white; background-color: green; padding: 2px 5px; border-radius: 2px'); }, warn: function(mesg, prompt) { var dtMsg = (prompt || siedim.datetime()) + '>' + mesg; console.log('WARN %c' + dtMsg, 'color: black; background-color: #f5d3b3; padding: 2px 5px; border-radius: 2px'); }, error: function(mesg, prompt) { var dtMsg = (prompt || siedim.datetime()) + '>' + mesg; console.log('ERROR %c' + dtMsg, 'color: white; background-color: orange; padding: 2px 5px; border-radius: 2px'); } } };