Skip to content

Commit edde9b6

Browse files
committed
Fix typo
1 parent 13313c0 commit edde9b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class AsyncLocal<T = any> {
166166
setValue(value: T);
167167
}
168168

169-
type ValueChangedListener<T> = (newValue: T, prevValue: T);
169+
type ValueChangedListener<T> = (newValue: T, prevValue: T) => void;
170170
```
171171
172172
`AsyncLocal.getValue()` returns the current value of the async execution flow.
@@ -312,7 +312,7 @@ query with the request trace id.
312312
First we'll have a module holding the async local instance.
313313
314314
```js
315-
//
315+
// context.js
316316
const asyncLocal = new AsyncLocal();
317317

318318
export function setContext(ctx) {
@@ -324,14 +324,14 @@ export function getContext() {
324324
}
325325
```
326326
327-
With the our owned instance of async local, we can set the value on each
327+
With our owned instance of async local, we can set the value on each
328328
request handling call. After set the context, any operations afterwards can
329329
fetch the context with the instance of async local.
330330
331331
```js
332332
import { createServer } from 'http';
333-
import { setContext } from './context';
334-
import { queryDatabase } from './db';
333+
import { setContext } from './context.js';
334+
import { queryDatabase } from './db.js';
335335

336336
const server = createServer(handleRequest);
337337

@@ -350,8 +350,8 @@ So we don't need an additional parameter to the database query functions.
350350
Still, it's easy to fetch the request data and print it.
351351
352352
```js
353-
import { getContext } from './context';
354-
// some module
353+
// db.js
354+
import { getContext } from './context.js';
355355
export function queryDatabase(query) {
356356
const ctx = getContext();
357357
console.log('query database by request %o with query %o',

0 commit comments

Comments
 (0)