Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix wrong words
  • Loading branch information
Zaynex committed Jun 19, 2017
1 parent 0a54e00 commit 6f6af2e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion part1-basic/03-event-bind.md
Expand Up @@ -41,7 +41,7 @@ fs.readFile('data1.json', function (err, data) {

## 我的观点

我个人看代码比较偏重设计,一个东西是什么要看它是未什么而设计的。因此,我倾向于**事件绑定不是异步操作**。虽然它也是通过 event-loop 实现调用的,但是它的设计目录却和异步操作完全不一样。
我个人看代码比较偏重设计,一个东西是什么要看它是为什么而设计的。因此,我倾向于**事件绑定不是异步操作**。虽然它也是通过 event-loop 实现调用的,但是它的设计目录却和异步操作完全不一样。

其实,事件绑定在 js 中扮演着非常重要的角色,各个地方都会用到事件绑定的形式。例如 web 页面监控鼠标、键盘,以及 nodejs 中的 `EventEmitter` 应用非常广泛(特别是涉及到数据流时)。而事件绑定被应用到非常广泛,却没有发生像异步操作带来的程序逻辑问题,反而大家用的非常开心————这又一个两者不一样的例证。

Expand Down
2 changes: 1 addition & 1 deletion part3-promise/05-promise-q.md
Expand Up @@ -108,7 +108,7 @@ const readFilePromise = function (fileName) {
const readFilePromise = Q.denodeify(fs.readFile)
```

`Q.denodeif`就是一键将`fs.readFile`这种有回调函数作为参数的异步操作封装成一个`promise`生成器,非常方便!
`Q.denodeify`就是一键将`fs.readFile`这种有回调函数作为参数的异步操作封装成一个`promise`生成器,非常方便!

## 使用`Q.all``Q.any`

Expand Down
2 changes: 1 addition & 1 deletion part4-generator/03-iterator-use.md
Expand Up @@ -52,7 +52,7 @@ g.next('ccc') // value: undefined, done: true

## `for...of`的应用示例

针对`for...of``Iterator`对象的操作之前已经介绍过了,不过这里用一个非常好的例子来展示一下。用简单几行代码实现斐波那契数列。通过之前学过的`Generator`知识,应该不能解读这份代码
针对`for...of``Iterator`对象的操作之前已经介绍过了,不过这里用一个非常好的例子来展示一下。用简单几行代码实现斐波那契数列。通过之前学过的`Generator`知识,应该不难解读这份代码

```javascript
function* fibonacci() {
Expand Down

0 comments on commit 6f6af2e

Please sign in to comment.