У меня нет устройств Apple, и я пытаюсь отладить iOS Chrome.К сожалению, стек браузеров пока не поддерживает консоль для iOS Chrome.Я нашел этот аккуратный инструмент для ведения журнала консоли веб-сокета https://console.re/
Он просит вас использовать специальный синтаксис для входа в их приложение.Вы должны написать console.re.log ('message').Тем не менее, я пытаюсь записать все, чтобы увидеть, где мое приложение ломается.Я попытался использовать следующий код, но у меня возникают проблемы с его переходом в бесконечные циклы, поскольку console.re.log также вызывает console.log, и я добавляю console.log в console.re.log ... Вот код:
<script>
console.log(window.location.href.slice(-5));
if(window.location.href.slice(-5) === 'debug') {
var consolere = {
channel:'music-blobs',
api:'//console.re/connector.js',
ready: function(c) {var d=document,s=d.createElement('script'),l;s.src=this.api;s.id='consolerescript';s.onreadystatechange=s.onload=function(){if(!l){c();}l=true;};d.getElementsByTagName('head')[0].appendChild(s);}};
var _log = console.log;
var _error = console.error;
var _warning = console.warn;
var logQueue = [];
var errorQueue = [];
var warnQueue = [];
var parseQueueRan = false;
consolere.ready(function() {
console.log = console.re.log;
console.warn = console.re.warn;
console.error = console.re.error;
});
window.console.log = function(...items) {
if(console.re) {
console.re.log(message);
} else {
logQueue.push(message);
_log.apply(console, arguments);
}
}
window.console.error = function(message) {
if(console.re) {
console.re.error(message);
} else {
errorQueue.push(message);
_warning.apply(console, arguments);
}
}
window.console.warn = function(message) {
if(console.re) {
console.re.warn(message);
} else {
warnQueue.push(message);
_error.apply(console, arguments);
}
}
}
</script>
Кто-нибудь знает, как я могу заставить это работать?