nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
generatePin
生成4位数字PIN码
static generatePin(): string { return CryptoUtil.generatePin(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generatePin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static generatePin(): string { return CryptoUtil.generatePin(); }
https://github.com/AlkaidLab/moonlight-harmony
2bc2739a0ee43c59f2cb52afc3a550e276cc27a2
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets
arkts
setHighlightLineWidth
Sets the width of the highlight line in dp. @param width
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.convertDpToPixel(width); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.convertDpToPixel(width); }
https://gitee.com/openharmony/developtools_profiler.git
cfab8e8ea0006ba7ef84c1b29d9aef92651b8d38
gitee
ibestservices/ibest-ui
library/src/main/ets/components/cellGroup/index.ets
arkts
getBorderWidth
获取边框宽度
getBorderWidth() { return this.hasBorder && !this.inset ? 1 : 0 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBorderWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
getBorderWidth() { return this.hasBorder && !this.inset ? 1 : 0 }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cellGroup/index.ets#L46-L48
571aca75438ed8ba236c463400b15d238e300a9d
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets
arkts
updateYearData
更新年数据
updateYearData() { this.yearViewList = []; for (let i = 1; i <= Constants.MONTHS_NUM; i++) { this.yearViewList.push(new OffscreenCanvas(this.year, i)); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateYearData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
updateYearData() { this.yearViewList = []; for (let i = 1; i <= Constants.MONTHS_NUM; i++) { this.yearViewList.push(new OffscreenCanvas(this.year, i)); } }
https://gitcode.com/arkui-x/samples
9f9f0b3e6f55618a8d6c14d5a7664d0b3f82c089
gitcode
openharmony/codelabs
Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets
arkts
progressTextStyle
Steps text common style.
@Extend(Text) function progressTextStyle(styleFontSize: number, styleFontWeight: number) { .fontColor(Color.White) .fontSize(styleFontSize) .fontWeight(styleFontWeight) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function progressTextStyle(styleFontSize: number, styleFontWeight: number) { .fontColor(Color.White) .fontSize(styleFontSize) .fontWeight(styleFontWeight) }
https://gitee.com/openharmony/codelabs.git
26dff71aaf32bb9ad62f904a18086d4696325fe1
gitee
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/DataExportService.ets
arkts
exportData
核心导出方法
static async exportData(options: ExportOptions, onProgress?: ProgressCallback): Promise<ExportResult> { DataExportService.logger.info(`Starting export with options: ${JSON.stringify(options)}`); if (onProgress) { onProgress(10, 'Initializing export engine...'); } await DataExportService.simulat...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST...
static async exportData(options: ExportOptions, onProgress?: ProgressCallback): Promise<ExportResult> { DataExportService.logger.info(`Starting export with options: ${JSON.stringify(options)}`); if (onProgress) { onProgress(10, 'Initializing export engine...'); } await DataExportService.simulat...
https://gitcode.com/openharmony/codelabs
ec43e00ed66df7485ecddb19eecea7b34a3b70ce
gitcode
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/AbsDanmakuSync.ets
arkts
getThresholdTimeMills
Get the threshold-time of timer synchronization This value should be greater than or equal to 1000L @return
public getThresholdTimeMills(): number { return 1500; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThresholdTimeMills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left numb...
public getThresholdTimeMills(): number { return 1500; }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
e019bef450916cf455acf0ec1ea8774b3e67ac43
gitee
openharmony-sig/knowledge_demo_entainment
FA/notebook/entry/src/main/ets/common/database/NoteInfoTable.ets
arkts
insertNote
插入数据 @param noteInfo 笔记信息 @param callback 插入成功的回调方法
insertNote(noteInfo: NoteInfo, callback) { try { // 获取RdbStore this.getRdbStore(() => { // 数据格式转换 const valueBucket = generateBucket(noteInfo); // 插入数据 this.rdbStore.insert(NOTE_INFO.tableName, valueBucket, function (status, rowId) { if (status) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertNote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left noteInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NoteInfo AST#identifier#Ri...
insertNote(noteInfo: NoteInfo, callback) { try { // 获取RdbStore this.getRdbStore(() => { // 数据格式转换 const valueBucket = generateBucket(noteInfo); // 插入数据 this.rdbStore.insert(NOTE_INFO.tableName, valueBucket, function (status, rowId) { if (status) { ...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
a13baf1bc506212eb1f1c631847a65cb842fc46d
gitee
bhengubv/aether-protocol
arkts/src/main/ets/vault/ReedSolomonCodec.ets
arkts
constructor
Creates a codec with `k` data shards and `m` parity shards. `k` must be ≥ 1, `m` must be ≥ 0, and `k+m` must be ≤ 256.
constructor(k: number, m: number) { if (k < 1) { throw new Error('vault: K must be >= 1'); } if (m < 0) { throw new Error('vault: M must be >= 0'); } if (k + m > 256) { throw new Error('vault: K + M must be <= 256'); } this.k = k; this.m = m; this.n = k + m; t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#...
constructor(k: number, m: number) { if (k < 1) { throw new Error('vault: K must be >= 1'); } if (m < 0) { throw new Error('vault: M must be >= 0'); } if (k + m > 256) { throw new Error('vault: K + M must be <= 256'); } this.k = k; this.m = m; this.n = k + m; t...
https://github.com/bhengubv/aether-protocol
a3151bc866f4970a290ce423c82702cbbdaccc1a
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
queryUserByUsername
按用户名(展示名)查询用户
public async queryUserByUsername(username: string): Promise<UserInfo | null> { const predicates = new relationalStore.RdbPredicates("t_user"); predicates.equalTo("username", username); return this._querySingleUser(predicates); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left queryUserByUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#...
public async queryUserByUsername(username: string): Promise<UserInfo | null> { const predicates = new relationalStore.RdbPredicates("t_user"); predicates.equalTo("username", username); return this._querySingleUser(predicates); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L382-L386
397d6075abf09d551d4367bceae3e2ffc0a8d44e
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitMapInt64String
访问 map<int64, string> 字段
visitMapInt64String(value: Map<bigint, string>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 0).int64(k) entryWriter.tag(2, 2).string(v) this.writer.tag(fieldNumber, 2).ldelim(entryWriter) }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt64String AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifie...
visitMapInt64String(value: Map<bigint, string>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 0).int64(k) entryWriter.tag(2, 2).string(v) this.writer.tag(fieldNumber, 2).ldelim(entryWriter) }) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
43260f1b503e193637bffa3576eb8f547c578e75
gitcode
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/PopularityItem.ets
arkts
build
热度数据的类型
build() { Row() { Row() { //图标,通过getImg函数获取,用以区分不同类型 Image(this.getImg()) .width(22) .height(22) .objectFit(ImageFit.Contain) //间隔(竖线) Divider() .vertical(true) .padding(({left:7,right:7})) .height(24) .co...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { Row() { //图标,通过getImg函数获取,用以区分不同类型 Image(this.getImg()) .width(22) .height(22) .objectFit(ImageFit.Contain) //间隔(竖线) Divider() .vertical(true) .padding(({left:7,right:7})) .height(24) .co...
https://gitee.com/openharmony-sig/online_event.git
31f23a7338eea51b0c2c1a7b76a6d2a99bfb1225
gitee
dingzhilin1990/zhilinclaw
src/skills/SkillRegistry.ets
arkts
unregister
注销技能 @param name 技能名称
public async unregister(name: string): Promise<boolean> { if (!this.skills.has(name)) { return false; } this.skills.delete(name); await this.eventBus.publish('skill:unregistered', { skillName: name, timestamp: Date.now() }); console.log(`[SkillRegistry] 技能已注销:${name}`); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#...
public async unregister(name: string): Promise<boolean> { if (!this.skills.has(name)) { return false; } this.skills.delete(name); await this.eventBus.publish('skill:unregistered', { skillName: name, timestamp: Date.now() }); console.log(`[SkillRegistry] 技能已注销:${name}`); ...
https://github.com/dingzhilin1990/zhilinclaw
31f64c0b5e2871652ac793d4db45470227e3e08a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets
arkts
constructor
The WeakMap() constructor creates WeakMap objects @param { ([K, V])[] | null } [entries] - Optional array of key-value pairs to initialize the WeakMap @syscap SystemCapability.Utils.Lang
constructor(entries?: ([K, V])[] | null) { this.registry = new FinalizationRegistry<WeakRef<K>>((keyRef: WeakRef<K>) => { const entry = this.keyRefToEntry.get(keyRef) if (entry === undefined) { return } this.keyRefToEntry.delete(keyRef) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#ERROR#Left AST#?...
constructor(entries?: ([K, V])[] | null) { this.registry = new FinalizationRegistry<WeakRef<K>>((keyRef: WeakRef<K>) => { const entry = this.keyRefToEntry.get(keyRef) if (entry === undefined) { return } this.keyRefToEntry.delete(keyRef) ...
https://gitcode.com/iop123123/arkts-static-skills
de3d23ade2ffaecc450e66b083b187a00eccb667
gitcode
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/AvPlayManager.ets
arkts
videoChoose
视频切换,前台调用
async videoChoose(videoSrc: string, videoSelectIndex: number): Promise<void> { try { this.videoSrc = videoSrc; this.videoSelectIndex = videoSelectIndex; Logger.info(this.tag, `videoChoose this.videoSrc = ${this.videoSrc}`); this.currentTime = 0; this.currentAudioTrackValue = 0; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left videoChoose AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left videoSrc AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async videoChoose(videoSrc: string, videoSelectIndex: number): Promise<void> { try { this.videoSrc = videoSrc; this.videoSelectIndex = videoSelectIndex; Logger.info(this.tag, `videoChoose this.videoSrc = ${this.videoSrc}`); this.currentTime = 0; this.currentAudioTrackValue = 0; ...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
a3ec1e7e20921b8091b3f324ce773b2969bc3360
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FLog.ets
arkts
setDebug
日志域,需要根据实际项目配置
public static setDebug(debug: boolean): void { FLog.DEBUG = debug; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left setDebug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#:#Left : AST#:#...
public static setDebug(debug: boolean): void { FLog.DEBUG = debug; }
https://github.com/jjjjjjava/ffmpeg_tools
23a4b77a517500ed2483586f6ca2814911386c22
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test14_original_index.ets
arkts
testBitwiseMasks
--- Bitwise AND/OR masks ---
function testBitwiseMasks(value: number): string { let flags: number = value; let hasA: boolean = (flags & 1) !== 0; let hasB: boolean = (flags & 2) !== 0; let hasC: boolean = (flags & 4) !== 0; let setD: number = flags | 8; let clearA: number = setD & (~1); return String(hasA) + ',' + String(hasB) + ',' ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testBitwiseMasks AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function testBitwiseMasks(value: number): string { let flags: number = value; let hasA: boolean = (flags & 1) !== 0; let hasB: boolean = (flags & 2) !== 0; let hasC: boolean = (flags & 4) !== 0; let setD: number = flags | 8; let clearA: number = setD & (~1); return String(hasA) + ',' + String(hasB) + ',' ...
https://github.com/miaochiahao/ark-ghidra
470440b6558ef59845312c2299b686d7594dfa90
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/AnimationUtil.ets
arkts
getAnimation
根据方向获取对应的过渡动画效果 @param dir 动画进入方向: 'left' | 'right' | 'up' | 'bottom' @param delay 动画延迟时间(毫秒),默认为0 @param hasAnimate 是否启用动画,默认为true @returns 对应方向的过渡动画效果对象
public static getAnimation(dir: 'left' | 'right' | 'up' | 'bottom', delay: number = 0, hasAnimate: boolean = true) { // 从上方进入的动画效果:透明度渐显 + 向上平移 const MoveFromTop: object = TransitionEffect.OPACITY.animation(hasAnimate ? { duration: 200, curve: Curve.Ease, delay: delay } : undefined) .com...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : AST#...
public static getAnimation(dir: 'left' | 'right' | 'up' | 'bottom', delay: number = 0, hasAnimate: boolean = true) { // 从上方进入的动画效果:透明度渐显 + 向上平移 const MoveFromTop: object = TransitionEffect.OPACITY.animation(hasAnimate ? { duration: 200, curve: Curve.Ease, delay: delay } : undefined) .com...
https://github.com/Yebingiscn/SweetVideo
ce49166ff60124646ba1ed7946e719e45c297f3a
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileFolderUtil.ets
arkts
changeFileFolderName
改变文件夹名称
static async changeFileFolderName(context: Context, folder: FileFolder, newFolderName: string, fileFolderDataSource: FileFolderDataSource) { let folders = Preferences.getFileFolder(context) as FileFolder[] const targetFolder = folders.find(i => i.date === folder.date) if (targetFolder) { targetF...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left changeFileFolderName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#...
static async changeFileFolderName(context: Context, folder: FileFolder, newFolderName: string, fileFolderDataSource: FileFolderDataSource) { let folders = Preferences.getFileFolder(context) as FileFolder[] const targetFolder = folders.find(i => i.date === folder.date) if (targetFolder) { targetF...
https://github.com/Yebingiscn/SweetVideo
fd0842e84507accb02f426acf1ded95aa7196dfd
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/MPPointD.ets
arkts
toString
returns a string representation of the object
public toString(): string { return "MPPointD, x: " + this.x + ", y: " + this.y; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string...
public toString(): string { return "MPPointD, x: " + this.x + ", y: " + this.y; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d46021de7d98d8bd493c11a2f0ee6679cb0d1701
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
get
Gets the short value wrapped in this ShortBox. @returns { short } The short value wrapped in this ShortBox @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get(): short { return this.value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right...
public get(): short { return this.value; }
https://gitcode.com/iop123123/arkts-static-skills
5def074cc1addc045c3718c84881802ebbff9296
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/module/expeditionNotification.ets
arkts
formatCountdown
── 工具函数 ─────────────────────────────────────────────────────
function formatCountdown(remainingMs: number): string { if (remainingMs <= 0) return '待归来'; const totalSec = Math.floor(remainingMs / 1000); const h = Math.floor(totalSec / 3600); const m = Math.floor((totalSec % 3600) / 60); const s = totalSec % 60; if (h > 0) { return `${h}:${String(m).padStart(2, '0'...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatCountdown AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remainingMs AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function formatCountdown(remainingMs: number): string { if (remainingMs <= 0) return '待归来'; const totalSec = Math.floor(remainingMs / 1000); const h = Math.floor(totalSec / 3600); const m = Math.floor((totalSec % 3600) / 60); const s = totalSec % 60; if (h > 0) { return `${h}:${String(m).padStart(2, '0'...
https://github.com/CsCesium/KantaiHomo
41a7f3294cead959c9cd324efe7a072c2aa87b03
github
lidaixian999/Smart_Car
entry/src/main/ets/model/SsapManager.ets
arkts
registerCallback
注册扫描结果回调
public registerCallback(callback: ScanResultCallback): void { this.callbacks.add(callback); hilog.info(this.domainId, this.logTag, `Callback registered, total: ${this.callbacks.size}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public registerCallback(callback: ScanResultCallback): void { this.callbacks.add(callback); hilog.info(this.domainId, this.logTag, `Callback registered, total: ${this.callbacks.size}`); }
https://github.com/lidaixian999/Smart_Car
898b00019da746a5a864e99958488c66c83f3c8a
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setMaskColor
设置遮罩层颜色 @param maskColor @returns
setMaskColor(maskColor?: ResourceColor): Builder { this.dialogOptions.maskColor = maskColor return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaskColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maskColor AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ResourceColor...
setMaskColor(maskColor?: ResourceColor): Builder { this.dialogOptions.maskColor = maskColor return this }
https://github.com/wuba/omni-ui
093b6bd4cc5a6615c6469d71dd2682d68d85a982
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
test_10param4
测试 10 param4
function test_10param4() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let mystruct: test_overload.Mystruct = { testNum: 2147483647, testStr: "path/to/source" }; let color = test_overload.Color.red; let nu...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_10param4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decla...
function test_10param4() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let mystruct: test_overload.Mystruct = { testNum: 2147483647, testStr: "path/to/source" }; let color = test_overload.Color.red; let nu...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
b6aabcf3ff05636e5a1ef9f7c5de562d036e448b
gitcode
genjishare/snake-game
entry/src/main/ets/entryability/EntryAbility.ets
arkts
updateExistingDataObject
更新现有的分布式数据对象
updateExistingDataObject() { if (!gameDataObject) { hilog.error(DOMAIN, TAG, '分布式数据对象不存在,无法更新'); return; } const latestGameState = AppStorage.Get<GameState>('latestGameState'); if (latestGameState) { hilog.info(DOMAIN, TAG, `使用现有分布式对象更新游戏状态,gameOver=${latestGameState.gameOver},...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateExistingDataObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement...
updateExistingDataObject() { if (!gameDataObject) { hilog.error(DOMAIN, TAG, '分布式数据对象不存在,无法更新'); return; } const latestGameState = AppStorage.Get<GameState>('latestGameState'); if (latestGameState) { hilog.info(DOMAIN, TAG, `使用现有分布式对象更新游戏状态,gameOver=${latestGameState.gameOver},...
https://github.com/genjishare/snake-game
66159ed4e2ebd01f2a6118c9f34bb48e6ed29a96
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
loadCurrentProfile
加载当前配置
private async loadCurrentProfile(): Promise<void> { try { if (!this.preferencesStore) return; const profileJson = await this.preferencesStore.get(this.CURRENT_PROFILE_KEY, '') as string; if (profileJson && profileJson.length > 0) { const loaded = SafeUtils.parseObj(profileJson) as...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadCurrentProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async loadCurrentProfile(): Promise<void> { try { if (!this.preferencesStore) return; const profileJson = await this.preferencesStore.get(this.CURRENT_PROFILE_KEY, '') as string; if (profileJson && profileJson.length > 0) { const loaded = SafeUtils.parseObj(profileJson) as...
https://github.com/DaLongZhuaZi/manxia
bc053d0a979cea82b5b2eb96cd9bd57a849fefd6
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/defaultformability/DefaultFormAbility.ets
arkts
onFormEvent
卡片 message 事件回调
onFormEvent(formId: string, message: string): void { try { const params: Record<string, Object> = JSON.parse(message) as Record<string, Object> // RollWheelCard 点击事件:输出卡片数据和 formId 日志 if (params['event'] === 'roll_wheel_click') { hilog.info(0x0000, 'testTag', '[卡片点击] formId: %...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onFormEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A...
onFormEvent(formId: string, message: string): void { try { const params: Record<string, Object> = JSON.parse(message) as Record<string, Object> // RollWheelCard 点击事件:输出卡片数据和 formId 日志 if (params['event'] === 'roll_wheel_click') { hilog.info(0x0000, 'testTag', '[卡片点击] formId: %...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
f47726e7463561e17df5c19ac19ebf4aef85747d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets
arkts
hypot
Square root of the sum of squares of `v` and `u` @param u arbitrary number @param v arbitrary number @returns The square root of the sum of squares of its arguments
public static hypot(...values: double[]): double { let max: double = 0; let hasNaN = false; for (const value of values) { if (value == Infinity || value == -Infinity) { return Infinity; } if (isNaN(value)) { hasNaN = true; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left hypot AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...
public static hypot(...values: double[]): double { let max: double = 0; let hasNaN = false; for (const value of values) { if (value == Infinity || value == -Infinity) { return Infinity; } if (isNaN(value)) { hasNaN = true; ...
https://gitcode.com/iop123123/arkts-static-skills
ee5ba7231a0b11fec7c3730caa5c5097c9de0966
gitcode
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
toggleSelectAll
全选/取消全选 @returns {void} 无返回值
toggleSelectAll(): void { if (this.isAllSelected) { this.selectedSpecIds = new Set(); } else { this.selectAll(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSelectAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression...
toggleSelectAll(): void { if (this.isAllSelected) { this.selectedSpecIds = new Set(); } else { this.selectAll(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
b9bfbbc667f1f9d380ab9dc6f236a8908a4a70a1
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
getTimeSegmentStr
将一个两位24小时时间的转换为上午、下午这样的描述。 @param hh24 两位的24小时制时间的小时部分 @return 如果成功转换则返回形如:“凌晨”、“上午”等,否则返回空字符串(不是null) @since 3.1
static getTimeSegmentStr(hh24: string): string { let ret: string = ''; if (hh24 && hh24.length >= 2) { try { // 取出“小时”部分 let a = parseInt(hh24.substring(0, 2)); if (a >= 0 && a <= 6) { ret = "凌晨"; } else if (a > 6 && a <= 12) { ret = "上午"; } el...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTimeSegmentStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hh24 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static getTimeSegmentStr(hh24: string): string { let ret: string = ''; if (hh24 && hh24.length >= 2) { try { // 取出“小时”部分 let a = parseInt(hh24.substring(0, 2)); if (a >= 0 && a <= 6) { ret = "凌晨"; } else if (a > 6 && a <= 12) { ret = "上午"; } el...
https://github.com/JackJiang2011/harmonychat
bee9e9bcae4744ecad1339d09ac9434c6adf187d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets
arkts
getAllRules
获取所有规则
getAllRules(): DictRule[] { return Array.from(this.rules.values()).sort((a, b) => a.sortNumber - b.sortNumber); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS...
getAllRules(): DictRule[] { return Array.from(this.rules.values()).sort((a, b) => a.sortNumber - b.sortNumber); }
https://github.com/DaLongZhuaZi/manxia
483c6d1a0209f23a7794a74d2d8685b213bbb983
github
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar.ets
arkts
expendContainerAnimation
半屏放大至全屏动效
expendContainerAnimation(): void { this.isHalfToFullScreen = true; animateTo({ duration: 150, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { this.contentBgColor = '#FFFFFF'; } }, () => { this.containerWidth = '100%'; this.contentMarginTop = ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left expendContainerAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#sta...
expendContainerAnimation(): void { this.isHalfToFullScreen = true; animateTo({ duration: 150, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { this.contentBgColor = '#FFFFFF'; } }, () => { this.containerWidth = '100%'; this.contentMarginTop = ...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
a33618a1d3c21f7b64a13cb15527eefd4dd16555
gitee
who7708/harmonyos-codelabs
HmosWorld/features/challenge/src/main/ets/components/ChallengeView.ets
arkts
initMapElements
Initializing Map Element Data,Calculate the coordinates
initMapElements(): void { this.mapElements = []; for (let index = 0; index < mapElementData.length; index++) { const element: MapElement = mapElementData[index]; let temp: MapElement = JSON.parse(JSON.stringify(element)); temp.iconPositionX = px2vp(element.iconPositionX) * this.ratio; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initMapElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
initMapElements(): void { this.mapElements = []; for (let index = 0; index < mapElementData.length; index++) { const element: MapElement = mapElementData[index]; let temp: MapElement = JSON.parse(JSON.stringify(element)); temp.iconPositionX = px2vp(element.iconPositionX) * this.ratio; ...
https://github.com/who7708/harmonyos-codelabs
abb784963e5e3f2f3a2faae6aaf56a1e71b5ec8c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
getVisibleXRange
Returns the range visible on the x-axis. @return
public getVisibleXRange(): number { return Math.abs(this.getHighestVisibleX() - this.getLowestVisibleX()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVisibleXRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS...
public getVisibleXRange(): number { return Math.abs(this.getHighestVisibleX() - this.getLowestVisibleX()); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8f9732289326a058eadfb13313eb24a1d0f8217f
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
keys
Returns an list of keys in BigInt64Array @returns { IterableIterator<int> } - iterator over keys @syscap SystemCapability.Utils.Lang @FaAndStageModel
public keys(): IterableIterator<int> { return new BigInt64ArrayIteratorKeys(this) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public keys(): IterableIterator<int> { return new BigInt64ArrayIteratorKeys(this) }
https://gitcode.com/iop123123/arkts-static-skills
b9e8b0e04a2ae264c517fb4ec70a00a9183bc107
gitcode
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AuthRepository.ets
arkts
loginByQqApp
QQ APP 授权登录 @param {QQLoginRequest} params - QQ 授权参数 @returns {Promise<NetworkResponse<Auth>>} 认证结果
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByQqApp(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByQqApp AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> { return this.networkDataSource.loginByQqApp(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
ff09d34c970af5d1f2ac25ae8d642c11c6fc40cc
github
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/BreakpointState.ets
arkts
isMD
是否为中断点 @returns {boolean} 是否中断点
isMD(): boolean { return this.current === BreakpointType.MD; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMD AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_bloc...
isMD(): boolean { return this.current === BreakpointType.MD; }
https://github.com/Joker-x-dev/CoolMallArkTS
e9e91f246fd4c44362c36ee0e429c6a1dccaaf58
github
Explore-In-HMOS-Wearable/perfume-collection
entry/src/main/ets/service/HapticService.ets
arkts
fallback
Fallback: simple time-based vibration.
private static fallback(duration: number): void { try { vibrator.startVibration({ type: 'time', duration: duration }, { usage: 'touch' }); } catch (err) { let e: BusinessError = err as BusinessError; console.error(`Haptic fallback failed: ${e.code}, ${e.me...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left fallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
private static fallback(duration: number): void { try { vibrator.startVibration({ type: 'time', duration: duration }, { usage: 'touch' }); } catch (err) { let e: BusinessError = err as BusinessError; console.error(`Haptic fallback failed: ${e.code}, ${e.me...
https://github.com/Explore-In-HMOS-Wearable/perfume-collection
a5bfd049a5c30cfa7a77e371f0222a4bc581a6a6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
addComicSource
添加新的漫画源
public async addComicSource(sourceConfig: ComicSourceConfig): Promise<number> { try { const sourcePkg: string = sourceConfig.pluginId && sourceConfig.pluginId.length > 0 ? sourceConfig.pluginId : sourceConfig.name; const configJson: string = sourceConfig.config ? JSON.stringify(sourceC...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left addComicSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sourceConfig AST#identifier#Right AST#:#L...
public async addComicSource(sourceConfig: ComicSourceConfig): Promise<number> { try { const sourcePkg: string = sourceConfig.pluginId && sourceConfig.pluginId.length > 0 ? sourceConfig.pluginId : sourceConfig.name; const configJson: string = sourceConfig.config ? JSON.stringify(sourceC...
https://github.com/DaLongZhuaZi/manxia
4535f45d81a7caedf11bb8b8271f3b95c50e41e8
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getSimOperatorNumericSync
获取指定卡槽SIM卡的归属PLMN(Public Land Mobile Network)号。 @param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。 @returns
static getSimOperatorNumericSync(slotId?: number): string { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimOperatorNumericSync(slotId); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSimOperatorNumericSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right...
static getSimOperatorNumericSync(slotId?: number): string { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimOperatorNumericSync(slotId); }
https://github.com/tdcare/tdwebrtc
2e05528ffb412426a701a27aad444d7fbd24e36f
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/pages/StarMapPage.ets
arkts
startMotionTimer
启动动画定时器,约 33ms 一帧(~30fps),wobble 不需要高频率。
startMotionTimer() { if (this.motionTimer !== -1) { clearInterval(this.motionTimer) } this.motionTimer = setInterval(() => { if (this.motionEnabled && !this.reduceMotion) { this.motionTick = Date.now() } }, 33) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startMotionTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
startMotionTimer() { if (this.motionTimer !== -1) { clearInterval(this.motionTimer) } this.motionTimer = setInterval(() => { if (this.motionEnabled && !this.reduceMotion) { this.motionTick = Date.now() } }, 33) }
https://github.com/Xiwei753/xiezuoruanjian
330f093d92178468eb88f517a87f46d1b8df3002
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EnumConstant.ets
arkts
toString
toString @returns { string } @throws { Error } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toString(): string { // TODO(shumilov-petr): not implemented throw new Error("not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): string { // TODO(shumilov-petr): not implemented throw new Error("not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
92128d849d12c2b447fd84c2b11f8826e345aaae
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/ClientSessionManager.ets
arkts
unregister
Unregister a client (usually called when it stops itself normally)
public unregister(client: NativeStreamClient): void { if (this.currentClient === client) { this.currentClient = undefined; LoggerClientSession.info('[ClientSessionManager] Client unregistered'); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left client AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Nat...
public unregister(client: NativeStreamClient): void { if (this.currentClient === client) { this.currentClient = undefined; LoggerClientSession.info('[ClientSessionManager] Client unregistered'); } }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
9e53b3356003e9583f98253042ed1f9859a063a2
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
getElementsByTagName
通过标签名获取元素列表
getElementsByTagName(tagName: string): HTMLElement[] { const results: HTMLElement[] = []; const lowerTagName = tagName.toLowerCase(); const matchAll = lowerTagName === '*'; const traverse = (node: Node): void => { for (const child of node.childNodes) { if (child.nodeType === NodeTyp...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getElementsByTagName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
getElementsByTagName(tagName: string): HTMLElement[] { const results: HTMLElement[] = []; const lowerTagName = tagName.toLowerCase(); const matchAll = lowerTagName === '*'; const traverse = (node: Node): void => { for (const child of node.childNodes) { if (child.nodeType === NodeTyp...
https://github.com/DaLongZhuaZi/manxia
33c1d3cfbbbd3d51bf5a1a0234e886cdaca9299b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
validateCbzArchive
验证CBZ文件完整性
public async validateCbzArchive(cbzPath: string): Promise<boolean> { try { // 检查文件存在 if (!await this.sandboxManager.exists(cbzPath)) { return false; } // 尝试读取压缩文件信息 const tempDir = await this.prepareExtractDirectory(cbzPath, true); try { await this...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left validateCbzArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cbzPath AST#identifier#Right AST#ERROR#Left AST#:#Le...
public async validateCbzArchive(cbzPath: string): Promise<boolean> { try { // 检查文件存在 if (!await this.sandboxManager.exists(cbzPath)) { return false; } // 尝试读取压缩文件信息 const tempDir = await this.prepareExtractDirectory(cbzPath, true); try { await this...
https://github.com/DaLongZhuaZi/manxia
047b36ed47d6ca89b2f64aa5f6b2c8be3bcac032
github
openharmony/applications_call
entry/src/main/ets/common/components/FuncBtnGroup.ets
arkts
onCallStateChange
update state of group buttons @param {Object} callData - call data
onCallStateChange(newVal) { const btnName = ['video', 'record', 'add', 'contact', 'merge']; if (newVal === CallStateConst.CALL_STATUS_ACTIVE || newVal === CallStateConst.CALL_STATUS_HOLDING) { this.btnList.forEach((item) => { if (!Method.includes(btnName, (item.type))) { item.isDisable...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCallStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newVal AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST...
onCallStateChange(newVal) { const btnName = ['video', 'record', 'add', 'contact', 'merge']; if (newVal === CallStateConst.CALL_STATUS_ACTIVE || newVal === CallStateConst.CALL_STATUS_HOLDING) { this.btnList.forEach((item) => { if (!Method.includes(btnName, (item.type))) { item.isDisable...
https://gitee.com/openharmony/applications_call.git
98556f1dfca1d9c9e01a2937e328ca0af8aaa8fe
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
getPayloadAsString
获取事件数据
getPayloadAsString(): string { return this.payloadJson; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPayloadAsString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta...
getPayloadAsString(): string { return this.payloadJson; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9d2a40b7595369abdc182056b6eb2320df94746e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/DemoDataService.ets
arkts
seedData
填充演示数据
private static async seedData(userId: number) { // 1. 确保有分类 let categories = await CategoryDAO.getAll(userId); if (categories.length < 5) { await DemoDataService.seedCategories(userId); categories = await CategoryDAO.getAll(userId); // 重新获取 } // 2. 确保有账户 let accounts = await Accou...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left seedData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId...
private static async seedData(userId: number) { // 1. 确保有分类 let categories = await CategoryDAO.getAll(userId); if (categories.length < 5) { await DemoDataService.seedCategories(userId); categories = await CategoryDAO.getAll(userId); // 重新获取 } // 2. 确保有账户 let accounts = await Accou...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9568b12a739a41936ec2ed6ade90991025be72a2
github
openharmony-sig/engine-native
templates/openharmony/native/engine/hmscore/index.ets
arkts
checkSign
上报应用服务器,服务端查询购买数量及其签名数据,返回购买数据及其签名数据
checkSign(inAppPurchaseDataSignature: string, inAppPurchaseData: string): Promise<string> { // 这里模拟默认为正常返回 console.log("inAppPurchaseDataSignature::", inAppPurchaseDataSignature); console.log("inAppPurchaseData::", inAppPurchaseData); return Promise.resolve(""); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left checkSign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inAppPurchaseDataSignature AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
checkSign(inAppPurchaseDataSignature: string, inAppPurchaseData: string): Promise<string> { // 这里模拟默认为正常返回 console.log("inAppPurchaseDataSignature::", inAppPurchaseDataSignature); console.log("inAppPurchaseData::", inAppPurchaseData); return Promise.resolve(""); }
https://gitee.com/openharmony-sig/engine-native.git
1d0e9996d67daf58d7526779b1d56c19db152182
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/components/TouchPointerView.ets
arkts
leftClick
Send left click at current position
leftClick(): void { if (this.instance === 0) return; LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1); LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY, PTR...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left leftClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le...
leftClick(): void { if (this.instance === 0) return; LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1); LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY, PTR...
https://github.com/tangwengang-del/freerdp-harmonyos
2f2f306fd385ffe6fda477ba7b3b4d67823a51fb
github
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
updateTaskInfoList
编辑完成后更新任务信息
public updateTaskInfoList(editedTaskInfo: ITaskItem) { if (editedTaskInfo?.taskID) { // edited task let taskID = editedTaskInfo.taskID; let targetValue = editedTaskInfo.targetValue; let isAlarm = editedTaskInfo.isAlarm; let frequency = editedTaskInfo.frequency; let startTime = ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateTaskInfoList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left editedTaskInfo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ITa...
public updateTaskInfoList(editedTaskInfo: ITaskItem) { if (editedTaskInfo?.taskID) { // edited task let taskID = editedTaskInfo.taskID; let targetValue = editedTaskInfo.targetValue; let isAlarm = editedTaskInfo.isAlarm; let frequency = editedTaskInfo.frequency; let startTime = ...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
d98d1cac984900188663c56a11931411b123e46b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets
arkts
searchByAuthor
按作者搜索书籍 @param author 作者名 @param limit 返回数量限制
public async searchByAuthor(author: string, limit: number = 20): Promise<ScraperSearchResult> { const query = `inauthor:${author}`; return this.searchVolumes(query, limit); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left searchByAuthor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left author AST#identifier#Right AST#:#Left : ...
public async searchByAuthor(author: string, limit: number = 20): Promise<ScraperSearchResult> { const query = `inauthor:${author}`; return this.searchVolumes(query, limit); }
https://github.com/DaLongZhuaZi/manxia
0f95cfc6d21b8533a95a78b2368c1425474d36ed
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
generateAesKeyFromHash
生成 AES 密钥(从哈希数据中取前16字节)
static generateAesKeyFromHash(hashData: Uint8Array): Uint8Array { return hashData.slice(0, 16); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateAesKeyFromHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hashData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static generateAesKeyFromHash(hashData: Uint8Array): Uint8Array { return hashData.slice(0, 16); }
https://github.com/AlkaidLab/moonlight-harmony
3d2a64cf7cb2001f6bf76c9cb83c10eda831ccf1
github
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/viewmodel/DailyViewModel.ets
arkts
hasMoreData
检查是否还有更多数据
hasMoreData(): boolean { return this.nextPageUrl !== null && this.nextPageUrl !== ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasMoreData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme...
hasMoreData(): boolean { return this.nextPageUrl !== null && this.nextPageUrl !== ''; }
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
bcb211ebdb9df096bdbae45932318d369b9b9d18
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets
arkts
inRangeOfRect
判断触摸点是否在指定矩形范围内 @param left 左边界 @param top 上边界 @param right 右边界 @param bottom 下边界 @param touchPoint 触摸点坐标 @returns boolean 返回true表示触摸点在范围内
public static inRangeOfRect( left: number, top: number, right: number, bottom: number, touchPoint: TouchPoint ): boolean { return touchPoint.x >= left && touchPoint.x <= right && touchPoint.y >= top && touchPoint.y <= bottom; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left inRangeOfRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#identifier#Right AST#:#Left : AS...
public static inRangeOfRect( left: number, top: number, right: number, bottom: number, touchPoint: TouchPoint ): boolean { return touchPoint.x >= left && touchPoint.x <= right && touchPoint.y >= top && touchPoint.y <= bottom; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
b89a3101c71c44d2aaa4cde7e8615b247b555a5a
gitcode
chendi126/harmonyOS-TCP
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWorkStart
当workScheduler触发时处理工作的方法
public onWorkStart(workInfo: workScheduler.WorkInfo): void { hilog.info(DOMAIN_NUMBER, TAG, `工作开始,ID: ${workInfo.workId}`); try { if (workInfo.parameters) { // 使用Record<string, string>代替any类型 const params = workInfo.parameters as Record<string, string>; const notificationType = ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onWorkStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left workInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressio...
public onWorkStart(workInfo: workScheduler.WorkInfo): void { hilog.info(DOMAIN_NUMBER, TAG, `工作开始,ID: ${workInfo.workId}`); try { if (workInfo.parameters) { // 使用Record<string, string>代替any类型 const params = workInfo.parameters as Record<string, string>; const notificationType = ...
https://github.com/chendi126/harmonyOS-TCP
d03abb1782136dc02b1582ca212ff48dcf5ae224
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
getServerInfo
获取服务器信息
public getServerInfo(): ServerInfo { return { status: this.status, port: this.port, localIp: this.localIp, uploadPath: this.uploadPath }; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getServerInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ServerIn...
public getServerInfo(): ServerInfo { return { status: this.status, port: this.port, localIp: this.localIp, uploadPath: this.uploadPath }; }
https://github.com/richshaw2015/nds
e1fbae928ce8b5fa3a0676a351e3220c7f5b07f7
github
HarmonyOS_Samples/guide-snippets
ArkGraphics2D/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/BasicEffect.ets
arkts
addDrawFunction
当前绘制函数的下标 添加绘制函数的接口
addDrawFunction(func: (canvas: drawing.Canvas) => void) { this.drawFunctions.push(func); }
AST#program#Left AST#ERROR#Left AST#identifier#Left addDrawFunction AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left func AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right ...
addDrawFunction(func: (canvas: drawing.Canvas) => void) { this.drawFunctions.push(func); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
73f2f1aca428aa63f2d975f7be0521681fdb1562
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
getAllSources
==================== 查询功能 ==================== 获取所有图源(包含置顶状态)
async getAllSources(): Promise<SourceInfo[]> { try { const sources = await this.dataManager.getAllComicSources(); const pinnedIds = await this.dataManager.getSourcePinnedList(); return sources.map((source: ESObject) => { const info = this.mapToSourceInfo(source); info.isPi...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSources AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async getAllSources(): Promise<SourceInfo[]> { try { const sources = await this.dataManager.getAllComicSources(); const pinnedIds = await this.dataManager.getSourcePinnedList(); return sources.map((source: ESObject) => { const info = this.mapToSourceInfo(source); info.isPi...
https://github.com/DaLongZhuaZi/manxia
d046b57860cf7f7377cccc1bde26a41b54f0e100
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_ushort.ets
arkts
main
--- desc: check unsigned right shift operation for unsigned short integer ---
function main(): void { const a: ushort = {{v.left}} const b: int = {{v.right}} assert (a >>> b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ushort = {{v.left}} const b: int = {{v.right}} assert (a >>> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
715054cd74f13c5646d1766d710f834706ecf185
gitee
codelably/HCompass
core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets
arkts
format
格式化日志数据 @param data 原始数据 @returns 格式化后的字符串
private static format(data: Any): string { if (data === null || data === undefined) return 'null'; switch (typeof data) { case "object": return Logger.objToJson(data); case "string": if (data.startsWith("{") && data.endsWith("}")) { try { return Logger.objToJ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left format AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Rig...
private static format(data: Any): string { if (data === null || data === undefined) return 'null'; switch (typeof data) { case "object": return Logger.objToJson(data); case "string": if (data.startsWith("{") && data.endsWith("}")) { try { return Logger.objToJ...
https://github.com/codelably/HCompass
7d853416c62cfdbaa3b4f8cd767c7106e8e67604
github
openharmony-tpc/httpclient
entry/src/main/ets/pages/requestCaching.ets
arkts
checkClientTrusted
校验客户端证书
checkClientTrusted(X509Certificate: certFramework.X509Cert): void { Logger.info(TAG, 'Get Client Trusted X509Certificate'); let encoded = X509Certificate.getEncoded(); // 获取X509证书序列化数据 Logger.info(TAG, 'encoded: ', JSON.stringify(encoded)); let publicKey = X509Certificate.getPublicKey(); // 获取X509证书公钥...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkClientTrusted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left X509Certificate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left certFramework A...
checkClientTrusted(X509Certificate: certFramework.X509Cert): void { Logger.info(TAG, 'Get Client Trusted X509Certificate'); let encoded = X509Certificate.getEncoded(); // 获取X509证书序列化数据 Logger.info(TAG, 'encoded: ', JSON.stringify(encoded)); let publicKey = X509Certificate.getPublicKey(); // 获取X509证书公钥...
https://gitee.com/openharmony-tpc/httpclient.git
e277fc553e84b083f760b785219be478286cdf45
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
executeBeforeDelete
执行 beforeDelete 钩子 在删除实体数据之前调用 @param entityName 实体名称 @param data 实体数据 @throws HookExecutionError 如果钩子执行失败
async executeBeforeDelete(entityName: string, data: EntityData): Promise<void> { await this.executeHook(entityName, data, 'beforeDelete') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeBeforeDelete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityName AST#identifier#Right AST#type_annotation#Left AS...
async executeBeforeDelete(entityName: string, data: EntityData): Promise<void> { await this.executeHook(entityName, data, 'beforeDelete') }
https://github.com/offlinecat-dev/OCNetORM
d2fd5b726bd2575ab26d8c680b7720da39bc3447
github
LYM15/FireflyCompanion
entry/src/main/ets/utils/CommonUtils.ets
arkts
showConfirmDialog
显示确认的弹窗 @param title 标题 @param content 内容 @param cancelBtnText 取消按钮文本 @param confirmBtnText 确认按钮文本 @param clickConfirmBtn 确认回调 @param clickCancelBtn 取消回调 @param showCancelBtn 是否显示取消按钮
public showConfirmDialog( title: string | Resource, content: string | Resource, cancelBtnText: string = '取消', // 改为字符串 confirmBtnText: string = '确定', // 改为字符串 clickConfirmBtn?: () => void | Promise<boolean>, clickCancelBtn?: () => void, showCancelBtn: boolean = true, ): void { if (...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showConfirmDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expres...
public showConfirmDialog( title: string | Resource, content: string | Resource, cancelBtnText: string = '取消', // 改为字符串 confirmBtnText: string = '确定', // 改为字符串 clickConfirmBtn?: () => void | Promise<boolean>, clickCancelBtn?: () => void, showCancelBtn: boolean = true, ): void { if (...
https://github.com/LYM15/FireflyCompanion
c535bf2b692c5360cd43b25fc99639348b90f3b7
github
HarmonyOS_Samples/sample_in_harmonyos
features/devpractices/src/main/ets/model/ImageModel.ets
arkts
pinchGestureUpdate
Pinch gestures callback during a move.
pinchGestureUpdate(event: GestureEvent): boolean { this.onScale(event.scale, event.offsetX, event.offsetY); this.pictureScaling(this.curScale); if (this.curScale > this.defaultScaleValue) { this.isDisableSwipe = true; } this.pictureBoundaryRestriction(); return this.isDisableSwipe; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinchGestureUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent AST#identifier#Right AS...
pinchGestureUpdate(event: GestureEvent): boolean { this.onScale(event.scale, event.offsetX, event.offsetY); this.pictureScaling(this.curScale); if (this.curScale > this.defaultScaleValue) { this.isDisableSwipe = true; } this.pictureBoundaryRestriction(); return this.isDisableSwipe; }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
f4e4b039c3905776ee18307050d39f948b014a8a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
sha256Encode
SHA256编码 - 异步版本
async sha256Encode(str: string): Promise<string> { try { const md = cryptoFramework.createMd('SHA256'); const encoder = new util.TextEncoder(); const data = encoder.encodeInto(str); await md.update({ data: data }); const result = await md.digest(); return this.uint8ArrayToHex(r...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sha256Encode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left str AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async sha256Encode(str: string): Promise<string> { try { const md = cryptoFramework.createMd('SHA256'); const encoder = new util.TextEncoder(); const data = encoder.encodeInto(str); await md.update({ data: data }); const result = await md.digest(); return this.uint8ArrayToHex(r...
https://github.com/DaLongZhuaZi/manxia
5145ed7d0eefd08b020e7a75d3e81d12077ba559
github
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subBrTest/deviceFound.ets
arkts
getDeviceIconPath
Get device icon resource @param type @return device icon path
function getDeviceIconPath(deviceType: string): string { let path: string = "/res/image/ic_bluetooth_device.svg"; switch ( deviceType ) { case DeviceType.HEADPHONE: path = "/res/image/ic_device_earphone_hero.svg"; break; case DeviceType.PHONE: path = "/res/image/ic_public_devices_phone.sv...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getDeviceIconPath AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceType AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function getDeviceIconPath(deviceType: string): string { let path: string = "/res/image/ic_bluetooth_device.svg"; switch ( deviceType ) { case DeviceType.HEADPHONE: path = "/res/image/ic_device_earphone_hero.svg"; break; case DeviceType.PHONE: path = "/res/image/ic_public_devices_phone.sv...
https://gitee.com/openharmony/communication_bluetooth_service.git
782d643e6cc04db862703e935ebc3def5115a2b2
gitee
huaiminqin/TankWar-Master-with-Many-Tasks
game/src/main/ets/mission/MissionFactory.ets
arkts
createClassicMission
创建经典模式任务 - 消灭所有敌人
static createClassicMission(level: number): Mission { const mission = new Mission( `第 ${level} 关`, '消灭所有敌方坦克,保护基地' ); // 使用固定的敌人数量20,与 GameSceneNew.TOTAL_ENEMY_TANKS 保持一致 const enemyCount = 20; mission.addObjective({ type: MissionType.DESTROY_ALL_ENEMIES, description: `消灭 ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createClassicMission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
static createClassicMission(level: number): Mission { const mission = new Mission( `第 ${level} 关`, '消灭所有敌方坦克,保护基地' ); // 使用固定的敌人数量20,与 GameSceneNew.TOTAL_ENEMY_TANKS 保持一致 const enemyCount = 20; mission.addObjective({ type: MissionType.DESTROY_ALL_ENEMIES, description: `消灭 ...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
33b0716976c905e35420ffddf1bcfdcbacbc2404
github
the-wwyang/kids-learning-app
src/main/ets/storage/UserSettingsStorageService.ets
arkts
updateDefaultDifficulty
更新默认难度 @param difficulty 难度
static async updateDefaultDifficulty(difficulty: Difficulty): Promise<void> { try { const settings = await UserSettingsStorageService.loadSettings(); settings.defaultDifficulty = difficulty; await UserSettingsStorageService.saveSettings(settings); console.log(`[UserSettingsStorage] Default...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateDefaultDifficulty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right ...
static async updateDefaultDifficulty(difficulty: Difficulty): Promise<void> { try { const settings = await UserSettingsStorageService.loadSettings(); settings.defaultDifficulty = difficulty; await UserSettingsStorageService.saveSettings(settings); console.log(`[UserSettingsStorage] Default...
https://github.com/the-wwyang/kids-learning-app
67b51ebe63f364cd49952f9b33ca69c931d7fe9c
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
send_play_status
7x6 播放状态广播 //
private send_play_status(status: string) { // 更新数据 // this.play_status = status log(status) // 广播状态 // emitter.emit({ eventId: 716 }, { data: { status: status } }) emitter.emit({ eventId: 726 }, { data: { status: status } }) // 更新元音频 // if (status == 'playing') { this.av_sessi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_play_status AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private send_play_status(status: string) { // 更新数据 // this.play_status = status log(status) // 广播状态 // emitter.emit({ eventId: 716 }, { data: { status: status } }) emitter.emit({ eventId: 726 }, { data: { status: status } }) // 更新元音频 // if (status == 'playing') { this.av_sessi...
https://github.com/Nekofox-POT/LinMusic
da96c1379c001df1052c4bea6a1d8af3a4dcb484
github
openharmony/arkui_advanced_ui_component
atomicservicenavigation/source/atomicservicenavigation.ets
arkts
resourceColorToString
ResourceColor转化为能作为addColorStop使用的字符串 @param resource ResourceColor = Color | number | string | Resource,对于Resource转化为直接使用的字符串需要特殊处理 @returns
resourceColorToString(resource: ResourceColor): string { if (typeof resource === 'object') { try { return getContext(this).resourceManager.getStringSync(resource) } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resourceColorToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ResourceColor AST#identifier#R...
resourceColorToString(resource: ResourceColor): string { if (typeof resource === 'object') { try { return getContext(this).resourceManager.getStringSync(resource) } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; ...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
b3199dc3e77bc6d9a9f8e98247e18bb96da489ef
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
toggleBasic
切换基础开关状态 @param value 新的开关状态
toggleBasic(value: boolean): void { this.switchBasic = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleBasic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A...
toggleBasic(value: boolean): void { this.switchBasic = value; }
https://github.com/codelably/tuniao-ui
b37b1e26d937383971e5ff0ef73f45c6e3bde500
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test4_original_index.ets
arkts
testComparisons
=== Comparison operators ===
function testComparisons(a: number, b: number): string { let eq: boolean = a === b; let neq: boolean = a !== b; let lt: boolean = a < b; let gt: boolean = a > b; let lte: boolean = a <= b; let gte: boolean = a >= b; return String(eq) + String(neq) + String(lt) + String(gt) + String(lte) + String(gte); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testComparisons AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function testComparisons(a: number, b: number): string { let eq: boolean = a === b; let neq: boolean = a !== b; let lt: boolean = a < b; let gt: boolean = a > b; let lte: boolean = a <= b; let gte: boolean = a >= b; return String(eq) + String(neq) + String(lt) + String(gt) + String(lte) + String(gte); }
https://github.com/miaochiahao/ark-ghidra
3d08c1c3068acbaadd92a0b6a307afaa29e69581
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue551.ets.audit.ets
arkts
indirectflog
HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 15 : issue551.ets
function indirectflog(): void { directflog(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left indirectflog AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_typ...
function indirectflog(): void { directflog(); }
https://gitee.com/openharmony-sig/earth.git
5b2881baea55bae0ed0b0925fb52d9fee21a10fc
gitee
aimilin6688/KeePassHO
entry/src/main/ets/workers/DatabaseSave.ets
arkts
handleSaveDatabase
处理数据库保存任务 @param request 请求
public async handleSaveDatabase(requestMessage: SaveDatabaseMessage) { try { let request = new SaveDatabase(JSON.parse(requestMessage.dbFileParam) as SaveDatabaseDbParam, requestMessage); this.postMessage($r('app.string.loading_key')); // 创建凭证 let credentials: KdbxCredentials = await Crede...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left handleSaveDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestMessage AST#identifier#Right A...
public async handleSaveDatabase(requestMessage: SaveDatabaseMessage) { try { let request = new SaveDatabase(JSON.parse(requestMessage.dbFileParam) as SaveDatabaseDbParam, requestMessage); this.postMessage($r('app.string.loading_key')); // 创建凭证 let credentials: KdbxCredentials = await Crede...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseSave.ets#L28-L50
b2d5cd0fb29d6bb1cf804e3ae35fdd4311cc36e3
github
HarmonyOS_Samples/BestPracticeSnippets
LoadPerformanceInWeb/entry/src/main/ets/pages/PracticalCaseTwo.ets
arkts
build
[StartExclude practical_case_two]
build() { Column() { // [Start web_attach_controller] Web({ src: 'https://www.example.com/a.html', controller: this.controller }) .onControllerAttached(async () => { // Read the configuration and precompile. for (const config of this.configs) { this.getUIContext...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { // [Start web_attach_controller] Web({ src: 'https://www.example.com/a.html', controller: this.controller }) .onControllerAttached(async () => { // Read the configuration and precompile. for (const config of this.configs) { this.getUIContext...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
dca9f7cead2c478ca6a1645641ed6f226db94dda
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/list/ListDemo3.ets
arkts
itemScale
每个 item 的高度 指定的 item 的缩放倍数
itemScale(item: string): number { if (this.dragItem == undefined) { return 1 } if (this.dragItem == item) { return 1.1 } else { return 0.9 } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left itemScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)...
itemScale(item: string): number { if (this.dragItem == undefined) { return 1 } if (this.dragItem == item) { return 1.1 } else { return 0.9 } }
https://github.com/webabcd/HarmonyDemo
f13aece37741eff65f31d0239ec47fc449be96dd
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/MedicalImageUtils.ets
arkts
calculateTextureFeatures
计算纹理特征 使用简单的梯度统计作为纹理特征 @param pixelMap 图像 @returns 纹理特征数组
static async calculateTextureFeatures(pixelMap: image.PixelMap): Promise<number[]> { try { // 获取图像信息 const imageInfo = await pixelMap.getImageInfo(); const width = imageInfo.size.width; const height = imageInfo.size.height; // 读取像素数据 const pixelBytesNumber = pixelMap.getPixelB...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateTextureFeatures AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identi...
static async calculateTextureFeatures(pixelMap: image.PixelMap): Promise<number[]> { try { // 获取图像信息 const imageInfo = await pixelMap.getImageInfo(); const width = imageInfo.size.width; const height = imageInfo.size.height; // 读取像素数据 const pixelBytesNumber = pixelMap.getPixelB...
https://github.com/LJ666-ui/harmony-health-care
f600e99a16f9b05de621afd7dd8e85520ba3c0c0
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/SearchHistoryRepository.ets
arkts
getRecentSearchHistory
获取指定数量的最新搜索历史记录 @param {number} limit 限制数量 @returns {Promise<SearchHistory[]>} 搜索历史列表
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> { return this.dataSource.getRecentSearchHistory(limit); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getRecentSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> { return this.dataSource.getRecentSearchHistory(limit); }
https://github.com/Joker-x-dev/CoolMallArkTS
a9ae6468ef1300c521067bd37132dc5f32884cf6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets
arkts
waitForProgressNotificationIdle
等待当前任务的进度通知发送完成,避免完成/失败通知被旧进度覆盖
private async waitForProgressNotificationIdle(task: InternalTask): Promise<void> { let waitedTimes = 0; while (task.isSendingProgressNotification) { await new Promise<void>((resolve) => { setTimeout(() => { resolve(); }, 12); }); waitedTimes++; if (waitedTimes...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left waitForProgressNotificationIdle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#R...
private async waitForProgressNotificationIdle(task: InternalTask): Promise<void> { let waitedTimes = 0; while (task.isSendingProgressNotification) { await new Promise<void>((resolve) => { setTimeout(() => { resolve(); }, 12); }); waitedTimes++; if (waitedTimes...
https://github.com/DaLongZhuaZi/manxia
d0d394f24d7d96dccfa952f3b19de09ec09e26e0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
cacheSourceIcon
缓存图源图标 @param sourceId 图源ID @param iconUrl 图标URL @param headers 请求头 @returns 缓存后的本地路径,失败返回null
public async cacheSourceIcon( sourceId: string, iconUrl: string, headers?: Record<string, string> ): Promise<string | null> { try { // 检查是否已缓存 const existingPath = this.getCachedSourceIconPath(sourceId, iconUrl); if (existingPath) { logger.debug(TAG, `图源图标已缓存: ${sourceId}`)...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cacheSourceIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async cacheSourceIcon( sourceId: string, iconUrl: string, headers?: Record<string, string> ): Promise<string | null> { try { // 检查是否已缓存 const existingPath = this.getCachedSourceIconPath(sourceId, iconUrl); if (existingPath) { logger.debug(TAG, `图源图标已缓存: ${sourceId}`)...
https://github.com/DaLongZhuaZi/manxia
dc2e074ddbcdbe061ef7f87c75eac60224f88f0a
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
useCoupon
使用优惠券
static async useCoupon(couponId: number): Promise<ApiResponse> { console.info('CouponApi.useCoupon: Starting request for couponId=' + couponId); try { const response = await httpClient.post(`/coupons/${couponId}/use`, '{}'); console.info('CouponApi.useCoupon: HTTP response code=' + response.code);...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left useCoupon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left couponId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static async useCoupon(couponId: number): Promise<ApiResponse> { console.info('CouponApi.useCoupon: Starting request for couponId=' + couponId); try { const response = await httpClient.post(`/coupons/${couponId}/use`, '{}'); console.info('CouponApi.useCoupon: HTTP response code=' + response.code);...
https://github.com/Harrisonls2004/WaterFlow
d281c2d85517516d4c944162a043501b69493e3c
github
openharmony/applications_settings
product/phone/src/main/ets/pages/applicationInfo.ets
arkts
showPromptDialog
Stop exception prompt Dialog
showPromptDialog(callback: Callback<void>) { AlertDialog.show({ message: $r("app.string.Stop_exception_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(ConfigData.TAG + 'Closed callbacks'); } }, secondaryButton: { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showPromptDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#id...
showPromptDialog(callback: Callback<void>) { AlertDialog.show({ message: $r("app.string.Stop_exception_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(ConfigData.TAG + 'Closed callbacks'); } }, secondaryButton: { ...
https://gitee.com/openharmony/applications_settings.git
75449b98a2efe845300dcf0cab48ed3381d07f94
gitee
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment5.ets
arkts
build
[EndExclude Case5]
build() { Column() { List() { LazyForEach(this.dataSource, (item: number) => { ListItem() { if (item % 2 === 0) { // Simulation of type I conditions ReusableComponent({ item: item }) .reuseId('type1') } else if (item % 3 === 0) { // Sim...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { List() { LazyForEach(this.dataSource, (item: number) => { ListItem() { if (item % 2 === 0) { // Simulation of type I conditions ReusableComponent({ item: item }) .reuseId('type1') } else if (item % 3 === 0) { // Sim...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
06392137a04f88c380c3a9c7b240770de9e530ae
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LargeFileJSONParser.ets
arkts
tryParseObject
尝试解析JSON对象
private tryParseObject(jsonStr: string, result: ParseResult<T>): T | null { try { const trimmed = jsonStr.trim(); if (!trimmed || !trimmed.startsWith('{') || !trimmed.endsWith('}')) { return null; } return SafeUtils.parseObj(trimmed) as T; } catch (error) { const e...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryParseObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
private tryParseObject(jsonStr: string, result: ParseResult<T>): T | null { try { const trimmed = jsonStr.trim(); if (!trimmed || !trimmed.startsWith('{') || !trimmed.endsWith('}')) { return null; } return SafeUtils.parseObj(trimmed) as T; } catch (error) { const e...
https://github.com/DaLongZhuaZi/manxia
68b0ae24cb229d586d30260abdf5e54c810293fe
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportBrowseHistory
导出浏览历史
private async exportBrowseHistory(): Promise<BrowseHistoryBackup[]> { try { const novelHistory = this.novelSettingsManager.getBrowseHistory(); return novelHistory.map((item: BrowseHistoryItem): BrowseHistoryBackup => ({ sourceId: item.sourceId, contentId: item.bookUrl, contentT...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportBrowseHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async exportBrowseHistory(): Promise<BrowseHistoryBackup[]> { try { const novelHistory = this.novelSettingsManager.getBrowseHistory(); return novelHistory.map((item: BrowseHistoryItem): BrowseHistoryBackup => ({ sourceId: item.sourceId, contentId: item.bookUrl, contentT...
https://github.com/DaLongZhuaZi/manxia
4603ee1351b9bbb2dd9b89f8ff567374214321d3
github
wanrenhuifu/JLU
harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/pages/Home/TKExamination.ets
arkts
getQuestionStatus
获取开始答题的状态
getQuestionStatus(){ switch (this.userSubmitStatus) { case 0: return 1 break; case 1: return 3 break; default: return 2 break; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getQuestionStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#...
getQuestionStatus(){ switch (this.userSubmitStatus) { case 0: return 1 break; case 1: return 3 break; default: return 2 break; } }
https://github.com/wanrenhuifu/JLU
62048e5995c3307bbb85dd68a2f02f52a458d126
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
isDarkTheme
判断是否为深色主题(异步)
public async isDarkTheme(): Promise<boolean> { return await this.getActualTheme() === ThemeType.DARK; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left isDarkTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public async isDarkTheme(): Promise<boolean> { return await this.getActualTheme() === ThemeType.DARK; }
https://github.com/DaLongZhuaZi/manxia
d06281b1aac62ebefd727c9c2ebf3a06684ecf21
github
HarmonyOS_Samples/guide-snippets
Ability/StartAbility/entry/src/main/ets/entryability/NavigationAbility.ets
arkts
onCreate
[Start navigation_ability_on_create]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { // [End navigation_ability_on_create] hilog.info(DOMAIN, TAG, `onCreate, want=${JSON.stringify(want)}`); super.onCreate(want, launchParam); this.parseWant(want); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { // [End navigation_ability_on_create] hilog.info(DOMAIN, TAG, `onCreate, want=${JSON.stringify(want)}`); super.onCreate(want, launchParam); this.parseWant(want); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
4fe43d4abb06225f69eea161fae8d502602c5c23
gitcode
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
getUserItem
获取用户数据 @param id @returns
public getUserItem(id: string): Promise<UserItemDataDto> { return this.requireApi().getUserItem(id) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
public getUserItem(id: string): Promise<UserItemDataDto> { return this.requireApi().getUserItem(id) }
https://github.com/OHPG/FinMusic
6c4fdcad1720daa653fa10a7838653c35aadd5d1
github
openharmony-tpc/VCard
library/src/main/ets/components/utils/PhoneNumberUtils.ets
arkts
isISODigit
True if c is ISO-LATIN characters 0-9
public static isISODigit (c:string):boolean { return c >= '0' && c <= '9'; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isISODigit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Ri...
public static isISODigit (c:string):boolean { return c >= '0' && c <= '9'; }
https://gitee.com/openharmony-tpc/VCard.git
ed2195f43b1e1423dace21aa9e4a4e9e9095656a
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a BigInt64Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new BigInt64Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): BigInt64Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): BigInt64Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
72400e58364ffcd3f9a37da65e43dd5281a47154
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/JSRuntime.ets
arkts
iterate
=================== Public API ===================
public static iterate(object: Any, callback: (arrElem: Any) => void): void { const global = JSRuntime.getGlobal(); const symbol = JSRuntime.getPropertyObject(global, "Symbol"); const symbolIterator = JSRuntime.getPropertyObject(symbol, "iterator"); const symbolIteratorMethod = J...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left iterate AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left object AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier...
public static iterate(object: Any, callback: (arrElem: Any) => void): void { const global = JSRuntime.getGlobal(); const symbol = JSRuntime.getPropertyObject(global, "Symbol"); const symbolIterator = JSRuntime.getPropertyObject(symbol, "iterator"); const symbolIteratorMethod = J...
https://gitcode.com/iop123123/arkts-static-skills
e6aeb45affad7d4a8da13cd4e3ffec15257638cb
gitcode
Nekofox-POT/LinMusic
entry/src/main/ets/pages/setting/setting_index.ets
arkts
aboutToAppear
自身页面开关 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 基础函数 // ////////// 页面挂载操作 //
aboutToAppear(): void { // 等待宿主节点挂载完成后拉取半模态 // setTimeout(() => { this.show_sheet = true }, 50) // 选项逐出动画 // for (let i = 0; i < 5; i++) { setTimeout(() => { this.item_count = i + 1 }, 200 + i * 80) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#comme...
aboutToAppear(): void { // 等待宿主节点挂载完成后拉取半模态 // setTimeout(() => { this.show_sheet = true }, 50) // 选项逐出动画 // for (let i = 0; i < 5; i++) { setTimeout(() => { this.item_count = i + 1 }, 200 + i * 80) } }
https://github.com/Nekofox-POT/LinMusic
f4517647b65cc7ecbd0dccf5016a045be74fb1f7
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
initialize
初始化缓存管理器 @param context 应用上下文
async initialize(context: common.UIAbilityContext): Promise<boolean> { if (this.initialized) { return true; } this.context = context; this.initialized = true; // 确保缓存目录存在 try { const cacheDir = this.getCacheDir(); if (cacheDir) { try { const stat = fileIo....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#t...
async initialize(context: common.UIAbilityContext): Promise<boolean> { if (this.initialized) { return true; } this.context = context; this.initialized = true; // 确保缓存目录存在 try { const cacheDir = this.getCacheDir(); if (cacheDir) { try { const stat = fileIo....
https://github.com/richshaw2015/nds
2807808ba93590e082da5ec0d87f7336baa20cb6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
then
Schedule callbacks to execute after the promise is completed @param onFulfilled callback that will be called after the promise is resolved @param [onRejected] callback that will be called after the promise is rejected @returns { Promise } new promise that will be resolved after the execution of one of the callbacks or ...
then<U = T, E = never>(onFulfilled: (value: T) => PromiseLike<U>|U, onRejected?: (error: Error) => PromiseLike<E>|E): Promise<Awaited<U|E>> { let promise = new Promise<Awaited<U|E>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_RE...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#identifier#Left then AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#identifier#Left T AST#identifier#Right AST#...
then<U = T, E = never>(onFulfilled: (value: T) => PromiseLike<U>|U, onRejected?: (error: Error) => PromiseLike<E>|E): Promise<Awaited<U|E>> { let promise = new Promise<Awaited<U|E>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_RE...
https://gitcode.com/iop123123/arkts-static-skills
2e86c62b8db0b93ede39d922948059907cbf94f9
gitcode
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
getPngOptimizeDecoding
获取默认解码是否开启了png解码优化 @returns 返回true表示开启了优化解码,返回false表示没有开启
getPngOptimizeDecoding(): boolean { return nativeNode.getPngOptimizeDecoding(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPngOptimizeDecoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right ...
getPngOptimizeDecoding(): boolean { return nativeNode.getPngOptimizeDecoding(); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L374-L376
bb51842bd211c7703b3516e5ab9625b05da8a011
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/OnlineComicConverter.ets
arkts
convertToOnlinePageInfo
将数据库记录转换为 OnlinePageInfo @param record 数据库记录 @returns OnlinePageInfo 对象
public static convertToOnlinePageInfo(record: DatabaseRecord): OnlinePageInfo { const obj: DatabaseObject = record as DatabaseObject; const info: OnlinePageInfo = { id: String(obj.id || ''), chapterId: String(obj.chapterId || ''), pageNumber: Number(obj.pageNumber) || Number(obj.index) ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertToOnlinePageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST...
public static convertToOnlinePageInfo(record: DatabaseRecord): OnlinePageInfo { const obj: DatabaseObject = record as DatabaseObject; const info: OnlinePageInfo = { id: String(obj.id || ''), chapterId: String(obj.chapterId || ''), pageNumber: Number(obj.pageNumber) || Number(obj.index) ...
https://github.com/DaLongZhuaZi/manxia
1cf6741fd105c5007ae0f6b44d8443be3abf4e3b
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/GlobalPackService.ets
arkts
parsePacks
Pure parser exposed for unit tests. Converts the global-packs latest.json envelope into a list of fully-hydrated Pack objects with `source = 'global'`. Returns an empty list on any parse error.
static parsePacks(body: string): Pack[] { if (body.length === 0) { return []; } let raw: RawLatest; try { raw = JSON.parse(body) as RawLatest; } catch (_err) { return []; } if (raw === null || raw === undefined || !Array.isArray(raw.packs)) { return []; } co...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parsePacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static parsePacks(body: string): Pack[] { if (body.length === 0) { return []; } let raw: RawLatest; try { raw = JSON.parse(body) as RawLatest; } catch (_err) { return []; } if (raw === null || raw === undefined || !Array.isArray(raw.packs)) { return []; } co...
https://github.com/terryma2024/happyword
4ecc27473f4decd99752182b680a73962a5f5e83
github