Http module for Greasyfork Script
MIT License
Http module for Greasyfork Script
npm install gm-http --save
安装前确保你的浏览器已安装如下扩展
浏览器 | 支持扩展 |
---|---|
Chrome | Tampermonkey or Violent monkey |
Firefox | Greasemonkey or Tampermonkey |
Safari | Tampermonkey |
Microsoft Edge | Tampermonkey |
Opera | Tampermonkey |
Maxthon | Violentmonkey |
Dolphin | Tampermonkey |
UC | Tampermonkey |
Qupzilla | 不需要额外软件 |
创建一个脚本,并且安装
在脚本头部的声明中,确保有http的权限申请
// @grant GM_xmlhttpRequest
// es6
import http from 'gm-http';
// commonJs
const http = require('gm-http');
// or Global
const http = window.gmHttp;
http.get('https://example.com')
.then(function() {
})
interface Http$ {
create(config: any): Http$;
request(
method: string,
url: string,
data: Object | string,
header: HttpHeader$,
config: RequestConfig$
): Promise<any>;
get(
url: string,
data?: Object | string,
header?: HttpHeader$,
config?: RequestConfig$
): Promise<any>;
post(
url: string,
data?: Object | string,
header?: HttpHeader$,
config?: RequestConfig$
): Promise<any>;
put(
url: string,
data?: Object | string,
header?: HttpHeader$,
config?: RequestConfig$
): Promise<any>;
['delete'](
url: string,
data?: Object | string,
header?: HttpHeader$,
config?: RequestConfig$
): Promise<any>;
head(
url: string,
data?: Object | string,
header?: HttpHeader$,
config?: RequestConfig$
): Promise<any>;
}
git clone https://github.com/axetroy/gm-http.git
cd ./gm-http
yarn
yarn run start
You can flow Contribute Guide
Axetroy💻 🔌 ⚠️ 🐛 🎨 |
---|
The MIT License