mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-23 01:56:52 +03:00
6782f4ae41
* Move extension * prettier
18 lines
500 B
JavaScript
18 lines
500 B
JavaScript
export function insertScript(str) {
|
|
const s = window.document.createElement('script');
|
|
s.appendChild(document.createTextNode(str));
|
|
(document.head || document.documentElement).appendChild(s);
|
|
}
|
|
|
|
export function listenMessage(f) {
|
|
return new Promise((resolve) => {
|
|
const listener = (event) => {
|
|
const message = event.data;
|
|
window.removeEventListener('message', listener);
|
|
resolve(message);
|
|
};
|
|
window.addEventListener('message', listener);
|
|
if (f) f();
|
|
});
|
|
}
|