Merge pull request #2485 from notapatch/pr-call-apply-decorators-clearer-comments
Clearer CachingDecorator comments
This commit is contained in:
commit
ebd0d110df
1 changed files with 4 additions and 4 deletions
|
@ -36,11 +36,11 @@ function cachingDecorator(func) {
|
||||||
|
|
||||||
slow = cachingDecorator(slow);
|
slow = cachingDecorator(slow);
|
||||||
|
|
||||||
alert( slow(1) ); // slow(1) is cached
|
alert( slow(1) ); // slow(1) is cached and the result returned
|
||||||
alert( "Again: " + slow(1) ); // the same
|
alert( "Again: " + slow(1) ); // slow(1) result returned from cache
|
||||||
|
|
||||||
alert( slow(2) ); // slow(2) is cached
|
alert( slow(2) ); // slow(2) is cached and the result returned
|
||||||
alert( "Again: " + slow(2) ); // the same as the previous line
|
alert( "Again: " + slow(2) ); // slow(2) result returned from cache
|
||||||
```
|
```
|
||||||
|
|
||||||
In the code above `cachingDecorator` is a *decorator*: a special function that takes another function and alters its behavior.
|
In the code above `cachingDecorator` is a *decorator*: a special function that takes another function and alters its behavior.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue