UNPKG

mock-violentmonkey

Version:

Mock violentmonkey's globals for testing userscripts

15 lines 456 B
import crypto from 'node:crypto'; import { getWindow } from '../dom.js'; const addStyle = css => { const { document } = getWindow(); const style = document.createElement('style'); style.textContent = css; style.id = crypto.randomUUID(); document.head.append(style); return style; }; export { addStyle as GM_addStyle }; Object.defineProperty(globalThis, 'GM_addStyle', { value: addStyle, }); //# sourceMappingURL=add-style.js.map