UNPKG

@sentry/core

Version:
21 lines (20 loc) • 722 B
import { derefWeakRef, makeWeakRef } from "./weakRef.js"; // src/utils/spanOnScope.ts const SCOPE_SPAN_FIELD = "span"; /** * Set the active span for a given scope. * NOTE: This should NOT be used directly, but is only used internally by the trace methods. */ function _setSpanForScope(scope, span) { if (span) scope.refs[SCOPE_SPAN_FIELD] = makeWeakRef(span); else delete scope.refs[SCOPE_SPAN_FIELD]; } /** * Get the active span for a given scope. * NOTE: This should NOT be used directly, but is only used internally by the trace methods. */ function _getSpanForScope(scope) { return derefWeakRef(scope.refs[SCOPE_SPAN_FIELD]); } export { _getSpanForScope, _setSpanForScope }; //# sourceMappingURL=spanOnScope.js.map