Last active
July 31, 2023 00:37
-
-
Save FlyInk13/74ed3781bf02605adec2c2127f3fe705 to your computer and use it in GitHub Desktop.
get original function js || Получаем оригинальную функцию в js
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
function getOriginalFunction(functionName) { | |
var iframe = document.createElement('iframe'); // Создаем iframe | |
iframe.style.display = 'none'; // Делаем скрытым | |
document.body.appendChild(iframe); // Добавляем в body | |
var func = iframe.contentWindow[functionName]; // Получаем функцию | |
iframe.parentNode.removeChild(iframe); // Удаляем элемент | |
return func.bind(window); // привязываем контекст к текущему window и отдаем функцию | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment