15 lines
482 B
JavaScript
Raw Normal View History

import { document } from 'global';
2018-12-29 19:50:44 +01:00
// HMR will cause this code to be invoked multiple times, so each warning should have a unique ID
export default function addHeadWarning(id, text) {
if (!document.getElementById(id)) {
const warning = document.createElement('h1');
warning.textContent = text;
warning.id = id;
warning.style.backgroundColor = 'tomato';
warning.style.padding = '10px';
2018-12-29 19:50:44 +01:00
document.body.insertBefore(warning, document.body.firstChild);
}
}