@opentelemetry/instrumentation-xml-http-request 0.222.0 → 0.300.0-development.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -10
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/semconv.cjs +13 -0
- package/dist/semconv.cjs.map +1 -0
- package/dist/semconv.mjs +13 -0
- package/dist/semconv.mjs.map +1 -0
- package/dist/types.d.cts +31 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +31 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/utils.cjs +86 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.mjs +82 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/version.cjs +6 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.mjs +6 -0
- package/dist/version.mjs.map +1 -0
- package/dist/xhr.cjs +345 -0
- package/dist/xhr.cjs.map +1 -0
- package/dist/xhr.d.cts +133 -0
- package/dist/xhr.d.cts.map +1 -0
- package/dist/xhr.d.mts +133 -0
- package/dist/xhr.d.mts.map +1 -0
- package/dist/xhr.mjs +343 -0
- package/dist/xhr.mjs.map +1 -0
- package/package.json +34 -31
- package/build/esm/enums/EventNames.d.ts +0 -9
- package/build/esm/enums/EventNames.js +0 -14
- package/build/esm/enums/EventNames.js.map +0 -1
- package/build/esm/index.d.ts +0 -3
- package/build/esm/index.js +0 -6
- package/build/esm/index.js.map +0 -1
- package/build/esm/semconv.d.ts +0 -9
- package/build/esm/semconv.js +0 -18
- package/build/esm/semconv.js.map +0 -1
- package/build/esm/types.d.ts +0 -29
- package/build/esm/types.js +0 -6
- package/build/esm/types.js.map +0 -1
- package/build/esm/utils.d.ts +0 -14
- package/build/esm/utils.js +0 -118
- package/build/esm/utils.js.map +0 -1
- package/build/esm/version.d.ts +0 -2
- package/build/esm/version.js +0 -7
- package/build/esm/version.js.map +0 -1
- package/build/esm/xhr.d.ts +0 -131
- package/build/esm/xhr.js +0 -415
- package/build/esm/xhr.js.map +0 -1
- package/build/esnext/enums/EventNames.d.ts +0 -9
- package/build/esnext/enums/EventNames.js +0 -14
- package/build/esnext/enums/EventNames.js.map +0 -1
- package/build/esnext/index.d.ts +0 -3
- package/build/esnext/index.js +0 -6
- package/build/esnext/index.js.map +0 -1
- package/build/esnext/semconv.d.ts +0 -9
- package/build/esnext/semconv.js +0 -18
- package/build/esnext/semconv.js.map +0 -1
- package/build/esnext/types.d.ts +0 -29
- package/build/esnext/types.js +0 -6
- package/build/esnext/types.js.map +0 -1
- package/build/esnext/utils.d.ts +0 -14
- package/build/esnext/utils.js +0 -118
- package/build/esnext/utils.js.map +0 -1
- package/build/esnext/version.d.ts +0 -2
- package/build/esnext/version.js +0 -7
- package/build/esnext/version.js.map +0 -1
- package/build/esnext/xhr.d.ts +0 -131
- package/build/esnext/xhr.js +0 -415
- package/build/esnext/xhr.js.map +0 -1
- package/build/src/enums/EventNames.d.ts +0 -9
- package/build/src/enums/EventNames.js +0 -17
- package/build/src/enums/EventNames.js.map +0 -1
- package/build/src/index.d.ts +0 -3
- package/build/src/index.js +0 -10
- package/build/src/index.js.map +0 -1
- package/build/src/semconv.d.ts +0 -9
- package/build/src/semconv.js +0 -21
- package/build/src/semconv.js.map +0 -1
- package/build/src/types.d.ts +0 -29
- package/build/src/types.js +0 -7
- package/build/src/types.js.map +0 -1
- package/build/src/utils.d.ts +0 -14
- package/build/src/utils.js +0 -124
- package/build/src/utils.js.map +0 -1
- package/build/src/version.d.ts +0 -2
- package/build/src/version.js +0 -10
- package/build/src/version.js.map +0 -1
- package/build/src/xhr.d.ts +0 -131
- package/build/src/xhr.js +0 -419
- package/build/src/xhr.js.map +0 -1
package/build/esm/utils.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { URLLike } from '@opentelemetry/sdk-trace-web';
|
|
2
|
-
/**
|
|
3
|
-
* Helper function to determine payload content length for XHR requests
|
|
4
|
-
* @param body
|
|
5
|
-
* @returns content length
|
|
6
|
-
*/
|
|
7
|
-
export declare function getXHRBodyLength(body: Document | XMLHttpRequestBodyInit): number | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Normalize an HTTP request method string per `http.request.method` spec
|
|
10
|
-
* https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client-span
|
|
11
|
-
*/
|
|
12
|
-
export declare function normalizeHttpRequestMethod(method: string): string;
|
|
13
|
-
export declare function serverPortFromUrl(url: URLLike): number | undefined;
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/build/esm/utils.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
// Much of the logic here overlaps with the same utils file in opentelemetry-instrumentation-fetch
|
|
6
|
-
// These may be unified in the future.
|
|
7
|
-
import * as api from '@opentelemetry/api';
|
|
8
|
-
import { getStringListFromEnv } from '@opentelemetry/core';
|
|
9
|
-
const DIAG_LOGGER = api.diag.createComponentLogger({
|
|
10
|
-
namespace: '@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils',
|
|
11
|
-
});
|
|
12
|
-
function isDocument(value) {
|
|
13
|
-
return typeof Document !== 'undefined' && value instanceof Document;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Helper function to determine payload content length for XHR requests
|
|
17
|
-
* @param body
|
|
18
|
-
* @returns content length
|
|
19
|
-
*/
|
|
20
|
-
export function getXHRBodyLength(body) {
|
|
21
|
-
if (isDocument(body)) {
|
|
22
|
-
return new XMLSerializer().serializeToString(document).length;
|
|
23
|
-
}
|
|
24
|
-
// XMLHttpRequestBodyInit expands to the following:
|
|
25
|
-
if (typeof body === 'string') {
|
|
26
|
-
return getByteLength(body);
|
|
27
|
-
}
|
|
28
|
-
if (body instanceof Blob) {
|
|
29
|
-
return body.size;
|
|
30
|
-
}
|
|
31
|
-
if (body instanceof FormData) {
|
|
32
|
-
return getFormDataSize(body);
|
|
33
|
-
}
|
|
34
|
-
if (body instanceof URLSearchParams) {
|
|
35
|
-
return getByteLength(body.toString());
|
|
36
|
-
}
|
|
37
|
-
// ArrayBuffer | ArrayBufferView
|
|
38
|
-
if (body.byteLength !== undefined) {
|
|
39
|
-
return body.byteLength;
|
|
40
|
-
}
|
|
41
|
-
DIAG_LOGGER.warn('unknown body type');
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const TEXT_ENCODER = new TextEncoder();
|
|
45
|
-
function getByteLength(s) {
|
|
46
|
-
return TEXT_ENCODER.encode(s).byteLength;
|
|
47
|
-
}
|
|
48
|
-
function getFormDataSize(formData) {
|
|
49
|
-
let size = 0;
|
|
50
|
-
for (const [key, value] of formData.entries()) {
|
|
51
|
-
size += key.length;
|
|
52
|
-
if (value instanceof Blob) {
|
|
53
|
-
size += value.size;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
size += value.length;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return size;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Normalize an HTTP request method string per `http.request.method` spec
|
|
63
|
-
* https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client-span
|
|
64
|
-
*/
|
|
65
|
-
export function normalizeHttpRequestMethod(method) {
|
|
66
|
-
const knownMethods = getKnownMethods();
|
|
67
|
-
const methUpper = method.toUpperCase();
|
|
68
|
-
if (methUpper in knownMethods) {
|
|
69
|
-
return methUpper;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return '_OTHER';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const DEFAULT_KNOWN_METHODS = {
|
|
76
|
-
CONNECT: true,
|
|
77
|
-
DELETE: true,
|
|
78
|
-
GET: true,
|
|
79
|
-
HEAD: true,
|
|
80
|
-
OPTIONS: true,
|
|
81
|
-
PATCH: true,
|
|
82
|
-
POST: true,
|
|
83
|
-
PUT: true,
|
|
84
|
-
TRACE: true,
|
|
85
|
-
// QUERY from https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/
|
|
86
|
-
QUERY: true,
|
|
87
|
-
};
|
|
88
|
-
let knownMethods;
|
|
89
|
-
function getKnownMethods() {
|
|
90
|
-
if (knownMethods === undefined) {
|
|
91
|
-
const cfgMethods = getStringListFromEnv('OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS');
|
|
92
|
-
if (cfgMethods && cfgMethods.length > 0) {
|
|
93
|
-
knownMethods = {};
|
|
94
|
-
cfgMethods.forEach(m => {
|
|
95
|
-
knownMethods[m] = true;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
knownMethods = DEFAULT_KNOWN_METHODS;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return knownMethods;
|
|
103
|
-
}
|
|
104
|
-
const HTTP_PORT_FROM_PROTOCOL = {
|
|
105
|
-
'https:': '443',
|
|
106
|
-
'http:': '80',
|
|
107
|
-
};
|
|
108
|
-
export function serverPortFromUrl(url) {
|
|
109
|
-
const serverPort = Number(url.port || HTTP_PORT_FROM_PROTOCOL[url.protocol]);
|
|
110
|
-
// Guard with `if (serverPort)` because `Number('') === 0`.
|
|
111
|
-
if (serverPort && !isNaN(serverPort)) {
|
|
112
|
-
return serverPort;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=utils.js.map
|
package/build/esm/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,kGAAkG;AAClG,sCAAs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AC;YACzB,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,YAAY,GAAG,qBAAqB,CAAC;SACtC;KACF;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,uBAAuB,GAA8B;IACzD,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,IAAI;CACd,CAAC;AACF,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7E,2DAA2D;IAC3D,IAAI,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Much of the logic here overlaps with the same utils file in opentelemetry-instrumentation-fetch\n// These may be unified in the future.\n\nimport * as api from '@opentelemetry/api';\nimport { getStringListFromEnv } from '@opentelemetry/core';\nimport type { URLLike } from '@opentelemetry/sdk-trace-web';\n\nconst DIAG_LOGGER = api.diag.createComponentLogger({\n namespace:\n '@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils',\n});\n\nfunction isDocument(value: unknown): value is Document {\n return typeof Document !== 'undefined' && value instanceof Document;\n}\n\n/**\n * Helper function to determine payload content length for XHR requests\n * @param body\n * @returns content length\n */\nexport function getXHRBodyLength(\n body: Document | XMLHttpRequestBodyInit\n): number | undefined {\n if (isDocument(body)) {\n return new XMLSerializer().serializeToString(document).length;\n }\n\n // XMLHttpRequestBodyInit expands to the following:\n if (typeof body === 'string') {\n return getByteLength(body);\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof FormData) {\n return getFormDataSize(body);\n }\n\n if (body instanceof URLSearchParams) {\n return getByteLength(body.toString());\n }\n\n // ArrayBuffer | ArrayBufferView\n if (body.byteLength !== undefined) {\n return body.byteLength;\n }\n\n DIAG_LOGGER.warn('unknown body type');\n return undefined;\n}\n\nconst TEXT_ENCODER = new TextEncoder();\nfunction getByteLength(s: string): number {\n return TEXT_ENCODER.encode(s).byteLength;\n}\n\nfunction getFormDataSize(formData: FormData): number {\n let size = 0;\n for (const [key, value] of formData.entries()) {\n size += key.length;\n if (value instanceof Blob) {\n size += value.size;\n } else {\n size += value.length;\n }\n }\n return size;\n}\n\n/**\n * Normalize an HTTP request method string per `http.request.method` spec\n * https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client-span\n */\nexport function normalizeHttpRequestMethod(method: string): string {\n const knownMethods = getKnownMethods();\n const methUpper = method.toUpperCase();\n if (methUpper in knownMethods) {\n return methUpper;\n } else {\n return '_OTHER';\n }\n}\n\nconst DEFAULT_KNOWN_METHODS = {\n CONNECT: true,\n DELETE: true,\n GET: true,\n HEAD: true,\n OPTIONS: true,\n PATCH: true,\n POST: true,\n PUT: true,\n TRACE: true,\n // QUERY from https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/\n QUERY: true,\n};\nlet knownMethods: { [key: string]: boolean };\nfunction getKnownMethods() {\n if (knownMethods === undefined) {\n const cfgMethods = getStringListFromEnv(\n 'OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS'\n );\n if (cfgMethods && cfgMethods.length > 0) {\n knownMethods = {};\n cfgMethods.forEach(m => {\n knownMethods[m] = true;\n });\n } else {\n knownMethods = DEFAULT_KNOWN_METHODS;\n }\n }\n return knownMethods;\n}\n\nconst HTTP_PORT_FROM_PROTOCOL: { [key: string]: string } = {\n 'https:': '443',\n 'http:': '80',\n};\nexport function serverPortFromUrl(url: URLLike): number | undefined {\n const serverPort = Number(url.port || HTTP_PORT_FROM_PROTOCOL[url.protocol]);\n // Guard with `if (serverPort)` because `Number('') === 0`.\n if (serverPort && !isNaN(serverPort)) {\n return serverPort;\n } else {\n return undefined;\n }\n}\n"]}
|
package/build/esm/version.d.ts
DELETED
package/build/esm/version.js
DELETED
package/build/esm/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0';\n"]}
|
package/build/esm/xhr.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import * as api from '@opentelemetry/api';
|
|
2
|
-
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
-
import { InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
4
|
-
import type { OpenFunction, PropagateTraceHeaderCorsUrls, SendFunction, XhrMem } from './types';
|
|
5
|
-
export type XHRCustomAttributeFunction = (span: api.Span, xhr: XMLHttpRequest) => void;
|
|
6
|
-
/**
|
|
7
|
-
* XMLHttpRequest config
|
|
8
|
-
*/
|
|
9
|
-
export interface XMLHttpRequestInstrumentationConfig extends InstrumentationConfig {
|
|
10
|
-
/**
|
|
11
|
-
* The number of timing resources is limited, after the limit
|
|
12
|
-
* (chrome 250, safari 150) the information is not collected anymore.
|
|
13
|
-
* The only way to prevent that is to regularly clean the resources
|
|
14
|
-
* whenever it is possible. This is needed only when PerformanceObserver
|
|
15
|
-
* is not available
|
|
16
|
-
*/
|
|
17
|
-
clearTimingResources?: boolean;
|
|
18
|
-
/** URLs which should include trace headers when origin doesn't match */
|
|
19
|
-
propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls;
|
|
20
|
-
/**
|
|
21
|
-
* URLs that partially match any regex in ignoreUrls will not be traced.
|
|
22
|
-
* In addition, URLs that are _exact matches_ of strings in ignoreUrls will
|
|
23
|
-
* also not be traced.
|
|
24
|
-
*/
|
|
25
|
-
ignoreUrls?: Array<string | RegExp>;
|
|
26
|
-
/** Function for adding custom attributes on the span */
|
|
27
|
-
applyCustomAttributesOnSpan?: XHRCustomAttributeFunction;
|
|
28
|
-
/** Ignore adding network events as span events */
|
|
29
|
-
ignoreNetworkEvents?: boolean;
|
|
30
|
-
/** Measure outgoing request size */
|
|
31
|
-
measureRequestSize?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* This class represents a XMLHttpRequest plugin for auto instrumentation
|
|
35
|
-
*/
|
|
36
|
-
export declare class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRequestInstrumentationConfig> {
|
|
37
|
-
readonly component: string;
|
|
38
|
-
readonly version: string;
|
|
39
|
-
moduleName: string;
|
|
40
|
-
private _tasksCount;
|
|
41
|
-
private _xhrMem;
|
|
42
|
-
private _usedResources;
|
|
43
|
-
private _isEnabled;
|
|
44
|
-
private _isXhrPatched;
|
|
45
|
-
constructor(config?: XMLHttpRequestInstrumentationConfig);
|
|
46
|
-
init(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Adds custom headers to XMLHttpRequest
|
|
49
|
-
* @param xhr
|
|
50
|
-
* @param spanUrl
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
private _addHeaders;
|
|
54
|
-
/**
|
|
55
|
-
* Add cors pre flight child span
|
|
56
|
-
* @param span
|
|
57
|
-
* @param corsPreFlightRequest
|
|
58
|
-
* @private
|
|
59
|
-
*/
|
|
60
|
-
private _addChildSpan;
|
|
61
|
-
/**
|
|
62
|
-
* Add attributes when span is going to end
|
|
63
|
-
* @param span
|
|
64
|
-
* @param xhr
|
|
65
|
-
* @private
|
|
66
|
-
*/
|
|
67
|
-
_addFinalSpanAttributes(span: api.Span, xhrMem: XhrMem): void;
|
|
68
|
-
private _applyAttributesAfterXHR;
|
|
69
|
-
/**
|
|
70
|
-
* will collect information about all resources created
|
|
71
|
-
* between "send" and "end" with additional waiting for main resource
|
|
72
|
-
* @param xhr
|
|
73
|
-
* @param spanUrl
|
|
74
|
-
* @private
|
|
75
|
-
*/
|
|
76
|
-
private _addResourceObserver;
|
|
77
|
-
/**
|
|
78
|
-
* Clears the resource timings and all resources assigned with spans
|
|
79
|
-
* when {@link XMLHttpRequestInstrumentationConfig.clearTimingResources} is
|
|
80
|
-
* set to true (default false)
|
|
81
|
-
* @private
|
|
82
|
-
*/
|
|
83
|
-
private _clearResources;
|
|
84
|
-
/**
|
|
85
|
-
* Finds appropriate resource and add network events to the span
|
|
86
|
-
* @param span
|
|
87
|
-
*/
|
|
88
|
-
private _findResourceAndAddNetworkEvents;
|
|
89
|
-
/**
|
|
90
|
-
* Removes the previous information about span.
|
|
91
|
-
* This might happened when the same xhr is used again.
|
|
92
|
-
* @param xhr
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
private _cleanPreviousSpanInformation;
|
|
96
|
-
/**
|
|
97
|
-
* Creates a new span when method "open" is called
|
|
98
|
-
* @param xhr
|
|
99
|
-
* @param url
|
|
100
|
-
* @param method
|
|
101
|
-
* @private
|
|
102
|
-
*/
|
|
103
|
-
private _createSpan;
|
|
104
|
-
/**
|
|
105
|
-
* Marks certain [resource]{@link PerformanceResourceTiming} when information
|
|
106
|
-
* from this is used to add events to span.
|
|
107
|
-
* This is done to avoid reusing the same resource again for next span
|
|
108
|
-
* @param resource
|
|
109
|
-
* @private
|
|
110
|
-
*/
|
|
111
|
-
private _markResourceAsUsed;
|
|
112
|
-
/**
|
|
113
|
-
* Patches the method open
|
|
114
|
-
* @private
|
|
115
|
-
*/
|
|
116
|
-
protected _patchOpen(): (original: OpenFunction) => OpenFunction;
|
|
117
|
-
/**
|
|
118
|
-
* Patches the method send
|
|
119
|
-
* @private
|
|
120
|
-
*/
|
|
121
|
-
protected _patchSend(): (original: SendFunction) => SendFunction;
|
|
122
|
-
/**
|
|
123
|
-
* implements enable function
|
|
124
|
-
*/
|
|
125
|
-
enable(): void;
|
|
126
|
-
/**
|
|
127
|
-
* implements disable function
|
|
128
|
-
*/
|
|
129
|
-
disable(): void;
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=xhr.d.ts.map
|