Merge pull request #2485 from notapatch/pr-call-apply-decorators-clearer-comments

Clearer CachingDecorator comments
This commit is contained in:
Ilya Kantor 2021-02-02 10:32:33 +03:00 committed by GitHub
commit ebd0d110df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.