Jeff-Lewis / cls-hooked

cls-hooked : CLS using AsynWrap or async_hooks instead of async-listener for node 4.7+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document ns.enter()/.exit() methods

puzpuzpuz opened this issue · comments

These methods should be included into the documentation (and thus, included into public API) as there are some use cases when ns.run()/.runAndReturn()/.bind() are not an option.

Namely, ns.enter()/.exit() methods are very helpful in case of generators. See here for an example: https://github.com/puzpuzpuz/cls-rtracer/blob/master/index.js#L76

Wow, @puzpuzpuz, that was the exact usecase (Koa V1 middleware) I was trying to implement.
Thanks!

@jrnail23 no problem at all. Glad that this information was helpful.