Skip to content

Commit 5c0de16

Browse files
committed
docs: 更新
1 parent 41f1759 commit 5c0de16

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/javascript/ES6系列之模块化.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ tags:
141141

142142
采用深拷贝方式,在第一次require时加载并执行该脚本,在内存中生成一个对象。以后使用该模块时直接从该内存对象取值,即使再次执行require,也不会执行,仍是从缓存中取值。
143143

144-
## ES6 模块化
144+
## ES6模块化
145145
### 设计思想
146146
尽量静态化,在编译时确定模块的依赖关系,以及输入和输出的变量。
147147

src/javascript/面向对象编程篇.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ tags:
199199
console.log(stu.hasOwnProperty('study')); // false
200200

201201
// 用function实现es6 class语法,需要注意以下几点:
202-
// 暂时性死区(函数提升) —— 闭包,IIFE,屏蔽函数定义
203-
// 构造只能通过new,不能直接调用 —— 非new方式创建抛错,通过Object.getPrototypeOf(this) === XXX.prototype判断是否是new创建
204-
// 静态属性 —— 挂载在函数上
205-
// 访问器属性 —— 通过Object.defineProperty声明getter和setter。是挂载在具体对象上,还是挂载在函数原型对象上,都要挂载。还需配置为不可枚举。
206-
// 对象方法 —— 挂载在函数对象上。还需配置为不可枚举,需改用为Object.defineProperty写法,不能用XXX.prototype.YYY。由于函数二义性,所以这里也需限制非new方式调用,通过Object.getPrototypeOf(this) === XXX.prototype.YYY.prototype判断
207-
// 继承 —— ?
202+
// 暂时性死区(防止函数提升) —— 使用IIFE
203+
// 构造只能new,不能调用 —— 函数调用时抛错,通过Object.getPrototypeOf(this) === XXX.prototype或new.target判断
204+
// 静态属性 —— 直接挂载在函数上
205+
// 访问器属性 —— 通过Object.defineProperty对函数原型对象声明getter和setter,并配置为不可枚举
206+
// 实例属性 —— 通过Object.defineProperty对函数原型对象声明getter和setter,并配置为不可枚举。由于函数二义性,所以这里也需限制非new方式调用,通过Object.getPrototypeOf(this) === XXX.prototype或new.target判断
207+
// 继承 —— 组合继承
208208
```
209209

210210
- 一个关于Date继承的特别例子

0 commit comments

Comments
 (0)