@opencensus/core
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -24,3 +24,3 @@ "use strict"; | ||
/** A map of AsyncResource IDs to Context objects. */ | ||
let contexts = {}; | ||
let contexts = new Map(); | ||
let current = {}; | ||
@@ -115,8 +115,9 @@ // Create the hook. | ||
function init(uid, provider, parentUid, parentHandle) { | ||
contexts[uid] = current; | ||
contexts.set(uid, current); | ||
} | ||
/** before is called just before the resource's callback is called. */ | ||
function before(uid) { | ||
if (contexts[uid]) { | ||
current = contexts[uid]; | ||
const maybeCurrent = contexts.get(uid); | ||
if (maybeCurrent !== undefined) { | ||
current = maybeCurrent; | ||
} | ||
@@ -129,3 +130,3 @@ } | ||
function destroy(uid) { | ||
delete contexts[uid]; | ||
contexts.delete(uid); | ||
} | ||
@@ -138,3 +139,3 @@ function createNamespace() { | ||
current = {}; | ||
contexts = {}; | ||
contexts = new Map(); | ||
} | ||
@@ -141,0 +142,0 @@ exports.destroyNamespace = destroyNamespace; |
{ | ||
"name": "@opencensus/core", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "OpenCensus is a toolkit for collecting application performance and behavior data.", | ||
@@ -56,3 +56,3 @@ "main": "build/src/index.js", | ||
"@types/continuation-local-storage": "^3.2.1", | ||
"@types/mocha": "^5.2.5", | ||
"@types/mocha": "^7.0.0", | ||
"@types/node": "^10.12.12", | ||
@@ -66,3 +66,3 @@ "@types/once": "^1.4.0", | ||
"intercept-stdout": "^0.1.2", | ||
"mocha": "^6.1.0", | ||
"mocha": "^7.0.0", | ||
"nyc": "14.1.1", | ||
@@ -69,0 +69,0 @@ "ts-mocha": "^6.0.0", |
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
380273
9429
1