Files
code-editor/app/elements/output-frame/injects/watch-console.txt
T
2022-03-21 17:43:17 +01:00

24 lines
851 B
Plaintext

// define a new console
var console=(function(oldCons){
return {
log: function(text){
oldCons.log(text);
parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'log');
},
info: function (text) {
oldCons.info(text);
parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'info');
},
warn: function (text) {
oldCons.warn(text);
parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'warn');
},
error: function (text) {
oldCons.error(text);
parent.document.body.getElementsByTagName("notification-bubbles")[0].add(text, 'error');
}
};
}(window.console));
//Then redefine the old console
window.console = console;