mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-25 03:02:21 +00:00
docs(set): edit weakmap
This commit is contained in:
parent
66b16e3b4a
commit
e2867f1956
@ -320,7 +320,7 @@ var Thunk = function(fn){
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ES6版本
|
// ES6版本
|
||||||
var Thunk = function(fn) {
|
const Thunk = function(fn) {
|
||||||
return function (...args) {
|
return function (...args) {
|
||||||
return function (callback) {
|
return function (callback) {
|
||||||
return fn.call(this, ...args, callback);
|
return fn.call(this, ...args, callback);
|
||||||
@ -342,10 +342,9 @@ readFileThunk(fileA)(callback);
|
|||||||
function f(a, cb) {
|
function f(a, cb) {
|
||||||
cb(a);
|
cb(a);
|
||||||
}
|
}
|
||||||
let ft = Thunk(f);
|
const ft = Thunk(f);
|
||||||
|
|
||||||
let log = console.log.bind(console);
|
ft(1)(console.log) // 1
|
||||||
ft(1)(log) // 1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Thunkify 模块
|
### Thunkify 模块
|
||||||
|
@ -1014,7 +1014,7 @@ undefined
|
|||||||
> let wm = new WeakMap();
|
> let wm = new WeakMap();
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
> const b = new Object();
|
> let b = new Object();
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
> global.gc();
|
> global.gc();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user