doc: fixed variable names in queueMicrotask example

fixed variable name in queueMicrotask where url variable was used
instead of key

PR-URL: https://github.com/nodejs/node/pull/39634
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
ashish maurya authored and Danielle Adams committed 2021-08-16 16:35:23 -04:00
1 parent c68415cba2
commit bfb1dc0a2c
1 file changed
+2 -2
+2 -2
View File
@@ -319,7 +319,7 @@ within each turn of the Node.js event loop.
// before any other promise jobs.
DataHandler.prototype.load = async function load(key) {
const hit = this._cache.get(url);
const hit = this._cache.get(key);
if (hit !== undefined) {
queueMicrotask(() => {
this.emit('load', hit);
@@ -328,7 +328,7 @@ DataHandler.prototype.load = async function load(key) {
}
const data = await fetchData(key);
this._cache.set(url, data);
this._cache.set(key, data);
this.emit('load', data);
};
```