gm-http
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

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. 安装扩展

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

浏览器 支持扩展
Chrome Tampermonkey or Violent monkey
Firefox Greasemonkey or Tampermonkey
Safari Tampermonkey
Microsoft Edge Tampermonkey
Opera Tampermonkey
Maxthon Violentmonkey
Dolphin Tampermonkey
UC Tampermonkey
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

Package Sidebar

Install

npm i gm-http

Weekly Downloads

6

Version

0.2.1

License

ISC

Unpacked Size

16.3 kB

Total Files

5

Last publish

Collaborators

  • axetroy