Files
30-seconds-of-code/node_modules/opentracing/lib/functions.js
2019-08-20 15:52:05 +02:00

36 lines
1.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Constants = require("./constants");
var reference_1 = require("./reference");
var span_1 = require("./span");
/**
* Return a new REFERENCE_CHILD_OF reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_CHILD_OF reference pointing to `spanContext`
*/
function childOf(spanContext) {
// Allow the user to pass a Span instead of a SpanContext
if (spanContext instanceof span_1.default) {
spanContext = spanContext.context();
}
return new reference_1.default(Constants.REFERENCE_CHILD_OF, spanContext);
}
exports.childOf = childOf;
/**
* Return a new REFERENCE_FOLLOWS_FROM reference.
*
* @param {SpanContext} spanContext - the parent SpanContext instance to
* reference.
* @return a REFERENCE_FOLLOWS_FROM reference pointing to `spanContext`
*/
function followsFrom(spanContext) {
// Allow the user to pass a Span instead of a SpanContext
if (spanContext instanceof span_1.default) {
spanContext = spanContext.context();
}
return new reference_1.default(Constants.REFERENCE_FOLLOWS_FROM, spanContext);
}
exports.followsFrom = followsFrom;
//# sourceMappingURL=functions.js.map