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
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
incrementContextCount
增加上下文计数
incrementContextCount(word: string): void { const record = this.getRecord(word); if (record !== null) { record.contextCount++; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left incrementContextCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#...
incrementContextCount(word: string): void { const record = this.getRecord(word); if (record !== null) { record.contextCount++; } }
https://github.com/CLMC2025/Vignette
8e2180f8a1efed8877997bd32a3026c2104c3266
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveConfig.ets
arkts
getRefreshTokenText
获取刷新令牌文本 @returns 刷新令牌
public getRefreshTokenText(): string { return Sm4Utils.decryptWithPrefix(this.refreshToken); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRefreshTokenText 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...
public getRefreshTokenText(): string { return Sm4Utils.decryptWithPrefix(this.refreshToken); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveConfig.ets#L77-L79
d1754f0ae9e7a02d3127d56493a108a2ba3cc781
github
OHPG/FinVideo
entry/src/main/ets/player/VersionSelectStrategy.ets
arkts
targetTier
根据 deviceType 和屏幕短边得出目标档位 deviceType 官方值:phone / default / wearable / liteWearable / tablet / tv / car / smartVision / 2in1
private static targetTier(deviceType: string, screenLongEdge: number): number { if (deviceType === 'tv' || deviceType === 'car') { return 4 } if (deviceType === '2in1') { return VersionSelectStrategy.screenTier(screenLongEdge) } if (deviceType === 'tablet') { try { 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 targetTier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceType AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private static targetTier(deviceType: string, screenLongEdge: number): number { if (deviceType === 'tv' || deviceType === 'car') { return 4 } if (deviceType === '2in1') { return VersionSelectStrategy.screenTier(screenLongEdge) } if (deviceType === 'tablet') { try { const ...
https://github.com/OHPG/FinVideo
16a4def52e5fdc7d6098a6965fc24dcfcb53d33f
github
webabcd/HarmonyHttpServer
harmony_httpserver/src/main/ets/HttpServer.ets
arkts
stop
停止本地 http server
public stop() { this.tcpServer.off("connect") log.i(`停止本地 http server`) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left stop 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#;#Le...
public stop() { this.tcpServer.off("connect") log.i(`停止本地 http server`) }
https://github.com/webabcd/HarmonyHttpServer
4cb218942863ba4519b5c2cdb1fb8c80fca44e1e
github
openharmony-sig/knowledge_demo_entainment
FA/notebook/entry/src/main/ets/common/database/LocalStorage.ets
arkts
getNoteBookName
获取记事本名称
public async getNoteBookName() { let preferences = await this.getPreferences() let notebookName = await preferences.get(CommonConstants.KEY_NOTEBOOK_NAME, CommonConstants.notebookName); return notebookName; }
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 getNoteBookName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public async getNoteBookName() { let preferences = await this.getPreferences() let notebookName = await preferences.get(CommonConstants.KEY_NOTEBOOK_NAME, CommonConstants.notebookName); return notebookName; }
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
b12a649cb1d7074755e5a6831416d83ea6291c79
gitee
Yebingiscn/SweetVideo
entry/src/main/ets/utils/SelectFileUtil.ets
arkts
exportFile
导出视频文件
static async exportFile(uri: string, title: string, format: string, context: common.UIAbilityContext) { let sourceFile: fs.File | null = null let targetFile: fs.File | null = null try { sourceFile = fs.openSync(uri) const saverOption = new picker.DocumentSaveOptions() saverOption.newFile...
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 exportFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#R...
static async exportFile(uri: string, title: string, format: string, context: common.UIAbilityContext) { let sourceFile: fs.File | null = null let targetFile: fs.File | null = null try { sourceFile = fs.openSync(uri) const saverOption = new picker.DocumentSaveOptions() saverOption.newFile...
https://github.com/Yebingiscn/SweetVideo
1d84bc168ca722c547413a2bde6d25167fe943e7
github
offlinecat-dev/OCNetORM
src/main/ets/query/DataTransformTask.ets
arkts
createFailure
创建失败结果 @param errorMessage 错误信息 @returns TransformTaskResult 实例
static createFailure(errorMessage: string): TransformTaskResult { const result = new TransformTaskResult() result.success = false result.errorMessage = errorMessage return result }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static createFailure(errorMessage: string): TransformTaskResult { const result = new TransformTaskResult() result.success = false result.errorMessage = errorMessage return result }
https://github.com/offlinecat-dev/OCNetORM
ee5d7d9c6c2bc07395e2c3cc4e27182a71f3af39
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/UnknownFields.ets
arkts
getLength
获取数据长度(字节数) @returns 未知字段数据的总字节数
getLength(): number { return this.data.length }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLength 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#number#Right AST#ERROR#Right AST#statement_bl...
getLength(): number { return this.data.length }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
2af07c1b3a86b034194f44d7972aa92fec103f72
gitcode
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
registerOption
注册自定义coap_option @param option 数值
registerOption(option: number) { this.coapClient.registerOption(option, this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Ri...
registerOption(option: number) { this.coapClient.registerOption(option, this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
43d752b03f9e9797063a84e0c1ca8391426712c0
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/unary_minus/unary_minus_float.ets
arkts
main
--- desc: check unary minus operation for float operand ---
function main(): void { const v: float = {{v.value}} as float const r: float = {{v.result}} as float if (Float.isNaN(v)) { assert(Float.isNaN(r)) } else { assert -(v) == r } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const v: float = {{v.value}} as float const r: float = {{v.result}} as float if (Float.isNaN(v)) { assert(Float.isNaN(r)) } else { assert -(v) == r } }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
006ee16760f04f9aa5b4d3f7046818c2d79d61e9
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getSourceCustomSettings
获取图源所有自定义设置(以 custom. 开头的设置) 返回 Map<settingKey, settingValue>,其中 settingKey 去掉了 'custom.' 前缀
async getSourceCustomSettings(sourceId: number): Promise<Map<string, string>> { const result = new Map<string, string>(); try { // 获取 pkg 标识符 const pkg = await this.getSourcePkgById(sourceId); const keyIdentifier = pkg || `id_${String(sourceId)}`; const keyPrefix: string = `source:${ke...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceCustomSettings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left ...
async getSourceCustomSettings(sourceId: number): Promise<Map<string, string>> { const result = new Map<string, string>(); try { // 获取 pkg 标识符 const pkg = await this.getSourcePkgById(sourceId); const keyIdentifier = pkg || `id_${String(sourceId)}`; const keyPrefix: string = `source:${ke...
https://github.com/DaLongZhuaZi/manxia
d6b4a7821de5e44b1a92e534aac42daccd386e0b
github
openharmony-sig/applications_compass
feature/compass/src/main/ets/components/CompassView.ets
arkts
insideDraw
Draw inside circle.
private insideDraw(): void { this.insideContext.clearRect(-this.insideSize / this.times, -this.insideSize / this.times, this.insideSize, this.insideSize); this.drawInsideDials(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left insideDraw 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#expressi...
private insideDraw(): void { this.insideContext.clearRect(-this.insideSize / this.times, -this.insideSize / this.times, this.insideSize, this.insideSize); this.drawInsideDials(); }
https://gitee.com/openharmony-sig/applications_compass.git
06b4cd07bf91fd868472d70afd3f3e607d850d45
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataConverter.ets
arkts
toTimestamp
转换时间值为时间戳 @param timeValue - 时间值(可能是Date、string、number或null/undefined) @returns 时间戳(毫秒)
static toTimestamp(timeValue: Date | string | number | undefined | null): number { if (timeValue === null || timeValue === undefined) { logger.warn(TAG, '时间值为空,使用当前时间'); return Date.now(); } try { return TimeUtils.toTimestamp(timeValue); } catch (error) { logger.error(TAG, `时间...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Lef...
static toTimestamp(timeValue: Date | string | number | undefined | null): number { if (timeValue === null || timeValue === undefined) { logger.warn(TAG, '时间值为空,使用当前时间'); return Date.now(); } try { return TimeUtils.toTimestamp(timeValue); } catch (error) { logger.error(TAG, `时间...
https://github.com/DaLongZhuaZi/manxia
c3c2e3ae7072bc707608ac7ae897947b627cb7ca
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateY
Animates values along the Y axis. @param durationMillis animation duration @param easing EasingFunction
public animateY(durationMillis: number, easing: EasingFunction) { let animatorY: ObjectAnimator = yAnimator(durationMillis, easing); animatorY.addUpdateListener(mListener); animatorY.start(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number...
public animateY(durationMillis: number, easing: EasingFunction) { let animatorY: ObjectAnimator = yAnimator(durationMillis, easing); animatorY.addUpdateListener(mListener); animatorY.start(); }
https://gitee.com/openharmony/developtools_profiler.git
b3ab588e65bd145253f518e2822ad2977d8ea46d
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGXMLChecker.ets
arkts
_readReference
读取引用 @see https://www.w3.org/TR/xml/ 4.1节 [67] Reference @return {string|false} 返回引用值,如果未读取到,则返回false
private _readReference(): string | boolean{ let _svgStringReader=this._svgStringReader!; if (_svgStringReader.peek() !== '&') { return false; } _svgStringReader.moveNext(); let ref = _svgStringReader.readByFunction(isReferenceChar); if (_svgStringReader.readByCount() !== ';') { thi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readReference 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#expr...
private _readReference(): string | boolean{ let _svgStringReader=this._svgStringReader!; if (_svgStringReader.peek() !== '&') { return false; } _svgStringReader.moveNext(); let ref = _svgStringReader.readByFunction(isReferenceChar); if (_svgStringReader.readByCount() !== ';') { thi...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
62babb158d524c08a21a456b69eb096446d8492b
gitee
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/mine/src/main/ets/service/UserNetFunc.ets
arkts
getAchievements
@param userId @returns Achieve[]
public getAchievements(): Promise<Achieve[]> { const params: UserIdParams = { userId: AppStorage.get<string>('userId') as string }; return new Promise(((resolve: (value: Achieve[] | PromiseLike<Achieve[]>) => void, reject: (reason?: Object) => void) => { Request.call(UserTrigger.ACHIEVE,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAchievements 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#instantiation_expressi...
public getAchievements(): Promise<Achieve[]> { const params: UserIdParams = { userId: AppStorage.get<string>('userId') as string }; return new Promise(((resolve: (value: Achieve[] | PromiseLike<Achieve[]>) => void, reject: (reason?: Object) => void) => { Request.call(UserTrigger.ACHIEVE,...
https://gitcode.com/HarmonyOS_Samples/hmosworld
08a06829f69799bf0c4e82d28c18b45d0ebb2bf7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
analyzeEbookFiles
分析电子书文件
private async analyzeEbookFiles(): Promise<StorageItem> { try { const ebooksPath = this.sandboxManager.getDirectory('ebooks'); const dirInfo = await this.getDirectoryInfo(ebooksPath); const size = dirInfo.size; const count = dirInfo.count; return { type: StorageType.EB...
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 analyzeEbookFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async analyzeEbookFiles(): Promise<StorageItem> { try { const ebooksPath = this.sandboxManager.getDirectory('ebooks'); const dirInfo = await this.getDirectoryInfo(ebooksPath); const size = dirInfo.size; const count = dirInfo.count; return { type: StorageType.EB...
https://github.com/DaLongZhuaZi/manxia
0dfba09f7ab7a8fcf05be7b4a2f566416b609a44
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
addKey
添加按键到当前配置
static async addKey(key: CustomKeyDef): Promise<void> { const profile = await CustomKeyStore.getActiveProfile(); profile.keys.push(key); await CustomKeyStore.save(); }
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 addKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right...
static async addKey(key: CustomKeyDef): Promise<void> { const profile = await CustomKeyStore.getActiveProfile(); profile.keys.push(key); await CustomKeyStore.save(); }
https://github.com/AlkaidLab/moonlight-harmony
524a9e4e60e3dc24d496ee307cb044178d3529b0
github
smarthane/DrawerLayout
DrawerLayout/src/main/ets/components/DrawerLayout.ets
arkts
animateDrawer
侧边栏移动动画 @param event
animateDrawer(event: () => void) { animateTo({ duration: this.drawerAnimDuration, curve: Curve.Linear, iterations: 1, playMode: PlayMode.Alternate, }, event) }
AST#program#Left AST#ERROR#Left AST#identifier#Left animateDrawer AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left event AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argumen...
animateDrawer(event: () => void) { animateTo({ duration: this.drawerAnimDuration, curve: Curve.Linear, iterations: 1, playMode: PlayMode.Alternate, }, event) }
https://github.com/smarthane/DrawerLayout
a426479a05967a75c4057f42d5c5b2c4d4169886
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ProviderViewModel.ets
arkts
testConnection
============================================================================ 业务:连接测试 / 模型列表 ============================================================================
async testConnection(provider: ModelProvider): Promise<AIApiResult> { const config = this.providerToApiConfig(provider) let testModelId = this.getPreferredModelId(provider) if (testModelId === '') { const modelsResult = await this.aiApiService.getModels(config) if (!modelsResult.success) { ...
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 provider AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async testConnection(provider: ModelProvider): Promise<AIApiResult> { const config = this.providerToApiConfig(provider) let testModelId = this.getPreferredModelId(provider) if (testModelId === '') { const modelsResult = await this.aiApiService.getModels(config) if (!modelsResult.success) { ...
https://github.com/LongLiveY96/chatcube
e671b9a44362b0770f3819f556ceba45cbb5eb14
github
Joker-x-dev/CoolMallArkTS
entry/src/main/ets/navigation/NavigationHost.ets
arkts
build
导航目标构建器 @returns 路由构建器
build() { Navigation(this.navPathStack) { MainPage() } .hideTitleBar(true) .mode(NavigationMode.Stack) .navDestination(this.PagesMap) }
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() { Navigation(this.navPathStack) { MainPage() } .hideTitleBar(true) .mode(NavigationMode.Stack) .navDestination(this.PagesMap) }
https://github.com/Joker-x-dev/CoolMallArkTS
3ed4e142efb6fa6389d37344d28726b34a719987
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/FileStorageFactory.ets
arkts
removeStorage
删除存储实现 @param type 存储类型 @param storage 存储实现
public removeStorage(type: StorageType): void { this.storageMap.delete(type); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left St...
public removeStorage(type: StorageType): void { this.storageMap.delete(type); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/FileStorageFactory.ets#L50-L52
4cbd9867e8cacfab03b5707111c0879a42a1d047
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/RegExp.ets
arkts
get
TODO(kirill-mitkin): add indices and groups fields Returns result string by index @param index @returns resulting string
public get(index: int): String { return this.result[index]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public get(index: int): String { return this.result[index]; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
37188945ed9db361014b708c9faa9b8efa2fb21b
gitee
PollenWang6/HiXD
entry/src/main/ets/services/VersionService.ets
arkts
compareVersion
比较版本号:返回 -1(old<new), 0(equal), 1(old>new)
static compareVersion(current: string, remote: string): number { const curParts = current.split('.').map(n => parseInt(n) || 0); const remParts = remote.split('.').map(n => parseInt(n) || 0); for (let i = 0; i < Math.max(curParts.length, remParts.length); i++) { const c = curParts[i] || 0; con...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left compareVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left current AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static compareVersion(current: string, remote: string): number { const curParts = current.split('.').map(n => parseInt(n) || 0); const remParts = remote.split('.').map(n => parseInt(n) || 0); for (let i = 0; i < Math.max(curParts.length, remParts.length); i++) { const c = curParts[i] || 0; con...
https://github.com/PollenWang6/HiXD
67593f5fe0c41af324698419757cad30b80c1f9b
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
initOffset
初始化多列位置
initOffset(){ const value: IBestStringNumber[] = this.value.length ? this.value : Array(this.options.length).fill(0) if(value.length) { this.isReady = false this.columnType = this.getColumnType() if (this.columnType == "cascade") { this.initCascadeOffset(0, this.options as IBestPickerOption[]) } el...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initOffset 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 AS...
initOffset(){ const value: IBestStringNumber[] = this.value.length ? this.value : Array(this.options.length).fill(0) if(value.length) { this.isReady = false this.columnType = this.getColumnType() if (this.columnType == "cascade") { this.initCascadeOffset(0, this.options as IBestPickerOption[]) } el...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L427-L448
152acfadca56a3d22ba45dd38cfd1cf43449dcd5
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/VNCSettings.ets
arkts
getNativePort
获取原生客户端端口
getNativePort(): number { return this.settings.nativePort }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNativePort 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#number#Right AST#ERROR#Right AST#statemen...
getNativePort(): number { return this.settings.nativePort }
https://github.com/AetheriumSimulator/qemu-hmos
39c3be66fa9402d75a3f805bc41f09f2c769da31
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ConsolePanel.ets
arkts
build
--- UI 构建方法 ---
build() { // 只有在显示Console面板时才渲染组件 if (this.showConsolePanel) { if (this.isMinimized) { // 悬浮按钮模式 this.FloatingBall(); } else { // 调整了面板的布局和事件处理逻辑 // 根Stack现在作为背景遮罩,并处理外部点击事件 Stack() { // Console面板内容区域(顶层) Column() { this.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#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 只有在显示Console面板时...
build() { // 只有在显示Console面板时才渲染组件 if (this.showConsolePanel) { if (this.isMinimized) { // 悬浮按钮模式 this.FloatingBall(); } else { // 调整了面板的布局和事件处理逻辑 // 根Stack现在作为背景遮罩,并处理外部点击事件 Stack() { // Console面板内容区域(顶层) Column() { this.Title...
https://github.com/DaLongZhuaZi/manxia
7f5aac2060dad39f258932ff174b89265048a5e3
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/LayoutConfigManager.ets
arkts
getDefaultLayout
获取当前全局默认布局,如果没有则返回内置默认
getDefaultLayout(viewportW: number, viewportH: number): LayoutConfiguration { if (this.defaultLayoutId === BUILTIN_DEFAULT_ID) { return this.createBuiltinDefault(viewportW, viewportH); } const found = this.layouts.find((l: LayoutConfiguration) => l.id === this.defaultLayoutId); if (found) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDefaultLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewportW AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A...
getDefaultLayout(viewportW: number, viewportH: number): LayoutConfiguration { if (this.defaultLayoutId === BUILTIN_DEFAULT_ID) { return this.createBuiltinDefault(viewportW, viewportH); } const found = this.layouts.find((l: LayoutConfiguration) => l.id === this.defaultLayoutId); if (found) { ...
https://github.com/richshaw2015/nds
27903c909e495c34e30a158698cc42d4e2cc4de1
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningService.ets
arkts
getModuleStats
获取学习统计数据
public async getModuleStats(moduleName: string, totalLessons: number): Promise<LearningStats> { const progress = await this.getModuleProgress(moduleName); if (!progress) { return { moduleName: moduleName, completedLessons: 0, totalLessons: totalLessons, stars: 0, ...
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 getModuleStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async getModuleStats(moduleName: string, totalLessons: number): Promise<LearningStats> { const progress = await this.getModuleProgress(moduleName); if (!progress) { return { moduleName: moduleName, completedLessons: 0, totalLessons: totalLessons, stars: 0, ...
https://github.com/the-wwyang/kids-learning-app
9c96dc73cbc13b90f47f5bc258d7076a9b441546
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/IndexManager.ets
arkts
createSharedLedgerIndexes
创建共享账本表的索引
private static async createSharedLedgerIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // 共享账本表 - 所有者索引 await store.executeSql(` CREATE INDEX IF NOT EXISTS idx_shared_ledgers_owner ON shared_ledgers(owner_id, created_at DESC) WHERE is_deleted ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left createSharedLedgerIndexes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right...
private static async createSharedLedgerIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // 共享账本表 - 所有者索引 await store.executeSql(` CREATE INDEX IF NOT EXISTS idx_shared_ledgers_owner ON shared_ledgers(owner_id, created_at DESC) WHERE is_deleted ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f61636b001f7ee902c0ceb4e58f73992bec684c7
github
richshaw2015/nds
ohos/entry/src/test/LayoutRestoreProperty.test.ets
arkts
generateMixedLayoutArray
Generate a random array of LayoutEntry objects with mixed INTERNAL/EXTERNAL targets.
function generateMixedLayoutArray(rng: PRNG): LayoutEntry[] { const length = rng.nextInt(0, 20); const layouts: LayoutEntry[] = []; for (let i = 0; i < length; i++) { const target = rng.pick(TARGETS); layouts.push(generateLayoutEntry(rng, target)); } return layouts; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateMixedLayoutArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function generateMixedLayoutArray(rng: PRNG): LayoutEntry[] { const length = rng.nextInt(0, 20); const layouts: LayoutEntry[] = []; for (let i = 0; i < length; i++) { const target = rng.pick(TARGETS); layouts.push(generateLayoutEntry(rng, target)); } return layouts; }
https://github.com/richshaw2015/nds
68325bd709392ba53abb4064f3a40cbf5abfdf02
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets
arkts
handleOpenDatabaseCall
/打开数据库
async handleOpenDatabaseCall(call: MethodCall, result: MethodResult): Promise<void> { await DatabaseHelper.openDatabase(this.context!, call, result); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left handleOpenDatabaseCall AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#type_annotation#Left AST#:...
async handleOpenDatabaseCall(call: MethodCall, result: MethodResult): Promise<void> { await DatabaseHelper.openDatabase(this.context!, call, result); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
f88a603ef68650cad53f2baac2e59e9bc9a1369d
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets
arkts
onInputConnectionLocked
Callback fired when the platform's input connection is locked, or should be used. <p>This hook only exists for rare cases where the plugin relies on the state of the input connection. This probably doesn't need to be implemented.
onInputConnectionLocked(): void {}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInputConnectionLocked 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_ex...
onInputConnectionLocked(): void {}
https://gitee.com/openharmony-sig/flutter_engine.git
95fba1c74778e2a305095950430dbee318478ad2
gitee
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getAttendanceSummary
获取考勤月统计
async getAttendanceSummary(year: number, month: number): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/summary', { year, month }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceSummary AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#L...
async getAttendanceSummary(year: number, month: number): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/summary', { year, month }) }
https://github.com/David8Idira/AI-OA
9ad7da445c95fb80fb8c33b6bedf18ab9e582f79
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/UserSessionService.ets
arkts
getSessionRemainingTime
获取会话剩余时间(毫秒) @returns 剩余时间,未登录返回0
static async getSessionRemainingTime(): Promise<number> { const session = await UserSessionService.getCurrentSession(); if (!session) { return 0; } const now: number = Date.now(); const lastActive: number = new Date(session.lastActiveTime).getTime(); const remaining: number = UserSessio...
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 getSessionRemainingTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
static async getSessionRemainingTime(): Promise<number> { const session = await UserSessionService.getCurrentSession(); if (!session) { return 0; } const now: number = Date.now(); const lastActive: number = new Date(session.lastActiveTime).getTime(); const remaining: number = UserSessio...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3b56c3ccc4d4eef26668d561948a772f905371ff
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets
arkts
setScatterShapeHoleRadius
Sets the ScatterShape this DataSet should be drawn with. This will search for an available IShapeRenderer and set this renderer for the DataSet. @param shape Sets a new IShapeRenderer responsible for drawing this DataSet. This can also be used to set a custom IShapeRenderer aside from the default ones. @param shapeRend...
public setScatterShapeHoleRadius(holeRadius: number): void { this.mScatterShapeHoleRadius = holeRadius; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScatterShapeHoleRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left holeRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
public setScatterShapeHoleRadius(holeRadius: number): void { this.mScatterShapeHoleRadius = holeRadius; }
https://gitee.com/openharmony/developtools_profiler.git
0d22ff8eedf3af57cde44f95fddf8b0b0ab4ee53
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/UnknownFields.ets
arkts
append
追加未知字段数据 @param bytes 要追加的二进制数据 注意:此方法会创建新的 Uint8Array, 在频繁调用时可能有性能开销。
append(bytes: Uint8Array): void { if (bytes.length === 0) { return } // 创建新数组,容量为现有数据 + 新数据 const newData = new Uint8Array(this.data.length + bytes.length) // 复制现有数据 newData.set(this.data, 0) // 追加新数据 newData.set(bytes, this.data.length) // 更新引用 this.data = newData ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#)#Left ) AST...
append(bytes: Uint8Array): void { if (bytes.length === 0) { return } // 创建新数组,容量为现有数据 + 新数据 const newData = new Uint8Array(this.data.length + bytes.length) // 复制现有数据 newData.set(this.data, 0) // 追加新数据 newData.set(bytes, this.data.length) // 更新引用 this.data = newData ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
c8d19caff30fcafc6909008e61cec81659cd0583
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/services/ExternalFileOpener.ets
arkts
toFileUri
将沙箱路径转为 file URI
static toFileUri(sandboxPath: string): string { try { return fileUri.getUriFromPath(sandboxPath); } catch (_e) { // 如果是 content URI 或已经是 URI,直接返回 if (sandboxPath.startsWith('file://') || sandboxPath.startsWith('content://')) { return sandboxPath; } return `file://${sandbo...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toFileUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sandboxPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
static toFileUri(sandboxPath: string): string { try { return fileUri.getUriFromPath(sandboxPath); } catch (_e) { // 如果是 content URI 或已经是 URI,直接返回 if (sandboxPath.startsWith('file://') || sandboxPath.startsWith('content://')) { return sandboxPath; } return `file://${sandbo...
https://github.com/XJTUWYD/ArkDiff
16427a3c91d121748b2153604fc2a7b749df111a
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/DigitPanelModel.ets
arkts
getSciencePanelList
get science calculator panel @return Array<Array<SimplePhysicsButtonInfo>> ScienceLists
public getSciencePanelList(): Array<Array<SimplePhysicsButtonInfo>> { let arr: SimplePhysicsButtonInfo[][] = [ [ { keyCode: KeyCode.KEYCODE_LEFT_PARENTHESES, keyText: $r('app.media.ic_left_parentheses'), accessibilityInfo: new AccessibilityInfo(KeyCode.KEYCODE_LEFT_PARENTHESES) }, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSciencePanelList 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#ex...
public getSciencePanelList(): Array<Array<SimplePhysicsButtonInfo>> { let arr: SimplePhysicsButtonInfo[][] = [ [ { keyCode: KeyCode.KEYCODE_LEFT_PARENTHESES, keyText: $r('app.media.ic_left_parentheses'), accessibilityInfo: new AccessibilityInfo(KeyCode.KEYCODE_LEFT_PARENTHESES) }, ...
https://gitee.com/openharmony-sig/applications_calculator.git
4381a1ec2c5e8526d294fcdafcf4f3bc9829df3a
gitee
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/CryptoDemo.ets
arkts
verifySignRsa
rsa 公钥验证签名
public static verifySignRsa(plainData: Uint8Array, signData: Uint8Array, publicKeyData: Uint8Array): boolean { let plainBlog: cryptoFramework.DataBlob = { data: plainData }; let signBlob: cryptoFramework.DataBlob = { data: signData }; let publicKey = CryptoHelper.getRsaKeyPair(publicKeyData, null).pubKey ...
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 verifySignRsa AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plainData AST#identifier#Right AST#:#Left...
public static verifySignRsa(plainData: Uint8Array, signData: Uint8Array, publicKeyData: Uint8Array): boolean { let plainBlog: cryptoFramework.DataBlob = { data: plainData }; let signBlob: cryptoFramework.DataBlob = { data: signData }; let publicKey = CryptoHelper.getRsaKeyPair(publicKeyData, null).pubKey ...
https://github.com/webabcd/HarmonyDemo
f14f761b32279bcd58468533d859f74dfcdc3c91
github
openharmony/codelabs
CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets
arkts
openNotificationPermission
open notification permission
public openNotificationPermission() { notification.requestEnableNotification().then(() => { console.info('Enable notification success'); }).catch((err: Error) => { console.error('Enable notification failed because ' + JSON.stringify(err)); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openNotificationPermission 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...
public openNotificationPermission() { notification.requestEnableNotification().then(() => { console.info('Enable notification success'); }).catch((err: Error) => { console.error('Enable notification failed because ' + JSON.stringify(err)); }); }
https://gitee.com/openharmony/codelabs.git
875e9a074a426121b5ff45cf9c153c6b9270ff22
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets
arkts
deleteHistory
Delete all entries with matching timestamps from the corresponding chunk file, then save the file. Orders doesn't matter. @param timestamps Set of timestamps of historical records to be deleted. @author ChatGLM @ 2026 Mar 31
async deleteHistory(timestamps: Set<number>): Promise<boolean> { if (this.busy) { meow(`Busy. Rejected.`, 'meowHistorian][deleteHistory', meowLevel.WARN); // meow(`Busy. Rejected history: ["${timestamps.join(', ')}"]`, 'meowHistorian][deleteHistory', meowLevel.WARN); return false; } if (...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left timestamps AST#identifier#Right...
async deleteHistory(timestamps: Set<number>): Promise<boolean> { if (this.busy) { meow(`Busy. Rejected.`, 'meowHistorian][deleteHistory', meowLevel.WARN); // meow(`Busy. Rejected history: ["${timestamps.join(', ')}"]`, 'meowHistorian][deleteHistory', meowLevel.WARN); return false; } if (...
https://github.com/awaLiny2333/LinysBrowser_NEXT
ec6b036c15a65865591a9cd2caf97bee2ea255ce
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/UserInfoRepository.ets
arkts
updatePersonInfo
更新用户个人信息 @param {Record<string, Unknown>} params - 更新参数 @returns {Promise<NetworkResponse<Unknown>>} 更新结果
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.updatePersonInfo(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updatePersonInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.updatePersonInfo(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
1c2bbc78c99a7139d238ba8a8e843c3debc46871
github
erosTeam/NextE
shared/src/main/ets/model/SimpleTag.ets
arkts
display
Localized text if available, else the raw EH tag.
display(): string { if (this.translat.length > 0) { return this.translat } return this.siteLabel.length > 0 ? this.siteLabel : this.text }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left display AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bloc...
display(): string { if (this.translat.length > 0) { return this.translat } return this.siteLabel.length > 0 ? this.siteLabel : this.text }
https://github.com/erosTeam/NextE
281447ad417099a5c7d32adf429b00b0911300d5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
updateLedger
更新账本信息
static async updateLedger(ledgerId: number, updates: UpdateLedgerParams): Promise<boolean> { try { const ledger = await SharedLedgerDAO.getById(ledgerId); if (!ledger) { throw new Error('账本不存在'); } // 手动更新字段 if (updates.name !== undefined) ledger.name = updates.name; i...
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 updateLedger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async updateLedger(ledgerId: number, updates: UpdateLedgerParams): Promise<boolean> { try { const ledger = await SharedLedgerDAO.getById(ledgerId); if (!ledger) { throw new Error('账本不存在'); } // 手动更新字段 if (updates.name !== undefined) ledger.name = updates.name; i...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
534e6171b55a9018522b8684e141a54134f8cf81
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/sub_pages/score_counter/ScoreCounterPage.ets
arkts
aboutToAppear
==================== Lifecycle ====================
aboutToAppear(): void { BreakpointSystem.getInstance().attach(this.currentBreakpoint) BreakpointSystem.getInstance().start() this.detectOrientation() this.listenOrientation() }
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 { BreakpointSystem.getInstance().attach(this.currentBreakpoint) BreakpointSystem.getInstance().start() this.detectOrientation() this.listenOrientation() }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
867126d448363e6c20deb1ce7bc9ea0c9d5734c2
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/repository/TaskRepository.ets
arkts
getTaskById
根据 ID 获取任务 @param id 任务 ID @returns Promise<TaskListData | null> 任务模型或 null
async getTaskById(id: number): Promise<TaskListData | null> { try { const record = await this.dao.queryById(id); return record ? TaskListData.fromRecord(record) : null; } catch (err) { Logger.error(this.LOG_TAG, `Failed to get task by ID: ${JSON.stringify(err)}`); return null; } ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTaskById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async getTaskById(id: number): Promise<TaskListData | null> { try { const record = await this.dao.queryById(id); return record ? TaskListData.fromRecord(record) : null; } catch (err) { Logger.error(this.LOG_TAG, `Failed to get task by ID: ${JSON.stringify(err)}`); return null; } ...
https://github.com/Kira-Yagami-Light/Kira-Projects
4c1199f0e145a7b6093b535c371d9cc198587a48
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
removeDataListener
移除数据变更监听器
public removeDataListener(listener: ChartDataChangeListener<T>): void { const index = this.dataListeners.indexOf(listener); if (index !== -1) { this.dataListeners.splice(index, 1); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeDataListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantia...
public removeDataListener(listener: ChartDataChangeListener<T>): void { const index = this.dataListeners.indexOf(listener); if (index !== -1) { this.dataListeners.splice(index, 1); } }
https://github.com/LJ666-ui/harmony-health-care
d381a79f5586edfdb2e2b7f7bf62a3ed21ddaed2
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/accessibility/AccessibilityConfig.ets
arkts
getTouchTargetSize
获取当前触控区域大小
public getTouchTargetSize(): number { return this.settings.elderlyMode ? 52 : this.settings.minTouchTarget; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTouchTargetSize 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 ...
public getTouchTargetSize(): number { return this.settings.elderlyMode ? 52 : this.settings.minTouchTarget; }
https://github.com/LJ666-ui/harmony-health-care
2c80016c786ba669f86e30e816651c35542a10aa
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildSearchActions
构建搜索操作序列
buildSearchActions(config: MangaSourceConfig, keyword: string): Action[] { const workflow = this.getWorkflow(config, 'search'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少搜索工作流配置' ); } return this.processActions(workflow, { searchK...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildSearchActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig AS...
buildSearchActions(config: MangaSourceConfig, keyword: string): Action[] { const workflow = this.getWorkflow(config, 'search'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少搜索工作流配置' ); } return this.processActions(workflow, { searchK...
https://github.com/DaLongZhuaZi/manxia
a0c2e4bdd71cec2f3826531bf6acf1cc04a6757a
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/pages/RemoteDesktop.ets
arkts
onSurfaceCreated
---- XComponent 生命周期回调 ----
onSurfaceCreated(surfaceId: string): void { try { hilog.info(RD_DOMAIN, RD_TAG, 'XComponentController.onSurfaceCreated: surfaceId=' + surfaceId); const desktop: DesktopSize = this.desktopSize(this.pendingHost); this.updateRemoteSize(desktop); const ok: boolean = rdpnapi.setXComponentSurfac...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSurfaceCreated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A...
onSurfaceCreated(surfaceId: string): void { try { hilog.info(RD_DOMAIN, RD_TAG, 'XComponentController.onSurfaceCreated: surfaceId=' + surfaceId); const desktop: DesktopSize = this.desktopSize(this.pendingHost); this.updateRemoteSize(desktop); const ok: boolean = rdpnapi.setXComponentSurfac...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
fbcb2147d771b9597ea7c3bb64ab19d323ec4a93
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/HomePage.ets
arkts
getGreeting
获取问候语
getGreeting(): string { const hour = new Date().getHours(); if (hour < 6) return '夜深了'; if (hour < 12) return '早上好'; if (hour < 14) return '中午好'; if (hour < 18) return '下午好'; return '晚上好'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGreeting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_...
getGreeting(): string { const hour = new Date().getHours(); if (hour < 6) return '夜深了'; if (hour < 12) return '早上好'; if (hour < 14) return '中午好'; if (hour < 18) return '下午好'; return '晚上好'; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
00918a554da4a43ce44da7246957ab7381c0cb10
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/config/MessageListConfig.ets
arkts
alignment
Getters with default values
get alignment(): MessageAlignment { if (this.userAlignment !== undefined) { return this.userAlignment; } return AppBuilderConfig.getInstance().messageAlignment; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left alignment 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 MessageAlignment AST#...
get alignment(): MessageAlignment { if (this.userAlignment !== undefined) { return this.userAlignment; } return AppBuilderConfig.getInstance().messageAlignment; }
https://github.com/Tencent-RTC/TUIKit_Harmony
ae2391af6a9e9699295d2eeb1c92ba9c47936bfa
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/DiffEngine.ets
arkts
mergeAdjacent
========== 合并 DELETE+ADD → MODIFIED(O(n) 单次遍历,避免内层 for+splice 的 O(k²)) ==========
private static mergeAdjacent(lines: DiffLine[], options: DiffOptions): DiffLine[] { const out: DiffLine[] = []; let i = 0; const len = lines.length; while (i < len) { if (lines[i].type === DiffType.UNCHANGED) { out.push(lines[i++]); continue; } // 收集连续变化段 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 mergeAdjacent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lines AST#identifier#Right AST#:#Left ...
private static mergeAdjacent(lines: DiffLine[], options: DiffOptions): DiffLine[] { const out: DiffLine[] = []; let i = 0; const len = lines.length; while (i < len) { if (lines[i].type === DiffType.UNCHANGED) { out.push(lines[i++]); continue; } // 收集连续变化段 const...
https://github.com/XJTUWYD/ArkDiff
fd39147e4ead9ab9186cb2899e76f83969403842
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets
arkts
calJankArray
方法描述 @param jankRangeArray 连续丢帧数组 @param defaultJankTime 默认单帧时间
private static calJankArray(jankRangeArray: Array<number>, defaultJankTime: number) { if (jankRangeArray[0] < 0.01) { for (let i = 1; i <= GameUtils.JANK_SIZE; i++) { jankRangeArray[i - 1] = (defaultJankTime * i + defaultJankTime * (i + 1)) / 2; } } }
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 calJankArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left jankRangeArray AST#i...
private static calJankArray(jankRangeArray: Array<number>, defaultJankTime: number) { if (jankRangeArray[0] < 0.01) { for (let i = 1; i <= GameUtils.JANK_SIZE; i++) { jankRangeArray[i - 1] = (defaultJankTime * i + defaultJankTime * (i + 1)) / 2; } } }
https://gitee.com/openharmony/developtools_profiler.git
691c8fec4d483b23fb3f706894ebd41d34f1b19d
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets
arkts
isAssignableFrom
Checks if a type can be assigned from another type. This includes subtype relationships, assignment compatibility between numeric types, between boolean types, and between character types. @static @param { Class } lhsType The target type. @param { Class } rhsType The source type. @returns { boolean } Returns true if rh...
public static isAssignableFrom(lhsType: Class, rhsType: Class): boolean { return (rhsType.isSubtypeOf(lhsType)) || (Types.isNumericType(lhsType) && Types.isNumericType(rhsType)) || (Types.isBooleanType(lhsType) && Types.isBooleanType(rhsType)) || (Types.isCharType(lhsType...
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 isAssignableFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lhsType AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public static isAssignableFrom(lhsType: Class, rhsType: Class): boolean { return (rhsType.isSubtypeOf(lhsType)) || (Types.isNumericType(lhsType) && Types.isNumericType(rhsType)) || (Types.isBooleanType(lhsType) && Types.isBooleanType(rhsType)) || (Types.isCharType(lhsType...
https://gitcode.com/iop123123/arkts-static-skills
78d4ec5ec3343c4c9966eb26d4454a44b9141207
gitcode
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
getSmsCode
获取短信验证码 @param {Record<string, string>} params - 验证码请求参数 @returns {Promise<NetworkResponse<string>>} 发送结果
async getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>> { const response: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("user/login/smsCode", params); return response.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSmsCode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>> { const response: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.post("user/login/smsCode", params); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
5aca32dfb9903fa12adfa269e69d714b1c77322c
github
openharmony/third_party_typescript
tests/arkTSTest/testcase/arkts-no-symbol/arkts-no-symbol-3-ok.ets
arkts
[Symbol.iterator]
Implement iterators
[Symbol.iterator](): Iterator<string> { let index: number = 0 return { next: (): IteratorResult<string> => { if (index < this.students.length) { return { done: false, value: this.students[index++] } } else { return { done: true, value: undefined } } }, ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#array#Left AST#[#Left [ AST#[#Right AST#member_expression#Left AST#identifier#Left Symbol AST#identifier#Right AST#.#Left . AST#.#Right AST#property_identifier#Left iterator AST#property_ide...
[Symbol.iterator](): Iterator<string> { let index: number = 0 return { next: (): IteratorResult<string> => { if (index < this.students.length) { return { done: false, value: this.students[index++] } } else { return { done: true, value: undefined } } }, ...
https://gitee.com/openharmony/third_party_typescript.git
c5a993486ac6e0636efc78bbde993b9d2c5e760d
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectField.ets
arkts
isPrivate
Checks if the field has private access permission. @returns { boolean } Returns true if the field is private; otherwise returns false.
public isPrivate(): boolean { return (this.accessMod == AccessModifier.PRIVATE) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPrivate 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#boo...
public isPrivate(): boolean { return (this.accessMod == AccessModifier.PRIVATE) }
https://gitcode.com/iop123123/arkts-static-skills
7de9f178b821e27195ce3efb9d3ea2040ca976ba
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
getAxisLineColor
Returns the color of the axis line (line alongside the axis). @return
public getAxisLineColor(): number { return this.mAxisLineColor; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAxisLineColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS...
public getAxisLineColor(): number { return this.mAxisLineColor; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
251c5463e60cdd10a7ea0db8fe3cc585a3c769d0
gitee
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
getFieldMapParameters
Get field map parameters metadata
static getFieldMapParameters(target: Object, propertyKey?: string | symbol): number[] | null { return this.getMetadata('retrofit:fieldMapParams', target, propertyKey) || null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFieldMapParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
static getFieldMapParameters(target: Object, propertyKey?: string | symbol): number[] | null { return this.getMetadata('retrofit:fieldMapParams', target, propertyKey) || null; }
https://github.com/killetom/ktretrofit
9096572adf5f394dc8b89c7938ff5e333b7b2f2d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
compare
Compares 2 input strings x and y @param x input string to compare @param y input string to compare @return 1 if x 'more' than y @return -1 if y 'more' than x @return 0 if x equal y
public compare(x: string, y: string): int { if (x == y) { return 0 } if (this.options.numeric) { let xNumber = new Number(x.replaceAll(',', '.')) let yNumber = new Number(y.replaceAll(',', '.')) if (!isNaN(xNum...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left compare 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 string AST#...
public compare(x: string, y: string): int { if (x == y) { return 0 } if (this.options.numeric) { let xNumber = new Number(x.replaceAll(',', '.')) let yNumber = new Number(y.replaceAll(',', '.')) if (!isNaN(xNum...
https://gitcode.com/iop123123/arkts-static-skills
af4e61644754cc3daad6d87e7e030ac423d9f65f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Float32Array with respect to buf. @param buf data initializer
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Float32Array.BYTES_PER_ELEMENT) }
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 buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Float32Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
65b6bc8f05b327d0233ea1ec8d530cc3febd36f7
gitee
anhao0226/harmony-music-player
entry/src/main/ets/models/CommonDataSource.ets
arkts
getAllData
@deprecated @returns
getAllData(): T [] { return this.dataArray; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllData 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 AST#identifier...
getAllData(): T [] { return this.dataArray; }
https://github.com/anhao0226/harmony-music-player
661afe686431866d894a598e18dbe9c1e1b83fdb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
getDownloadSources
获取下载源列表(电子书专用) @param bookId 书籍ID
async getDownloadSources(bookId: string): Promise<EngineResult<Object[]>> { const startTime = Date.now(); try { const taskParams: Record<string, Object | undefined> = {}; taskParams['bookId'] = bookId; const result = await this.executeTask('getDownloadSources', taskParams); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDownloadSources AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async getDownloadSources(bookId: string): Promise<EngineResult<Object[]>> { const startTime = Date.now(); try { const taskParams: Record<string, Object | undefined> = {}; taskParams['bookId'] = bookId; const result = await this.executeTask('getDownloadSources', taskParams); ...
https://github.com/DaLongZhuaZi/manxia
b17f42f98ea767e215eeb83f535c198e457cd48a
github
luojiang001/Pulse
Pulse/oh_modules/collect_personal_info/src/main/ets/common/WindowModel.ets
arkts
unRegisterKeyboardListener
取消注册监听键盘区域变化
public unRegisterKeyboardListener(callback: Callback<number>) { window.getLastWindow(getContext()).then(currentWindow => { currentWindow.off('keyboardHeightChange', callback); }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unRegisterKeyboardListener 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#i...
public unRegisterKeyboardListener(callback: Callback<number>) { window.getLastWindow(getContext()).then(currentWindow => { currentWindow.off('keyboardHeightChange', callback); }) }
https://github.com/luojiang001/Pulse
79be700247f31ef5b896f08da8f41305fdedd998
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/OmniPopup.ets
arkts
setWrap
全局设置-自定义组件时,是否NodeContainer包裹 @param wrap true:参数可统一设置,比如弹窗圆角、内边距等; false:所有内容都需要自己在使用地方配置,比如圆角,内边距等
static setWrap(wrap: boolean) { Config.wrap = wrap }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setWrap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wrap AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean ...
static setWrap(wrap: boolean) { Config.wrap = wrap }
https://github.com/wuba/omni-ui
823742391f04b8270226c0eea8acb85438ac739c
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
joinRoom
---- 房间管理(对齐 Android WebRtcManager) ---- 加入房间
public joinRoom(roomId: string): void { this.signaling?.sendJoinRoom(roomId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left joinRoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left roomId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public joinRoom(roomId: string): void { this.signaling?.sendJoinRoom(roomId); }
https://github.com/tdcare/tdwebrtc
d64a56d649335df51e2d2b552d3f9203407ea084
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/OmniPopup.ets
arkts
setMaskColor
全局设置-设置遮罩层颜色 @param maskColor @returns
static setMaskColor(maskColor?: ResourceColor) { Config.dialogOptions.maskColor = maskColor }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setMaskColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maskColor AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR...
static setMaskColor(maskColor?: ResourceColor) { Config.dialogOptions.maskColor = maskColor }
https://github.com/wuba/omni-ui
48de9b8cbdd78b65d1db5543dad49f8b74318b34
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
getClickNodeChildrenInfo
get child nodeInfo views by node id @param nodeId node id @returns child nodeInfo views
public getClickNodeChildrenInfo(nodeId: number): NodeInfoView[] { let parent: NodeItem = new NodeItem(emptyNodeInfo); if (this.nodeIdNodeItemMap.has(nodeId)) { parent = this.nodeIdNodeItemMap.get(nodeId) as NodeItem; } if (parent) { if (parent.children.length === 0) { return []; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getClickNodeChildrenInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public getClickNodeChildrenInfo(nodeId: number): NodeInfoView[] { let parent: NodeItem = new NodeItem(emptyNodeInfo); if (this.nodeIdNodeItemMap.has(nodeId)) { parent = this.nodeIdNodeItemMap.get(nodeId) as NodeItem; } if (parent) { if (parent.children.length === 0) { return []; ...
https://gitcode.com/openharmony/arkui_ace_engine
5e8410fab4ed37164a883630d990408b5368785b
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
getDebugInfo
获取调试信息
getDebugInfo(): PreloadDebugInfo { return { currentPage: this.currentPage, totalPages: this.totalPages, preloadRange: this.preloadRange, queueItems: this.getQueueItems(), completedCount: this.completed.size, failedCount: this.failed.size, memCacheHits: this.stats.memCache...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDebugInfo 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 PreloadDebugInfo AST#identifier#Right AST#ERROR#R...
getDebugInfo(): PreloadDebugInfo { return { currentPage: this.currentPage, totalPages: this.totalPages, preloadRange: this.preloadRange, queueItems: this.getQueueItems(), completedCount: this.completed.size, failedCount: this.failed.size, memCacheHits: this.stats.memCache...
https://github.com/DaLongZhuaZi/manxia
545fb64893e2ef3bfbe8a2490b0f0e52b5a5f47c
github
openharmony/arkui_ace_engine
examples/ComponentSnapshot/entry/src/main/ets/common/CommonUtils.ets
arkts
scrollAnimation
[Start scroll_animation] src/main/ets/common/CommonUtils.ets
static scrollAnimation(scroller: Scroller, duration: number, scrollHeight: number): void { scroller.scrollTo({ xOffset: 0, yOffset: (scroller.currentOffset().yOffset + scrollHeight), animation: { duration: duration, curve: Curve.Smooth, canOverScroll: false } })...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left scrollAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scroller AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static scrollAnimation(scroller: Scroller, duration: number, scrollHeight: number): void { scroller.scrollTo({ xOffset: 0, yOffset: (scroller.currentOffset().yOffset + scrollHeight), animation: { duration: duration, curve: Curve.Smooth, canOverScroll: false } })...
https://gitcode.com/openharmony/arkui_ace_engine
63f26819e6dc7cf8ca98a7abae60393ce0aeaf73
gitcode
the-wwyang/kids-learning-app
src/main/ets/utils/ArrayUtils.ets
arkts
randomPickMultiple
从数组中随机选择 n 个不重复的元素 @param array 原数组 @param count 要选择的元素数量 @returns 随机选中的元素数组 @example ArrayUtils.randomPickMultiple([1, 2, 3, 4, 5], 3) // [2, 5, 1] (随机返回3个)
static randomPickMultiple<T>(array: T[], count: number): T[] { if (count <= 0 || array.length === 0) { return []; } const actualCount = Math.min(count, array.length); const shuffled = ArrayUtils.shuffle(array); return shuffled.slice(0, actualCount); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left randomPickMultiple AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( ...
static randomPickMultiple<T>(array: T[], count: number): T[] { if (count <= 0 || array.length === 0) { return []; } const actualCount = Math.min(count, array.length); const shuffled = ArrayUtils.shuffle(array); return shuffled.slice(0, actualCount); }
https://github.com/the-wwyang/kids-learning-app
66962d1e7ffd01630659c011d19a2c0ad7a50573
github
zhui1234/Navix
entry/src/main/ets/utils/MapIO.ets
arkts
parseImport
从 JSON 字符串解析地图数据
static parseImport(jsonStr: string): MapExportData | null { try { const data: MapExportData = JSON.parse(jsonStr) as MapExportData if (data.type !== MapIO.TYPE) { return null } if (data.mapType !== 'grid' && data.mapType !== 'graph') { return null } return data ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseImport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static parseImport(jsonStr: string): MapExportData | null { try { const data: MapExportData = JSON.parse(jsonStr) as MapExportData if (data.type !== MapIO.TYPE) { return null } if (data.mapType !== 'grid' && data.mapType !== 'graph') { return null } return data ...
https://github.com/zhui1234/Navix/blob/df5c3b4c83baa8ecdc9bf26350f9e16492c24d2b/entry/src/main/ets/utils/MapIO.ets#L115-L128
4b0ba99cd5d2d1381e85edceb809a8814f0396ab
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
getNextAvailableTime
获取下一个可用时间戳
static getNextAvailableTime(baseDate: Date, existingEvents: CalendarEvent[]): number { const baseTimestamp = baseDate.getTime(); const dayStart = new Date(baseDate); dayStart.setHours(9, 0, 0, 0); // 从上午9点开始 const existingTimes = existingEvents .filter(event => CalendarUtils.isSameDay(event.sta...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNextAvailableTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseDate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AS...
static getNextAvailableTime(baseDate: Date, existingEvents: CalendarEvent[]): number { const baseTimestamp = baseDate.getTime(); const dayStart = new Date(baseDate); dayStart.setHours(9, 0, 0, 0); // 从上午9点开始 const existingTimes = existingEvents .filter(event => CalendarUtils.isSameDay(event.sta...
https://gitcode.com/openharmony/codelabs
fd051dd92178e407779b8782b573c1a3d33be872
gitcode
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/external_manager.ets
arkts
save_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 内部函数 // ////////// 格式化保存数据 //
private save_data(data: Map<string, string[][]>) { // 初始化所有数据池 // this.all_songs_list = [] this.hr_songs_list = [] this.artist_list = new Map<string, string[]>() this.album_list = new Map<string, string[]>() this.album_artist_list = new Map<string, string[]>() this.genre_list = new Map<st...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left save_data 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#instantiation_expre...
private save_data(data: Map<string, string[][]>) { // 初始化所有数据池 // this.all_songs_list = [] this.hr_songs_list = [] this.artist_list = new Map<string, string[]>() this.album_list = new Map<string, string[]>() this.album_artist_list = new Map<string, string[]>() this.genre_list = new Map<st...
https://github.com/Nekofox-POT/LinMusic
9ee132690d079b3c83b46ed6bb8dcd8076eee526
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/button/ButtonDemo.ets
arkts
buildButton
自定义按钮
@Builder function buildButton(config: ButtonConfiguration) { /* * ButtonConfiguration - 自定义按钮的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * pressed - 按钮是否被按下 * triggerClick() - 触发按钮的 onClick 回调 */ Column({space:5}) { Rect({ width: 100, height: 50 }) // 获取自定义按...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildButton AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requi...
@Builder function buildButton(config: ButtonConfiguration) { /* * ButtonConfiguration - 自定义按钮的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * pressed - 按钮是否被按下 * triggerClick() - 触发按钮的 onClick 回调 */ Column({space:5}) { Rect({ width: 100, height: 50 }) // 获取自定义按...
https://github.com/webabcd/HarmonyDemo
6f52dd7bd811c72745aca468cb907c8edc29109f
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
greaterThanOrEqualTo
Return true if the value of this Decimal is greater than or equal to the value of `n`, otherwise return false. @param { Value } n {double | string | Decimal} @returns { boolean } the boolean type
public greaterThanOrEqualTo(n: Value): boolean { let k = this.comparedTo(n); return k == 1 || k === 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left greaterThanOrEqualTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public greaterThanOrEqualTo(n: Value): boolean { let k = this.comparedTo(n); return k == 1 || k === 0; }
https://gitcode.com/iop123123/arkts-static-skills
fb5eb27c9153b4eef3304773f20601dcbd7c4344
gitcode
richshaw2015/nds
ohos/entry/src/test/NativeSync.test.ets
arkts
setSimulateFailure
设置是否模拟失败
setSimulateFailure(simulate: boolean): void { this.simulateFailure = simulate; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSimulateFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left simulate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left...
setSimulateFailure(simulate: boolean): void { this.simulateFailure = simulate; }
https://github.com/richshaw2015/nds
0073323f8f2a8da4937bf9cabd298f674452af46
github
hiyuey3/Hixy_MyMemories
entry/src/main/ets/utils/MemDBUtils.ets
arkts
initMemoryDB
初始化数据库 包括两个参数: context: 上下文对象 tableName: 数据库名称
initMemoryDB(context: Context, tableName: string) { // 创建一个调用者可以等待的准备就绪承诺 this.readyPromise = new Promise<void>((resolve) => { this.readyResolve = resolve }) // (1) 初始化数据库配置 const STORE_CONFIG: relationalStore.StoreConfig = { name: 'hixy.db', // 数据库文件名 securityLevel: relationalStore.Securi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initMemoryDB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Ri...
initMemoryDB(context: Context, tableName: string) { // 创建一个调用者可以等待的准备就绪承诺 this.readyPromise = new Promise<void>((resolve) => { this.readyResolve = resolve }) // (1) 初始化数据库配置 const STORE_CONFIG: relationalStore.StoreConfig = { name: 'hixy.db', // 数据库文件名 securityLevel: relationalStore.Securi...
https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/MemDBUtils.ets#L55-L119
c4bc261fb7b26889c45004542b9b313ac854f600
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
getPendingEvents
获取未完成的日程
async getPendingEvents(): Promise<CalendarEvent[]> { try { const allEvents = await this.eventDao.getAllEvents(); return allEvents.filter(event => !event.completed); } catch (error) { console.error('Get pending events failed:', error); return []; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPendingEvents 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 getPendingEvents(): Promise<CalendarEvent[]> { try { const allEvents = await this.eventDao.getAllEvents(); return allEvents.filter(event => !event.completed); } catch (error) { console.error('Get pending events failed:', error); return []; } }
https://gitcode.com/openharmony/codelabs
287374800044340f28187c122c0b37ac066a1f9e
gitcode
751496032/ZRouter
RouterApi/src/main/ets/model/ConfigInitializer.ets
arkts
onRouterMapLoadedComplete
路由表加载完成回调 @param value
public set onRouterMapLoadedComplete(value: onRouterMapLoadedComplete) { if (!this._onRouterMapLoadedCompletes) { this._onRouterMapLoadedCompletes = [] } this._onRouterMapLoadedCompletes?.push(value) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left set AST#identifier#Right AST#call_expression#Left AST#identifier#Left onRouterMapLoadedComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:...
public set onRouterMapLoadedComplete(value: onRouterMapLoadedComplete) { if (!this._onRouterMapLoadedCompletes) { this._onRouterMapLoadedCompletes = [] } this._onRouterMapLoadedCompletes?.push(value) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/ConfigInitializer.ets#L68-L73
ae45d1ccfc2838753295dba4fe8a79861c2bd5d2
github
PollenWang6/HiXD
entry/src/main/ets/services/SchoolnetService.ets
arkts
getZfwCaptcha
获取验证码图片(base64 PNG) 对齐 Flutter: refresh → get bytes
async getZfwCaptcha(): Promise<string> { // 先刷新验证码 await this.http.getWithQuery( ZFW_BASE + '/site/captcha', { 'refresh': '1', '_': Date.now().toString() } ); // 再获取图片二进制 const buffer: ArrayBuffer = await this.http.getArrayBuffer( ZFW_BASE + '/site/captcha?_=' + Date.now().toStri...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getZfwCaptcha AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async getZfwCaptcha(): Promise<string> { // 先刷新验证码 await this.http.getWithQuery( ZFW_BASE + '/site/captcha', { 'refresh': '1', '_': Date.now().toString() } ); // 再获取图片二进制 const buffer: ArrayBuffer = await this.http.getArrayBuffer( ZFW_BASE + '/site/captcha?_=' + Date.now().toStri...
https://github.com/PollenWang6/HiXD
219a46ee28d683c622931d0e26c30b55d6f3a958
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
between
设置单个字段的 BETWEEN 条件 @param field 字段 @param start 起始值 @param end 结束值 @returns Wrapper
between(field: string, start: relationalStore.ValueType, end: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} between ? and ?`) this.valueList.push(start) this.valueList.push(end) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left between AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#...
between(field: string, start: relationalStore.ValueType, end: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} between ? and ?`) this.valueList.push(start) this.valueList.push(end) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L155-L163
75363e9dcc8144c609acdf6b4f8c303b9edfd24f
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/KeyboardMapper.ets
arkts
isAltPressed
Check if Alt is pressed
isAltPressed(): boolean { return this.altPressed; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAltPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem...
isAltPressed(): boolean { return this.altPressed; }
https://github.com/tangwengang-del/freerdp-harmonyos
4f967389788251f12d6b442027f1ea720e07d80e
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ColorPickerUtil.ets
arkts
getRgb
Calculate the color number of red, blue, green area. @param rgba, rgba(0, 255, 255, 1.00) @returns the number of three area.
public static getRgb(rgba: string): number[] { if (rgba.length < ColorPickerUtil.RGBA_PREFIX_LENGTH || !rgba.endsWith(')')) { Logger.error(TAG, `getRgb failed. Cause param: ${rgba} is invalid`); return [0, 0, 0]; } rgba = rgba.substring(ColorPickerUtil.RGBA_PREFIX_LENGTH, rgba.length - 1); ...
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 getRgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rgba AST#identifier#Right AST#:#Left : AST#:#Rig...
public static getRgb(rgba: string): number[] { if (rgba.length < ColorPickerUtil.RGBA_PREFIX_LENGTH || !rgba.endsWith(')')) { Logger.error(TAG, `getRgb failed. Cause param: ${rgba} is invalid`); return [0, 0, 0]; } rgba = rgba.substring(ColorPickerUtil.RGBA_PREFIX_LENGTH, rgba.length - 1); ...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
85c381cd40887ad299c445618c18d6a840bb9381
gitcode
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets
arkts
onDeviceIdChange
定时器id DeviceId变动事件
onDeviceIdChange(): void { Log.showInfo(TAG, `onDeviceIdChange: deviceId = ${this.deviceId}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDeviceIdChange 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...
onDeviceIdChange(): void { Log.showInfo(TAG, `onDeviceIdChange: deviceId = ${this.deviceId}`); }
https://gitcode.com/arkui-x/samples
735d52da5a169d957a3f5272b8a184f6f83b4a29
gitcode
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/PullUpManager.ets
arkts
clearBadgeNum
set the badgeNum to zero.
private static clearBadgeNum(): void { notificationManager.setBadgeNumber(0) .catch((error: BusinessError) => { Logger.error(TAG, `notificationManager setBadgeNumber failed, cause: ${error.message}`); }); }
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 clearBadgeNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private static clearBadgeNum(): void { notificationManager.setBadgeNumber(0) .catch((error: BusinessError) => { Logger.error(TAG, `notificationManager setBadgeNumber failed, cause: ${error.message}`); }); }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
6570823a642ed03b2e1fe1ddbf4e8239a361540f
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/SunAngleHelper.ets
arkts
calculateJulianDay
计算儒略日
private calculateJulianDay(year: number, month: number, day: number, hour: number, minute: number, second: number): number { if (month <= 2) { year -= 1; month += 12; } const A = Math.floor(year / 100); const B = 2 - A + Math.floor(A / 4); const jd = Math...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateJulianDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private calculateJulianDay(year: number, month: number, day: number, hour: number, minute: number, second: number): number { if (month <= 2) { year -= 1; month += 12; } const A = Math.floor(year / 100); const B = 2 - A + Math.floor(A / 4); const jd = Math...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
26922a79553a5d53cbfcb2de98561a1b77cc0085
github
HarmonyOS_Samples/guide-snippets
Ability/AppStartup/entry/src/main/ets/startup/StartupConfig.ets
arkts
onConfig
[StartExclude startup_config]
onConfig() { hilog.info(0x0000, 'testTag', `onConfig`); let onCompletedCallback = (error: BusinessError<void>) => { hilog.info(0x0000, 'testTag', `onCompletedCallback`); if (error) { hilog.error(0x0000, 'testTag', 'onCompletedCallback: %{public}d, message: %{public}s', error.code, ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onConfig 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#expression_statement#Left AS...
onConfig() { hilog.info(0x0000, 'testTag', `onConfig`); let onCompletedCallback = (error: BusinessError<void>) => { hilog.info(0x0000, 'testTag', `onCompletedCallback`); if (error) { hilog.error(0x0000, 'testTag', 'onCompletedCallback: %{public}d, message: %{public}s', error.code, ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
0a802f250bbdec58974c6f00d874afd8d8af4471
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
nextMonth
切换到下个月
nextMonth() { this.currentDate = new Date(this.currentYear, this.currentMonth + 1, 1) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left nextMonth 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 AST...
nextMonth() { this.currentDate = new Date(this.currentYear, this.currentMonth + 1, 1) }
https://gitcode.com/openharmony/codelabs
b01e8904c1606614129528fcaf9a932dad118b38
gitcode
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/TextInput.ets
arkts
build
标签文本的颜色
build(){ Column(){ Row(){ Row(){ Stack(){ Text(this.placeholder) .fontSize(15) .margin({left:5}) } .width("18%") Stack({alignContent:Alignment.End}){ TextInput() .placeholderColor(Color.Gray) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build(){ Column(){ Row(){ Row(){ Stack(){ Text(this.placeholder) .fontSize(15) .margin({left:5}) } .width("18%") Stack({alignContent:Alignment.End}){ TextInput() .placeholderColor(Color.Gray) ...
https://gitee.com/openharmony-sig/ohos_easyui.git
c53203e3c10c45bb3a20d59b214cfeb819c67f63
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
deleteAllCache
删除所有缓存文件
static async deleteAllCache(): Promise<void> { try { const cacheDir: string = CacheConstants.getCacheDir(); // 先删除目录中的所有文件 const files = CacheConstants.listCacheFiles(cacheDir); for (const file of files) { try { await fs.unlink(file); } catch { // ignore...
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 deleteAllCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async deleteAllCache(): Promise<void> { try { const cacheDir: string = CacheConstants.getCacheDir(); // 先删除目录中的所有文件 const files = CacheConstants.listCacheFiles(cacheDir); for (const file of files) { try { await fs.unlink(file); } catch { // ignore...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L111-L129
2af8ed09165d694598c55737eb7e264fcceb88e4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getGlassShadowColor
获取通用玻璃阴影颜色(不区分主题)
public getGlassShadowColor(): string { return this.getGlassToken(GlassLevel.CARD).shadowColor; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGlassShadowColor 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...
public getGlassShadowColor(): string { return this.getGlassToken(GlassLevel.CARD).shadowColor; }
https://github.com/DaLongZhuaZi/manxia
1aa599f345bfe26e30d0b09e5a19809465bbb86b
github
CsCesium/KantaiHomo
entry/src/main/ets/infra/fairy/service/FairyService.ets
arkts
moveTo
Move the ball to an absolute screen position (px). Called by FairyBall on every PanGesture update.
async moveTo(xPx: number, yPx: number): Promise<void> { if (!this.subWin || !this.alive) { return; } const d = display.getDefaultDisplaySync(); const ballPx = Math.round(vp2px(FAIRY_BALL_VP)); const x = Math.max(0, Math.min(Math.round(xPx), d.width - ballPx)); const y = Math.max(0, Math....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left moveTo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left xPx AST#identifier#Right AST#type_anno...
async moveTo(xPx: number, yPx: number): Promise<void> { if (!this.subWin || !this.alive) { return; } const d = display.getDefaultDisplaySync(); const ballPx = Math.round(vp2px(FAIRY_BALL_VP)); const x = Math.max(0, Math.min(Math.round(xPx), d.width - ballPx)); const y = Math.max(0, Math....
https://github.com/CsCesium/KantaiHomo
7d556990b43de58f253cceab6f6a160d6c9d538c
github
HarmonyOS_Samples/pdfkit_-sample-code_-arkts
entry/src/main/ets/pages/Index.ets
arkts
copyResourceFileAndJump
将资源文件复制到沙盒中并进入下一个页面
copyResourceFileAndJump(): void { try { let context = this.getUIContext().getHostContext(); if (!context) { hilog.error(0x0000, TAG, 'Get context failed'); return; } let dir = context.filesDir; let filePath = dir + '/input.pdf'; let res = fs.accessSync(filePath)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left copyResourceFileAndJump 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#stat...
copyResourceFileAndJump(): void { try { let context = this.getUIContext().getHostContext(); if (!context) { hilog.error(0x0000, TAG, 'Get context failed'); return; } let dir = context.filesDir; let filePath = dir + '/input.pdf'; let res = fs.accessSync(filePath)...
https://gitcode.com/HarmonyOS_Samples/pdfkit_-sample-code_-arkts
52e8b24b6d777da682dacd65739ce565c7612823
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/PredicateBuilder.ets
arkts
getOperatorDescription
获取条件操作符的描述 @param operator 操作符 @returns 描述字符串
static getOperatorDescription(operator: ConditionOperator): string { switch (operator) { case ConditionOperator.EQUAL: return 'equalTo()' case ConditionOperator.NOT_EQUAL: return 'notEqualTo()' case ConditionOperator.GREATER: return 'greaterThan()' case ConditionOpe...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOperatorDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left operator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static getOperatorDescription(operator: ConditionOperator): string { switch (operator) { case ConditionOperator.EQUAL: return 'equalTo()' case ConditionOperator.NOT_EQUAL: return 'notEqualTo()' case ConditionOperator.GREATER: return 'greaterThan()' case ConditionOpe...
https://github.com/offlinecat-dev/OCNetORM
b3f5eb801d21bd72836302aca31b157c258004d5
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets
arkts
cancelLeave
取消请假申请 @param leaveId 请假ID
async cancelLeave(leaveId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/attendance/leave/${leaveId}`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelLeave AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left leaveId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async cancelLeave(leaveId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/attendance/leave/${leaveId}`) }
https://github.com/David8Idira/AI-OA
a1f9b8e026d97ff1c561c6055d2414271cf8c7d4
github
HarmonyOS_Samples/HMRouter
entry/src/main/ets/component/live/CommentInput.ets
arkts
aboutToAppear
[StartExclude comment_render_node]
aboutToAppear(): void { console.log('make node'); this.commentRenderNode.makeNode(this.getUIContext()); }
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 { console.log('make node'); this.commentRenderNode.makeNode(this.getUIContext()); }
https://gitcode.com/HarmonyOS_Samples/HMRouter
629f3e705f1632f14760198e51c8cc976db932ee
gitcode
arkui-x/samples
CodeLab/Cases/feature/dealstridesolution/src/main/ets/model/CameraService.ets
arkts
releaseCamera
释放会话和相关参数
async releaseCamera(): Promise<void> { logger.info(TAG, 'releaseCamera is called'); try { await this.receiver?.release(); } catch (err) { logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`); } try { await this.previewOutput?.release(); } catch (err)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left releaseCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
async releaseCamera(): Promise<void> { logger.info(TAG, 'releaseCamera is called'); try { await this.receiver?.release(); } catch (err) { logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`); } try { await this.previewOutput?.release(); } catch (err)...
https://gitcode.com/arkui-x/samples
5c3bf75ba934a1204532183fa7efefaa9a127b67
gitcode