MYTAC
MYTAC
# 准备阶段 1. 需要一个rn项目,这里演示的是我个人的项目[ReactNative-ReduxSaga-TODO](https://github.com/mytac/ReactNative-ReduxSaga-TODO) 2. 安装jest 如果你是用```react-native init```命令行创建的rn项目,并且你的rn版本在0.38以上,则无需安装了。不太清楚的话就看一下```package.json```文件中是否包含以下代码: ```json // package.json "scripts": { "test": "jest" }, "jest": { "preset": "react-native" } ``` 如果没有就安装一下```npm i jest --save-dev```,并把上述代码添加到```package.json```文件的对应位置。 3. 以上步骤完成后,简单运行```npm run test```测试一下jest是否配置成功。但我们没有写测试用例,终端会打印```no...
虽然现在异步解决方案都用```async/await```了,但co是一个小巧而精致的库,我们也可以学习一下他的实现原理。 ## 什么是co co是一个函数库,用于generator的自动执行。 我们先定义一个generator,用来异步读下面几个文件 ```js const gen=function *(){ const b=yield read('b.js') console.log(b.length) const c=yield read('c.js') console.log(c.length) } ``` 其中,我们定义的read异步读取文件的函数为: ```js function read(file){ fs.readFile(file,'utf8',(err,res)=>{ g.next(res) }) } const g=gen() g.next()...
## 数据图表相关 1. [charts -- 简单,响应迅速,具有零依赖关系的现代SVG图表](https://github.com/frappe/charts) [【官网】](https://frappe.github.io/charts/) 2. [tikzcd-editor -- 用于创建可交换图的简单可视化编辑器。](https://github.com/yishn/tikzcd-editor) [【Demo】](http://tikzcd.yichuanshen.de/)  3. [wasm-particles -- 这是一个视觉基准,每个粒子从WebAssembly更新,然后用WebGL绘制到屏幕上。](https://github.com/maierfelix/wasm-particles) [demo](https://maierfelix.github.io/wasm-particles/static/) 4. [Wade -- 超级快的1kb搜索](https://github.com/kbrsh/wade) 5. [lottie-web -- 分析Adobe After Effects动画与Bodymovin一起导出为json,并在移动设备上原生呈现](https://github.com/airbnb/lottie-web) 6. [luxon...
## UI相关 1. [weex-ui - weex的ui库](https://github.com/alibaba/weex-ui) 2. [iview-admin - 基于iview的后台继承解决方案](https://github.com/iview/iview-admin) [【详细介绍】](https://juejin.im/post/59e6a995518825619a01c433) 3. [material-ui -- google material design的react component的解决方案](https://github.com/callemall/material-ui) 4. [ant-design-pro -- 开箱即用的中台前端/设计解决方案。](https://github.com/ant-design/ant-design-pro) [官网](http://pro.ant.design/) ## 文件处理 1. [url-to-pdf-api -- 把网页转成pdf](https://github.com/alvarcarto/url-to-pdf-api) ##...
### 特效处理 1. [Rythm.js -- 一个使您的页面跳舞的JavaScript库。](https://github.com/Okazari/Rythm.js) 2. [anime -- JavaScript动画引擎](https://github.com/juliangarnier/anime) [Demo](https://okazari.github.io/Rythm.js/) 3. [lookforward.js -- 在页面跳转时的一些特效](https://github.com/appleple/lookforward) [Demo](https://appleple.github.io/lookforward/) 4. [better-scroll -- 一款重点解决移动端(未来可能会考虑 PC 端)各种滚动场景需求的插件。](https://github.com/ustbhuangyi/better-scroll) 5. [cssFilters -- 自定义和Instagram喜欢用React创建的CSS的照片过滤器](https://github.com/ghosh/cssFilters) [【官网】](http://www.cssfilters.co/) [【Demo】](https://ustbhuangyi.github.io/better-scroll/#/examples) 6. [Liike...
### 为啥要使用事件代理 我们在开发中,可能会遇见这样的需求: 在一个列表中点击每个列表项,将每个列表项中的内容传入某个函数中进行处理。 通常结构为 ```html msg msg1 msg2 msg3 ``` 这里需要点击某个列表项,弹出他的内容文本,不难写出下面的方法: ```js window.onload = () => { const ulNode = document.getElementById("list") const liNodes = ulNode.childNode || ulNode.children for (let...
推荐亲测好用的梯子(随着GFW的不断升级,很多梯子也不能用了) https://github.com/meimeihi/tizi.github.io 轮子出品 https://github.com/osurf/kzdy