UNPKG

1.29 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var Constants = require("./constants");
4var reference_1 = require("./reference");
5var span_1 = require("./span");
6/**
7 * Return a new REFERENCE_CHILD_OF reference.
8 *
9 * @param {SpanContext} spanContext - the parent SpanContext instance to
10 * reference.
11 * @return a REFERENCE_CHILD_OF reference pointing to `spanContext`
12 */
13function childOf(spanContext) {
14 // Allow the user to pass a Span instead of a SpanContext
15 if (spanContext instanceof span_1.default) {
16 spanContext = spanContext.context();
17 }
18 return new reference_1.default(Constants.REFERENCE_CHILD_OF, spanContext);
19}
20exports.childOf = childOf;
21/**
22 * Return a new REFERENCE_FOLLOWS_FROM reference.
23 *
24 * @param {SpanContext} spanContext - the parent SpanContext instance to
25 * reference.
26 * @return a REFERENCE_FOLLOWS_FROM reference pointing to `spanContext`
27 */
28function followsFrom(spanContext) {
29 // Allow the user to pass a Span instead of a SpanContext
30 if (spanContext instanceof span_1.default) {
31 spanContext = spanContext.context();
32 }
33 return new reference_1.default(Constants.REFERENCE_FOLLOWS_FROM, spanContext);
34}
35exports.followsFrom = followsFrom;
36//# sourceMappingURL=functions.js.map
\No newline at end of file