浏览代码

Gitbook Auto Published

Willin Wang 8 年之前
父节点
当前提交
ad7d88644e
共有 3 个文件被更改,包括 37 次插入0 次删除
  1. 2 0
      SUMMARY.md
  2. 33 0
      project/fe/fetch.md
  3. 2 0
      project/js/redux.md

+ 2 - 0
SUMMARY.md

@@ -21,6 +21,8 @@
   - DB
     - [MySQL](project/db/mysql.md)
     - [Redis](project/db/redis.md)
+  - Front-End
+    - [Fetch AJAX](project/fe/fetch.md)
   - [Tool](project/tool/README.md)
     - [Babel](project/tool/babel.md)
     - [守护进程PM2](project/tool/pm2.md)

+ 33 - 0
project/fe/fetch.md

@@ -0,0 +1,33 @@
+# Fetch API AJAX
+
+## 浏览器兼容性
+
+<http://caniuse.com/#feat=fetch>
+
+## 支持检查
+
+```js
+if(typeof fetch === 'function' && typeof window.fetch === 'function') {
+  // 支持
+}
+
+if(typeof fetch !== 'function' || typeof window.fetch !== 'function') {
+  // 不支持
+}
+```
+
+## 示例代码
+
+```js
+var req = new Request('/data.json', {method: 'POST', cache: 'reload'});  
+fetch(req).then(function(res) {  
+  return res.json();
+}).then(function(data){
+  console.log(data);
+});  
+```
+
+## 参考资料
+
+接口文档: <https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API>
+介绍: <https://github.com/camsong/blog/issues/2>

+ 2 - 0
project/js/redux.md

@@ -1,5 +1,7 @@
 # React and Redux
 
+中文文档: <https://github.com/camsong/redux-in-chinese>
+
 > view层发出actions通知触发store里的reducer从而来更新state;state的改变会将更新反馈给我们的view层,从而让我们的view层发生相应的反应给用户。
 
 ## 流程图