Coder Social home page Coder Social logo

wechatnetworkpackage's Introduction

WeChatNetworkPackage

微信小程序网络库的简单封装

微信有封装好的网络请求 wx.request() 方法,但是在项目中实际使用时,需要作大量的重复操作,所以就把相同的操作进行了封装。

封装的主要**是根据当时的网络框架,通信协议,进行封装的,使用时候需要根据自己的情况进行参考,切勿完整复制。

仅供参考,小白勿喷


实现功能

  1. 封装请求队列,所以的请求会放在队列中处理
  2. 请求失败,会自动重试2次
  3. 统一处理Loading效果,失败结果
  4. 自动处理session过期问题,自动无感知登陆(-401错误)
  5. 借鉴Android MVP**,封装 presenter,简化 js中的代码

使用

参考代码,注释写的很详细

喜欢收藏、点赞

简书详细介绍地址,教你一步步搭建

第一篇 简介

第二篇 简单搭建

第三篇 处理网络响应

第四篇 打印日志

第五篇 加入请求队列

第六篇 简单使用

第七篇 加上Presenter

wechatnetworkpackage's People

Contributors

wan7451 avatar

Stargazers

Xiaowenyong avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.