File tree Expand file tree Collapse file tree 13 files changed +858
-488
lines changed Expand file tree Collapse file tree 13 files changed +858
-488
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "version" : " 0.2.0" ,
3
+ "configurations" : [
4
+ {
5
+ "name" : " Current TS File" ,
6
+ "type" : " node" ,
7
+ "request" : " launch" ,
8
+ "program" : " ${workspaceRoot}/node_modules/ts-node/dist/bin.js" ,
9
+ "args" : [
10
+ " ${relativeFile}"
11
+ ]
12
+ }
13
+ ]
14
+ }
Original file line number Diff line number Diff line change 1
- # 1.0.0 (2020-03-03 )
1
+ # 1.0.0 (2020-03-05 )
2
2
3
3
4
4
### Bug Fixes
12
12
* husky pre-commit ([ 06f1144] ( https://github.com/Rain120/awesome-javascript-code-implementation/commit/06f1144d4c80888dbe6da76d28d5f6f0fff55358 ) )
13
13
* math docs menu ([ 3958b99] ( https://github.com/Rain120/awesome-javascript-code-implementation/commit/3958b99b27170aa419b4b8983d7cf62cbae6b724 ) )
14
14
* netlify deploy bug ([ f1830e9] ( https://github.com/Rain120/awesome-javascript-code-implementation/commit/f1830e9a07d27b4d6b9c3c67e13272e9064bb322 ) )
15
+ * plop create code and docs model(plop name bug) ([ 8ef0e62] ( https://github.com/Rain120/awesome-javascript-code-implementation/commit/8ef0e627daadc21842de8a35495c345f9ca70550 ) )
15
16
* readme selected; package.json husky add test ([ b228b61] ( https://github.com/Rain120/awesome-javascript-code-implementation/commit/b228b6194832f909c0b3c7a0c38843bab3b7c63d ) )
16
17
17
18
Original file line number Diff line number Diff line change 12
12
[ ![ ISSUES] ( https://img.shields.io/github/issues/rain120/awesome-javascript-code-implementation?style=flat-square )] ( https://github.com/Rain120/awesome-javascript-code-implementation/issues ) [ ![ GitHub closed pull requests] ( https://img.shields.io/github/issues-pr-closed/rain120/awesome-javascript-code-implementation?style=flat-square )] ( https://github.com/Rain120/awesome-javascript-code-implementation/pulls ) [ ![ COMMIT] ( https://img.shields.io/github/last-commit/rain120/awesome-javascript-code-implementation?style=flat-square )] ( https://github.com/Rain120/awesome-javascript-code-implementation/commits/master )
13
13
14
14
<!-- [](https://github.com/Rain120/awesome-javascript-code-implementation/actions) -->
15
+
15
16
![ LANGUAGES] ( https://img.shields.io/github/languages/top/rain120/awesome-javascript-code-implementation?style=flat-square )
16
17
[ ![ VERSION] ( https://img.shields.io/github/package-json/v/rain120/awesome-javascript-code-implementation?style=flat-square )] ( https://github.com/Rain120/awesome-javascript-code-implementation/blob/master/package.json ) [ ![ LICENSE] ( https://img.shields.io/github/license/rain120/awesome-javascript-code-implementation?style=flat-square )] ( https://github.com/Rain120/awesome-javascript-code-implementation/blob/master/LICENSE )
17
18
@@ -49,6 +50,7 @@ Document Link:
49
50
⌨️
50
51
51
52
生成 ` code ` 模板
53
+
52
54
``` sh
53
55
npm run template
54
56
```
@@ -60,6 +62,7 @@ npm run docs
60
62
```
61
63
62
64
同时生成 ` code ` ` docs ` 模板
65
+
63
66
```
64
67
npm run template-docs
65
68
```
@@ -92,7 +95,7 @@ We welcome all contributions. You can submit any ideas as [pull requests](https:
92
95
93
96
- [ ] ES6
94
97
95
- - [ ] Promise
98
+ - [x ] Promise
96
99
97
100
- [ ] Proxy
98
101
@@ -161,7 +164,7 @@ We welcome all contributions. You can submit any ideas as [pull requests](https:
161
164
#### 📰 References
162
165
163
166
- Algorithms
164
-
167
+
165
168
[ Visualising Data Structures and Algorithms Through Animation] ( https://visualgo.net/ )
166
169
167
170
[ Data Structure Visualizations] ( https://www.cs.usfca.edu/~galles/visualization/Algorithms.html )
Original file line number Diff line number Diff line change 1
1
/*
2
2
* @Author : Rainy
3
3
* @Date : 2020-01-31 11:42:43
4
- * @LastEditors : Rainy
5
- * @LastEditTime : 2020-02-07 12:55:08
4
+ * @LastEditors : Rainy
5
+ * @LastEditTime : 2020-03-04 22:17:41
6
6
*/
7
7
8
8
const alias = {
@@ -25,6 +25,10 @@ const alias = {
25
25
'debounce' : '防抖' ,
26
26
'throttle' : '节流' ,
27
27
28
+ // es6
29
+ 'es6' : 'ECMAScript 6(ES6)' ,
30
+ 'promise' : '手写Promise' ,
31
+
28
32
// Array
29
33
'array' : 'Array(MDN + Function)' ,
30
34
Original file line number Diff line number Diff line change
1
+ ### ECMAScript6 (ES6)
2
+
3
+ ::: tip
4
+ 主要是对常见的 ** ECMAScript 6(ES6)** 进行学习并实现
5
+ :::
6
+
7
+ ### 目录
8
+
9
+ - [x] [ 手写Promise] ( ./promise/README.md )
Original file line number Diff line number Diff line change
1
+ ## 原理
2
+
3
+ ` Promise ` 对象是一个代理对象(代理一个值),被代理的值在` Promise ` 对象创建时可能是未知的。它允许你为异步操作的成功和失败分别绑定相应的处理方法` (handlers) ` 。 这让异步方法可以像同步方法那样返回值,但并不是立即返回最终执行结果,而是一个能代表未来出现的结果的` promise ` 对象。
4
+
5
+ ![ promise-process.png] ( @images/src/promise/images/promise-process.png )
6
+
7
+ <p align =" center " >Promise Process</p >
8
+
9
+ <iframe src =" https://promisesaplus.com/ " width =" 100% " height =" 500px " frameborder =" 0 " />
10
+
11
+ <p align="center">Promise A+</p>
12
+
13
+ <iframe src="http://liubin.org/promises-book/" width="100%" height="500px" frameborder="0" />
14
+
15
+ <p align="center">JavaScript Promise 迷你书</p>
16
+
17
+ ## 实现代码
18
+
19
+ <<< @/src/promise/index.ts
20
+
21
+ ## 参考
22
+
23
+ [Promises/A+规范](https://promisesaplus.com/) -> [【翻译】Promises/A+规范](https://www.ituring.com.cn/article/66566)
24
+
25
+ [Github Promise](https://github.com/then/promise) -> [Document](https://www.promisejs.org/)
26
+
27
+ [JavaScript Promise 迷你书](http://liubin.org/promises-book)
28
+
29
+ [MDN Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
30
+
31
+ [手写实现满足 Promise/A+ 规范的 Promise](https://www.jianshu.com/p/8d5c3a9e6181)
32
+
33
+ [BAT 前端经典面试问题:史上最最最详细的手写 Promise 教程](https://juejin.im/post/5b2f02cd5188252b937548ab)
34
+
35
+ [MDN Promise.finally](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally)
Original file line number Diff line number Diff line change 2
2
3
3
## 实现代码
4
4
5
+ <<< @/{{ path }} /{{ name }} /index.ts
6
+
5
7
## 参考
6
8
Original file line number Diff line number Diff line change
1
+ ### 原理
2
+
3
+ ` Promise ` 对象是一个代理对象(代理一个值),被代理的值在` Promise ` 对象创建时可能是未知的。它允许你为异步操作的成功和失败分别绑定相应的处理方法` (handlers) ` 。 这让异步方法可以像同步方法那样返回值,但并不是立即返回最终执行结果,而是一个能代表未来出现的结果的` promise ` 对象。
4
+
5
+ ![ promise-process.png] ( ./images/promise-process.png )
6
+
7
+ <p align =" center " >Promise Process</p >
8
+
9
+ <iframe src =" https://promisesaplus.com/ " width =" 100% " height =" 500px " frameborder =" 0 " />
10
+
11
+ <p align="center">Promise A+</p>
12
+
13
+ <iframe src="http://liubin.org/promises-book/" width="100%" height="500px" frameborder="0" />
14
+
15
+ <p align="center">JavaScript Promise 迷你书</p>
16
+
17
+ ### 参考
18
+
19
+ [Promises/A+规范](https://promisesaplus.com/) -> [【翻译】Promises/A+规范](https://www.ituring.com.cn/article/66566)
20
+
21
+ [Github Promise](https://github.com/then/promise) -> [Document](https://www.promisejs.org/)
22
+
23
+ [JavaScript Promise 迷你书](http://liubin.org/promises-book)
24
+
25
+ [MDN Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
26
+
27
+ [手写实现满足 Promise/A+ 规范的 Promise](https://www.jianshu.com/p/8d5c3a9e6181)
28
+
29
+ [BAT 前端经典面试问题:史上最最最详细的手写 Promise 教程](https://juejin.im/post/5b2f02cd5188252b937548ab)
30
+
31
+ [MDN Promise.finally](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally)
You can’t perform that action at this time.
0 commit comments