From 52a5bf8b520d1e38001448402583fe332d4de3be Mon Sep 17 00:00:00 2001 From: lishutong Date: Thu, 1 Jul 2021 20:56:08 +0000 Subject: [PATCH] Add some comments for a consistent javascript style. Follow the requirement of: https://google.github.io/styleguide/jsguide.html#jsdoc-top-file-level-comments Test: Mannual tested. Change-Id: I697879384f64120a0effda00e70ec1b20260746b --- tools/otagui/src/services/echarts_data.js | 4 ++-- tools/otagui/src/services/payload.js | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/otagui/src/services/echarts_data.js b/tools/otagui/src/services/echarts_data.js index f75e2038c..d45b2eabe 100644 --- a/tools/otagui/src/services/echarts_data.js +++ b/tools/otagui/src/services/echarts_data.js @@ -17,7 +17,7 @@ export class EchartsData { * @return {String} A list of [key, value]. */ listData() { - let table = '' + let /** String */ table = '' for (let [key, value] of this.statisticData) { table += key + ' : ' + value.toString() + ' Blocks' + '\n' } @@ -32,7 +32,7 @@ export class EchartsData { * @return {Object} an ECharts option object. */ getEchartsOption() { - let option = new Object() + let /** Object */ option = new Object() option.title = { text: this.title, left: "center" diff --git a/tools/otagui/src/services/payload.js b/tools/otagui/src/services/payload.js index 1bfd254e3..542a58246 100644 --- a/tools/otagui/src/services/payload.js +++ b/tools/otagui/src/services/payload.js @@ -10,11 +10,11 @@ import * as zip from '@zip.js/zip.js/dist/zip-full.min.js' import { chromeos_update_engine as update_metadata_pb } from './update_metadata_pb.js' -const _MAGIC = 'CrAU' -const _VERSION_SIZE = 8 -const _MANIFEST_LEN_SIZE = 8 -const _METADATA_SIGNATURE_LEN_SIZE = 4 -const _BRILLO_MAJOR_PAYLOAD_VERSION = 2 +const /** Number */ _MAGIC = 'CrAU' +const /** Number */ _VERSION_SIZE = 8 +const /** Number */ _MANIFEST_LEN_SIZE = 8 +const /** Number */ _METADATA_SIGNATURE_LEN_SIZE = 4 +const /** Number */ _BRILLO_MAJOR_PAYLOAD_VERSION = 2 export class Payload { /** @@ -27,7 +27,7 @@ export class Payload { } async unzipPayload() { - let entries = await this.packedFile.getEntries() + let /** Array */ entries = await this.packedFile.getEntries() this.payload = null for (let entry of entries) { if (entry.filename == 'payload.bin') { @@ -48,7 +48,7 @@ export class Payload { * @return {Int} an integer. */ readInt(size) { - let view = new DataView( + let /** DataView */ view = new DataView( this.buffer.slice(this.cursor, this.cursor + size)) this.cursor += size switch (size) { @@ -64,7 +64,7 @@ export class Payload { } readHeader() { - let decoder = new TextDecoder() + let /** TextDecoder */ decoder = new TextDecoder() try { this.magic = decoder.decode( this.buffer.slice(this.cursor, _MAGIC.length)) @@ -89,7 +89,7 @@ export class Payload { * aosp/system/update_engine/update_metadata.proto */ readManifest() { - let manifest_raw = new Uint8Array(this.buffer.slice( + let /** Array */ manifest_raw = new Uint8Array(this.buffer.slice( this.cursor, this.cursor + this.manifest_len )) this.cursor += this.manifest_len @@ -98,7 +98,7 @@ export class Payload { } readSignature() { - let signature_raw = new Uint8Array(this.buffer.slice( + let /** Array*/ signature_raw = new Uint8Array(this.buffer.slice( this.cursor, this.cursor + this.metadata_signature_len )) this.cursor += this.metadata_signature_len @@ -122,7 +122,7 @@ export class OpType { * update_metadata.proto and must be decoded before any usage. */ constructor() { - let types = update_metadata_pb.InstallOperation.Type + let /** Array<{String: Number}>*/ types = update_metadata_pb.InstallOperation.Type this.mapType = new Map() for (let key in types) { this.mapType.set(types[key], key)