/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
v16.10.2
packages/react-devtools-extensions/src/inject.js
24 строки
653 B
Brian Vaughn
Revert change to backend injection method from PR #16752 (#16864)
23 сен 2019, 22:56
Не верифицирован
23 сен 2019, 22:56
bce2ac6
Код
Авторство
О чём код?
/* global chrome */ export default function inject(scriptName: string, done: ?Function) { const source = ` // the prototype stuff is in case document.createElement has been modified (function () { var script = document.constructor.prototype.createElement.call(document, 'script'); script.src = "${scriptName}"; script.charset = "utf-8"; document.documentElement.appendChild(script); script.parentNode.removeChild(script); })() `; chrome.devtools.inspectedWindow.eval(source, function(response, error) { if (error) { console.log(error); } if (typeof done === 'function') { done(); } }); }