You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-10 22:11:50 +02:00
Desktop: Disable console wrapper (#12663)
This commit is contained in:
@@ -39,32 +39,6 @@ window.React = React;
|
|||||||
|
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
if (bridge().env() === 'dev') {
|
|
||||||
const newConsole = function(oldConsole) {
|
|
||||||
const output = {};
|
|
||||||
const fnNames = ['assert', 'clear', 'context', 'count', 'countReset', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'memory', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeLog', 'timeStamp', 'trace', 'warn'];
|
|
||||||
for (const fnName of fnNames) {
|
|
||||||
if (fnName === 'warn') {
|
|
||||||
output.warn = function(...text) {
|
|
||||||
const s = [...text].join('');
|
|
||||||
// React spams the console with walls of warnings even outside of strict mode, and even after having renamed
|
|
||||||
// unsafe methods to UNSAFE_xxxx, so we need to hack the console to remove them...
|
|
||||||
if (s.indexOf('Warning: componentWillReceiveProps has been renamed, and is not recommended for use') === 0) return;
|
|
||||||
if (s.indexOf('Warning: componentWillUpdate has been renamed, and is not recommended for use.') === 0) return;
|
|
||||||
oldConsole.warn(...text);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
output[fnName] = function(...text) {
|
|
||||||
return oldConsole[fnName](...text);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}(window.console);
|
|
||||||
|
|
||||||
window.console = newConsole;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.info(`Environment: ${bridge().env()}`);
|
console.info(`Environment: ${bridge().env()}`);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user