Last active
July 19, 2018 19:53
-
-
Save cherniavskii/a7e57a824c70da730ba636503ba4be4d to your computer and use it in GitHub Desktop.
This file contains 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
// See https://github.com/mrdoob/three.js/pull/14483 | |
const consoleWarn = window.console.warn; | |
window.console.warn = function() { | |
const string = arguments[0]; | |
const filterStrings = [ | |
'is not power of two', | |
'image is too big', | |
'marked for update', | |
]; | |
// filter warnings containing above strings | |
const shouldBeFiltered = filterStrings.some(string => ( | |
arguments[0].includes('THREE') && arguments[0].includes(string) | |
); | |
if (shouldBeFiltered) { | |
// log it to console without second argument, which contains reference to `image` | |
consoleWarn.call(null, arguments[0]); | |
} else { | |
// pass other warnings without changes | |
consoleWarn.apply(null, arguments); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment