UNPKG

kara-reactutil-mobileweb

Version:

kara项目移动端react公共模块功能

767 lines (266 loc) 11.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Module: http:invokeApi</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Module: http:invokeApi</h1> <section> <header> </header> <article> <div class="container-overview"> <div class="description"><p>全局http请求的基于fetch polyfill的whatwg-fetch库</p></div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"><p>全局请求的配置设置参数</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>prefixG</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>全局设定的请求前缀</p></td> </tr> <tr> <td class="name"><code>versionG</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 'v1.0.0' </td> <td class="description last"><p>全局默认默认请求版本号</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>tokenStorage</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"><p>token的增删改方法</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>getToken</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>获取授权码相关参数token\refreshToken</p></td> </tr> <tr> <td class="name"><code>setToken</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>设置授权码</p></td> </tr> <tr> <td class="name"><code>removeToken</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>移除授权码</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>url</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last"><p>请求url[注意把前缀除开]</p></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>对fetch标准options参数进行扩展, 单个请求的参数设置在options上</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>prefix</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>API请求前缀</p></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>API请求版本号</p></td> </tr> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>url上的query参数</p></td> </tr> <tr> <td class="name"><code>withToken</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>是否附带token认证</p></td> </tr> <tr> <td class="name"><code>timeout</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>超时处理,单位ms;</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-version">Version:</dt> <dd class="tag-version"><ul class="dummy"><li>v0.01</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line63">line 63</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://github.com/github/fetch#post-json">https://github.com/github/fetch#post-json</a></li> <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API/Using_Fetch">https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API/Using_Fetch</a></li> <li><a href="https://github.com/camsong/blog/issues/2">https://github.com/camsong/blog/issues/2</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>请求返回处理的promise对象</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> </div> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-http.html">http</a></li><li><a href="module-http-http_invokeApi.html">http:invokeApi</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue Jun 20 2017 10:57:47 GMT+0800 (CST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>