NoopContextManager.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright The OpenTelemetry Authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. var __read = (this && this.__read) || function (o, n) {
  17. var m = typeof Symbol === "function" && o[Symbol.iterator];
  18. if (!m) return o;
  19. var i = m.call(o), r, ar = [], e;
  20. try {
  21. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  22. }
  23. catch (error) { e = { error: error }; }
  24. finally {
  25. try {
  26. if (r && !r.done && (m = i["return"])) m.call(i);
  27. }
  28. finally { if (e) throw e.error; }
  29. }
  30. return ar;
  31. };
  32. var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
  33. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  34. if (ar || !(i in from)) {
  35. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  36. ar[i] = from[i];
  37. }
  38. }
  39. return to.concat(ar || Array.prototype.slice.call(from));
  40. };
  41. import { ROOT_CONTEXT } from './context';
  42. var NoopContextManager = /** @class */ (function () {
  43. function NoopContextManager() {
  44. }
  45. NoopContextManager.prototype.active = function () {
  46. return ROOT_CONTEXT;
  47. };
  48. NoopContextManager.prototype.with = function (_context, fn, thisArg) {
  49. var args = [];
  50. for (var _i = 3; _i < arguments.length; _i++) {
  51. args[_i - 3] = arguments[_i];
  52. }
  53. return fn.call.apply(fn, __spreadArray([thisArg], __read(args), false));
  54. };
  55. NoopContextManager.prototype.bind = function (_context, target) {
  56. return target;
  57. };
  58. NoopContextManager.prototype.enable = function () {
  59. return this;
  60. };
  61. NoopContextManager.prototype.disable = function () {
  62. return this;
  63. };
  64. return NoopContextManager;
  65. }());
  66. export { NoopContextManager };
  67. //# sourceMappingURL=NoopContextManager.js.map