0.2.1 • Published 4 years ago

gm-http v0.2.1

Weekly downloads
50
License
ISC
Repository
github
Last release
4 years ago

gm-http

Greenkeeper badge Build Status Dependency License Prettier Node npm version

Http module for Greasyfork Script

Installation

npm install gm-http --save

FeedBack

如果这能够帮助到你, 不妨点个start, 你的支持就是我更新的动力

使用

  1. 安装扩展

安装前确保你的浏览器已安装如下扩展

浏览器支持扩展
ChromeTampermonkey or Violent monkey
FirefoxGreasemonkey or Tampermonkey
SafariTampermonkey
Microsoft EdgeTampermonkey
OperaTampermonkey
MaxthonViolentmonkey
DolphinTampermonkey
UCTampermonkey
Qupzilla不需要额外软件
  1. 安装脚本

创建一个脚本,并且安装

  1. 确保拥有http权限

在脚本头部的声明中,确保有http的权限申请

// @grant             GM_xmlhttpRequest
  1. 引入本库
// 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

0.2.1

4 years ago

0.2.0

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago