Comparing version 0.2.5 to 0.2.6
@@ -29,1 +29,6 @@ | ||
- [feature] 添加 febs.file.dirExplorerDirsRecursive | ||
0.2.6 | ||
================== | ||
- [feature] 添加 febs.net 支持 fetch, jsonp | ||
- [feature] 添加 requestAnimationFrame / cancelAnimationFrame |
@@ -44,3 +44,3 @@ { | ||
"name": "febs", | ||
"version": "0.2.5" | ||
"version": "0.2.6" | ||
} |
@@ -26,2 +26,3 @@ febs 库是一些常用的工具的合集; | ||
- [nav](#nav) | ||
- [net](#net) | ||
@@ -42,2 +43,4 @@ - 服务端独有库 | ||
``` | ||
* 定义了`window.requestAnimationFrame`和`window.cancelAnimationFrame`方法,可进行动画帧操作. | ||
* 对浏览器添加了`Promise`支持. | ||
@@ -263,3 +266,3 @@ > 服务端 | ||
* @desc: ajax 跳转. | ||
* @param ctx:例如: (详见jquery.ajax) | ||
* @param option:例如: (详见jquery.ajax) | ||
{ | ||
@@ -273,3 +276,3 @@ type: "GET", | ||
*/ | ||
febs.nav.ajax( ctx ) | ||
febs.nav.ajax( option ) | ||
/** | ||
@@ -282,3 +285,55 @@ * @desc: 寻找指定的url | ||
# net | ||
net封装了浏览器通信方法: ajax, fetch, jsonp | ||
```js | ||
/** | ||
* @desc: 进行ajax请求, 同 febs.nav.ajax. | ||
*/ | ||
febs.net.ajax(option) | ||
/** | ||
* @desc: 使用fetch方式进行数据请求. | ||
* 如果超時, 可以catch到 'timeout' | ||
* @param option: 请求选项. | ||
* { | ||
method, // 请求方法 get, post, delete 等. | ||
mode, // 'no-cors', 'same-origin'等; (可忽略) | ||
headers, // 请求header, 例如: | ||
{ | ||
"Content-Type": "application/json", | ||
"Accept": 'application/json', | ||
} | ||
body, // 请求内容. | ||
timeout, // 超时 (ms), 默认为5000 | ||
} | ||
* @return: 返回 Promise; | ||
* @e.g. | ||
febs.net.fetch(url, {}) | ||
.then(response=>response.json()) | ||
.then(data=>{}) | ||
.catch(err=>{ | ||
if (err === 'timeout) // 超时. | ||
}); | ||
*/ | ||
febs.net.fetch(url, option) | ||
/** | ||
* @desc: jsonp方式获取数据. | ||
* 如果超時, 可以catch到 'timeout' | ||
* @param option: 请求选项同fetch. 可以附带如下的更多属性. jsonp只能使用`get`方式. | ||
* { | ||
jsonpCallback, // jsonp请求时附带到地址中的callback参数, 默认为 'callback'; | ||
// 服务端需将查询字符串中的此参数作为返回数据中 `callback`([data])的 callback值 | ||
} | ||
* @return: 返回 Promise; | ||
* @e.g. | ||
febs.net.jsonp(url, {}) | ||
.then(response=>response.json()) | ||
.then(data=>{}) | ||
.catch(err=>{ | ||
if (err === 'timeout) // 超时. | ||
}); | ||
*/ | ||
febs.net.jsonp(url, option) | ||
``` | ||
# exception | ||
@@ -285,0 +340,0 @@ 定义了服务端常用的错误类型. |
exports.upload = require('./upload'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322241
1729
573
7
5