@getlimelight/sdk 0.4.0 → 0.4.2
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 +42 -420
- package/dist/index.d.mts +46 -2
- package/dist/index.d.ts +46 -2
- package/dist/index.js +235 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48,17 +48,17 @@ var BodyFormat = /* @__PURE__ */ ((BodyFormat2) => {
|
|
|
48
48
|
BodyFormat2["UNSERIALIZABLE"] = "UNSERIALIZABLE";
|
|
49
49
|
return BodyFormat2;
|
|
50
50
|
})(BodyFormat || {});
|
|
51
|
-
var HttpMethod = /* @__PURE__ */ ((
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
51
|
+
var HttpMethod = /* @__PURE__ */ ((HttpMethod5) => {
|
|
52
|
+
HttpMethod5["GET"] = "GET";
|
|
53
|
+
HttpMethod5["POST"] = "POST";
|
|
54
|
+
HttpMethod5["PUT"] = "PUT";
|
|
55
|
+
HttpMethod5["PATCH"] = "PATCH";
|
|
56
|
+
HttpMethod5["DELETE"] = "DELETE";
|
|
57
|
+
HttpMethod5["HEAD"] = "HEAD";
|
|
58
|
+
HttpMethod5["OPTIONS"] = "OPTIONS";
|
|
59
|
+
HttpMethod5["TRACE"] = "TRACE";
|
|
60
|
+
HttpMethod5["CONNECT"] = "CONNECT";
|
|
61
|
+
return HttpMethod5;
|
|
62
62
|
})(HttpMethod || {});
|
|
63
63
|
var HttpStatusClass = /* @__PURE__ */ ((HttpStatusClass2) => {
|
|
64
64
|
HttpStatusClass2[HttpStatusClass2["INFORMATIONAL"] = 100] = "INFORMATIONAL";
|
|
@@ -199,6 +199,15 @@ var parseGraphQL = (body) => {
|
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
+
// src/helpers/graphql/normalizeOperationType.ts
|
|
203
|
+
var normalizeOperationType = (type) => {
|
|
204
|
+
if (!type) return null;
|
|
205
|
+
if (type === "query") return "query";
|
|
206
|
+
if (type === "mutation") return "mutation";
|
|
207
|
+
if (type === "subscription") return "subscription";
|
|
208
|
+
return type;
|
|
209
|
+
};
|
|
210
|
+
|
|
202
211
|
// src/constants/index.ts
|
|
203
212
|
var SENSITIVE_HEADERS = [
|
|
204
213
|
"authorization",
|
|
@@ -222,7 +231,7 @@ var SENSITIVE_HEADERS = [
|
|
|
222
231
|
var LIMELIGHT_WEB_WSS_URL = "wss://api.getlimelight.io";
|
|
223
232
|
var LIMELIGHT_DESKTOP_WSS_URL = "ws://localhost:8484";
|
|
224
233
|
var WS_PATH = "/limelight";
|
|
225
|
-
var SDK_VERSION = true ? "0.4.
|
|
234
|
+
var SDK_VERSION = true ? "0.4.2" : "test-version";
|
|
226
235
|
var RENDER_THRESHOLDS = {
|
|
227
236
|
HOT_VELOCITY: 5,
|
|
228
237
|
HIGH_RENDER_COUNT: 50,
|
|
@@ -532,7 +541,7 @@ var ConsoleInterceptor = class {
|
|
|
532
541
|
*/
|
|
533
542
|
setup(config) {
|
|
534
543
|
if (this.isSetup) {
|
|
535
|
-
if (this.config?.
|
|
544
|
+
if (this.config?.enableInternalLogging) {
|
|
536
545
|
console.warn("[Limelight] Console interceptor already set up");
|
|
537
546
|
}
|
|
538
547
|
return;
|
|
@@ -618,7 +627,7 @@ var ConsoleInterceptor = class {
|
|
|
618
627
|
*/
|
|
619
628
|
cleanup() {
|
|
620
629
|
if (!this.isSetup) {
|
|
621
|
-
if (this.config?.
|
|
630
|
+
if (this.config?.enableInternalLogging) {
|
|
622
631
|
console.warn("[Limelight] Console interceptor not set up");
|
|
623
632
|
}
|
|
624
633
|
return;
|
|
@@ -660,7 +669,7 @@ var NetworkInterceptor = class {
|
|
|
660
669
|
*/
|
|
661
670
|
setup(config) {
|
|
662
671
|
if (this.isSetup) {
|
|
663
|
-
if (this.config?.
|
|
672
|
+
if (this.config?.enableInternalLogging) {
|
|
664
673
|
console.warn("[Limelight] Network interceptor already set up");
|
|
665
674
|
}
|
|
666
675
|
return;
|
|
@@ -698,7 +707,7 @@ var NetworkInterceptor = class {
|
|
|
698
707
|
}
|
|
699
708
|
} catch {
|
|
700
709
|
requestBodyToSerialize = void 0;
|
|
701
|
-
if (self.config?.
|
|
710
|
+
if (self.config?.enableInternalLogging) {
|
|
702
711
|
console.warn(
|
|
703
712
|
"[Limelight] Failed to read request body from Request object"
|
|
704
713
|
);
|
|
@@ -819,7 +828,7 @@ var NetworkInterceptor = class {
|
|
|
819
828
|
*/
|
|
820
829
|
cleanup() {
|
|
821
830
|
if (!this.isSetup) {
|
|
822
|
-
if (this.config?.
|
|
831
|
+
if (this.config?.enableInternalLogging) {
|
|
823
832
|
console.warn("[Limelight] Network interceptor not set up");
|
|
824
833
|
}
|
|
825
834
|
return;
|
|
@@ -852,7 +861,7 @@ var XHRInterceptor = class {
|
|
|
852
861
|
*/
|
|
853
862
|
setup(config) {
|
|
854
863
|
if (this.isSetup) {
|
|
855
|
-
if (this.config?.
|
|
864
|
+
if (this.config?.enableInternalLogging) {
|
|
856
865
|
console.warn("[Limelight] XHR interceptor already set up");
|
|
857
866
|
}
|
|
858
867
|
return;
|
|
@@ -1066,7 +1075,7 @@ var XHRInterceptor = class {
|
|
|
1066
1075
|
*/
|
|
1067
1076
|
cleanup() {
|
|
1068
1077
|
if (!this.isSetup) {
|
|
1069
|
-
if (this.config?.
|
|
1078
|
+
if (this.config?.enableInternalLogging) {
|
|
1070
1079
|
console.warn("[Limelight] XHR interceptor not set up");
|
|
1071
1080
|
}
|
|
1072
1081
|
return;
|
|
@@ -1100,14 +1109,14 @@ var RenderInterceptor = class {
|
|
|
1100
1109
|
}
|
|
1101
1110
|
setup(config) {
|
|
1102
1111
|
if (this.isSetup) {
|
|
1103
|
-
if (this.config?.
|
|
1112
|
+
if (this.config?.enableInternalLogging) {
|
|
1104
1113
|
console.warn("[Limelight] Render interceptor already set up");
|
|
1105
1114
|
}
|
|
1106
1115
|
return;
|
|
1107
1116
|
}
|
|
1108
1117
|
this.config = config;
|
|
1109
1118
|
if (!this.installHook()) {
|
|
1110
|
-
if (this.config?.
|
|
1119
|
+
if (this.config?.enableInternalLogging) {
|
|
1111
1120
|
console.warn("[Limelight] Failed to install render hook");
|
|
1112
1121
|
}
|
|
1113
1122
|
return;
|
|
@@ -1178,7 +1187,7 @@ var RenderInterceptor = class {
|
|
|
1178
1187
|
this.countRenderedComponents(root.current);
|
|
1179
1188
|
this.walkFiberTree(root.current, null, 0);
|
|
1180
1189
|
} catch (error) {
|
|
1181
|
-
if (this.config?.
|
|
1190
|
+
if (this.config?.enableInternalLogging) {
|
|
1182
1191
|
console.warn("[Limelight] Error processing fiber tree:", error);
|
|
1183
1192
|
}
|
|
1184
1193
|
}
|
|
@@ -1896,6 +1905,165 @@ var StateInterceptor = class {
|
|
|
1896
1905
|
}
|
|
1897
1906
|
};
|
|
1898
1907
|
|
|
1908
|
+
// src/limelight/interceptors/RequestBridge.ts
|
|
1909
|
+
var RequestBridge = class {
|
|
1910
|
+
constructor(sendMessage, getSessionId) {
|
|
1911
|
+
this.sendMessage = sendMessage;
|
|
1912
|
+
this.getSessionId = getSessionId;
|
|
1913
|
+
}
|
|
1914
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
1915
|
+
config = null;
|
|
1916
|
+
/**
|
|
1917
|
+
* Updates the config reference (called when LimelightClient configures)
|
|
1918
|
+
* @param config The new Limelight configuration or null to disable
|
|
1919
|
+
*/
|
|
1920
|
+
setConfig(config) {
|
|
1921
|
+
this.config = config;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Starts tracking a manual request. Returns a requestId to use with endRequest/failRequest.
|
|
1925
|
+
* @param config The request configuration
|
|
1926
|
+
* @returns The generated request ID
|
|
1927
|
+
*/
|
|
1928
|
+
startRequest(config) {
|
|
1929
|
+
const requestId = generateRequestId();
|
|
1930
|
+
const startTime = Date.now();
|
|
1931
|
+
this.pendingRequests.set(requestId, { startTime, config });
|
|
1932
|
+
const method = config.method?.toUpperCase() || "POST";
|
|
1933
|
+
const headers = config.headers || {};
|
|
1934
|
+
const requestBody = serializeBody(
|
|
1935
|
+
typeof config.body === "string" ? config.body : JSON.stringify(config.body),
|
|
1936
|
+
this.config?.disableBodyCapture
|
|
1937
|
+
);
|
|
1938
|
+
let requestEvent = {
|
|
1939
|
+
id: requestId,
|
|
1940
|
+
sessionId: this.getSessionId(),
|
|
1941
|
+
timestamp: startTime,
|
|
1942
|
+
phase: "REQUEST" /* REQUEST */,
|
|
1943
|
+
networkType: "fetch" /* FETCH */,
|
|
1944
|
+
url: config.url,
|
|
1945
|
+
method,
|
|
1946
|
+
headers: redactSensitiveHeaders(headers),
|
|
1947
|
+
body: requestBody,
|
|
1948
|
+
name: config.name || formatRequestName(config.url),
|
|
1949
|
+
initiator: "manual",
|
|
1950
|
+
requestSize: requestBody?.size ?? 0,
|
|
1951
|
+
graphql: config.graphql ? {
|
|
1952
|
+
operationName: config.graphql.operationName,
|
|
1953
|
+
operationType: normalizeOperationType(config.graphql.operationType),
|
|
1954
|
+
variables: config.graphql.variables,
|
|
1955
|
+
query: config.graphql.query
|
|
1956
|
+
} : void 0
|
|
1957
|
+
};
|
|
1958
|
+
if (this.config?.beforeSend) {
|
|
1959
|
+
const modifiedEvent = this.config.beforeSend(requestEvent);
|
|
1960
|
+
if (!modifiedEvent) {
|
|
1961
|
+
this.pendingRequests.delete(requestId);
|
|
1962
|
+
return requestId;
|
|
1963
|
+
}
|
|
1964
|
+
if (modifiedEvent.phase !== "REQUEST" /* REQUEST */) {
|
|
1965
|
+
console.error("[Limelight] beforeSend must return same event type");
|
|
1966
|
+
return requestId;
|
|
1967
|
+
}
|
|
1968
|
+
requestEvent = modifiedEvent;
|
|
1969
|
+
}
|
|
1970
|
+
this.sendMessage(requestEvent);
|
|
1971
|
+
return requestId;
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Completes a tracked request with a successful response.
|
|
1975
|
+
* @param requestId The ID returned from startRequest
|
|
1976
|
+
* @param response The response data
|
|
1977
|
+
*/
|
|
1978
|
+
endRequest(requestId, response) {
|
|
1979
|
+
const pending = this.pendingRequests.get(requestId);
|
|
1980
|
+
if (!pending) {
|
|
1981
|
+
if (this.config?.enableInternalLogging) {
|
|
1982
|
+
console.warn(
|
|
1983
|
+
`[Limelight] No pending request found for id: ${requestId}`
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
this.pendingRequests.delete(requestId);
|
|
1989
|
+
const endTime = Date.now();
|
|
1990
|
+
const duration = endTime - pending.startTime;
|
|
1991
|
+
const responseHeaders = response.headers || {};
|
|
1992
|
+
const responseBody = serializeBody(
|
|
1993
|
+
typeof response.body === "string" ? response.body : JSON.stringify(response.body),
|
|
1994
|
+
this.config?.disableBodyCapture
|
|
1995
|
+
);
|
|
1996
|
+
let responseEvent = {
|
|
1997
|
+
id: requestId,
|
|
1998
|
+
sessionId: this.getSessionId(),
|
|
1999
|
+
timestamp: endTime,
|
|
2000
|
+
phase: "RESPONSE" /* RESPONSE */,
|
|
2001
|
+
networkType: "fetch" /* FETCH */,
|
|
2002
|
+
status: response.status,
|
|
2003
|
+
statusText: response.statusText || "",
|
|
2004
|
+
headers: redactSensitiveHeaders(responseHeaders),
|
|
2005
|
+
body: responseBody,
|
|
2006
|
+
duration,
|
|
2007
|
+
responseSize: responseBody?.size ?? 0,
|
|
2008
|
+
redirected: false,
|
|
2009
|
+
ok: response.status >= 200 && response.status < 300
|
|
2010
|
+
};
|
|
2011
|
+
if (this.config?.beforeSend) {
|
|
2012
|
+
const modifiedEvent = this.config.beforeSend(responseEvent);
|
|
2013
|
+
if (!modifiedEvent) {
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
if (modifiedEvent.phase !== "RESPONSE" /* RESPONSE */) {
|
|
2017
|
+
console.error("[Limelight] beforeSend must return same event type");
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
responseEvent = modifiedEvent;
|
|
2021
|
+
}
|
|
2022
|
+
this.sendMessage(responseEvent);
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Completes a tracked request with an error.
|
|
2026
|
+
* @param requestId The ID returned from startRequest
|
|
2027
|
+
* @param error The error object or message
|
|
2028
|
+
*/
|
|
2029
|
+
failRequest(requestId, error) {
|
|
2030
|
+
const pending = this.pendingRequests.get(requestId);
|
|
2031
|
+
if (!pending) {
|
|
2032
|
+
if (this.config?.enableInternalLogging) {
|
|
2033
|
+
console.warn(
|
|
2034
|
+
`[Limelight] No pending request found for id: ${requestId}`
|
|
2035
|
+
);
|
|
2036
|
+
}
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
this.pendingRequests.delete(requestId);
|
|
2040
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2041
|
+
const errorStack = error instanceof Error ? error.stack : void 0;
|
|
2042
|
+
let errorEvent = {
|
|
2043
|
+
id: requestId,
|
|
2044
|
+
sessionId: this.getSessionId(),
|
|
2045
|
+
timestamp: Date.now(),
|
|
2046
|
+
phase: "ERROR" /* ERROR */,
|
|
2047
|
+
networkType: "fetch" /* FETCH */,
|
|
2048
|
+
errorMessage,
|
|
2049
|
+
stack: errorStack
|
|
2050
|
+
};
|
|
2051
|
+
if (this.config?.beforeSend) {
|
|
2052
|
+
const modifiedEvent = this.config.beforeSend(errorEvent);
|
|
2053
|
+
if (modifiedEvent && modifiedEvent.phase === "ERROR" /* ERROR */) {
|
|
2054
|
+
errorEvent = modifiedEvent;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
this.sendMessage(errorEvent);
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* Cleans up any pending requests (called on disconnect)
|
|
2061
|
+
*/
|
|
2062
|
+
cleanup() {
|
|
2063
|
+
this.pendingRequests.clear();
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
|
|
1899
2067
|
// src/limelight/LimelightClient.ts
|
|
1900
2068
|
var LimelightClient = class {
|
|
1901
2069
|
ws = null;
|
|
@@ -1912,6 +2080,7 @@ var LimelightClient = class {
|
|
|
1912
2080
|
consoleInterceptor;
|
|
1913
2081
|
renderInterceptor;
|
|
1914
2082
|
stateInterceptor;
|
|
2083
|
+
requestBridge;
|
|
1915
2084
|
constructor() {
|
|
1916
2085
|
this.networkInterceptor = new NetworkInterceptor(
|
|
1917
2086
|
this.sendMessage.bind(this),
|
|
@@ -1933,6 +2102,10 @@ var LimelightClient = class {
|
|
|
1933
2102
|
this.sendMessage.bind(this),
|
|
1934
2103
|
() => this.sessionId
|
|
1935
2104
|
);
|
|
2105
|
+
this.requestBridge = new RequestBridge(
|
|
2106
|
+
this.sendMessage.bind(this),
|
|
2107
|
+
() => this.sessionId
|
|
2108
|
+
);
|
|
1936
2109
|
}
|
|
1937
2110
|
/**
|
|
1938
2111
|
* Configures the Limelight client with the provided settings.
|
|
@@ -1955,12 +2128,13 @@ var LimelightClient = class {
|
|
|
1955
2128
|
enableGraphQL: config?.enableGraphQL ?? true,
|
|
1956
2129
|
enableRenderInspector: config?.enableRenderInspector ?? true,
|
|
1957
2130
|
enableStateInspector: config?.enableStateInspector ?? true,
|
|
1958
|
-
|
|
2131
|
+
enableInternalLogging: config?.enableInternalLogging ?? false
|
|
1959
2132
|
};
|
|
1960
2133
|
if (!this.config?.enabled) {
|
|
1961
2134
|
return;
|
|
1962
2135
|
}
|
|
1963
2136
|
this.sessionId = createSessionId();
|
|
2137
|
+
this.requestBridge.setConfig(this.config);
|
|
1964
2138
|
try {
|
|
1965
2139
|
if (this.config.enableNetworkInspector) {
|
|
1966
2140
|
this.networkInterceptor.setup(this.config);
|
|
@@ -1976,7 +2150,7 @@ var LimelightClient = class {
|
|
|
1976
2150
|
this.stateInterceptor.setup(this.config);
|
|
1977
2151
|
}
|
|
1978
2152
|
} catch (error) {
|
|
1979
|
-
if (this.config?.
|
|
2153
|
+
if (this.config?.enableInternalLogging) {
|
|
1980
2154
|
console.error("[Limelight] Failed to setup interceptors:", error);
|
|
1981
2155
|
}
|
|
1982
2156
|
}
|
|
@@ -1998,7 +2172,7 @@ var LimelightClient = class {
|
|
|
1998
2172
|
return;
|
|
1999
2173
|
}
|
|
2000
2174
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
2001
|
-
if (this.config?.
|
|
2175
|
+
if (this.config?.enableInternalLogging) {
|
|
2002
2176
|
console.warn("[Limelight] Already connected. Call disconnect() first.");
|
|
2003
2177
|
}
|
|
2004
2178
|
return;
|
|
@@ -2015,7 +2189,7 @@ var LimelightClient = class {
|
|
|
2015
2189
|
}
|
|
2016
2190
|
const { serverUrl, appName, platform } = this.config;
|
|
2017
2191
|
if (!serverUrl) {
|
|
2018
|
-
if (this.config?.
|
|
2192
|
+
if (this.config?.enableInternalLogging) {
|
|
2019
2193
|
console.error("[Limelight] serverUrl missing in configuration.");
|
|
2020
2194
|
}
|
|
2021
2195
|
return;
|
|
@@ -2039,7 +2213,7 @@ var LimelightClient = class {
|
|
|
2039
2213
|
this.sendMessage(message);
|
|
2040
2214
|
};
|
|
2041
2215
|
this.ws.onerror = (error) => {
|
|
2042
|
-
if (this.config?.
|
|
2216
|
+
if (this.config?.enableInternalLogging) {
|
|
2043
2217
|
console.error("[Limelight] WebSocket error:", error);
|
|
2044
2218
|
}
|
|
2045
2219
|
};
|
|
@@ -2047,7 +2221,7 @@ var LimelightClient = class {
|
|
|
2047
2221
|
this.attemptReconnect();
|
|
2048
2222
|
};
|
|
2049
2223
|
} catch (error) {
|
|
2050
|
-
if (this.config?.
|
|
2224
|
+
if (this.config?.enableInternalLogging) {
|
|
2051
2225
|
console.error("[Limelight] Failed to connect:", error);
|
|
2052
2226
|
}
|
|
2053
2227
|
this.attemptReconnect();
|
|
@@ -2091,7 +2265,7 @@ var LimelightClient = class {
|
|
|
2091
2265
|
try {
|
|
2092
2266
|
this.ws.send(safeStringify(message));
|
|
2093
2267
|
} catch (error) {
|
|
2094
|
-
if (this.config?.
|
|
2268
|
+
if (this.config?.enableInternalLogging) {
|
|
2095
2269
|
console.error("[Limelight] Failed to send queued message:", error);
|
|
2096
2270
|
}
|
|
2097
2271
|
}
|
|
@@ -2112,7 +2286,7 @@ var LimelightClient = class {
|
|
|
2112
2286
|
try {
|
|
2113
2287
|
this.ws.send(safeStringify(message));
|
|
2114
2288
|
} catch (error) {
|
|
2115
|
-
if (this.config?.
|
|
2289
|
+
if (this.config?.enableInternalLogging) {
|
|
2116
2290
|
console.error("[Limelight] Failed to send message:", error);
|
|
2117
2291
|
}
|
|
2118
2292
|
this.messageQueue.push(message);
|
|
@@ -2122,7 +2296,7 @@ var LimelightClient = class {
|
|
|
2122
2296
|
}
|
|
2123
2297
|
} else {
|
|
2124
2298
|
if (this.messageQueue.length >= this.maxQueueSize) {
|
|
2125
|
-
if (this.config?.
|
|
2299
|
+
if (this.config?.enableInternalLogging) {
|
|
2126
2300
|
console.warn(
|
|
2127
2301
|
"[Limelight] Message queue full, dropping oldest message"
|
|
2128
2302
|
);
|
|
@@ -2168,6 +2342,7 @@ var LimelightClient = class {
|
|
|
2168
2342
|
this.consoleInterceptor.cleanup();
|
|
2169
2343
|
this.renderInterceptor.cleanup();
|
|
2170
2344
|
this.stateInterceptor.cleanup();
|
|
2345
|
+
this.requestBridge.cleanup();
|
|
2171
2346
|
this.reconnectAttempts = 0;
|
|
2172
2347
|
this.messageQueue = [];
|
|
2173
2348
|
}
|
|
@@ -2182,6 +2357,35 @@ var LimelightClient = class {
|
|
|
2182
2357
|
this.config = null;
|
|
2183
2358
|
this.sessionId = "";
|
|
2184
2359
|
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Manually register a request with Limelight.
|
|
2362
|
+
* Use this when your app makes network requests outside of fetch/XHR
|
|
2363
|
+
* (e.g., through native modules).
|
|
2364
|
+
*
|
|
2365
|
+
* @param config - Request configuration
|
|
2366
|
+
* @returns A request ID to use with endRequest() or failRequest()
|
|
2367
|
+
*/
|
|
2368
|
+
startRequest(config) {
|
|
2369
|
+
return this.requestBridge.startRequest(config);
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Complete a manually tracked request with a successful response.
|
|
2373
|
+
*
|
|
2374
|
+
* @param requestId - The ID returned from startRequest()
|
|
2375
|
+
* @param response - Response data
|
|
2376
|
+
*/
|
|
2377
|
+
endRequest(requestId, response) {
|
|
2378
|
+
this.requestBridge.endRequest(requestId, response);
|
|
2379
|
+
}
|
|
2380
|
+
/**
|
|
2381
|
+
* Complete a manually tracked request with an error.
|
|
2382
|
+
*
|
|
2383
|
+
* @param requestId - The ID returned from startRequest()
|
|
2384
|
+
* @param error - The error that occurred
|
|
2385
|
+
*/
|
|
2386
|
+
failRequest(requestId, error) {
|
|
2387
|
+
this.requestBridge.failRequest(requestId, error);
|
|
2388
|
+
}
|
|
2185
2389
|
};
|
|
2186
2390
|
var Limelight = new LimelightClient();
|
|
2187
2391
|
export {
|