sass-site/source/assets/js/vendor/html5-boilerplate/plugins.ts

23 lines
685 B
TypeScript
Raw Normal View History

2023-01-06 22:40:29 +01:00
// Avoid `console` errors in browsers that lack a console.
(function() {
2023-03-08 22:14:25 +01:00
let method;
const noop = function () {};
const methods = [
2023-01-06 22:40:29 +01:00
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn'
];
2023-03-08 22:14:25 +01:00
let length = methods.length;
const console = (window.console = window.console || {});
2023-01-06 22:40:29 +01:00
while (length--) {
method = methods[length];
// Only stub undefined methods.
2023-01-09 20:48:04 +01:00
if (!(console as any)[method]) {
(console as any)[method] = noop;
2023-01-06 22:40:29 +01:00
}
}
}());