mirror of
https://github.com/khairul169/code-share.git
synced 2025-04-28 16:49:36 +07:00
19 lines
512 B
JavaScript
19 lines
512 B
JavaScript
if (window.parent !== window) {
|
|
const _log = console.log;
|
|
const _error = console.error;
|
|
const _warn = console.warn;
|
|
|
|
console.log = function (...args) {
|
|
parent.window.postMessage({ type: "log", args: args }, "*");
|
|
_log(...args);
|
|
};
|
|
console.error = function (...args) {
|
|
parent.window.postMessage({ type: "error", args: args }, "*");
|
|
_error(...args);
|
|
};
|
|
console.warn = function (...args) {
|
|
parent.window.postMessage({ type: "warn", args: args }, "*");
|
|
_warn(...args);
|
|
};
|
|
}
|