gm-http
v0.2.1
Published
Http module for Greasyfork Script
Downloads
24
Maintainers
Readme
gm-http
Http module for Greasyfork Script
Installation
npm install gm-http --save
FeedBack
- https://github.com/axetroy/gm-http/issues
- https://github.com/axetroy/gm-http/issues
- https://github.com/axetroy/gm-http/issues
如果这能够帮助到你, 不妨点个start, 你的支持就是我更新的动力
使用
- 安装扩展
安装前确保你的浏览器已安装如下扩展
浏览器 | 支持扩展 ------------ | ------------- Chrome | Tampermonkey or Violent monkey Firefox | Greasemonkey or Tampermonkey Safari | Tampermonkey Microsoft Edge | Tampermonkey Opera | Tampermonkey Maxthon | Violentmonkey Dolphin | Tampermonkey UC | Tampermonkey Qupzilla | 不需要额外软件
- 安装脚本
创建一个脚本,并且安装
- 确保拥有http权限
在脚本头部的声明中,确保有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() {
})
API
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>;
}
Contributing
git clone https://github.com/axetroy/gm-http.git
cd ./gm-http
yarn
yarn run start
You can flow Contribute Guide
Contributors
| Axetroy💻 🔌 ⚠️ 🐛 🎨 | | :---: |
License
The MIT License