continuation-local-storage
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -5,2 +5,5 @@ 'use strict'; | ||
// load polyfill if native support is unavailable | ||
if (!process.addAsyncListener) require('async-listener'); | ||
var namespaces = process.namespaces = Object.create(null); | ||
@@ -88,4 +91,20 @@ | ||
module.exports = { | ||
createNamespace : function (name) { return new Namespace(name); }, | ||
createNamespace : function (name) { | ||
var namespace = new Namespace(name); | ||
process.addAsyncListener( | ||
function () { | ||
return namespace.active; | ||
}, | ||
{ | ||
before: function (context) { | ||
namespace.enter(context); | ||
}, | ||
after: function (context) { | ||
namespace.exit(context); | ||
} | ||
} | ||
); | ||
return namespace; | ||
}, | ||
getNamespace : getNamespace | ||
}; |
{ | ||
"name": "continuation-local-storage", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "userland implementation of https://github.com/joyent/node/issues/5243", | ||
@@ -32,3 +32,6 @@ "main": "context.js", | ||
"tap": "~0.4.2" | ||
}, | ||
"optionalDependencies": { | ||
"async-listener": "0.0.2" | ||
} | ||
} |
@@ -9,3 +9,3 @@ 'use strict'; | ||
// module under test | ||
var context = require('../context'); | ||
var context = require('../context.js'); | ||
@@ -12,0 +12,0 @@ // multiple contexts in use |
@@ -51,6 +51,4 @@ 'use strict'; | ||
process.nextTick(function () { | ||
// FIXME: once this is in core, 'value' should be 1 because | ||
// outer is still active | ||
// FIXME: t.equal(writer.active, outer, "writer.active == outer"); | ||
t.equal(writer.get('value'), 0, "inner hasn't been entered yet"); | ||
t.equal(writer.active, outer, "writer.active == outer"); | ||
t.equal(writer.get('value'), 1, "inner has been entered"); | ||
writer.run(function (inner) { | ||
@@ -57,0 +55,0 @@ t.equal(writer.active, inner, "writer.active == inner"); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
// module under test | ||
var context = require('../context'); | ||
var context = require('../context.js'); | ||
@@ -12,0 +12,0 @@ // multiple contexts in use |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55421
17
1300
1
1
4