なっく日報

技術やら生活やらのメモ

Node.jsでThreadLocal変数的なやつ2

Node.jsでThreadLocal変数的なモノがないか?ということを再度調べたメモ書きです。

以前、調べた結果は↓。

yukidarake.hateblo.jp

調査メモ

以前調べたnode-continuation-local-storageは健在

github.com

Googleの人が作っているzone.jsというモノがある

angularのオーガニゼーションの下に入ってます。

github.com

node-continuation-local-storageと同様な感じ。domainチックな。

node-continuation-local-storageもzone.jsも使えない?

www.youtube.com

の動画で仕組みが語られていましたが、setTimeoutとか非同期系の関数をラップして、始まりと終わりにゴニョゴニョしている仕組みのよう。

node-continuation-local-storageが依存している

async-listener/index.js at master · othiym23/async-listener · GitHub

も同様の仕組みのよう。

サーバサイドでは使いたくないな。。

strongloop/zoneはdeprecated

希望の星(だった)

github.com

NOTE: This project is deprecated and no longer being actively developed or maintained.

だそう(´・ω・`)

zone.js的機能がtc39でZoneという仕様で提案されstage0に入る模様

https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-01/2016-01-26.md#5i-zonesgithub.com

に議事録が。

スライドもあった docs.google.com

所感

ECMAScriptの仕様に提案されていたというのが意外でした。 だがしかし、仮に正式採用されるとしても、相当先になりそう・・・