Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSasync_hooks execution contextSingle-choice MCQ

An event listener is registered outside any als.run() scope but emitted later from inside one. Wrapping the listener with AsyncResource.bind (or const bound = asyncResource.bind(fn)) fixes a context bug. What does bind actually do?

const bound = AsyncResource.bind(myListener); emitter.on('data', bound);