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
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/data/DecryptContent.ets
arkts
clone
DecryptContent里添加成员变量,一定要在clone()里添加复制操作
public clone(): DecryptContent { const clone = new DecryptContent(this._fileMetaInfo, this._openDlpFileData); clone.dlpFd = this._dlpFd; clone.dlpFile = this._dlpFile; clone.appInfo = this._appInfo; clone.distributedInfoId = this._distributedInfoId; clone.linkUri = this._linkUri; clone.lin...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clone 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#:#Rig...
public clone(): DecryptContent { const clone = new DecryptContent(this._fileMetaInfo, this._openDlpFileData); clone.dlpFd = this._dlpFd; clone.dlpFile = this._dlpFile; clone.appInfo = this._appInfo; clone.distributedInfoId = this._distributedInfoId; clone.linkUri = this._linkUri; clone.lin...
https://gitee.com/openharmony/applications_dlp_manager.git
ea13d0a3266c034b4d71905f58ec8fb2610bdd11
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
constructor
私有构造函数
private constructor() { this.factory = new TemplateFactory(); this.presetStrategy = this.factory.getPresetStrategy(); this.userStrategy = this.factory.getUserStrategy(); hilog.info(DOMAIN, TAG, 'TemplateService initialized'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor 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#statement_block#Left AST#{#Left ...
private constructor() { this.factory = new TemplateFactory(); this.presetStrategy = this.factory.getPresetStrategy(); this.userStrategy = this.factory.getUserStrategy(); hilog.info(DOMAIN, TAG, 'TemplateService initialized'); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L41-L46
fa01c9c4e1b8e5895f07fd01cb98e6bd87cd957d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GyroAssistService.ets
arkts
setInvertY
设置 Y 轴反转
setInvertY(invert: boolean): void { this._invertY = invert; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInvertY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left invert AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A...
setInvertY(invert: boolean): void { this._invertY = invert; }
https://github.com/AlkaidLab/moonlight-harmony
74d3b10232652c653b61f178b3dcf359ea261d43
github
CPF-ApplicationTPC/openharmony_tpc_samples
amqplib/entry/src/main/ets/pages/001_ConnectClosePage.ets
arkts
aboutToAppear
─── 生命周期 ──────────────────────────────────────────────────────────────
aboutToAppear(): void { hilog.info(DOMAIN, TAG, 'Demo page appeared'); }
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#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { hilog.info(DOMAIN, TAG, 'Demo page appeared'); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
813774abe534eda39d50ae58c1e8df4f5563e832
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/FontNameParser.ets
arkts
decodeUTF16BE
解码UTF-16BE字符串
function decodeUTF16BE(data: Uint8Array): string { let result = ''; for (let i = 0; i < data.length - 1; i += 2) { const charCode = (data[i] << 8) | data[i + 1]; // 处理代理对 (surrogate pairs) 用于扩展字符 if (charCode >= 0xD800 && charCode <= 0xDBFF && i + 3 < data.length) { const highSurrogate = char...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left decodeUTF16BE AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function decodeUTF16BE(data: Uint8Array): string { let result = ''; for (let i = 0; i < data.length - 1; i += 2) { const charCode = (data[i] << 8) | data[i + 1]; // 处理代理对 (surrogate pairs) 用于扩展字符 if (charCode >= 0xD800 && charCode <= 0xDBFF && i + 3 < data.length) { const highSurrogate = char...
https://github.com/DaLongZhuaZi/manxia
8daa6a44e854e7898a28e35c40531f099f1ce73e
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
initGrantResult
初始化授权状态列表 @param reqPermsState 权限状态 return 授权状态列表
private initGrantResult(reqPermsState: number[]): number[] { let grantResult: number[] = new Array(reqPermsState.length).fill(abilityAccessCtrl.GrantStatus.PERMISSION_DENIED); reqPermsState.forEach((state, idx) => { if (state === Constants.PASS_OPER) { grantResult[idx] = abilityAccessCtrl.GrantS...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initGrantResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reqPermsState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
private initGrantResult(reqPermsState: number[]): number[] { let grantResult: number[] = new Array(reqPermsState.length).fill(abilityAccessCtrl.GrantStatus.PERMISSION_DENIED); reqPermsState.forEach((state, idx) => { if (state === Constants.PASS_OPER) { grantResult[idx] = abilityAccessCtrl.GrantS...
https://gitee.com/openharmony/applications_permission_manager.git
51c8a6d4d01d522979d9b494b26c029f2791158b
gitee
2763981847/Accounting-app
entry/src/main/ets/common/database/Rdb.ets
arkts
batchInsert
批量插入数据 @param data - 要插入的数据数组 @param callback - 插入成功后的回调函数
batchInsert(data: relationalStore.ValuesBucket[], callback: Function = () => { }): void { // 如果回调函数未提供,记录警告信息 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'batchInsert() has no callback!'); return; } let resFlag: bool...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left batchInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#member_expression#Left AST#ide...
batchInsert(data: relationalStore.ValuesBucket[], callback: Function = () => { }): void { // 如果回调函数未提供,记录警告信息 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'batchInsert() has no callback!'); return; } let resFlag: bool...
https://github.com/2763981847/Accounting-app
33c3572d67d50fc27021b7431fbef558b1003d47
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/validation/ValidationUtil.ets
arkts
isValidSmsCode
验证短信验证码是否有效(4位数字) @param {string} code - 验证码 @returns {boolean} 是否有效
static isValidSmsCode(code: string): boolean { if (code.length !== 4) { return false; } for (let i = 0; i < code.length; i += 1) { const current: string = code[i]; if (current < "0" || current > "9") { return false; } } return true; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidSmsCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
static isValidSmsCode(code: string): boolean { if (code.length !== 4) { return false; } for (let i = 0; i < code.length; i += 1) { const current: string = code[i]; if (current < "0" || current > "9") { return false; } } return true; }
https://github.com/Joker-x-dev/CoolMallArkTS
d79d0c399271d44ed0cc3a51a811d9113fe73d88
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
check14Nines
Check for 14 nines from the 2nd rounding digit, as the first may be 4.
private check14Nines(d: Array<double>, k: int) { return (Utils.toNumber(Utils.digitsToString(d).slice(k + 1, k + 15)) + 1 == 1e14) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left check14Nines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre...
private check14Nines(d: Array<double>, k: int) { return (Utils.toNumber(Utils.digitsToString(d).slice(k + 1, k + 15)) + 1 == 1e14) }
https://gitcode.com/iop123123/arkts-static-skills
8763470b1ca9137cb5c05bda706e2cdcc495251e
gitcode
openharmony-sig/applications_filemanager
entry/src/main/ets/Components/VideoController.ets
arkts
refreshData
是否是音频
refreshData() { this.mediaList = [] let fileAsset if(this.isAudio) fileAsset = this.mediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.AUDIO) else fileAsset = this.mediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.VIDEO) fileAsset.then(fileList => { Logger.info(this.TA...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshData 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#Left A...
refreshData() { this.mediaList = [] let fileAsset if(this.isAudio) fileAsset = this.mediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.AUDIO) else fileAsset = this.mediaUtils.getFileAssetsFromType(mediaLibrary.MediaType.VIDEO) fileAsset.then(fileList => { Logger.info(this.TA...
https://gitee.com/openharmony-sig/applications_filemanager.git
ea1ac3d1593a5c2a5f505023231708c23b156267
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
endsWith
Checks that this string ends with the specified suffix. @param { String } suffix suffix string @param { int } [endPosition] at which suffix is expected to be found. Defaults to str.length. @returns { boolean } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public endsWith(suffix: String, endPosition?: int): boolean { return this.endsWithImpl(suffix, endPosition ?? this.getLength()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left endsWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left suffix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Strin...
public endsWith(suffix: String, endPosition?: int): boolean { return this.endsWithImpl(suffix, endPosition ?? this.getLength()); }
https://gitcode.com/iop123123/arkts-static-skills
87ff42e8e6f9ff48f7052421de7b3e925663ffe0
gitcode
YANGZX22/Voot
entry/src/main/ets/pages/PolishPage.ets
arkts
splitIntoSentences
将文本分割成句子
splitIntoSentences(text: string): string[] { // 按中英文句号、问号、感叹号分割 const sentences = text.split(/(?<=[。!?.!?])/g).filter(s => s.trim().length > 0); return sentences.length > 0 ? sentences : [text]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left splitIntoSentences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#...
splitIntoSentences(text: string): string[] { // 按中英文句号、问号、感叹号分割 const sentences = text.split(/(?<=[。!?.!?])/g).filter(s => s.trim().length > 0); return sentences.length > 0 ? sentences : [text]; }
https://github.com/YANGZX22/Voot
3f5b428e84cea25b463803a798db32d9d0590bc1
github
openharmony/security_privacy_center
entry/src/main/ets/common/utils/AutoMenuManager.ets
arkts
_isValidAccessMode
Whether the access mode is valid
private _isValidAccessMode(dstAbilityMode: number, dstBundleName: string): boolean { return dstAbilityMode !== DST_ABILITY_MODE && dstAbilityMode !== DST_UIABILITY_MODE }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _isValidAccessMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dstAbilityMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
private _isValidAccessMode(dstAbilityMode: number, dstBundleName: string): boolean { return dstAbilityMode !== DST_ABILITY_MODE && dstAbilityMode !== DST_UIABILITY_MODE }
https://gitee.com/openharmony/security_privacy_center.git
7ff97d9325ad08efa1d00b2bd34c2586ba6d1abd
gitee
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/MockWriterCoreBridge.ets
arkts
listWorkspaces
Workspace methods
async listWorkspaces(): Promise<ResultEnvelope<WorkspaceSummary[]>> { await this.delay(100) return this.success([ { path: '/mock/workspace', isValid: true, projects: this.mockProjects, recentEdits: [] as RecentEdit[] } as WorkspaceSummary ] as WorkspaceSummary[]...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listWorkspaces 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#gener...
async listWorkspaces(): Promise<ResultEnvelope<WorkspaceSummary[]>> { await this.delay(100) return this.success([ { path: '/mock/workspace', isValid: true, projects: this.mockProjects, recentEdits: [] as RecentEdit[] } as WorkspaceSummary ] as WorkspaceSummary[]...
https://github.com/Xiwei753/xiezuoruanjian
6241de5121c3c45c14ebb5b40abe1805d6ce412b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/UsbDriverService.ets
arkts
deviceHasHidInterface
检查设备是否包含 HID 接口
private deviceHasHidInterface(device: usbManager.USBDevice): boolean { if (!device.configs) return false; for (let ci = 0; ci < device.configs.length; ci++) { const config = device.configs[ci]; if (!config.interfaces) continue; for (let ii = 0; ii < config.interfaces.length; ii++) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deviceHasHidInterface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe...
private deviceHasHidInterface(device: usbManager.USBDevice): boolean { if (!device.configs) return false; for (let ci = 0; ci < device.configs.length; ci++) { const config = device.configs[ci]; if (!config.interfaces) continue; for (let ii = 0; ii < config.interfaces.length; ii++) { ...
https://github.com/AlkaidLab/moonlight-harmony
74ebcfbf760ed56fd0d502f581e0afe6c081e08b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets
arkts
isView
Checks if the passed object is one of the ArrayBuffer views. @param { Object } obj The object to check. @returns { boolean } Returns true if the object is a view; otherwise false. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isView(obj: Object): boolean { return ( obj instanceof DataView || obj instanceof Int8Array || obj instanceof Int16Array || obj instanceof Int32Array || obj instanceof BigInt64Array || obj instanceof Float32Array || ob...
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 isView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Righ...
public static isView(obj: Object): boolean { return ( obj instanceof DataView || obj instanceof Int8Array || obj instanceof Int16Array || obj instanceof Int32Array || obj instanceof BigInt64Array || obj instanceof Float32Array || ob...
https://gitcode.com/iop123123/arkts-static-skills
b317a1e67e13ed77489042fbde61a02f9acdafe1
gitcode
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
initLoad
初始化加载(子类可在 aboutToAppear 中调用) @returns {void} 无返回值
protected initLoad(): void { this.loadListData(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left initLoad 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...
protected initLoad(): void { this.loadListData(); }
https://github.com/Joker-x-dev/CoolMallArkTS
f08c5153b08d5ca656ceec08a473861936785bf3
github
openharmony-sig/earth
hpauditor/tests/issues/expected/issue124.ets.audit.ets
arkts
build
构造0-99的数组
build() { List() { /* HPAudit: Consider using LazyForEach for long lists : hp-arkui-load-on-demand : 1 : 7 : issue124.ets */ ForEach(this.arr, (item: number) => { ListItem() { Text(`item value: ${item}`) } }, (item: number) => item.toString()) } }
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() { List() { /* HPAudit: Consider using LazyForEach for long lists : hp-arkui-load-on-demand : 1 : 7 : issue124.ets */ ForEach(this.arr, (item: number) => { ListItem() { Text(`item value: ${item}`) } }, (item: number) => item.toString()) } }
https://gitee.com/openharmony-sig/earth.git
ded399f00b7de87718b9443ffac210346538b92a
gitee
openharmony-sig/ohos_react_native
tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets
arkts
createLogger
region RNAbility methods that can be safely overridden.
protected createLogger(): RNOHLogger { return new StandardRNOHLogger(); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left createLogger 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 ...
protected createLogger(): RNOHLogger { return new StandardRNOHLogger(); }
https://gitee.com/openharmony-sig/ohos_react_native.git
f9070dda6e0c4d63c3cbcf19e8e1ff291db2f8c4
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseEntry.ets
arkts
getIcon
Returns the icon of this Entry. @return
public getIcon(): ChartPixelMap | null { return this.mIcon; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIcon 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#binary_expression#Left AST#ide...
public getIcon(): ChartPixelMap | null { return this.mIcon; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f560e1197d534e786b3ca2f6ed09bbe0974e542f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
ensureFontsDir
确保字体目录存在
private async ensureFontsDir(): Promise<void> { try { const exists = SafeFileUtils.accessSync(this.fontsDirPath); if (!exists) { SafeFileUtils.mkdirSync(this.fontsDirPath); logger.info(TAG, `创建字体目录: ${this.fontsDirPath}`); } } catch (error) { // 目录不存在,创建它 try { ...
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 ensureFontsDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async ensureFontsDir(): Promise<void> { try { const exists = SafeFileUtils.accessSync(this.fontsDirPath); if (!exists) { SafeFileUtils.mkdirSync(this.fontsDirPath); logger.info(TAG, `创建字体目录: ${this.fontsDirPath}`); } } catch (error) { // 目录不存在,创建它 try { ...
https://github.com/DaLongZhuaZi/manxia
68ec5428cc106b599a736b7557e316c3c712118c
github
CLMC2025/Vignette
entry/src/main/ets/utils/TimerManager.ets
arkts
setInterval
设置间隔定时器 @param callback 回调函数 @param interval 间隔时间(毫秒) @returns 定时器 ID
setInterval(callback: () => void, interval: number): TimerId { if (this.destroyed) { console.warn('[TimerManager] setInterval called after destroy, ignoring'); return -1; } const timerId = setInterval(() => { try { callback(); } catch (e) { const errMsg = e instanc...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#argu...
setInterval(callback: () => void, interval: number): TimerId { if (this.destroyed) { console.warn('[TimerManager] setInterval called after destroy, ignoring'); return -1; } const timerId = setInterval(() => { try { callback(); } catch (e) { const errMsg = e instanc...
https://github.com/CLMC2025/Vignette
62de3861e1cdb03a355eba6c75bc20f83065aec3
github
CPF-ApplicationTPC/openharmony_tpc_samples
bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets
arkts
wordArrayToBytes
WordArray 转 Uint8Array
private wordArrayToBytes(wordArray: CryptoJS.lib.WordArray): Uint8Array { const words: number[] = wordArray.words; const sigBytes: number = wordArray.sigBytes; const bytes: Uint8Array = new Uint8Array(sigBytes); for (let i = 0; i < sigBytes; i++) { const wordIndex: number = Math.floor(i / 4); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left wordArrayToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordArray AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_...
private wordArrayToBytes(wordArray: CryptoJS.lib.WordArray): Uint8Array { const words: number[] = wordArray.words; const sigBytes: number = wordArray.sigBytes; const bytes: Uint8Array = new Uint8Array(sigBytes); for (let i = 0; i < sigBytes; i++) { const wordIndex: number = Math.floor(i / 4); ...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
26b3b3d99faa8d897500473e9264874210c41e9d
gitcode
Eklps/harmony-mall-perf
entry/src/main/ets/view/TabBarsComponent.ets
arkts
build
构建主页面
build() { Tabs() { TabContent() { Column() { if (this.refreshStatus) { PutDownRefresh({ refreshText: $refreshText }) } SearchView() SelectView() // 瀑布流作为主滚动区域 WaterfallGoods() } .width(LAYOUT_WIDTH_OR_HEIGHT) ...
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() { Tabs() { TabContent() { Column() { if (this.refreshStatus) { PutDownRefresh({ refreshText: $refreshText }) } SearchView() SelectView() // 瀑布流作为主滚动区域 WaterfallGoods() } .width(LAYOUT_WIDTH_OR_HEIGHT) ...
https://github.com/Eklps/harmony-mall-perf
76ebcf433cac1da83d9f1d61502797ac5bc90225
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Search/SearchIntentParser.ets
arkts
isPureNumber
检测是否为纯数字
private static isPureNumber(text: string): boolean { return /^\d+$/.test(text); }
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 isPureNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : ...
private static isPureNumber(text: string): boolean { return /^\d+$/.test(text); }
https://github.com/DaLongZhuaZi/manxia
c5df3073a6d5c76d0bf15481102e9daadf372634
github
ibestservices/ibest-ui
library/src/main/ets/apis/IBestActionSheet.ets
arkts
close
关闭actionSheet
public async close(id?: string){ let key = id || this.getLastKey() if(this.contentNodeArr.some(e => e.key == key)){ let index = this.contentNodeArr.findIndex(e => e.key == key) let val = this.contentNodeArr[index] val.uiContext.closeBindSheet(val.content).then(() => { val.content.dispose() this.co...
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 close AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#?#Left ? AST#?#Right A...
public async close(id?: string){ let key = id || this.getLastKey() if(this.contentNodeArr.some(e => e.key == key)){ let index = this.contentNodeArr.findIndex(e => e.key == key) let val = this.contentNodeArr[index] val.uiContext.closeBindSheet(val.content).then(() => { val.content.dispose() this.co...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestActionSheet.ets#L475-L485
025162bb0a090f36ff3c238b0cac95878e5bac13
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
map
Creates a new Float64Array using fn(arr[i]) over all elements of current Float64Array. @param { function } fn - a function to apply for each element of current Float64Array @returns { Float64Array } - a new Float64Array where for each element from current Float64Array fn was applied @syscap SystemCapability.Utils.Lang ...
public map(fn: (val: number, index: int, array: Float64Array) => number): Float64Array { let resBuf = new ArrayBuffer(this.lengthInt * Float64Array.BYTES_PER_ELEMENT) let res = new Float64Array(resBuf, 0, (resBuf.getByteLength() / Float64Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number, index: int, array: Float64Array) => number): Float64Array { let resBuf = new ArrayBuffer(this.lengthInt * Float64Array.BYTES_PER_ELEMENT) let res = new Float64Array(resBuf, 0, (resBuf.getByteLength() / Float64Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < ...
https://gitcode.com/iop123123/arkts-static-skills
244fb0b832ba390f0f51d282350edba04c7c8b51
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/SportService.ets
arkts
getHeaders
构建请求头: channel/version/type + token + timestamp + sign
private getHeaders(body: Record<string, string>): Record<string, string> { const headers: Record<string, string> = { 'channel': 'H5', 'version': '99999', 'type': '0', }; if (this.token.length > 0) { headers['token'] = this.token; } const timestamp: string = Date.now().toStr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getHeaders 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#instantiation_expr...
private getHeaders(body: Record<string, string>): Record<string, string> { const headers: Record<string, string> = { 'channel': 'H5', 'version': '99999', 'type': '0', }; if (this.token.length > 0) { headers['token'] = this.token; } const timestamp: string = Date.now().toStr...
https://github.com/PollenWang6/HiXD
005290a0338dafbf76b0eb274f3a9891d23fdc95
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
sftpListDir
List directory contents.
async sftpListDir(path: string): Promise<SftpFileInfo[]> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { const json = await ssh.sftpListDir(this.handle, path); return JSON.parse(json) as SftpFileInfo[]; } catch (err) { const msg = (err as Error)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpListDir AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Le...
async sftpListDir(path: string): Promise<SftpFileInfo[]> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { const json = await ssh.sftpListDir(this.handle, path); return JSON.parse(json) as SftpFileInfo[]; } catch (err) { const msg = (err as Error)...
https://github.com/UnbalancedCat/ohos-ssh-core
43b4acd02a9900acda2c31319ba4eaa5730fd90e
github
lidaixian999/Smart_Car
entry/src/main/ets/model/SmartCommandExecutor.ets
arkts
executeAICommands
执行AI回复中的指令(保留原方法,保持向后兼容)
async executeAICommands(aiResponse: string): Promise<string> { try { const result = await this.executeFromAIResponse(aiResponse); return result.confirmMessage || ''; } catch (error) { console.error('SmartCommandExecutor: 执行指令时出错:', error); return '指令执行失败,请稍后重试'; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeAICommands AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left aiResponse AST#identifier#Right AST#type_annotation#Left AST#...
async executeAICommands(aiResponse: string): Promise<string> { try { const result = await this.executeFromAIResponse(aiResponse); return result.confirmMessage || ''; } catch (error) { console.error('SmartCommandExecutor: 执行指令时出错:', error); return '指令执行失败,请稍后重试'; } }
https://github.com/lidaixian999/Smart_Car
7f5558db7693e2cb96a1caca90519e8042833b55
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
updateOffsetByIndex
通过索引更新偏移量
updateOffsetByIndex(columnIndex: number, index: number){ const offset = - index * (this.horizontal ? this.itemCalcWidth : this.itemCalcHeight) this.offsetList[columnIndex] = offset }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateOffsetByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#...
updateOffsetByIndex(columnIndex: number, index: number){ const offset = - index * (this.horizontal ? this.itemCalcWidth : this.itemCalcHeight) this.offsetList[columnIndex] = offset }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L475-L478
af5126b6dc3088b36f469e030df5b3d588b9da0a
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/AppTypeUtil.ets
arkts
setAppType
Set app type. @param type appType
public static setAppType(type: AppType): void { if (!type) { return; } AppStorage.setOrCreate(AppTypeUtil.appTypeKey, type); }
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 setAppType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:...
public static setAppType(type: AppType): void { if (!type) { return; } AppStorage.setOrCreate(AppTypeUtil.appTypeKey, type); }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
755a559259e22f83d003b87163cd82e3ab4929d2
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
loginNative
Native login account and password. @param {string} account account @param {string} password password
public loginNative(account: string, password: string): void { let check: string = this.loginCheckNative(account, password); if (CommonConstants.LOGIN_TEXT !== check) { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'login account or password is empty'); this.showToastContent(check); return; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loginNative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
public loginNative(account: string, password: string): void { let check: string = this.loginCheckNative(account, password); if (CommonConstants.LOGIN_TEXT !== check) { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'login account or password is empty'); this.showToastContent(check); return; ...
https://gitee.com/harmonyos/codelabs.git
a6e0099953bbacee53630e1a66d8d6c591449269
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
constructor
Constructs a new Boolean with provided Object value @param { Any } value value to construct class instance with @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(value: Any = undefined) { if (value == null || value == undefined) { this.value = false; } else if (value instanceof Boolean) { this.value = value; } else if (value instanceof Number) { this.value = (value != 0 && !isNaN(value)); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor 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#assignment_expressi...
public constructor(value: Any = undefined) { if (value == null || value == undefined) { this.value = false; } else if (value instanceof Boolean) { this.value = value; } else if (value instanceof Number) { this.value = (value != 0 && !isNaN(value)); ...
https://gitcode.com/iop123123/arkts-static-skills
b5e5c1657a45f22f1261df4e82af0d654356bc36
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/MultiCommunityApplication/commons/base/src/main/ets/utils/Logger.ets
arkts
constructor
Constructor. @param Prefix Identifies the log tag. @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
constructor(prefix: string) { this.prefix = prefix; this.domain = 0xFF00; }
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 prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right...
constructor(prefix: string) { this.prefix = prefix; this.domain = 0xFF00; }
https://gitee.com/harmonyos/codelabs.git
450dab6507656baf6587cd8e626863b9af054b43
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
reset
彻底重置引擎状态
reset(): void { this.cleanupTimer(); this.resetState(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#Left A...
reset(): void { this.cleanupTimer(); this.resetState(); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L101-L104
5c1758d0318f7c21d1b987d88d53670882bb6373
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets
arkts
getBigInt64
Read bytes as they represent given type @param { int } byteOffset zero index to read @param { boolean } [ littleEndian ] read as little or big endian @returns { bigint } @throws { RangeError } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getBigInt64(byteOffset: int, littleEndian?: boolean): bigint { if (littleEndian !== undefined && littleEndian.valueOf() == true) { return this.getBigInt64Little(byteOffset) } else { return this.getBigInt64Big(byteOffset) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBigInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi...
public getBigInt64(byteOffset: int, littleEndian?: boolean): bigint { if (littleEndian !== undefined && littleEndian.valueOf() == true) { return this.getBigInt64Little(byteOffset) } else { return this.getBigInt64Big(byteOffset) } }
https://gitcode.com/iop123123/arkts-static-skills
01ce739f6c78ebafb358942eebc24c72a4659f94
gitcode
honjow/Next2V
feature/settings/src/main/ets/model/BackupFilePickerCoordinator.ets
arkts
readText
The picker returns a file:// uri, not a sandbox path: readTextSync(path) fails on it with "No such file or directory" (which surfaced as import doing nothing — never reaching the encrypted-detection/password prompt). Open the uri to a fd and read bytes via readSync (the mirror of writeText's writeSync(fd)), then decode...
private static readText(uri: string): string { let file: fileIo.File | null = null try { file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) const size = fileIo.statSync(file.fd).size const buffer = new ArrayBuffer(size) const bytesRead = fileIo.readSync(file.fd, buffer) const...
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 readText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:...
private static readText(uri: string): string { let file: fileIo.File | null = null try { file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) const size = fileIo.statSync(file.fd).size const buffer = new ArrayBuffer(size) const bytesRead = fileIo.readSync(file.fd, buffer) const...
https://github.com/honjow/Next2V
525c57afba1675e9ba6844597b6529f3f556a7b4
github
openharmony/codelabs
Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets
arkts
getDataPreferences
Get data preferences action.
getDataPreferences(common: Object): Promise<preferences.Preferences> { return preferences.getPreferences(getContext(common), CommonConstants.PREFERENCES_FILE_NAME); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDataPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left common AST#identifier#Right AS...
getDataPreferences(common: Object): Promise<preferences.Preferences> { return preferences.getPreferences(getContext(common), CommonConstants.PREFERENCES_FILE_NAME); }
https://gitee.com/openharmony/codelabs.git
eea488df221341c9c3b7920c4dbbde40d6c1d238
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {FixedArray<short>} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: FixedArray<short>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Short())) }
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#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: FixedArray<short>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Short())) }
https://gitcode.com/iop123123/arkts-static-skills
20b1c0c7f7bea88368a2fac3ab837ac6c3f3f90b
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
reverse
Creates a new Float32Array using reversed data from the current one @returns a new Float32Array using reversed data from the current one
public reverse(): Float32Array { let res = new Float32Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reverse 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 Float32Array A...
public reverse(): Float32Array { let res = new Float32Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
62447b4f15ab1e30a6b7f55dc54fa36ea43e7944
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
constructor
`Date` constructor. NOTE: Dates before `1921-01-01T00:00:00 GMT` can be represented as UTC milliseconds in different ways then TS do. @param { long | string | Date } value @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(value: long | string | Date) { if (value instanceof Date) { this.ms = value.ms } else if (value instanceof string) { this.ms = Date.parseDateFromString(value); } else { this.ms = value } }
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 value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression...
constructor(value: long | string | Date) { if (value instanceof Date) { this.ms = value.ms } else if (value instanceof string) { this.ms = Date.parseDateFromString(value); } else { this.ms = value } }
https://gitcode.com/iop123123/arkts-static-skills
812ec2f7fe415f1189b47223e958e16c9e239488
gitcode
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets
arkts
toggleAdvertiser
开启或关闭心率广播
toggleAdvertiser(): void { Log.showInfo(TAG, `toggleAdvertiser: startAdvertiserState = ${this.startAdvertiserState}`) if (this.startAdvertiserState) { // TODO: 知识点 关闭蓝牙服务 advertiserBluetoothViewModel.stopAdvertiser(); this.toggleHeartRate(false); this.startAdvertiserState = false; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleAdvertiser 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_b...
toggleAdvertiser(): void { Log.showInfo(TAG, `toggleAdvertiser: startAdvertiserState = ${this.startAdvertiserState}`) if (this.startAdvertiserState) { // TODO: 知识点 关闭蓝牙服务 advertiserBluetoothViewModel.stopAdvertiser(); this.toggleHeartRate(false); this.startAdvertiserState = false; ...
https://gitcode.com/arkui-x/samples
b22ef66887cf22c013ea0c1ed715ca5b195ba88c
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/FullscreenController.ets
arkts
getInstance
获取单例实例 @returns FullscreenController 实例
public static getInstance(): FullscreenController { if (!FullscreenController.instance) { FullscreenController.instance = new FullscreenController(); } return FullscreenController.instance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): FullscreenController { if (!FullscreenController.instance) { FullscreenController.instance = new FullscreenController(); } return FullscreenController.instance; }
https://github.com/richshaw2015/nds
61af0f723acf309f34601cd07fe472b308bbde78
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/Constituency-12-smarthome/entry/src/main/ets/pages/Login.ets
arkts
aboutToAppear
组件的生命周期,组件销毁时执行
aboutToAppear() { console.log('aboutToAppear') }
AST#program#Left AST#expression_statement#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#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { console.log('aboutToAppear') }
https://gitee.com/openharmony/vendor_unionman.git
7a279faf0bd7e02db00b9de91a9133a7373e6501
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPDriveManager.ets
arkts
generateRDPDriveArgs
生成 RDP 驱动器重定向参数 (用于 FreeRDP)
public generateRDPDriveArgs(vmName: string): string[] { if (!this.config.enableRDPRedirect) { return []; } const args: string[] = []; // 添加 VM 共享目录 const sharedDir = this.sharedDirectories.get(`shared-${vmName}`); if (sharedDir && sharedDir.enabled) { args.push(`/drive:shared...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateRDPDriveArgs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public generateRDPDriveArgs(vmName: string): string[] { if (!this.config.enableRDPRedirect) { return []; } const args: string[] = []; // 添加 VM 共享目录 const sharedDir = this.sharedDirectories.get(`shared-${vmName}`); if (sharedDir && sharedDir.enabled) { args.push(`/drive:shared...
https://github.com/AetheriumSimulator/qemu-hmos
835255a82f645e724dc1bdd0b0e984b9c220314d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
scanInstalledPlugins
扫描已安装的插件
private async scanInstalledPlugins(): Promise<void> { try { const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE); for (const hapModuleInfo of bundleInfo.hapModulesInfo) { // 使用明确的接口替代对象字面量类型声明 const moduleAccess = ...
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 scanInstalledPlugins AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async scanInstalledPlugins(): Promise<void> { try { const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE); for (const hapModuleInfo of bundleInfo.hapModulesInfo) { // 使用明确的接口替代对象字面量类型声明 const moduleAccess = ...
https://github.com/DaLongZhuaZi/manxia
1fdc3fee590bebbc784f29a3a1709c388d4bbb23
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets
arkts
query
query taskInfo @param date @param callback
query(date: string, isOpen: boolean = true, callback: Function): void { let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', date); if (isOpen) { predicates.equalTo('isOpen', true); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig...
query(date: string, isOpen: boolean = true, callback: Function): void { let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', date); if (isOpen) { predicates.equalTo('isOpen', true); ...
https://gitee.com/harmonyos/codelabs.git
57fecdfb1e9ac60522162e91290d328dc0d19d74
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
padEnd
The padEnd() method pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end of the current string. @returns This string if `length` >= `end`, and padded string of length exactly `end` otherwise
public padEnd(end: number, ch: String): String { throw new Error("not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST...
public padEnd(end: number, ch: String): String { throw new Error("not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
263eea12b72c32a983790a5738cdd17d597f3692
gitee
openharmony-sig/shimmer-ohos
library/src/main/ets/components/MainPage/Shimmer.ets
arkts
setDuration
Sets how long the shimmering animation takes to do one full sweep.
setDuration(millis: number): Shimmer { if (millis < 0) { throw new Error("Given a negative duration: " + millis); } this.animationDuration = millis; return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left millis AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A...
setDuration(millis: number): Shimmer { if (millis < 0) { throw new Error("Given a negative duration: " + millis); } this.animationDuration = millis; return this }
https://gitee.com/openharmony-sig/shimmer-ohos.git
d8981ae37c40b6fb5a5792d0b3cd61cdd3e780cf
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/WhereCondition.ets
arkts
greaterOrEqual
创建大于等于条件 @param column 列名 @param value 值 @returns WhereCondition 实例
static greaterOrEqual(column: string, value: ValueType): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.GREATER_EQUAL condition.value = value return condition }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left greaterOrEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static greaterOrEqual(column: string, value: ValueType): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.GREATER_EQUAL condition.value = value return condition }
https://github.com/offlinecat-dev/OCNetORM
66538d8af9a1eae18c3844fd15e8dba778d8745a
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/TotpEngine.ets
arkts
_leftRotate
==================== SHA-1 ====================
function _leftRotate(value: number, amount: number): number { return ((value << amount) | (value >>> (32 - amount))) >>> 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left _leftRotate 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#:#Rig...
function _leftRotate(value: number, amount: number): number { return ((value << amount) | (value >>> (32 - amount))) >>> 0; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
2c74cfe2a57af955854d903f12cbccd9286294a6
github
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets
arkts
setVibrator
设置振动效果。
setVibrator() { if (PlatformInfo.getPlatform() === PlatformTypeEnum.HARMONYOS) { // 查询设备是否支持预设振动效果 vibrator.isSupportEffect(this.presetVibration, (err: BusinessError, state: boolean) => { if (err) { logger.error(TAG, `Failed to query effect. Code: ${err.code}, message: ${err.message}...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setVibrator 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#Left A...
setVibrator() { if (PlatformInfo.getPlatform() === PlatformTypeEnum.HARMONYOS) { // 查询设备是否支持预设振动效果 vibrator.isSupportEffect(this.presetVibration, (err: BusinessError, state: boolean) => { if (err) { logger.error(TAG, `Failed to query effect. Code: ${err.code}, message: ${err.message}...
https://gitcode.com/arkui-x/samples
703cdd930f80e0a0ce72a675dc97702cf6c4639c
gitcode
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
regCameraLightUpdateListener
注册相机闪光灯状态更新回调函数 @param {Function} callback 相机闪光灯状态更新回调函数 @returns {void}
regCameraLightUpdateListener(callback: Function): void { this.cameraLightUpdateCb = callback; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left regCameraLightUpdateListener 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#Left Function AST#identifier...
regCameraLightUpdateListener(callback: Function): void { this.cameraLightUpdateCb = callback; }
https://gitcode.com/arkui-x/samples
8b0165727425ef41bedbd2c5b442863a5b5926cb
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ContentPanel.ets
arkts
minimize
最小化为悬浮球
minimize(): void { if (this.tabs.length > 0) { this.mode = PanelMode.MINIMIZED; this.notifyCallback(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left minimize 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#Left A...
minimize(): void { if (this.tabs.length > 0) { this.mode = PanelMode.MINIMIZED; this.notifyCallback(); } }
https://github.com/DaLongZhuaZi/manxia
dbfc29906a207c355268b28d6d305c4f395a28d8
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FollowManager.ets
arkts
getFollowStats
Get both following and follower counts in one API call 优化:一次请求获取两个统计值
static async getFollowStats(userId?: number): Promise<IFollowStats> { try { if (SERVER_ENABLED) { try { const response = await FollowApi.getStats(userId); console.info(`FollowManager: getFollowStats response code=${response.code}`); if (response.code === 200 && response...
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 getFollowStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#?#Left ? ...
static async getFollowStats(userId?: number): Promise<IFollowStats> { try { if (SERVER_ENABLED) { try { const response = await FollowApi.getStats(userId); console.info(`FollowManager: getFollowStats response code=${response.code}`); if (response.code === 200 && response...
https://github.com/Harrisonls2004/WaterFlow
51de380e28d30797b89e89a8a342c60a8afba14c
github
arkui-x/samples
CodeLab/Cases/feature/imageviewer/src/main/ets/utils/Constrain.ets
arkts
isToggle
查询图片是否需要切换图片 @param offset -- 当前偏移量 @param winSize -- 视口大小 @param imageSize -- 图片大小 @param scale -- 缩放 @param TogglePercent -- 移动视口多少时候需要切换图片
function isToggle(offset: number, winSize: number, imageSize: number, scale: number, TogglePercent: number): boolean { let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale); const deviation = Math.abs(offset) - maxAllowedOffset; const switchThreshold = winSize * TogglePercent; if (deviation > s...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isToggle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left offset AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function isToggle(offset: number, winSize: number, imageSize: number, scale: number, TogglePercent: number): boolean { let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale); const deviation = Math.abs(offset) - maxAllowedOffset; const switchThreshold = winSize * TogglePercent; if (deviation > s...
https://gitcode.com/arkui-x/samples
d476d6d58b7e83223b6aa7f30b298ac2ffb6d716
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateFactory.ets
arkts
getStrategy
获取适合的策略
private getStrategy(template: ITemplate): ITemplateStrategy | null { const strategyValues = this.strategies.values(); let result = strategyValues.next(); while (!result.done) { const strategy = result.value; if (strategy.supports(template)) { return strategy; } result = str...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private getStrategy(template: ITemplate): ITemplateStrategy | null { const strategyValues = this.strategies.values(); let result = strategyValues.next(); while (!result.done) { const strategy = result.value; if (strategy.supports(template)) { return strategy; } result = str...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateFactory.ets#L51-L62
a85c4a798261064c30ab86a4d0374ecd40a0267f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
constructor
Constructs a new RegExp by RegExp or string @param { RegExp | String } regexp The pattern of the regular expression or another RegExp instance. @param { String } [flags] description of flags to be used. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(regexp: RegExp | String, flags?: String) { if (regexp instanceof String) { RegExp.init(this, regexp as String, flags === undefined ? "" : flags!) } else { let re = regexp as RegExp RegExp.init(this, re.pattern_, flags === undefined ? re.flags : ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left regexp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#...
public constructor(regexp: RegExp | String, flags?: String) { if (regexp instanceof String) { RegExp.init(this, regexp as String, flags === undefined ? "" : flags!) } else { let re = regexp as RegExp RegExp.init(this, re.pattern_, flags === undefined ? re.flags : ...
https://gitcode.com/iop123123/arkts-static-skills
29e7b04912732a9b93fe6debdc75d83ab9d5181b
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/PanZoomHandler.ets
arkts
handleTouchEvent
处理触摸事件 @returns true 表示事件已被消费
handleTouchEvent(event: TouchEvent): boolean { const touches = event.touches; const changedTouches = event.changedTouches; // 更新指针状态 for (const touch of changedTouches) { if (touch.type === TouchType.Down) { const downPt: PointXY = { x: touch.x, y: touch.y }; this.pointers.set(t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleTouchEvent 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 TouchEvent AST#identifier#Right AST#)#...
handleTouchEvent(event: TouchEvent): boolean { const touches = event.touches; const changedTouches = event.changedTouches; // 更新指针状态 for (const touch of changedTouches) { if (touch.type === TouchType.Down) { const downPt: PointXY = { x: touch.x, y: touch.y }; this.pointers.set(t...
https://github.com/AlkaidLab/moonlight-harmony
b8ecf34c2bd8c823b06dd6f44bb08fd2117349a6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets
arkts
updateFrameMetrics
更新帧率指标
private updateFrameMetrics(deltaTime: number): void { if (deltaTime <= 0) return; const frameRate = 1.0 / deltaTime; const frameTime = deltaTime * 1000; // 转换为毫秒 // 更新帧率 this.metrics.frameRate.current = frameRate; this.metrics.frameRate.min = Math.min(this.metrics.frameRate.min, frameRate); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateFrameMetrics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deltaTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
private updateFrameMetrics(deltaTime: number): void { if (deltaTime <= 0) return; const frameRate = 1.0 / deltaTime; const frameTime = deltaTime * 1000; // 转换为毫秒 // 更新帧率 this.metrics.frameRate.current = frameRate; this.metrics.frameRate.min = Math.min(this.metrics.frameRate.min, frameRate); ...
https://github.com/DaLongZhuaZi/manxia
0c3e45a72c2351a120d8668fa60bd3128edff442
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setArrowTopRightRadius
箭头尖右边弧度,单位:vp ,气泡弹窗有效 @param arrowTopRightRadius @returns
setArrowTopRightRadius(arrowTopRightRadius: number): Builder { this.popupConfig.arrowTopRightRadius = arrowTopRightRadius return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArrowTopRightRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrowTopRightRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Righ...
setArrowTopRightRadius(arrowTopRightRadius: number): Builder { this.popupConfig.arrowTopRightRadius = arrowTopRightRadius return this }
https://github.com/wuba/omni-ui
5b10fb3f6c799cce9c5089e8e0252fbdb4295d03
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
setPhases
Set the phases used for animations. @param phaseX @param phaseY
public setPhases(phaseX: number, phaseY: number): void { this.phaseX = phaseX; this.phaseY = phaseY; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPhases AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phaseX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public setPhases(phaseX: number, phaseY: number): void { this.phaseX = phaseX; this.phaseY = phaseY; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
0a1629fd7b3f0b53486f41eacd14c7b86fb7618e
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/SunshineRatingSystem.ets
arkts
getScoreDescription
获取评分说明文本
static getScoreDescription(score: number): string { if (score >= 85) return '极优'; if (score >= 70) return '优良'; if (score >= 55) return '中等'; if (score >= 40) return '偏低'; return '很低'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getScoreDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left score AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static getScoreDescription(score: number): string { if (score >= 85) return '极优'; if (score >= 70) return '优良'; if (score >= 55) return '中等'; if (score >= 40) return '偏低'; return '很低'; }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
c3d994732e4ad8f1ef3d0bb6a28b306d8aa1cb3d
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
toString
Gets the string representation of the current RationalNumber object. @returns { string } returns a string in Numerator/Denominator format if the denominator is 0 return Infinity. If both the numerator and denominator are 0 return NaN.
public toString(): string { let buf: string; if (this.isNaN()) { buf = 'NaN'; } else if (this.mnum > 0 && this.mden === 0) { buf = 'Infinity'; } else if (this.mnum < 0 && this.mden === 0) { buf = '-Infinity'; ...
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 { let buf: string; if (this.isNaN()) { buf = 'NaN'; } else if (this.mnum > 0 && this.mden === 0) { buf = 'Infinity'; } else if (this.mnum < 0 && this.mden === 0) { buf = '-Infinity'; ...
https://gitcode.com/iop123123/arkts-static-skills
6019f301ade44ddd2148f7a3ddb1ea0a3da70df7
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/deepseek/DeepSeekChatManager.ets
arkts
sendMessageStream
流式对话 - 实时返回生成的内容
async sendMessageStream( sessionId: string, userMessage: string, onChunk: (chunk: string) => void, onComplete: () => void, onError: (error: Error) => void, systemPrompt?: string ): Promise<void> { try { // 添加用户消息到历史 siliconFlowClient.addMessageToSession(sessionId, { r...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessageStream AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:...
async sendMessageStream( sessionId: string, userMessage: string, onChunk: (chunk: string) => void, onComplete: () => void, onError: (error: Error) => void, systemPrompt?: string ): Promise<void> { try { // 添加用户消息到历史 siliconFlowClient.addMessageToSession(sessionId, { r...
https://github.com/LJ666-ui/harmony-health-care
1c51455b78e49ee5e7075e3dc0ef29cfc463b01b
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
tan
Return a new Decimal whose value is the tangent of the value in radians of this Decimal. @returns { Decimal } the Decimal type
public tan(): Decimal { let x: Decimal = this; if (!x.isFinite()) { return new Decimal(NaN); } if (x.isZero()) { return new Decimal(x); } let pr = Decimal.precision; let rm = Decimal.rounding; Decimal.precision = pr + 10; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left tan 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 tan(): Decimal { let x: Decimal = this; if (!x.isFinite()) { return new Decimal(NaN); } if (x.isZero()) { return new Decimal(x); } let pr = Decimal.precision; let rm = Decimal.rounding; Decimal.precision = pr + 10; ...
https://gitcode.com/iop123123/arkts-static-skills
88a65557984b336056b6eaf5c44a55c56265f6c5
gitcode
openharmony/applications_filepicker
audiopicker/src/main/ets/localresource/localaudio/LocalAudioManager.ets
arkts
transferFileAssetsToLocalAudioFiles
将FileAsset转换为LocalAudioFile
transferFileAssetsToLocalAudioFiles(): Promise<Array<LocalAudioFile>> { let localAudioFile: LocalAudioFile[] = [] return new Promise(async (resolve) => { if (this.fileAssets) { logger.info('fileAsset.length :' + this.fileAssets.length); for (let fileAsset of this.fileAssets) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left transferFileAssetsToLocalAudioFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : A...
transferFileAssetsToLocalAudioFiles(): Promise<Array<LocalAudioFile>> { let localAudioFile: LocalAudioFile[] = [] return new Promise(async (resolve) => { if (this.fileAssets) { logger.info('fileAsset.length :' + this.fileAssets.length); for (let fileAsset of this.fileAssets) { ...
https://gitee.com/openharmony/applications_filepicker.git
9cf285becd387bb7906191a21d1c13bf28759958
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/WebDAVService.ets
arkts
testConnection
测试连接(OPTIONS,如失败回退 HEAD)
async testConnection(config: WebDAVConfig): Promise<TestResult> { const dirUrl = this.joinPath(config.serverUrl, config.remoteDir, '') const headers = this.buildHeaders(config) const httpService = HttpService.getInstance() let response: HttpResponse = await httpService.options(dirUrl, headers, { time...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testConnection AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async testConnection(config: WebDAVConfig): Promise<TestResult> { const dirUrl = this.joinPath(config.serverUrl, config.remoteDir, '') const headers = this.buildHeaders(config) const httpService = HttpService.getInstance() let response: HttpResponse = await httpService.options(dirUrl, headers, { time...
https://github.com/LongLiveY96/chatcube
a4d4755f49353a3a3a8c3e23c7c3c09c82556c63
github
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/WoDe/PatientManager.ets
arkts
deletePatient
删除就诊人
deletePatient(id: number) { promptAction.showDialog({ title: '提示', message: '确定要删除该就诊人吗?', buttons: [ { text: '取消', color: '#666666' }, { text: '确定', color: '#FF4D4F' } ] }) .then((result) => { if (result.index === 1) { // 用户点击确定 axios.post(`${...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deletePatient 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 number AST#identifier#Right A...
deletePatient(id: number) { promptAction.showDialog({ title: '提示', message: '确定要删除该就诊人吗?', buttons: [ { text: '取消', color: '#666666' }, { text: '确定', color: '#FF4D4F' } ] }) .then((result) => { if (result.index === 1) { // 用户点击确定 axios.post(`${...
https://github.com/luojiang001/Pulse
a318d1c473dac8f676ea5f8d929758ef7012c351
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnWaterFallViewModel.ets
arkts
handleLoadMore
模拟加载更多数据
handleLoadMore(): void { if (this.isLoading) { return; } this.isLoading = true; this.loadMoreCount++; setTimeout(() => { const startIndex = this.loadMoreDataSource.totalCount(); const items: Object[] = []; for (let i = 0; i < 6; i++) { const idx = startIndex + i; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleLoadMore 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#...
handleLoadMore(): void { if (this.isLoading) { return; } this.isLoading = true; this.loadMoreCount++; setTimeout(() => { const startIndex = this.loadMoreDataSource.totalCount(); const items: Object[] = []; for (let i = 0; i < 6; i++) { const idx = startIndex + i; ...
https://github.com/codelably/tuniao-ui
e1cedd8af2699d79618b66f69aee3cb6f104d840
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/animation/ChartAnimator.ets
arkts
getPhaseX
Gets the X axis phase of the animation. @return float value of {@link #mPhaseX}
public getPhaseX(): number { return this.mPhaseX; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPhaseX 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 AST#numbe...
public getPhaseX(): number { return this.mPhaseX; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
19d6cb34e3a03c6eb5edaedf6bf19314c03690d1
gitee
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/RemoteDeviceManager.ets
arkts
init
初始化,创建deviceManager对象,返回Promise对象
async init(): Promise<any> { if (!this.bundleName) { this.bundleName = await getBundleName() CommonLog.info('getBundleName:' + this.bundleName); } return new Promise((resolve, reject) => { try { if (!this.dmInstance) { CommonLog.info('deviceManager.createDeviceManager begin'); deviceManage...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init 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...
async init(): Promise<any> { if (!this.bundleName) { this.bundleName = await getBundleName() CommonLog.info('getBundleName:' + this.bundleName); } return new Promise((resolve, reject) => { try { if (!this.dmInstance) { CommonLog.info('deviceManager.createDeviceManager begin'); deviceManage...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
d2335c0b2ce5fe801e0151a8b72167d0978b68ca
gitee
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/pages/Shop/ShopPage.ets
arkts
loadMore
加载更多数据
loadMore() { return new Promise<boolean>((resolve) => { setTimeout(() => { this.shopDataInfo.pushArrayData(shopData, false, 0, 6) resolve(true) }, 500) }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadMore 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#statement_block#Left AST#{#Left { AST#{#Right AST#return_statement#Left AST#re...
loadMore() { return new Promise<boolean>((resolve) => { setTimeout(() => { this.shopDataInfo.pushArrayData(shopData, false, 0, 6) resolve(true) }, 500) }) }
https://github.com/SMAT-Lab/PhantomRendering
797500ae9de16631458297397863a2f4209a568c
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/AppTypeUtil.ets
arkts
isWearableApp
Check is wearable app type. @returns
static isWearableApp(): boolean { const type = AppTypeUtil.getAppType(); return type === AppType.WEARABLE; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isWearableApp 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...
static isWearableApp(): boolean { const type = AppTypeUtil.getAppType(); return type === AppType.WEARABLE; }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
113cb5c13b00d95944c88353a0534b58ef5faee8
gitcode
tdcare/tdwebrtc
example/SignalingClientExample.ets
arkts
makeVideoCall
发起视频呼叫
public makeVideoCall(toMac: string): void { if (!this.signaling) { return; } this.signaling.sendVideoCall(toMac, this.currentRoomId, '', CallType.VIDEO); console.log(`[SignalingExample] 发起视频呼叫 to ${toMac}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left makeVideoCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
public makeVideoCall(toMac: string): void { if (!this.signaling) { return; } this.signaling.sendVideoCall(toMac, this.currentRoomId, '', CallType.VIDEO); console.log(`[SignalingExample] 发起视频呼叫 to ${toMac}`); }
https://github.com/tdcare/tdwebrtc
23b969b50db9923386e98c44726a9bd9a44dd25a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
getSources
==================== 图源 API ==================== 获取所有 Suwayomi 源
public async getSources(): Promise<SuwayomiSourceInfo[]> { const query = ` query { sources { nodes { id name lang iconUrl isNsfw } } } `; const data = await this.executeGraphQL(query); const sou...
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 getSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async getSources(): Promise<SuwayomiSourceInfo[]> { const query = ` query { sources { nodes { id name lang iconUrl isNsfw } } } `; const data = await this.executeGraphQL(query); const sou...
https://github.com/DaLongZhuaZi/manxia
c4ea599e52a59f5fd715e52e9b384a1684f73b15
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Search/SearchIntentParser.ets
arkts
parseWithCustomPattern
使用自定义模式解析URL
private static parseWithCustomPattern( url: string, path: string, pattern: SourceUrlPattern ): SearchIntent | null { if (pattern.artworkPattern) { const regex = new RegExp(pattern.artworkPattern); const match = path.match(regex); if (match && match[1]) { const result: Searc...
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 parseWithCustomPattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#...
private static parseWithCustomPattern( url: string, path: string, pattern: SourceUrlPattern ): SearchIntent | null { if (pattern.artworkPattern) { const regex = new RegExp(pattern.artworkPattern); const match = path.match(regex); if (match && match[1]) { const result: Searc...
https://github.com/DaLongZhuaZi/manxia
6e18d23503a8e43a4961e1159f7394e65c55c89b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/SettingsService.ets
arkts
shouldShowPerfOverlay
是否显示性能覆盖层
async shouldShowPerfOverlay(): Promise<boolean> { return await this.getBoolean(SettingsKeys.ENABLE_PERF_OVERLAY, false); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left shouldShowPerfOverlay 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 AS...
async shouldShowPerfOverlay(): Promise<boolean> { return await this.getBoolean(SettingsKeys.ENABLE_PERF_OVERLAY, false); }
https://github.com/AlkaidLab/moonlight-harmony
6109f2d63896c10c6f5dc51539676be448f8ff1c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
generateCorrelationId
生成关联ID
static generateCorrelationId(): string { const timestamp = Date.now().toString(); const random = Math.floor(Math.random() * 1000000000).toString(36); return 'corr-' + timestamp + '-' + random; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateCorrelationId 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 stri...
static generateCorrelationId(): string { const timestamp = Date.now().toString(); const random = Math.floor(Math.random() * 1000000000).toString(36); return 'corr-' + timestamp + '-' + random; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b954a64c3ca26fbd33048c3324ddafac3f2528cb
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
filterEventsByUser
获取用户的所有事件 @param events 所有事件 @param userId 用户ID
static filterEventsByUser(events: DomainEvent[], userId: number): DomainEvent[] { const filtered: DomainEvent[] = []; for (let i = 0; i < events.length; i++) { const event = events[i]; if (event.userId === userId) { filtered.push(event); } } return filtered; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left filterEventsByUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_e...
static filterEventsByUser(events: DomainEvent[], userId: number): DomainEvent[] { const filtered: DomainEvent[] = []; for (let i = 0; i < events.length; i++) { const event = events[i]; if (event.userId === userId) { filtered.push(event); } } return filtered; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1c989a95b8449925ca09a1516ebc31a81dd327e4
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets
arkts
lookUpHistoryEntries
Look up the query in all chunks in time order, and return query results. @param query The query. @param maxResults The maximum number of results to return. @param bruteForce To use brute force or not. @param minHitRate The minimum keyword hit rate for brute force. @param unique Whether to return unique results only. @r...
async lookUpHistoryEntries(query: string, maxResults: number, bruteForce: boolean, minHitRate = 0.8, unique = false) { if (this.busy) { meow(`Busy. Rejected history: ["${query}", ${maxResults}]`, 'meowHistorian][lookUpHistoryEntries', meowLevel.WARN); return []; } console.log(' '); meow(`...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left lookUpHistoryEntries AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Rig...
async lookUpHistoryEntries(query: string, maxResults: number, bruteForce: boolean, minHitRate = 0.8, unique = false) { if (this.busy) { meow(`Busy. Rejected history: ["${query}", ${maxResults}]`, 'meowHistorian][lookUpHistoryEntries', meowLevel.WARN); return []; } console.log(' '); meow(`...
https://github.com/awaLiny2333/LinysBrowser_NEXT
6804f6a4f46a55e241d510ff95ac18599ea740cf
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/widening_refs_unbox2.ets
arkts
foo
--- desc: Assignment contexts allow the use a widening reference conversion followed by an unboxing conversion. params: Conversion from '{{case.type}}' to '{{case.ptype}}' through Integral ---
function foo<T extends Integral>(p: T): {{case.ptype}} {
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#constraint#Left AST#extends#Left extends AST#extend...
function foo<T extends Integral>(p: T): {{case.ptype}} {
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
82e8599aaa3c925ac057b3ea8436c86da3a5a87c
gitee
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/utils/FormUtils.ets
arkts
backgroundUpdateCard
Background update all card
public backgroundUpdateCard(taskListChange: boolean): void { if (taskListChange) { GlobalContext.getContext().setObject('taskListChange', false); let timeId = setTimeout(() => { this.queryForms(); clearInterval(timeId); }, Const.TIMES_100); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left backgroundUpdateCard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left taskListChange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bool...
public backgroundUpdateCard(taskListChange: boolean): void { if (taskListChange) { GlobalContext.getContext().setObject('taskListChange', false); let timeId = setTimeout(() => { this.queryForms(); clearInterval(timeId); }, Const.TIMES_100); } }
https://gitee.com/harmonyos/codelabs.git
0d4c61e25d57ac83c90001aa3443d34555320d78
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
setFontScale
设置字体缩放比例
public setFontScale(scale: number): void { this.config.fontScale = Math.max(0.8, Math.min(2.0, scale)); AppStorage.setOrCreate<number>('fontScale', this.config.fontScale); console.log('[Accessibility] 字体缩放比例:', this.config.fontScale); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFontScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public setFontScale(scale: number): void { this.config.fontScale = Math.max(0.8, Math.min(2.0, scale)); AppStorage.setOrCreate<number>('fontScale', this.config.fontScale); console.log('[Accessibility] 字体缩放比例:', this.config.fontScale); }
https://github.com/LJ666-ui/harmony-health-care
db9d9fea555b654154d466b6cbdb545765ded45d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets
arkts
buildFullUrl
构建完整URL(处理相对路径)
buildFullUrl(baseUrl: string, path: string): string { // 如果path已经是完整URL,直接返回 if (path.startsWith('http://') || path.startsWith('https://')) { return path; } // 确保baseUrl不以/结尾 const cleanBaseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; // 确保path以/开头 const cleanP...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildFullUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R...
buildFullUrl(baseUrl: string, path: string): string { // 如果path已经是完整URL,直接返回 if (path.startsWith('http://') || path.startsWith('https://')) { return path; } // 确保baseUrl不以/结尾 const cleanBaseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl; // 确保path以/开头 const cleanP...
https://github.com/DaLongZhuaZi/manxia
959c9078bce539a746bca019e54b7f5b0988c571
github
who7708/harmonyos-codelabs
HmosWorld/features/discover/src/main/ets/model/DiscoverModel.ets
arkts
getHomeResources
Data loaded on the home page converts network data into page rendering data
getHomeResources(): Promise<void> { this.loadingStatus = LoadingStatus.LOADING; return new Promise(resolve => { this.resourcesRepository.getHomeResources().then((data: NetworkNewsResources) => { this.swiperData.length = 0; this.hotFeedList.length = 0; this.techArticleList.length ...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getHomeResources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right A...
getHomeResources(): Promise<void> { this.loadingStatus = LoadingStatus.LOADING; return new Promise(resolve => { this.resourcesRepository.getHomeResources().then((data: NetworkNewsResources) => { this.swiperData.length = 0; this.hotFeedList.length = 0; this.techArticleList.length ...
https://github.com/who7708/harmonyos-codelabs
1a00cdc9fd16ea6fafa45fafca45c2743b56a813
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ProviderViewModel.ets
arkts
loadAllProviders
返回全部(含未启用),用于模型管理页面
async loadAllProviders(): Promise<ModelProvider[]> { return await this.store.loadAll() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadAllProviders 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#gen...
async loadAllProviders(): Promise<ModelProvider[]> { return await this.store.loadAll() }
https://github.com/LongLiveY96/chatcube
daa2036f5dca4d7a9977de2fdbada252e52ce9df
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/BaseTracker.ets
arkts
getAuthState
获取认证状态
public getAuthState(): TrackerAuthState { return this.authState; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAuthState 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 TrackerAu...
public getAuthState(): TrackerAuthState { return this.authState; }
https://github.com/DaLongZhuaZi/manxia
e2ad59f070f5be429d5c769e425b096ff429a4bd
github
azhu0001/localsend-harmony
serve/src/main/ets/decode/BufferPool.ets
arkts
findHeaderEnd
查找消息头部结束位置 @param inputStream 输入流 @param rlen 读取长度 @return 返回头部结束位置
private findHeaderEnd(inputStream: string, rlen: number): number { let splitByte: number = 0; while (splitByte + 1 < rlen) { /* * 这是根据RFC2616(HTTP 1.1协议的官方文档)中的规定,头部的结束是由两个'\r\n'组成的 * 首先检查splitByte位置的字符串和splitByte + 1位置的字符串是否为“\r”和“\n”,同时splitByte + 2和splitByte + 3位置的字符串 * 是否也是为“\r”...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findHeaderEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputStream AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private findHeaderEnd(inputStream: string, rlen: number): number { let splitByte: number = 0; while (splitByte + 1 < rlen) { /* * 这是根据RFC2616(HTTP 1.1协议的官方文档)中的规定,头部的结束是由两个'\r\n'组成的 * 首先检查splitByte位置的字符串和splitByte + 1位置的字符串是否为“\r”和“\n”,同时splitByte + 2和splitByte + 3位置的字符串 * 是否也是为“\r”...
https://gitcode.com/azhu0001/localsend-harmony
b235b46e44b18151ee46ff95a37cfc29bff5d28a
gitcode
ZestBox-18/kitebook-frontend
features/home/src/main/ets/pages/Index.ets
arkts
build
构建首页主容器,负责组合卡片区、标题区和列表区。
build() { HdsNavigation(this.pageInfos) { List({ space: 10 }) { ListItem().height(this.winUtil.mainWindowInfo.safeAreaTop + CommonConstants.TITLE_BAR_HEIGHT_FREE) ListItem() { this.SwiperSection() } ListItem() { SectionHeaderComponent({ title...
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() { HdsNavigation(this.pageInfos) { List({ space: 10 }) { ListItem().height(this.winUtil.mainWindowInfo.safeAreaTop + CommonConstants.TITLE_BAR_HEIGHT_FREE) ListItem() { this.SwiperSection() } ListItem() { SectionHeaderComponent({ title...
https://github.com/ZestBox-18/kitebook-frontend
025d75a752f670de39aab50d308a0acccda5ed19
github
openharmony/app_samples
ETSUI/TransitionAnimation/entry/src/main/ets/pages/page/BottomTransition.ets
arkts
pageTransition
页面转场通过全局transition方法进行配置转场参数
pageTransition() { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) // 页面退场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideE...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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...
pageTransition() { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) // 页面退场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideE...
https://gitee.com/openharmony/app_samples.git
7739900c03cac116ab394593c18b76f46e95ad30
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
forEach
Performs the specified action for each element in Uint16Array @param { function } callbackfn - A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public forEach(callbackfn: (value: number, index: int, array: Uint16Array) => void): void { for (let i = 0; i < this.lengthInt; i++) { callbackfn(this.getUnsafe(i).toDouble(), i, this) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri...
public forEach(callbackfn: (value: number, index: int, array: Uint16Array) => void): void { for (let i = 0; i < this.lengthInt; i++) { callbackfn(this.getUnsafe(i).toDouble(), i, this) } }
https://gitcode.com/iop123123/arkts-static-skills
5c0a75961b137f25d85db6f3a251a19d2e592e87
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
fixSideToConner
Fix side conner. @param x @param y
private fixSideToConner(x: number, y: number) { if ((this.isLeft || this.isRight) && !this.isTop && !this.isBottom) { if (y < this.cropRect.getCenterY()) { this.isTop = true; } else { this.isBottom = true; } this.isVerticalSide = true; } else if ((this.isTop || this.isB...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixSideToConner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private fixSideToConner(x: number, y: number) { if ((this.isLeft || this.isRight) && !this.isTop && !this.isBottom) { if (y < this.cropRect.getCenterY()) { this.isTop = true; } else { this.isBottom = true; } this.isVerticalSide = true; } else if ((this.isTop || this.isB...
https://gitee.com/openharmony/codelabs.git
42a8356d37124d74fb1508ac05e19011c5fc7aca
gitee
Strive700/AdvisoryCore
AdvisoryCore-Harmony/entry/src/main/ets/pages/BasicFund.ets
arkts
showFundImage
显示基金画像
private showFundImage(row: Fund) { class FundImageParams { fund_code: string; constructor(fund_code: string) { this.fund_code = fund_code; } } const params = new FundImageParams(row.fundCode); RequestAxios.post<FundImageResponse>('/funds/Fund_Image', params) .then((r...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showFundImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left row AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private showFundImage(row: Fund) { class FundImageParams { fund_code: string; constructor(fund_code: string) { this.fund_code = fund_code; } } const params = new FundImageParams(row.fundCode); RequestAxios.post<FundImageResponse>('/funds/Fund_Image', params) .then((r...
https://github.com/Strive700/AdvisoryCore
9a4e51dc8b32847e1a23304c7ea8c919a6bd08b2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
set
Assigns val as element on insertPos. @description Added to avoid (un)packing a single value into array to use overloaded set(BigInt[], insertPos) @param val value to set @param insertPos index to change
public set(insertPos: number, val: BigInt): void { this.set(insertPos as int, val) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
public set(insertPos: number, val: BigInt): void { this.set(insertPos as int, val) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ab6e16532c24e28c35ec6950ca41951a7e6d89be
gitee
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
createFolder
创建文件夹 @param name 文件夹名称 @param parentId 父文件夹ID
async createFolder(name: string, parentId?: string): Promise<ApiResponse<KnowledgeDocument>> { return this.client.post<KnowledgeDocument>('/api/v1/knowledge/documents', { title: name, type: DocumentType.FOLDER, parentId }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createFolder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async createFolder(name: string, parentId?: string): Promise<ApiResponse<KnowledgeDocument>> { return this.client.post<KnowledgeDocument>('/api/v1/knowledge/documents', { title: name, type: DocumentType.FOLDER, parentId }) }
https://github.com/David8Idira/AI-OA
1f4ff658e1bcae74a28c7ce2b0ecba4f59a17a37
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/MoonBridge.ets
arkts
nativeMicStart
========================================================================== Opus 编码器 ========================================================================== Native 低时延麦克风 ========================================================================== 启动 native 低时延麦克风采集 使用 OHAudio C API + AUDIOSTREAM_LATENCY_MODE_FAST, 在 n...
nativeMicStart(sampleRate: number = 48000, channels: number = 1, bitrate: number = 64000): number { return nativeLib.nativeMicStart(sampleRate, channels, bitrate); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nativeMicStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sampleRate AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left numb...
nativeMicStart(sampleRate: number = 48000, channels: number = 1, bitrate: number = 64000): number { return nativeLib.nativeMicStart(sampleRate, channels, bitrate); }
https://github.com/AlkaidLab/moonlight-harmony
c1643dcc5dc57c0cafb34627190b61fb84aeec2d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets
arkts
fire
Unblocks all coroutines that are waiting the same event. Can be used concurrently with other wait/fire but multiply calls have no effect.
public fire(): void { Event.fire(this); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fire 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 fire(): void { Event.fire(this); }
https://gitcode.com/iop123123/arkts-static-skills
a7dc36031766314f412d8954813a50359f4804fa
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/MoonBridge.ets
arkts
testClientConnectivity
========================================================================== 工具函数 ==========================================================================
testClientConnectivity(testServerHostName: string, referencePort: number, testFlags: number): number { return nativeLib.testClientConnectivity(testServerHostName, referencePort, testFlags); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left testClientConnectivity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left testServerHostName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right...
testClientConnectivity(testServerHostName: string, referencePort: number, testFlags: number): number { return nativeLib.testClientConnectivity(testServerHostName, referencePort, testFlags); }
https://github.com/AlkaidLab/moonlight-harmony
81db95fa041831061edae7e991fad1f3e31b250d
github