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
LZZLHY/hlib
entry/src/main/ets/utils/I18n.ets
arkts
currentLocale
当前应用首选语言(与系统 locale 同步)
static currentLocale(): string { try { return i18n.System.getSystemLanguage(); } catch { return 'zh-Hans'; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left currentLocale 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#s...
static currentLocale(): string { try { return i18n.System.getSystemLanguage(); } catch { return 'zh-Hans'; } }
https://github.com/LZZLHY/hlib
ebdbcf4e03ffdc2d24375e800e73de5467a29b6d
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionGenerator.ets
arkts
generateCount
生成数数题 @param difficulty 难度等级 @returns 数数题对象
static generateCount(difficulty: Difficulty): MathQuestion { const maxCount = QuestionGenerator.getCountMaxNum(difficulty); const answer = Math.floor(Math.random() * maxCount) + 1; return { type: QuestionType.COUNT, question: MathPageStrings.COUNT_QUESTION, answer: answer }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static generateCount(difficulty: Difficulty): MathQuestion { const maxCount = QuestionGenerator.getCountMaxNum(difficulty); const answer = Math.floor(Math.random() * maxCount) + 1; return { type: QuestionType.COUNT, question: MathPageStrings.COUNT_QUESTION, answer: answer }; }
https://github.com/the-wwyang/kids-learning-app
b8ca852bd1db3745ee8bcaffc48776394c801441
github
zmuxuny/ai-guardian-star
entry/src/main/ets/pages/MqttManager.ets
arkts
getCurrentUsername
── 关键改动:addFallRecord / addSedentaryRecord 新增持久化写库 ── 获取当前登录用户名(统一入口,保证一致性)
private getCurrentUsername(): string { return UserManager.getInstance().getCurrentUsername(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left stri...
private getCurrentUsername(): string { return UserManager.getInstance().getCurrentUsername(); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/pages/MqttManager.ets#L396-L398
e3db52de78f60e30826177a24b880331438f8c75
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
setListener
设置输入监听器 设置后会立即通知所有已连接的设备 如果使用 Game Controller Kit 模式,会确保 GC Kit 回调已设置
setListener(listener: GamepadInputListener | null): void { const listenerChanged = this.listener !== listener; this.listener = listener; if (listenerChanged) { this.notifiedConnectionKeys.clear(); } // 通知已连接的设备 if (listener) { if (!this.modeInitialized) { // 输入模式尚未确定(l...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setListener 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#binary_expression#Left AST#identifier#Left GamepadInputL...
setListener(listener: GamepadInputListener | null): void { const listenerChanged = this.listener !== listener; this.listener = listener; if (listenerChanged) { this.notifiedConnectionKeys.clear(); } // 通知已连接的设备 if (listener) { if (!this.modeInitialized) { // 输入模式尚未确定(l...
https://github.com/AlkaidLab/moonlight-harmony
48e09e93b3d5a26e4cf62aa869d01b913bb9c7af
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxFileManager.ets
arkts
init
初始化存储 @param storageConfig
public init(storageConfig: StorageConfig): KdbxFileManager { this.storage.init(storageConfig); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left storageConfig AST#identifier#Right AST#:#Left : AST#:#Right...
public init(storageConfig: StorageConfig): KdbxFileManager { this.storage.init(storageConfig); return this; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L41-L44
d070a6d29241f3bffb27fcd0dcf0bb07def07265
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarChartModel.ets
arkts
getBarBoundsByEntry
Returns the bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be found in the charts data. Performance-intensive code should use void getBarBounds(BarEntry, RectF) instead. @param e @return
public getBarBoundsByEntry(e: BarEntry): MyRect { let bounds: MyRect = new MyRect(); this.getBarBounds(e, bounds); return bounds; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBarBoundsByEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public getBarBoundsByEntry(e: BarEntry): MyRect { let bounds: MyRect = new MyRect(); this.getBarBounds(e, bounds); return bounds; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
da0a34b0c7d4d11322cb323b0a9b4c97332811b3
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
openActionSheet
打开 ActionSheet 覆盖页。
openActionSheet(contentBuilder: () => void = () => {}, height: string = AppNav.DEFAULT_ACTION_SHEET_HEIGHT): void { this.actionSheetContentBuilder = contentBuilder; this.actionSheetHeight = this.resolveOverlayHeight(height, AppNav.DEFAULT_ACTION_SHEET_HEIGHT); // 禁用路由级动画,仅保留 ActionSheet 组件内部动画,避免遮罩随路由整体滑动...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openActionSheet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left contentBuilder AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Righ...
openActionSheet(contentBuilder: () => void = () => {}, height: string = AppNav.DEFAULT_ACTION_SHEET_HEIGHT): void { this.actionSheetContentBuilder = contentBuilder; this.actionSheetHeight = this.resolveOverlayHeight(height, AppNav.DEFAULT_ACTION_SHEET_HEIGHT); // 禁用路由级动画,仅保留 ActionSheet 组件内部动画,避免遮罩随路由整体滑动...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L73-L78
b1a4805ae174bb31e883d84e39faff1e5ea1f21d
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
mapRowToBillTag
将查询结果映射为 BillTag 实例 @param resultSet 查询结果集 @returns BillTag 对象
private static mapRowToBillTag(resultSet: relationalStore.ResultSet): BillTag { const billTag = new BillTag(); billTag.billId = resultSet.getLong(resultSet.getColumnIndex('bill_id')); billTag.tagId = resultSet.getLong(resultSet.getColumnIndex('tag_id')); billTag.createdAt = resultSet.getString(resultS...
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 mapRowToBillTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:...
private static mapRowToBillTag(resultSet: relationalStore.ResultSet): BillTag { const billTag = new BillTag(); billTag.billId = resultSet.getLong(resultSet.getColumnIndex('bill_id')); billTag.tagId = resultSet.getLong(resultSet.getColumnIndex('tag_id')); billTag.createdAt = resultSet.getString(resultS...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3b99f27ffa48e8a455d1cf2f6220aa8c6279ac60
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookTransitionOverlay.ets
arkts
startOpenTransition
开始翻开过渡动画 @param coverImagePath 封面图片路径 @param coverPosition 封面在屏幕上的位置 @param targetBookId 目标书籍ID @param targetBookType 目标书籍类型 @param onComplete 动画完成回调 @param ebookBackground 电子书背景设置(可选,仅电子书使用)
public startOpenTransition( coverImagePath: string, coverPosition: CoverPosition, targetBookId: string, targetBookType: 'manga' | 'ebook' | 'novel', onComplete?: () => void, ebookBackground?: EBookBackgroundSettings, metaInfo?: BookTransitionMetaInfo ): void { this.clearOpenReadyHide...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startOpenTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left coverImagePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string...
public startOpenTransition( coverImagePath: string, coverPosition: CoverPosition, targetBookId: string, targetBookType: 'manga' | 'ebook' | 'novel', onComplete?: () => void, ebookBackground?: EBookBackgroundSettings, metaInfo?: BookTransitionMetaInfo ): void { this.clearOpenReadyHide...
https://github.com/DaLongZhuaZi/manxia
ede9d54da7ab707c9602cde3a33fe9cb0400571c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
calculateSampleSize
计算降采样比例
private calculateSampleSize(originalWidth: number, originalHeight: number, maxWidth: number, maxHeight: number): number { let sampleSize = 1; if (originalWidth > maxWidth || originalHeight > maxHeight) { const widthRatio = Math.ceil(originalWidth / maxWidth); const heightRatio = Math.ceil(ori...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateSampleSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
private calculateSampleSize(originalWidth: number, originalHeight: number, maxWidth: number, maxHeight: number): number { let sampleSize = 1; if (originalWidth > maxWidth || originalHeight > maxHeight) { const widthRatio = Math.ceil(originalWidth / maxWidth); const heightRatio = Math.ceil(ori...
https://github.com/DaLongZhuaZi/manxia
6accea3dfa9c276bcf2502be5270d92cc4bdcb1a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
find
Returns the value of the first element in the array where predicate is true, and undefined otherwise @param { function } predicate - find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that el...
public find(predicate: (value: BigInt, index: int, obj: BigInt64Array) => boolean): BigInt | undefined { for (let i = 0; i < this.lengthInt; ++i) { let val = this.getUnsafe(i) if (predicate(new BigInt(val), i, this)) { return new BigInt(val) } } ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left ...
public find(predicate: (value: BigInt, index: int, obj: BigInt64Array) => boolean): BigInt | undefined { for (let i = 0; i < this.lengthInt; ++i) { let val = this.getUnsafe(i) if (predicate(new BigInt(val), i, this)) { return new BigInt(val) } } ...
https://gitcode.com/iop123123/arkts-static-skills
547d12d33ad6ee64ecee8166ed3df9f7ff60f01c
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/QuestionCacheService.ets
arkts
getAdaptiveDifficulty
获取当前建议难度(基于答题历史)
getAdaptiveDifficulty(): Difficulty { if (this.answerHistory.length < 3) { // 答题太少,返回简单难度 return Difficulty.EASY; } // 获取最近的答题记录 const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize); const correctCount = recentAnswers.filter(a => a.isCorrect).length; c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAdaptiveDifficulty 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 Difficulty AST#identifier#Right AST#ERRO...
getAdaptiveDifficulty(): Difficulty { if (this.answerHistory.length < 3) { // 答题太少,返回简单难度 return Difficulty.EASY; } // 获取最近的答题记录 const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize); const correctCount = recentAnswers.filter(a => a.isCorrect).length; c...
https://github.com/the-wwyang/kids-learning-app
30808df4bb6920efe872be56006459ad128ef31c
github
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets
arkts
startAbilityContinuation
Select a device from the list in the pop-up window. @param context Ability context. @param device Device information. @param positionList Position list.
startAbilityContinuation( context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[] ): void { remoteDeviceModel.authenticateDevice(context, device, positionList); remoteDeviceModel.stopDeviceDiscovery(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startAbilityContinuation 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#member_expression#Left AST#identifier#Left c...
startAbilityContinuation( context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[] ): void { remoteDeviceModel.authenticateDevice(context, device, positionList); remoteDeviceModel.stopDeviceDiscovery(); }
https://gitee.com/openharmony/codelabs.git
385b38e21a315a47171bc6a039a47d2065d52aa4
gitee
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkBytecode/FundamentalsAndNamingConventions/entry/src/main/ets/pages/Index.ets
arkts
m
构造函数在字节码中的函数名为"#&A~B=#B"
m() { // 函数m在字节码中的函数名为"#&A~B>#m" return () => {} // 匿名函数在字节码中的函数名为"#&A~B>m*#" }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left m 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 // 函数m在字节码中的函数名为"#&A~B...
m() { // 函数m在字节码中的函数名为"#&A~B>#m" return () => {} // 匿名函数在字节码中的函数名为"#&A~B>m*#" }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
05d9c61a596f68ca157f1eaa0d055923b04412e8
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/contentSource/facades/AuthInterceptorFacade.ets
arkts
onResponse
响应拦截(透传,不做处理) @param response 原始响应 @returns 原始响应
async onResponse(response: NGFHttpResponse): Promise<NGFHttpResponse> { return response; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onResponse AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left response AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async onResponse(response: NGFHttpResponse): Promise<NGFHttpResponse> { return response; }
https://github.com/DaLongZhuaZi/NGF
8175d8669b50eef3db76e4e8e0a5bdc129636a31
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getConversations
============ 消息模块 API ============ 获取会话列表
async getConversations(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> { return this.get<any>('/api/im/conversations', params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getConversations AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_...
async getConversations(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> { return this.get<any>('/api/im/conversations', params) }
https://github.com/David8Idira/AI-OA
e1e34252c45ca2f6cafcf262da61e33570e70111
github
apap6628114/nga_oh
entry/src/main/ets/parser/bbcode/parser.ets
arkts
tryMatchBlock
按原 if 顺序依次尝试各块级标签 handler,命中即返回。 顺序与拆分前 tryMatchBlock 逐字一致,保证行为等价。 @param state 解析游标 @param result 当前块级节点输出数组 @returns 是否命中任一块级标签
function tryMatchBlock(state: ParseState, result: BBNode[]): boolean { if (handlePostBy(state, result)) return true if (handleQuote(state, result)) return true if (handleCollapse(state, result)) return true if (handleCode(state, result)) return true if (handleList(state, result)) return true if (handleNuke(...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left tryMatchBlock AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left state AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function tryMatchBlock(state: ParseState, result: BBNode[]): boolean { if (handlePostBy(state, result)) return true if (handleQuote(state, result)) return true if (handleCollapse(state, result)) return true if (handleCode(state, result)) return true if (handleList(state, result)) return true if (handleNuke(...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/parser.ets#L113-L133
9edba7b811b8a1424975f9a46a11b8a0799be889
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets
arkts
getCurrentSearchKeyword
获取当前搜索关键词 @returns {string} 搜索关键词
getCurrentSearchKeyword(): string { return this.searchKeyword; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentSearchKeyword 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 AS...
getCurrentSearchKeyword(): string { return this.searchKeyword; }
https://github.com/Joker-x-dev/CoolMallArkTS
356658770099c6a541a412e688b32464fbf513fe
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Double.ets
arkts
toExponential
toExponential() returns std.core.String representing the underlying double in exponential notation @returns the result of conversion
public toExponential():String { return this.toExponential(0); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toExponential 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 String A...
public toExponential():String { return this.toExponential(0); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
6bdad17d56e5c346a3639cd46fa313516601b731
gitee
JQHxx/codelabs
SelectContact/entry/src/main/ets/common/utils/JsBridge.ets
arkts
javaScriptProxy
Injects the JavaScript object into window and invoke the function in window. @returns javaScriptProxy object.
get javaScriptProxy(): JavaScriptItem { let result: JavaScriptItem = { object: { call: this.call }, name: "JSBridgeHandle", methodList: ['call'], controller: this.controller } return result; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left javaScriptProxy 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 JavaScriptItem ...
get javaScriptProxy(): JavaScriptItem { let result: JavaScriptItem = { object: { call: this.call }, name: "JSBridgeHandle", methodList: ['call'], controller: this.controller } return result; }
https://github.com/JQHxx/codelabs
2966257a23932d767c2fd73c750d725eb32e6c85
github
arkui-x/samples
CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/view/CustomCalendarPickerDialog.ets
arkts
aboutToAppear
获取当前月和下个月的日期数据
aboutToAppear() { this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear); // 如果下个月是在下一年,则下个月是1月份,年份要+1 if (this.currentMonth === MONTHS) { this.nextMonth = JANUARY; this.nextYear = this.currentYear + 1; } // 如果下个月是还是当前年,则月份+1,年份不变 else { this.nextMonth = thi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear); // 如果下个月是在下一年,则下个月是1月份,年份要+1 if (this.currentMonth === MONTHS) { this.nextMonth = JANUARY; this.nextYear = this.currentYear + 1; } // 如果下个月是还是当前年,则月份+1,年份不变 else { this.nextMonth = thi...
https://gitcode.com/arkui-x/samples
d14d6eb3822f04003c2a5ec8e85d1e48323fa850
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/UserDAO.ets
arkts
updateEmail
更新用户邮箱
static async updateEmail(userId: number, newEmail: string): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE users SET email = ?, updated_at = ? WHERE user_id = ? AND is_deleted = 0 `; await store.executeSql(s...
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 updateEmail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST...
static async updateEmail(userId: number, newEmail: string): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE users SET email = ?, updated_at = ? WHERE user_id = ? AND is_deleted = 0 `; await store.executeSql(s...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c20ccb23bc1f675628de678db6d20ad7446eb1ea
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/ThemeUtil.ets
arkts
updateAutoTheme
更新自动主题
private static async updateAutoTheme(): Promise<void> { const isDark = ThemeUtil.isDarkMode(); console.log('系统主题检测结果:', isDark ? '深色' : '浅色'); }
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 updateAutoTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum...
private static async updateAutoTheme(): Promise<void> { const isDark = ThemeUtil.isDarkMode(); console.log('系统主题检测结果:', isDark ? '深色' : '浅色'); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
a2a02b0f6971bebeaf4ae16ea9c2a389c36b0aa0
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPInputHandler.ets
arkts
sendMouseClick
发送鼠标单击
private sendMouseClick(x: number, y: number, button: number) { // 按下 this.sendInputEvent({ type: 'mouse', x: Math.floor(x), y: Math.floor(y), button: button, flags: 0x8000 }) // 释放 setTimeout(() => { this.sendInputEvent({ type: 'mouse', x: M...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendMouseClick 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 n...
private sendMouseClick(x: number, y: number, button: number) { // 按下 this.sendInputEvent({ type: 'mouse', x: Math.floor(x), y: Math.floor(y), button: button, flags: 0x8000 }) // 释放 setTimeout(() => { this.sendInputEvent({ type: 'mouse', x: M...
https://github.com/AetheriumSimulator/qemu-hmos
a3a4343b57e9ef69fb8d0e4e7ed8558ef3b2e46b
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/FootprintViewModel.ets
arkts
confirmClearAll
确认清空足迹 @returns {void} 无返回值
confirmClearAll(): void { this.repository.clearAllFootprints() .then((): void => { this.hideClearDialogModal(); this.loadFootprints(); }) .catch((): void => { this.hideClearDialogModal(); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmClearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
confirmClearAll(): void { this.repository.clearAllFootprints() .then((): void => { this.hideClearDialogModal(); this.loadFootprints(); }) .catch((): void => { this.hideClearDialogModal(); }); }
https://github.com/Joker-x-dev/CoolMallArkTS
34363cf365327d98b4aa7eeffc36ead737784953
github
openharmony-sig/jtar
library/src/main/ets/ohos_tar.ets
arkts
delTarPath
删除一个需要tar的文件或目录
public delTarPath(path: string) { let index = this.tarPaths.indexOf(path); if (index != -1) { this.tarPaths.splice(index, 1) // 从index开始删除一个 } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left delTarPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public delTarPath(path: string) { let index = this.tarPaths.indexOf(path); if (index != -1) { this.tarPaths.splice(index, 1) // 从index开始删除一个 } }
https://gitee.com/openharmony-sig/jtar.git
6b9d72cc6a47e392da76109f136a5f00ddacdaa5
gitee
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
isImage
检查文件是否为支持的图片格式 @param filePath 文件路径或URI @returns 是否为支持的图片格式
static isImage(filePath: string): boolean { if (!filePath) { return false; } const extension = LubanUtils.getFileExtension(filePath); return LubanUtils.SUPPORTED_FORMATS.includes(extension); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ...
static isImage(filePath: string): boolean { if (!filePath) { return false; } const extension = LubanUtils.getFileExtension(filePath); return LubanUtils.SUPPORTED_FORMATS.includes(extension); }
https://github.com/kumaleap/ArkLuban
4d4443c0644aabf3e53a390753309a56fee29d90
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
saveSync
添加关键资产 @param assetId 关键资产Id @param secret 关键资产内容
public static saveSync(assetId: string, secret: string): void { if (!assetId || !secret) { hilog.error(DOMAIN, TAG, `addAsset error: assetId or secret is empty`) return; } try { let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.ALIAS, ByteUtils.stringToBytes(assetId)); ...
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 saveSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left assetId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public static saveSync(assetId: string, secret: string): void { if (!assetId || !secret) { hilog.error(DOMAIN, TAG, `addAsset error: assetId or secret is empty`) return; } try { let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.ALIAS, ByteUtils.stringToBytes(assetId)); ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/AssetUtils.ets#L45-L64
af61891632536a411f39decfe5aab4ad33d1f88c
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/GestureUtils.ets
arkts
createInitialGestureState
创建初始手势状态 @param startX - 起始X坐标 @param startY - 起始Y坐标 @returns 初始手势状态
static createInitialGestureState(startX: number, startY: number): GestureState { return { startX: startX, startY: startY, currentX: startX, currentY: startY, deltaX: 0, deltaY: 0, velocity: 0, isActive: true }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createInitialGestureState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left startX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
static createInitialGestureState(startX: number, startY: number): GestureState { return { startX: startX, startY: startY, currentX: startX, currentY: startY, deltaX: 0, deltaY: 0, velocity: 0, isActive: true }; }
https://github.com/kumaleap/ArkSwipeDeck
4df72cb47b1e3ea0e1c376e4045911b554acbc5c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
codePointCount
Returns the amount of full codepoints between begin and end indexes. Characters outside the range are not counted, even if the range ends in the middle of a surrogate pair. @param begin index to start from @param end past the ending index @throws StringIndexOutOfBoundsException if begin is negative or >= length @throws...
public codePointCount(begin: number, end: number): number { return this.codePointCount(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left codePointCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public codePointCount(begin: number, end: number): number { return this.codePointCount(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8658fdf381e498f097d865c3eaa062c58027c738
gitee
PollenWang6/HiXD
entry/src/main/ets/pages/calendar_export/CalendarExportPage.ets
arkts
showTimePicker
==================== UI ====================
showTimePicker(t: string): void { const h: number = t === 'e' ? this.eDbHour : this.xDbHour; const m: number = t === 'e' ? this.eDbMin : this.xDbMin; TimePickerDialog.show({ selected: new Date(2020, 0, 1, h, m, 0), useMilitaryTime: true, onAccept: (v: TimePickerResult) => { if (v...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showTimePicker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
showTimePicker(t: string): void { const h: number = t === 'e' ? this.eDbHour : this.xDbHour; const m: number = t === 'e' ? this.eDbMin : this.xDbMin; TimePickerDialog.show({ selected: new Date(2020, 0, 1, h, m, 0), useMilitaryTime: true, onAccept: (v: TimePickerResult) => { if (v...
https://github.com/PollenWang6/HiXD
249a14cd9a38cef467c7d9ea1004904bb012c755
github
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets
arkts
testAnimationStopModeValues
===================== AnimationStopMode 测试 =====================
testAnimationStopModeValues() { this.addLog('=== Test: AnimationStopMode 枚举值 ==='); this.addLog(`FIRST_FRAME = ${AnimationStopMode.FIRST_FRAME}`, '#2196F3'); this.addLog(`LAST_FRAME = ${AnimationStopMode.LAST_FRAME}`, '#2196F3'); if (AnimationStopMode.FIRST_FRAME === 0) { this.addLog('PASS: Anim...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left testAnimationStopModeValues 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#statem...
testAnimationStopModeValues() { this.addLog('=== Test: AnimationStopMode 枚举值 ==='); this.addLog(`FIRST_FRAME = ${AnimationStopMode.FIRST_FRAME}`, '#2196F3'); this.addLog(`LAST_FRAME = ${AnimationStopMode.LAST_FRAME}`, '#2196F3'); if (AnimationStopMode.FIRST_FRAME === 0) { this.addLog('PASS: Anim...
https://gitcode.com/openharmony/arkui_ace_engine
a7972f9d7baf0bc78f0e0bd1a6f8ee0b9503b969
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/StreamViewModel.ets
arkts
initOverlayPosition
初始化覆盖层位置
initOverlayPosition(): void { const snapPos = calculateSnapPosition( this.overlayState.config.position, this.displayInfo.screenWidth, this.displayInfo.screenHeight, this.overlayState.width, this.overlayState.height ); this.overlayState.x = snapPos.x; this.overlayState.y =...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initOverlayPosition 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#statemen...
initOverlayPosition(): void { const snapPos = calculateSnapPosition( this.overlayState.config.position, this.displayInfo.screenWidth, this.displayInfo.screenHeight, this.overlayState.width, this.overlayState.height ); this.overlayState.x = snapPos.x; this.overlayState.y =...
https://github.com/AlkaidLab/moonlight-harmony
fc9d156ca71264b02db65d33aeefd04eb0de6929
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
fetchAndMergeRemoteSettings
获取并合并远端设置数据
private static async fetchAndMergeRemoteSettings(): Promise<void> { try { // 获取所有本地设置键 const allSettings = SettingsService.getAll(); const localSettingKeys = Object.keys(allSettings); // 只过滤掉同步开关本身 const realSettingKeys = localSettingKeys.filter(key => key !== SettingsServic...
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 fetchAndMergeRemoteSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Rig...
private static async fetchAndMergeRemoteSettings(): Promise<void> { try { // 获取所有本地设置键 const allSettings = SettingsService.getAll(); const localSettingKeys = Object.keys(allSettings); // 只过滤掉同步开关本身 const realSettingKeys = localSettingKeys.filter(key => key !== SettingsServic...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L552-L583
b38fb79fed9c03c8b4e1df00b4b2ce70e68655cc
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/CallButtonController.ets
arkts
getDeviceStatus
获取呼叫按钮设备状态
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('isPressed', { key: 'isPressed', value: false, ...
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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('isPressed', { key: 'isPressed', value: false, ...
https://github.com/LJ666-ui/harmony-health-care
0d42499b2e21774da95c638f4c02894716ec01fe
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
disableScroll
disables intercept touchevents
public disableScroll() { // ViewParent parent = getParent(); // if (parent != null) // parent.requestDisallowInterceptTouchEvent(true); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disableScroll 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 {...
public disableScroll() { // ViewParent parent = getParent(); // if (parent != null) // parent.requestDisallowInterceptTouchEvent(true); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
efff62139542f7ab176eb5d0317fcfea89ea1264
gitee
HarmonyOS_Samples/BestPracticeSnippets
VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets
arkts
start
[EndExclude manage]
public start(controllerName: string, path: string, url: string): Promise<string> { return new Promise((resolve, reject) => { const controller = this.getController(controllerName); // [StartExclude manage] // [Start gate] this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadI...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cont...
public start(controllerName: string, path: string, url: string): Promise<string> { return new Promise((resolve, reject) => { const controller = this.getController(controllerName); // [StartExclude manage] // [Start gate] this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadI...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
f632dc058be12925c407b44a76cb185fd15c2a7b
gitcode
Countly/countly-sdk-hos
library/src/main/ets/Countly.ets
arkts
lifecycleForegroundAll
Manual lifecycle fan-out. Auto-tracking covers the typical case via each instance's own ApplicationContext subscription, but tests (and integrators with non-standard ability hosts) can still drive it.
public static lifecycleForegroundAll(): void { if (Countly.shared) Countly.shared.lifecycleForeground(); Countly.namedInstances.forEach((instance: CountlyInstance) => instance.lifecycleForeground()); }
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 lifecycleForegroundAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
public static lifecycleForegroundAll(): void { if (Countly.shared) Countly.shared.lifecycleForeground(); Countly.namedInstances.forEach((instance: CountlyInstance) => instance.lifecycleForeground()); }
https://github.com/Countly/countly-sdk-hos
1a2e763748a347e05e433bf61f7ac1b3fe79b925
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/EventViewModel.ets
arkts
groupEventsByDate
将日程按日期分组 (Group By Date)
public groupEventsByDate(events: Array<Event>): Map<string, Array<Event>> { const map = new Map<string, Array<Event>>(); events.forEach(event => { const dateKey = DateUtils.formatDate(event.startTime); if (!map.has(dateKey)) { map.set(dateKey, []); } map.get(dateKey)?.push(eve...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left groupEventsByDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio...
public groupEventsByDate(events: Array<Event>): Map<string, Array<Event>> { const map = new Map<string, Array<Event>>(); events.forEach(event => { const dateKey = DateUtils.formatDate(event.startTime); if (!map.has(dateKey)) { map.set(dateKey, []); } map.get(dateKey)?.push(eve...
https://gitcode.com/openharmony/codelabs
f2dc4cde9790440b4df7c2bbf69dced32f255f6c
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoTrimmer.ets
arkts
getUploadWorkItem
获取并添加新发表的视频信息
getUploadWorkItem(): void { if (this.addWorkItem.videoSrc !== undefined && this.addWorkItem.videoSrc !== '') { logger.info(TAG, `videoTrimmer_upload back, isDayTop:${this.addWorkItem.isDayTop}, date: ${this.addWorkItem.date}`); this.workList.addData(0, this.addWorkItem); AppStorage.setOr...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUploadWorkItem 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_expressi...
getUploadWorkItem(): void { if (this.addWorkItem.videoSrc !== undefined && this.addWorkItem.videoSrc !== '') { logger.info(TAG, `videoTrimmer_upload back, isDayTop:${this.addWorkItem.isDayTop}, date: ${this.addWorkItem.date}`); this.workList.addData(0, this.addWorkItem); AppStorage.setOr...
https://github.com/openharmony/applications_app_samples
7093c88d5977bf37c7b11972647c54a381fec881
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
updateDpadHorizontal
更新 D-Pad 水平方向按钮
private updateDpadHorizontal(state: GamepadState, value: number): void { if (value < 0) { state.buttons |= MoonlightButton.LEFT; state.buttons &= ~MoonlightButton.RIGHT; } else if (value > 0) { state.buttons |= MoonlightButton.RIGHT; state.buttons &= ~MoonlightButton.LEFT; } else {...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateDpadHorizontal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private updateDpadHorizontal(state: GamepadState, value: number): void { if (value < 0) { state.buttons |= MoonlightButton.LEFT; state.buttons &= ~MoonlightButton.RIGHT; } else if (value > 0) { state.buttons |= MoonlightButton.RIGHT; state.buttons &= ~MoonlightButton.LEFT; } else {...
https://github.com/AlkaidLab/moonlight-harmony
1bc74137480056dbc40152bd6b71508c75c7ea4f
github
popsiclelmlm/Hey
entry/src/main/ets/features/runtime/RuntimeController.ets
arkts
makeAppEntry
应用内日志没有等级信息,统一记为 info;raw 保留「时钟 + 正文」整行原文。
private static makeAppEntry(message: string): LogEntry { const at = Date.now(); const time = formatClockTime(at); return { at, time, level: 'info', source: '', message, raw: `${time} ${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 makeAppEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left...
private static makeAppEntry(message: string): LogEntry { const at = Date.now(); const time = formatClockTime(at); return { at, time, level: 'info', source: '', message, raw: `${time} ${message}` }; }
https://github.com/popsiclelmlm/Hey
fc3bbfca61a8ef8338395c184d80e483c482325f
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
syncBlockToRight
块同步到右侧:patch diffResult 原地修改,不跑全量 re-diff
syncBlockToRight(sbsStartIdx: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; const rightLines = this.diffResult.rightLines; if (sbsStartIdx < 0 || sbsStartIdx >= leftLines.length) return; const startType = leftLines[sbsStartIdx].type; if (startType ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncBlockToRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sbsStartIdx AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left )...
syncBlockToRight(sbsStartIdx: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; const rightLines = this.diffResult.rightLines; if (sbsStartIdx < 0 || sbsStartIdx >= leftLines.length) return; const startType = leftLines[sbsStartIdx].type; if (startType ...
https://github.com/XJTUWYD/ArkDiff
ab2c4c3c79423ca0cfecdfacd837573aad0f5345
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallService.ets
arkts
updateMissedCallNotifications
updateMissedCallNotifications
public async updateMissedCallNotifications() { if (this.lastMissedId == -1) { this.lastMissedId = await this.getLastNotificationId(); } this.registerDataChangeObserver(); HiLog.i(TAG, 'updateMissedCallNotifications, lastMissedId:' + this.lastMissedId); this.sendMissedCallNotify(this.lastMiss...
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 updateMissedCallNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
public async updateMissedCallNotifications() { if (this.lastMissedId == -1) { this.lastMissedId = await this.getLastNotificationId(); } this.registerDataChangeObserver(); HiLog.i(TAG, 'updateMissedCallNotifications, lastMissedId:' + this.lastMissedId); this.sendMissedCallNotify(this.lastMiss...
https://gitee.com/openharmony/applications_contacts.git
c5591535d4184e6e87b14e2553cb47024fe4b2f1
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
setStartAtZero
This method is deprecated. Use setAxisMinimum(...) / setAxisMaximum(...) instead. @param startAtZero @Deprecated
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) super.setAxisMinimum(0); else super.resetAxisMinimum(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setStartAtZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startAtZero AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b...
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) super.setAxisMinimum(0); else super.resetAxisMinimum(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e6102355b4c30e6e5513a756adfe3a07a903982c
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/NavigationErrorHandler.ets
arkts
logError
记录错误日志 @param error 错误对象 @param url 目标URL @param errorType 错误类型
private static logError(error: Error, url: string, errorType: NavigationErrorType): void { const logEntry = { timestamp: new Date().toISOString(), level: 'ERROR', category: 'NAVIGATION', errorType: errorType, url: url, message: error.message, stack: error.stack }; ...
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 logError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST...
private static logError(error: Error, url: string, errorType: NavigationErrorType): void { const logEntry = { timestamp: new Date().toISOString(), level: 'ERROR', category: 'NAVIGATION', errorType: errorType, url: url, message: error.message, stack: error.stack }; ...
https://github.com/LJ666-ui/harmony-health-care
3a3c61b5064b8de717033a8a55558a910b6ea611
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
onBLEConnectionStateChange
订阅蓝牙低功耗设备的连接状态变化事件
private onBLEConnectionStateChange() { Log.showInfo(TAG, `onBLEConnectionStateChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `onBLEConnectionStateChange: mGattClientDevice is null`); return; } try { this.mGattClientDevice.on('BLEConnectionStateChange', async (data: ble.B...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onBLEConnectionStateChange 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#L...
private onBLEConnectionStateChange() { Log.showInfo(TAG, `onBLEConnectionStateChange`); if (!this.mGattClientDevice) { Log.showInfo(TAG, `onBLEConnectionStateChange: mGattClientDevice is null`); return; } try { this.mGattClientDevice.on('BLEConnectionStateChange', async (data: ble.B...
https://gitcode.com/arkui-x/samples
cade6a069fa7222a934aefc0c35ba8115036bccc
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
slice
Creates a slice of current BigInt64Array using range [begin, this.length). @param begin start index to be taken into slice @returns a new BigInt64Array with elements of current BigInt64Array[begin, this.length)
public slice(begin: number): BigInt64Array { return this.slice(begin as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public slice(begin: number): BigInt64Array { return this.slice(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5de14646a899ac7cf3cf01917e3d961e227d0010
gitee
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
updateById
更新指定 ID 的记录 @param {number} id - 记录主键 @returns {Promise<void>} Promise<void>
private async updateById(id: number): Promise<void> { const entity: DemoEntity = new DemoEntity(); entity.id = id; entity.title = this.titleInput.trim(); entity.description = this.descInput.trim(); await this.demoRepository.updateDemo(entity); }
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 updateById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:...
private async updateById(id: number): Promise<void> { const entity: DemoEntity = new DemoEntity(); entity.id = id; entity.title = this.titleInput.trim(); entity.description = this.descInput.trim(); await this.demoRepository.updateDemo(entity); }
https://github.com/Joker-x-dev/HarmonyKit
4f6ce107a30cd0a32226c52de79b610cdb46e447
github
openharmony/codelabs
ETSUI/RoundThreadScheduler/entry/src/main/ets/scheduler/SchedulerConfig.ets
arkts
validate
参数合法性校验 - 轮次必须为正整数 - 每轮 worker 数必须为正整数
private validate(): void { if (!Number.isInteger(this.totalRounds) || this.totalRounds <= 0) { throw new Error('totalRounds must be a positive integer'); } if (!Number.isInteger(this.workersPerRound) || this.workersPerRound <= 0) { throw new Error('workersPerRound must be a positive integer');...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validate 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#Ri...
private validate(): void { if (!Number.isInteger(this.totalRounds) || this.totalRounds <= 0) { throw new Error('totalRounds must be a positive integer'); } if (!Number.isInteger(this.workersPerRound) || this.workersPerRound <= 0) { throw new Error('workersPerRound must be a positive integer');...
https://gitcode.com/openharmony/codelabs
28487f4d4f50a3a5b502e465d8b78fa0e4b3b403
gitcode
the-wwyang/kids-learning-app
src/main/ets/common/MathPageStrings.ets
arkts
getScoreGained
得分消息 @param points 获得的分数 @returns 得分消息
static getScoreGained(points: number): string { return `太棒了!+${points}分`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getScoreGained AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left points AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static getScoreGained(points: number): string { return `太棒了!+${points}分`; }
https://github.com/the-wwyang/kids-learning-app
938937c54c0f6e91b3f8f2847a27d50ea1252ec3
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/DownloadManager.ets
arkts
getTask
获取任务信息
public getTask(taskId: string): DownloadTask | undefined { return this.tasks.get(taskId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
public getTask(taskId: string): DownloadTask | undefined { return this.tasks.get(taskId); }
https://github.com/AetheriumSimulator/qemu-hmos
80ddff89b5d7cae47c73a84e7cf5114a229eebf0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
initialize
初始化数据管理器
public async initialize(context: common.UIAbilityContext, config?: DataManagerConfigInput): Promise<void> { try { logger.info(TAG, '开始初始化数据管理器'); // 合并配置 - 避免使用扩展运算符 if (config) { this.config.enableAutoBackup = config.enableAutoBackup ?? this.config.enableAutoBackup; this.config...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST...
public async initialize(context: common.UIAbilityContext, config?: DataManagerConfigInput): Promise<void> { try { logger.info(TAG, '开始初始化数据管理器'); // 合并配置 - 避免使用扩展运算符 if (config) { this.config.enableAutoBackup = config.enableAutoBackup ?? this.config.enableAutoBackup; this.config...
https://github.com/DaLongZhuaZi/manxia
d525024fcc5fcfabf7e0fdb2df076e2dd101bdc2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
includes
Determines whether Int16Array includes a certain element, returning true or false as appropriate @param { short } searchElement - The element to search for. The search starts at index 0. @returns { boolean } - true if searchElement is in Int16Array, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public includes(searchElement: short): boolean { return this.includes(searchElement, 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left short AST#iden...
public includes(searchElement: short): boolean { return this.includes(searchElement, 0) }
https://gitcode.com/iop123123/arkts-static-skills
fcd2b04464af2e7b7b078fa5fa717fbb3ebec8f4
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
calculateStreakBonus
计算连续学习奖励
public calculateStreakBonus(streakDays: number): number { if (streakDays >= 30) return 10; // 连续30天奖励10星 if (streakDays >= 14) return 5; // 连续14天奖励5星 if (streakDays >= 7) return 3; // 连续7天奖励3星 if (streakDays >= 3) return 1; // 连续3天奖励1星 return 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculateStreakBonus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left streakDays AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public calculateStreakBonus(streakDays: number): number { if (streakDays >= 30) return 10; // 连续30天奖励10星 if (streakDays >= 14) return 5; // 连续14天奖励5星 if (streakDays >= 7) return 3; // 连续7天奖励3星 if (streakDays >= 3) return 1; // 连续3天奖励1星 return 0; }
https://github.com/the-wwyang/kids-learning-app
583779a9e3217070e8be389c7e578f18faa663d3
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
unSubscribeCollectUrlEvent
取消收藏Url事件 @param key @param callback
unSubscribeCollectUrlEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT_URL, key) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeCollectUrlEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#iden...
unSubscribeCollectUrlEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT_URL, key) }
https://github.com/RedRackham-R/WanAndroidHarmoney
3300d83b8d5245d13c5a8645d278ae716e2a1037
github
2763981847/Clock-Alarm
entry/src/main/ets/pages/WorldClockPage.ets
arkts
aboutToAppear
在页面显示之前调用的方法
aboutToAppear() { // 查询城市列表并更新界面 this.worldClockModel.queryCitiesTasker((cities: Array<CityItem>) => { animateTo({ duration: CommonConstants.ANIMATION_MEDIUM_DURATION }, () => { this.cityItems = cities; }); }); // 设置定时器以更新当前时间 this.timeInterval = setInterval(() => { this...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // 查询城市列表并更新界面 this.worldClockModel.queryCitiesTasker((cities: Array<CityItem>) => { animateTo({ duration: CommonConstants.ANIMATION_MEDIUM_DURATION }, () => { this.cityItems = cities; }); }); // 设置定时器以更新当前时间 this.timeInterval = setInterval(() => { this...
https://github.com/2763981847/Clock-Alarm
609d9d5d871a548a1c185b7428327d66a33945f6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
set
Sets the int value wrapped in this IntBox. @param { int } value - The new int value to set @returns { int } The newly set int value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set(value: int): int { return (this.value = value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public set(value: int): int { return (this.value = value); }
https://gitcode.com/iop123123/arkts-static-skills
fc2954288a33d215707fce1da8d4a798619e5524
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RejectedHandler.ets
arkts
size
Returns the number of unique handlers in the RejectedHandler. @returns { int } number of unique handlers in the RejectedHandler.
public get size(): int { return this.handlers.size; }
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#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#...
public get size(): int { return this.handlers.size; }
https://gitcode.com/iop123123/arkts-static-skills
44714c70e1fdbd93c6b1ba1c31636dcb3433d974
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getDownload
@summary Downloads item media. @param {LibraryApiGetDownloadRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public getDownload(requestParameters: LibraryApiGetDownloadRequest): Promise<string> { this.assertParam(requestParameters.itemId) return this.apiClient.createUrl({path: `/Items/${requestParameters.itemId}/Download`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
public getDownload(requestParameters: LibraryApiGetDownloadRequest): Promise<string> { this.assertParam(requestParameters.itemId) return this.apiClient.createUrl({path: `/Items/${requestParameters.itemId}/Download`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
4a5cff21fb6a29c6fbd4c3d7a5e212376f16bc4f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/YAxisRenderer.ets
arkts
linePath
Calculates the path for a grid line. @param p @param i @param positions @return
protected linePath(c: CanvasRenderingContext2D, i: number, positions: number[]): void { c.beginPath() c.moveTo(this.mViewPortHandler ? this.mViewPortHandler.offsetLeft() : 0, positions[i+1]); c.lineTo(this.mViewPortHandler ? this.mViewPortHandler.contentRight() : 0, positions[i+1]); c.stroke(); c....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left linePath AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#...
protected linePath(c: CanvasRenderingContext2D, i: number, positions: number[]): void { c.beginPath() c.moveTo(this.mViewPortHandler ? this.mViewPortHandler.offsetLeft() : 0, positions[i+1]); c.lineTo(this.mViewPortHandler ? this.mViewPortHandler.contentRight() : 0, positions[i+1]); c.stroke(); c....
https://gitee.com/openharmony-tpc/ohos_mpchart.git
67f03cd4acbdbc72569b68bc2cd2726061607bcf
gitee
arkui-x/samples
CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
initAddressSelect
首次加载AddressPickerComponent如果传入了有效的地址信息(如'浙江省', '杭州市', '余杭区')时,在拉起地址选择半模态页面时,会按传入的地址信息进行显示
initAddressSelect() { if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') { this.provinceCityRegion = this.address.province + this.address.city + this.address.region; this.currentSelectInfo.province = this.address.province; this.currentSelectInfo.city = th...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initAddressSelect 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#...
initAddressSelect() { if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') { this.provinceCityRegion = this.address.province + this.address.city + this.address.region; this.currentSelectInfo.province = this.address.province; this.currentSelectInfo.city = th...
https://gitcode.com/arkui-x/samples
f688069bf932e5a0a20dd9342892b5762779b410
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
sendRequest
==================== 私有方法 ==================== 发送HTTP请求
private async sendRequest(method: string, url: string, options?: RequestOptions): Promise<RequestResult> { logger.info(TAG, `发送请求: ${method} ${url}`); const httpRequest = http.createHttp(); try { const headers = this.buildHeaders(options?.headers); let httpMethod: http.Request...
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 sendRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left method AST#identifier#Right AST#:#Left : ...
private async sendRequest(method: string, url: string, options?: RequestOptions): Promise<RequestResult> { logger.info(TAG, `发送请求: ${method} ${url}`); const httpRequest = http.createHttp(); try { const headers = this.buildHeaders(options?.headers); let httpMethod: http.Request...
https://github.com/DaLongZhuaZi/manxia
72059bc454bcdc170abeb14ec6fdecce271043fb
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/NetworkManager.ets
arkts
updateConfig
更新网络配置
public updateConfig(config: Partial<NetworkConfig>): void { this.config = { ...this.config, ...config }; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateConfig 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#instantiation_exp...
public updateConfig(config: Partial<NetworkConfig>): void { this.config = { ...this.config, ...config }; }
https://github.com/AetheriumSimulator/qemu-hmos
7b5fc5c7a6b81d4cb0d52148a3fcf5450e52e1e2
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/pages/DashBoardPage.ets
arkts
getBMIStatus
--- 辅助逻辑 ---
getBMIStatus(): string { if (this.bmi < 18.5) { return '偏瘦'; } if (this.bmi < 24) { return '正常'; } if (this.bmi < 28) { return '超重'; } return '肥胖'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBMIStatus 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...
getBMIStatus(): string { if (this.bmi < 18.5) { return '偏瘦'; } if (this.bmi < 24) { return '正常'; } if (this.bmi < 28) { return '超重'; } return '肥胖'; }
https://gitcode.com/openharmony/codelabs
e20b00f9ce6822d57a1b1edfb7576b3d50d5190f
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/deviceAwareness/facades/DeviceAdaptationFacade.ets
arkts
getDeviceRuntimeStatus
获取设备运行状态与性能信息
public getDeviceRuntimeStatus(): NGFRuntimeStatus { const status: NGFRuntimeStatus = { processId: 0, uid: 0, is64Bit: false, uptime: 0, appMemoryLimit: 0, appNativeMemSize: 0, systemCpuUsage: 0, appCpuUsage: 0, threads: [], batterySOC: 0, batteryTe...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDeviceRuntimeStatus 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...
public getDeviceRuntimeStatus(): NGFRuntimeStatus { const status: NGFRuntimeStatus = { processId: 0, uid: 0, is64Bit: false, uptime: 0, appMemoryLimit: 0, appNativeMemSize: 0, systemCpuUsage: 0, appCpuUsage: 0, threads: [], batterySOC: 0, batteryTe...
https://github.com/DaLongZhuaZi/NGF
939751a875ab4633e179e9c13829adfe82ca06b4
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
verifyOrPollComputer
尝试通过 mDNS 地址验证电脑在线,失败则回退到全地址轮询
private async verifyOrPollComputer(computer: ComputerInfo, address: string): Promise<void> { try { const nvHttp = NvHttp.fromAddress(address, computer, this.context || undefined); const serverInfo = await nvHttp.getServerInfo(); // 处理 UUID 归一:discovered-* 临时条目获得真实 UUID let target = comput...
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 verifyOrPollComputer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AS...
private async verifyOrPollComputer(computer: ComputerInfo, address: string): Promise<void> { try { const nvHttp = NvHttp.fromAddress(address, computer, this.context || undefined); const serverInfo = await nvHttp.getServerInfo(); // 处理 UUID 归一:discovered-* 临时条目获得真实 UUID let target = comput...
https://github.com/AlkaidLab/moonlight-harmony
e07aab57ddd87fc09b16fd5cef88179f9f7bf292
github
openharmony/applications_filepicker
audiopicker/src/main/ets/audiopreference/AudioPickerPreference.ets
arkts
saveSafetyTipStatus
保存安全提示状态 @param isFirstStartUp
public saveSafetyTipStatus(isFirstStartUp: boolean): void { this.preferenceManager.put(keyPermissionTipLog, isFirstStartUp, true, this.preferenceManager.preferKeys.audioPicker).then((res) => { logger.info(`saveSafetyTipStatus Success ? : ${res}`) }).catch((err: BusinessError) => { logger.err...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left saveSafetyTipStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFirstStartUp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole...
public saveSafetyTipStatus(isFirstStartUp: boolean): void { this.preferenceManager.put(keyPermissionTipLog, isFirstStartUp, true, this.preferenceManager.preferKeys.audioPicker).then((res) => { logger.info(`saveSafetyTipStatus Success ? : ${res}`) }).catch((err: BusinessError) => { logger.err...
https://gitee.com/openharmony/applications_filepicker.git
b81ff17b619caa4fd71b0a03bc7271e11c5f99be
gitee
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
setRumbleCallback
注册震动事件回调 (Rumble Pak) 对齐 Android: EmulatorEvent.RumbleStart → Vibrator API
static setRumbleCallback(callback: (durationMs: number) => void): boolean { return MelonDSNative.native.setRumbleCallback(callback); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setRumbleCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#ar...
static setRumbleCallback(callback: (durationMs: number) => void): boolean { return MelonDSNative.native.setRumbleCallback(callback); }
https://github.com/richshaw2015/nds
111c621f693af4b72a8009b6b4d67aed4efe98ae
github
openharmony/codelabs
ETSUI/Foodbook/entry/src/main/ets/pages/set up.ets
arkts
showClearCacheConfirm
清除缓存对话框
showClearCacheConfirm() { AlertDialog.show({ title: '清除缓存', message: '确定要清除所有缓存数据吗?', primaryButton: { value: '取消', action: () => console.log('取消清除缓存'), backgroundColor: '#F5F5F5', fontColor: '#666666' }, secondaryButton: { value: '确认清除', ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showClearCacheConfirm 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_bl...
showClearCacheConfirm() { AlertDialog.show({ title: '清除缓存', message: '确定要清除所有缓存数据吗?', primaryButton: { value: '取消', action: () => console.log('取消清除缓存'), backgroundColor: '#F5F5F5', fontColor: '#666666' }, secondaryButton: { value: '确认清除', ...
https://gitcode.com/openharmony/codelabs
a424b6a093a607f09feca40468d6b8733d318286
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_api/src/main/ets/services/MineService.ets
arkts
queryMyHistory
查询我的浏览记录 @returns
public queryMyHistory(): string[] { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; return mineUserInfo.myHistory }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryMyHistory 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 string ...
public queryMyHistory(): string[] { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; return mineUserInfo.myHistory }
https://github.com/xblLab/HarmonyProjectTemplate
72ae12638c145d404aaab4f58e81b66cfa84f553
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { byte } value - value to set @returns { Int8Array } - an Int8Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageMode...
public with(index: int, value: byte): Int8Array { let res = new Int8Array(this) res.set(index, value) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: byte): Int8Array { let res = new Int8Array(this) res.set(index, value) return res }
https://gitcode.com/iop123123/arkts-static-skills
6e28088d69cca1f15bb6f5ed965c07c8fd5c1a1b
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createInjectText
============ TYPE_INJECT_TEXT (1) ============ 格式: type(1) + length(4) + text(N) = 5+N bytes
static createInjectText(text: string): ArrayBuffer { const textBytes = buffer.from(text, 'utf-8'); const textLen = textBytes.buffer.byteLength; const buf = new ArrayBuffer(5 + textLen); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_INJECT_TEXT); view.setInt32(1, text...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createInjectText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static createInjectText(text: string): ArrayBuffer { const textBytes = buffer.from(text, 'utf-8'); const textLen = textBytes.buffer.byteLength; const buf = new ArrayBuffer(5 + textLen); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_INJECT_TEXT); view.setInt32(1, text...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
560d236d720d1048f840c3c6cf8a3a8b120da84d
github
openharmony-tpc/ImageKnife
library/src/main/ets/transform/BrightnessTransformation.ets
arkts
constructor
高亮程度,取值范围在0-1之间,取值为0时图像保持不变。
constructor(bright: number) { super() this.bright = bright }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bright AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right...
constructor(bright: number) { super() this.bright = bright }
https://gitee.com/openharmony-tpc/ImageKnife.git
460c0b3b7f9bd7de4127dfc4a1cbcaf48deb6b58
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets
arkts
toggleMultiColumn
切换多列数组选择器显示状态
toggleMultiColumn(): void { this.multiColumnOpen = !this.multiColumnOpen; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleMultiColumn 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_...
toggleMultiColumn(): void { this.multiColumnOpen = !this.multiColumnOpen; }
https://github.com/codelably/tuniao-ui
5f96dfdf87d695c6bc479591cf74320f0b518c03
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/clog/Clog.ets
arkts
getLogDomain
获取当前日志域 @returns 当前日志域值
public static getLogDomain(): number { return Clog.LOG_DOMAIN; }
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 getLogDomain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public static getLogDomain(): number { return Clog.LOG_DOMAIN; }
https://github.com/ZestBox-18/kitebook-frontend
e5363ce1b66477bbec4c7d25453039e8afbd6c95
github
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseManager.ets
arkts
getStore
获取 RdbStore 实例 @returns RdbStore 实例 @throws DatabaseNotInitializedError 如果数据库未初始化
getStore(): relationalStore.RdbStore { if (!this.initialized || this.store === null) { throw new DatabaseNotInitializedError() } return this.store }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStore 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#member_expression#Left AST#identifier#Left relationalStore AST#identi...
getStore(): relationalStore.RdbStore { if (!this.initialized || this.store === null) { throw new DatabaseNotInitializedError() } return this.store }
https://github.com/offlinecat-dev/OCNetORM
e33a2292272e534126f2e677bb668a2514be8d95
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
getVMStatus
获取虚拟机状态
async getVMStatus(vmId: string): Promise<VMStatusResult> { try { const response = await this.sendCommand({ command: 'get_status', vmId: vmId }) const result: VMStatusResult = { success: response.success, status: response.status, data: response.data, ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getVMStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async getVMStatus(vmId: string): Promise<VMStatusResult> { try { const response = await this.sendCommand({ command: 'get_status', vmId: vmId }) const result: VMStatusResult = { success: response.success, status: response.status, data: response.data, ...
https://github.com/AetheriumSimulator/qemu-hmos
de71f6066b9cfd15e21cb0510869b30e3d1620ef
github
YANGZX22/Voot
entry/src/main/ets/services/PipSubtitleManager.ets
arkts
startPip
Start PiP subtitle
async startPip(): Promise<boolean> { if (!this.isInitialized || !this.pipController) { console.error(`${TAG} PiP not initialized`); return false; } if (this.isPipRunning) { console.info(`${TAG} PiP already running`); return true; } try { await this.pipController.sta...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startPip AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#...
async startPip(): Promise<boolean> { if (!this.isInitialized || !this.pipController) { console.error(`${TAG} PiP not initialized`); return false; } if (this.isPipRunning) { console.info(`${TAG} PiP already running`); return true; } try { await this.pipController.sta...
https://github.com/YANGZX22/Voot
b2fc272b8c9d4a22f8ea57691441b9bac561c9eb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
loadSourceHeaders
从图源配置中加载图片请求头
private async loadSourceHeaders(sourceId: number): Promise<void> { try { this.currentSourceHeaders = {} as RequestHeaders; const sources = await DataManager.getInstance().getAllComicSources(); for (let i = 0; i < sources.length; i++) { const s = sources[i] as ComicSourceDatabaseRe...
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 loadSourceHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:...
private async loadSourceHeaders(sourceId: number): Promise<void> { try { this.currentSourceHeaders = {} as RequestHeaders; const sources = await DataManager.getInstance().getAllComicSources(); for (let i = 0; i < sources.length; i++) { const s = sources[i] as ComicSourceDatabaseRe...
https://github.com/DaLongZhuaZi/manxia
10535513e8398b9c7b59ad32b6f84aaca695f470
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelReplaceRuleManager.ets
arkts
reorderRules
调整规则顺序
async reorderRules(ids: string[]): Promise<void> { const updatedRules: ReplaceRule[] = []; ids.forEach((id, index) => { const rule = this.rules.get(id); if (rule) { rule.order = index; rule.updateTime = Date.now(); updatedRules.push(rule); } }); // 批量保存更新的规则 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reorderRules AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ids AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async reorderRules(ids: string[]): Promise<void> { const updatedRules: ReplaceRule[] = []; ids.forEach((id, index) => { const rule = this.rules.get(id); if (rule) { rule.order = index; rule.updateTime = Date.now(); updatedRules.push(rule); } }); // 批量保存更新的规则 ...
https://github.com/DaLongZhuaZi/manxia
b8eb728509b135b9157c957ac41ad57b71c0b00a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewContainerPage.ets
arkts
addWebView
添加WebView
static addWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks, initialUrl?: string ): void { if (GlobalWebViewContainer.containerRef) { GlobalWebViewContainer.containerRef.addWebView(sourceId, controller, conf...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left addWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static addWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks, initialUrl?: string ): void { if (GlobalWebViewContainer.containerRef) { GlobalWebViewContainer.containerRef.addWebView(sourceId, controller, conf...
https://github.com/DaLongZhuaZi/manxia
7c405adc24ae3a447759548749ba178071e28598
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/goods/GoodsListItem.ets
arkts
build
构建商品列表卡片 @returns {void} 无返回值
build(): void { Card({ onTap: (): void => this.onItemClick(this.goods.id) }) { Row() { NetWorkImage({ model: this.goods.mainPic, sizeValue: 100, imageFit: ImageFit.Cover, showBackground: true, cornerRadius: $r("app.float.radius_small") ...
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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Card({ onTap: (): void => this.onItemClick(this.goods.id) }) { Row() { NetWorkImage({ model: this.goods.mainPic, sizeValue: 100, imageFit: ImageFit.Cover, showBackground: true, cornerRadius: $r("app.float.radius_small") ...
https://github.com/Joker-x-dev/CoolMallArkTS
9a7f2e2b9c5b6991997893b04dcc361798397817
github
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets
arkts
delete1stItem
删除第一个元素
public delete1stItem(): void { this.dataArray.splice(0, 1); this.notifyDataDelete(0); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left delete1stItem 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...
public delete1stItem(): void { this.dataArray.splice(0, 1); this.notifyDataDelete(0); }
https://gitee.com/openharmony/xts_tools.git
7dad5dd77aa2ccde494fb377c7f103a5d46192fa
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
getAllPlugins
获取所有插件信息
public getAllPlugins(): PluginInfo[] { return Array.from(this.pluginRegistry.values()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllPlugins 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 PluginIn...
public getAllPlugins(): PluginInfo[] { return Array.from(this.pluginRegistry.values()); }
https://github.com/DaLongZhuaZi/manxia
a33fdfb787612ef01125f8907c8963e6e630972f
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
contrastInitType
Format conversion @param initContent
contrastInitType(initContent: string): string { let base64regex = new RegExp('/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/'); if (!base64regex.test(initContent)) { const inputBuffer = buffer.from(initContent, 'utf-8'); initContent = inputBuffer.toString('base64'); } r...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left contrastInitType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left initContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )...
contrastInitType(initContent: string): string { let base64regex = new RegExp('/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/'); if (!base64regex.test(initContent)) { const inputBuffer = buffer.from(initContent, 'utf-8'); initContent = inputBuffer.toString('base64'); } r...
https://gitee.com/openharmony/applications_notes.git
d93a6355905263e17ca4cff371a116bdfecb0c5d
gitee
OpenHarmonyPCDeveloper/GitNext
entry/src/main/ets/pages/utils/fileUtils.ets
arkts
activatePermissionExample
激活授权,激活成功后返回true
static async activatePermissionExample(uri: string) : Promise <boolean> { let result : boolean = false; try { let policyInfo: fileShare.PolicyInfo = { uri: uri, operationMode: fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE, }; let policies: Array<fileS...
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 activatePermissionExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:...
static async activatePermissionExample(uri: string) : Promise <boolean> { let result : boolean = false; try { let policyInfo: fileShare.PolicyInfo = { uri: uri, operationMode: fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE, }; let policies: Array<fileS...
https://gitcode.com/OpenHarmonyPCDeveloper/GitNext
5593ab8b882b0d1bbcba9e76fd878c8dd470443a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
getCoverCacheDir
获取封面缓存目录
private getCoverCacheDir(): string { return DownloadDirManager.ensureDirectory('suwayomi/covers'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCoverCacheDir 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...
private getCoverCacheDir(): string { return DownloadDirManager.ensureDirectory('suwayomi/covers'); }
https://github.com/DaLongZhuaZi/manxia
2704339a14ad6804377f44389677d84b38c85c1f
github
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/utils/AIConfig.ets
arkts
load
从本地存储加载配置
static async load(context: common.UIAbilityContext): Promise<AIConfigClass> { const cfg = new AIConfigClass(); cfg.apiUrl = await PreferencesUtil.getAIConfigApiUrl(context); cfg.apiKey = await PreferencesUtil.getAIConfigApiKey(context); cfg.model = await PreferencesUtil.getAIConfigModel(context); ...
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 load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
static async load(context: common.UIAbilityContext): Promise<AIConfigClass> { const cfg = new AIConfigClass(); cfg.apiUrl = await PreferencesUtil.getAIConfigApiUrl(context); cfg.apiKey = await PreferencesUtil.getAIConfigApiKey(context); cfg.model = await PreferencesUtil.getAIConfigModel(context); ...
https://github.com/electronicminer/Harmony-Markdown-Editor
bea01f2e1f6c2da0391e2f3db2639da575f888c4
github
harmonyos/codelabs
HarmonyOS_NEXT/SimpleCalculator/entry/src/main/ets/pages/HomePage.ets
arkts
inputOperators
Triggered when input is added, subtracted, multiplied, and divided. @param len Expression Length. @param value Current Input Value.
inputOperators(len: number, value: string) { let last = len > 0 ? this.expressions[len - 1] : undefined; let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined; if (!last && (value === Symbol.MIN)) { this.expressions.push(this.getSymbol(value)); return; } if...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left inputOperators AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right...
inputOperators(len: number, value: string) { let last = len > 0 ? this.expressions[len - 1] : undefined; let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined; if (!last && (value === Symbol.MIN)) { this.expressions.push(this.getSymbol(value)); return; } if...
https://gitee.com/harmonyos/codelabs.git
04ad09a6e770f8ae28c32ce1da538f0c41508f5f
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
log
@section Console logging API Implementations for log primitive types to stdout @param {string | boolean | byte | short | char | int | long | Any} i - The value to print to stdout @returns {void} @public NOTE(ivan-tyulyandin): overload are added for performance reasons To optimize `debug`, `warn`, `info` and `error` the...
public log(i: boolean): void { this.addToBuffer(this.indent + i + c'\n', LogLevel.LOG) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
public log(i: boolean): void { this.addToBuffer(this.indent + i + c'\n', LogLevel.LOG) }
https://gitcode.com/iop123123/arkts-static-skills
1bde2be9c803513830b3d17a8384e9bafd82520a
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnInputViewModel.ets
arkts
setInputValue2
设置输入框2的文本内容 @param value 新的输入值
setInputValue2(value: string): void { this.inputValue2 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInputValue2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setInputValue2(value: string): void { this.inputValue2 = value; }
https://github.com/codelably/tuniao-ui
38515894c7e0b5cec1d5abec899cba0f50fcf435
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
addSearchHistory
添加搜索历史
async addSearchHistory(keyword: string): Promise<void> { // 移除重复项 this.searchHistory = this.searchHistory.filter(k => k !== keyword); // 添加到开头 this.searchHistory.unshift(keyword); // 限制数量 if (this.searchHistory.length > this.searchSettings.searchHistoryLimit) { this.searchHistory = this....
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left addSearchHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#...
async addSearchHistory(keyword: string): Promise<void> { // 移除重复项 this.searchHistory = this.searchHistory.filter(k => k !== keyword); // 添加到开头 this.searchHistory.unshift(keyword); // 限制数量 if (this.searchHistory.length > this.searchSettings.searchHistoryLimit) { this.searchHistory = this....
https://github.com/DaLongZhuaZi/manxia
11ca02e5ddd96a99a0f1c72a769ac7ec809a4fb7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/NotificationManager.ets
arkts
sendDownloadFailedNotification
发送下载失败通知
public async sendDownloadFailedNotification( taskId: string, fileName: string, reason: string ): Promise<boolean> { const config: NotificationConfig = { id: this.getNotificationId(taskId), title: '下载失败', text: fileName, additionalText: reason, type: NotificationType.DOW...
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 sendDownloadFailedNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Rig...
public async sendDownloadFailedNotification( taskId: string, fileName: string, reason: string ): Promise<boolean> { const config: NotificationConfig = { id: this.getNotificationId(taskId), title: '下载失败', text: fileName, additionalText: reason, type: NotificationType.DOW...
https://github.com/DaLongZhuaZi/manxia
66c442d15fe71bebc06c85a52d6e7a6befda2e0f
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
lessThanOrEqualTo
Return true if the value of this Decimal is less than or equal to `n`, otherwise return false. @param { Value } n {double | string | Decimal} @returns { boolean } the boolean type
public lessThanOrEqualTo(n: Value): boolean { return this.comparedTo(n) <= 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lessThanOrEqualTo 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#Left V...
public lessThanOrEqualTo(n: Value): boolean { return this.comparedTo(n) <= 0; }
https://gitcode.com/iop123123/arkts-static-skills
a4b9cf1f7d446dc37b49aa38be293f8cf38828ab
gitcode
offlinecat-dev/OCNetORM
example/repository/UserRepository.ets
arkts
findAll
查询所有用户 @returns 用户列表
async findAll(): Promise<Array<EntityData>> { return await this.repository.findAll() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findAll 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#generic_type...
async findAll(): Promise<Array<EntityData>> { return await this.repository.findAll() }
https://github.com/offlinecat-dev/OCNetORM
cc1983b6f4c57d5ec85265e85e02638fda30dc39
github
ibestservices/ibest-ui
library/src/main/ets/components/checkbox/index.ets
arkts
getLabelColor
获取label的颜色
getLabelColor() { return this.getIsDisabled() ? IBestCheckboxColor.disabledLabelColor : IBestCheckboxColor.labelColor }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLabelColor 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...
getLabelColor() { return this.getIsDisabled() ? IBestCheckboxColor.disabledLabelColor : IBestCheckboxColor.labelColor }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L194-L196
0b6b1b003e86205684a5975e2c0045e8dd18696b
github
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/pages/PageThree.ets
arkts
build
[EndExclude PageThree_start]
build() { NavDestination() { // [StartExclude PageThree_start] this.navDestinationTitle() // [EndExclude PageThree_start] Column() { if (this.isShowStridePixel) { Image(this.stridePixel) .width(this.getUIContext().px2vp(this.imageWidth)) .height(th...
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() { NavDestination() { // [StartExclude PageThree_start] this.navDestinationTitle() // [EndExclude PageThree_start] Column() { if (this.isShowStridePixel) { Image(this.stridePixel) .width(this.getUIContext().px2vp(this.imageWidth)) .height(th...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
9a634ed09654991549a8d0cba0d3f0a76d63a1a3
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
getById
根据 ID 查询标签 @param userId 用户ID @param tagId 标签ID @returns 标签对象或 null
static async getById(userId: number, tagId: number): Promise<Tag | null> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM tags WHERE tag_id = ? AND user_id = ? AND is_deleted = 0`; let resultSet: relationalStore.ResultSet | null = null; try { resultSet = await store.quer...
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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R...
static async getById(userId: number, tagId: number): Promise<Tag | null> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM tags WHERE tag_id = ? AND user_id = ? AND is_deleted = 0`; let resultSet: relationalStore.ResultSet | null = null; try { resultSet = await store.quer...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6518ab3cbcf70fa7f92fa82455d4962352cda8aa
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/ChatPage.ets
arkts
refreshConnecteStatus
刷新连接状态。
refreshConnecteStatus() { this.connectStatus = ClientCoreSDK.getInstance().connectedToServer; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshConnecteStatus 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_bl...
refreshConnecteStatus() { this.connectStatus = ClientCoreSDK.getInstance().connectedToServer; }
https://github.com/JackJiang2011/harmonychat
552a4c85441e941ab87dcbe5a720e2227c53acf9
github