mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: replace var usage with let/const (#7064)
This commit is contained in:
@@ -36,7 +36,7 @@ export namespace domains {
|
||||
}
|
||||
}
|
||||
|
||||
var network;
|
||||
let network;
|
||||
|
||||
export function getNetwork(): domains.network.NetworkDomainDebugger {
|
||||
return network;
|
||||
@@ -45,7 +45,7 @@ export function setNetwork(newNetwork: domains.network.NetworkDomainDebugger) {
|
||||
network = newNetwork;
|
||||
}
|
||||
|
||||
var dom;
|
||||
let dom;
|
||||
|
||||
export function getDOM(): any {
|
||||
return dom;
|
||||
@@ -55,7 +55,7 @@ export function setDOM(newDOM) {
|
||||
dom = newDOM;
|
||||
}
|
||||
|
||||
var css;
|
||||
let css;
|
||||
|
||||
export function getCSS(): any {
|
||||
return css;
|
||||
@@ -121,7 +121,7 @@ export namespace NetworkAgent {
|
||||
// Content-Type and content-type are both common in headers spelling
|
||||
const mimeType: string = <string>headers["Content-Type"] || <string>headers["content-type"] || "application/octet-stream";
|
||||
const contentLengthHeader: string = <string>headers["Content-Length"] || <string>headers["content-length"];
|
||||
var contentLength = parseInt(contentLengthHeader, 10);
|
||||
let contentLength = parseInt(contentLengthHeader, 10);
|
||||
if (isNaN(contentLength)) {
|
||||
contentLength = 0;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ export namespace NetworkAgent {
|
||||
}
|
||||
|
||||
function getTimeStamp(): number {
|
||||
var d = new Date();
|
||||
const d = new Date();
|
||||
return Math.round(d.getTime() / 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as inspectorCommandTypes from "./InspectorBackendCommands.ios";
|
||||
var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
const inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
|
||||
import * as debuggerDomains from "./debugger";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as inspectorCommandTypes from "./InspectorBackendCommands.ios";
|
||||
var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
// var inspectorCommandTypes: any = inspectorCommands;
|
||||
const inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
|
||||
import * as debuggerDomains from "./debugger";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as inspectorCommandTypes from "./InspectorBackendCommands.ios";
|
||||
var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
const inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
|
||||
|
||||
import * as debuggerDomains from "./debugger";
|
||||
|
||||
@@ -10,9 +10,9 @@ declare var __inspectorTimestamp;
|
||||
const frameId = "NativeScriptMainFrameIdentifier";
|
||||
const loaderId = "Loader Identifier";
|
||||
|
||||
var resources_datas = [];
|
||||
const resources_datas = [];
|
||||
|
||||
var documentTypeByMimeType = {
|
||||
const documentTypeByMimeType = {
|
||||
"text/xml": "Document",
|
||||
"text/plain": "Document",
|
||||
"text/html": "Document",
|
||||
@@ -54,7 +54,7 @@ export class Request {
|
||||
|
||||
this._mimeType = value;
|
||||
|
||||
var resourceType = "Other";
|
||||
let resourceType = "Other";
|
||||
|
||||
if (this._mimeType in documentTypeByMimeType) {
|
||||
resourceType = documentTypeByMimeType[this._mimeType];
|
||||
@@ -169,8 +169,8 @@ export class NetworkDomainDebugger implements inspectorCommandTypes.NetworkDomai
|
||||
* Returns content served for the given request.
|
||||
*/
|
||||
getResponseBody(params: inspectorCommandTypes.NetworkDomain.GetResponseBodyMethodArguments): { body: string, base64Encoded: boolean } {
|
||||
var resource_data = resources_datas[params.requestId];
|
||||
var body = resource_data.hasTextContent ? NSString.alloc().initWithDataEncoding(resource_data.data, 4).toString() :
|
||||
const resource_data = resources_datas[params.requestId];
|
||||
const body = resource_data.hasTextContent ? NSString.alloc().initWithDataEncoding(resource_data.data, 4).toString() :
|
||||
resource_data.data.base64EncodedStringWithOptions(0);
|
||||
|
||||
if (resource_data) {
|
||||
|
||||
Reference in New Issue
Block a user