mock-violentmonkey
Version:
Mock violentmonkey's globals for testing userscripts
30 lines (29 loc) • 1.1 kB
TypeScript
import { Buffer } from 'node:buffer';
import type { Headers } from '../xmlhttprequest/index.js';
import { type XHREventHandler } from './xmlhttprequest.js';
type DownloadOptions = {
url: string;
name: string;
headers?: Headers | undefined;
timeout?: number | undefined;
context?: any;
user?: string | undefined;
password?: string | undefined;
anonymous?: boolean | undefined;
onabort?: XHREventHandler;
onerror?: XHREventHandler;
onload?: XHREventHandler | undefined;
onloadend?: XHREventHandler | undefined;
onloadstart?: XHREventHandler | undefined;
onprogress?: XHREventHandler | undefined;
onreadystatechange?: XHREventHandler | undefined;
ontimeout?: XHREventHandler | undefined;
};
type Download = {
(url: string, name: string): void;
(options: DownloadOptions): void;
};
declare const download: Download;
declare const getDownloads: () => Record<string, Buffer>;
declare const getDownload: (name: string) => Buffer<ArrayBuffer> | undefined;
export { download as GM_download, getDownloads, getDownload, type Download };