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
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/parkingMock_realdata.ets
arkts
calculateParkingFee
计算停车费用(基于真实费率规则) @param parkDurationMinutes 停放时长(分钟) @param config 费率配置 @returns 费用详情
function calculateParkingFee(parkDurationMinutes: number, config: FeeRateConfig): FeeDetailBreakdown { let totalFee = 0; const breakdown: FeeItem[] = []; if (parkDurationMinutes <= config.freeMinutes) { const item: FeeItem = { period: '0-30分钟(免费)', fee: 0 }; breakdown.push(item); return { totalFee: 0...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateParkingFee AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left parkDurationMinutes AST#identifier#Right AST#type_annotation#Left ...
function calculateParkingFee(parkDurationMinutes: number, config: FeeRateConfig): FeeDetailBreakdown { let totalFee = 0; const breakdown: FeeItem[] = []; if (parkDurationMinutes <= config.freeMinutes) { const item: FeeItem = { period: '0-30分钟(免费)', fee: 0 }; breakdown.push(item); return { totalFee: 0...
https://github.com/LJ666-ui/harmony-health-care
a151f890908e7b06071ad1011077b46024010f58
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
nextItem
Appends a newline character followed by indentation spaces to the `out` property. @param {StringBuilder} stringBuilder - The `StringBuilder` instance used to append spaces to the XML output.
private nextItem(stringBuilder: StringBuilder): void { stringBuilder.append('\r\n'); stringBuilder.append(' '.repeat(SpacesIndentation * this.depth)); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left nextItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stringBuilder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private nextItem(stringBuilder: StringBuilder): void { stringBuilder.append('\r\n'); stringBuilder.append(' '.repeat(SpacesIndentation * this.depth)); }
https://gitcode.com/iop123123/arkts-static-skills
696fe166b20f5ce1d933eeaf2115f7039e839d14
gitcode
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
getProviders
============================================================================ 查询(不碰 DB) ============================================================================ 返回当前内存中的所有 providers(含未启用),调用方只读
getProviders(): ModelProvider[] { return getAppSettingsState().providers }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProviders 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 ModelProvider AST#identifier#Right AST#[#Left [ A...
getProviders(): ModelProvider[] { return getAppSettingsState().providers }
https://github.com/LongLiveY96/chatcube
d826e2919fd4b98cb303947fb38fe669fecea94c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/BillDAO.ets
arkts
bulkSoftDelete
批量软删除账单 @param billIds 要删除的账单 ID 数组 @returns 删除成功的记录数 性能优化: - 使用 IN 子句批量更新 - 比逐条删除快 5-10 倍
static async bulkSoftDelete(billIds: number[]): Promise<number> { if (!billIds || billIds.length === 0) { console.log('[BillDAO] 没有账单需要删除'); return 0; } console.log(`[BillDAO] 开始批量软删除 ${billIds.length} 条账单`); try { // 调用批量软删除辅助方法 const deletedCount = await BatchQueryHelper.bu...
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 bulkSoftDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billIds AST#identifier#Right AST#:#Left :...
static async bulkSoftDelete(billIds: number[]): Promise<number> { if (!billIds || billIds.length === 0) { console.log('[BillDAO] 没有账单需要删除'); return 0; } console.log(`[BillDAO] 开始批量软删除 ${billIds.length} 条账单`); try { // 调用批量软删除辅助方法 const deletedCount = await BatchQueryHelper.bu...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
608b873d703a95e2c5935ff8b1ea7f5ce19957fb
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/utils/TranslationTextParser.ets
arkts
splitTextByEmojiAndAtUsers
Parse text message and return translation components @param text Original text @param atUserNames @ user name list (without @ prefix) @returns Object containing "result", "text", "textIndex" keys
public static splitTextByEmojiAndAtUsers( text: string, atUserNames?: string[] ): SplitTextResult | null { if (!text || text.length === 0) { return null; } let result: string[] = []; // Build user strings with @ prefix and trailing space const atUsers: string[] = []; if (atUs...
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 splitTextByEmojiAndAtUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AS...
public static splitTextByEmojiAndAtUsers( text: string, atUserNames?: string[] ): SplitTextResult | null { if (!text || text.length === 0) { return null; } let result: string[] = []; // Build user strings with @ prefix and trailing space const atUsers: string[] = []; if (atUs...
https://github.com/Tencent-RTC/TUIKit_Harmony
338351859abe41055b19530e9a992118644d0030
github
PollenWang6/HiXD
entry/src/main/ets/services/AttendanceService.ets
arkts
ensureLogin
确保登录状态
async ensureLogin(): Promise<void> { if (await this.isLogin()) { console.info(TAG, 'ensureLogin: already logged in'); return; } console.info(TAG, 'ensureLogin: need login'); await this.loginToLearning(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left ensureLogin 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 ensureLogin(): Promise<void> { if (await this.isLogin()) { console.info(TAG, 'ensureLogin: already logged in'); return; } console.info(TAG, 'ensureLogin: need login'); await this.loginToLearning(); }
https://github.com/PollenWang6/HiXD
9c4bd59a043c76bd9a0cef10492951dde13ce62e
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
putCacheImage
用于外部已获取pixelmap,需要加入ImageKnife缓存的场景 @param url 图片地址url @param pixelMap 需要缓存的图片数据 @param cacheType 写入缓存的类型,DEFAULT为同时写入文件和内存缓存,MEMORY为写入内存缓存,FILE为写入文件缓存 @param signature 缓存key自定义签名信息 @param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存
putCacheImage(url: string, pixelMap: PixelMap, cacheType: CacheStrategy = CacheStrategy.DEFAULT, signature: string = "", cacheName?:string) { nativeNode.putCacheImage(url, pixelMap, cacheType, signature, cacheName); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left putCacheImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
putCacheImage(url: string, pixelMap: PixelMap, cacheType: CacheStrategy = CacheStrategy.DEFAULT, signature: string = "", cacheName?:string) { nativeNode.putCacheImage(url, pixelMap, cacheType, signature, cacheName); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L514-L517
66095492413d762b6a0aae96616b9182c935d209
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets
arkts
isPrimitiveType
Checks if the given Class object represents a primitive type (numeric or boolean types). @static @param { Class } type The Class object to be checked. @returns { boolean } Returns true if it's a primitive type; otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isPrimitiveType(type: Class): boolean { return Types.isNumericType(type) || Types.isBooleanType(type) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isPrimitiveType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : ...
public static isPrimitiveType(type: Class): boolean { return Types.isNumericType(type) || Types.isBooleanType(type) }
https://gitcode.com/iop123123/arkts-static-skills
387a34325875981146349323fb2a77bf52c8f2c5
gitcode
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets
arkts
setSize
设置缓存文件大小 @param size 文件大小
setSize(size: number) { this.size = size; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)...
setSize(size: number) { this.size = size; }
https://gitcode.com/arkui-x/samples
cf1dad62c6b3f9e47a9b9323c473b5c4a1ca3c37
gitcode
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
showDoWhileStatements
do-while语句
function showDoWhileStatements() { let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi']; let index = 0; // 初始化索引 do { console.log(students[index]); // 先执行循环体中的语句 index++; } while (index < students.length); // 然后判断循环控制表达式 }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showDoWhileStatements AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexic...
function showDoWhileStatements() { let students: string[] = ['XiaoMing', 'XiaoZhang', 'XiaoWang', 'XiaoLi']; let index = 0; // 初始化索引 do { console.log(students[index]); // 先执行循环体中的语句 index++; } while (index < students.length); // 然后判断循环控制表达式 }
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
fb35af94a0983ee3288d9ede81e013e00446ffd5
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getAllConditions
获取所有条件(包括软删除条件) @returns 包含软删除条件的完整条件数组
getAllConditions(): Array<WhereCondition> { const allConditions: Array<WhereCondition> = [] // 添加用户定义的条件 for (let i = 0; i < this.conditions.length; i++) { allConditions.push(this.cloneCondition(this.conditions[i])) } // 添加软删除条件(需要按 OR 分段追加) const softDeleteCondition = this.getSoftDele...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAllConditions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#...
getAllConditions(): Array<WhereCondition> { const allConditions: Array<WhereCondition> = [] // 添加用户定义的条件 for (let i = 0; i < this.conditions.length; i++) { allConditions.push(this.cloneCondition(this.conditions[i])) } // 添加软删除条件(需要按 OR 分段追加) const softDeleteCondition = this.getSoftDele...
https://github.com/offlinecat-dev/OCNetORM
87ff631fc9cacbe3066717e676e440b1e45c5ad8
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets
arkts
getAttendanceStatistics
============ 统计数据 ============ 获取考勤统计数据
async getAttendanceStatistics(): Promise<ApiResponse<AttendanceStatistics>> { return this.client.get<AttendanceStatistics>('/api/v1/attendance/statistics') }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAttendanceStatistics AST#identifier#Right AST#formal_parameters#Left AST#(#Left ...
async getAttendanceStatistics(): Promise<ApiResponse<AttendanceStatistics>> { return this.client.get<AttendanceStatistics>('/api/v1/attendance/statistics') }
https://github.com/David8Idira/AI-OA
8a8b9c6242575ce8fe8042ad971de0a512137063
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/manager/PageContextManager.ets
arkts
openPage
打开页面 @param data 路由参数 @param animated boolean
public openPage(data: RouterParam, animated: boolean = true): void { try { this.pathStack.pushPath({ name: data.routerName, param: data.param, }, animated) } catch (error) { const businessError: BusinessError = error as BusinessError Logger.error(TAG, `打开 ${data...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RouterP...
public openPage(data: RouterParam, animated: boolean = true): void { try { this.pathStack.pushPath({ name: data.routerName, param: data.param, }, animated) } catch (error) { const businessError: BusinessError = error as BusinessError Logger.error(TAG, `打开 ${data...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
03aada44774d33828f0411fe873386a97cfb2610
gitcode
silence17/harmonydemo
common_lib/src/main/ets/common/ContainerPage.ets
arkts
aboutToDisappear
在自定义组件即将析构销毁时执行。 https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md/#abouttodisappear
aboutToDisappear() { }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { }
https://github.com/silence17/harmonydemo
39e44ddd882f667b246b88071075cdbb4900e349
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/EventSourcingService.ets
arkts
getAggregateEvents
==================== 事件查询 ==================== 获取聚合的所有事件
static async getAggregateEvents( aggregateType: string, aggregateId: number, fromVersion: number = 0 ): Promise<DomainEvent[]> { try { return await DomainEventDAO.getByAggregate(aggregateType, aggregateId, fromVersion); } catch (error) { console.error('[EventSourcingService] 获取聚合事件失败...
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 getAggregateEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AS...
static async getAggregateEvents( aggregateType: string, aggregateId: number, fromVersion: number = 0 ): Promise<DomainEvent[]> { try { return await DomainEventDAO.getByAggregate(aggregateType, aggregateId, fromVersion); } catch (error) { console.error('[EventSourcingService] 获取聚合事件失败...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
7279db4c1d5a247c77ad4779d7e8244b6500c2b8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
createAggregationResultFromResultSet
从ResultSet创建聚合查询结果对象
private async createAggregationResultFromResultSet<T extends AggregationQueryResult>( resultSet: relationalStore.ResultSet ): Promise<T> { const columnNames = resultSet.columnNames; // 根据聚合查询的特点,创建类型安全的结果对象 if (columnNames.length === 1) { const columnName = columnNames[0]; const col...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left createAggregationResultFromResultSet AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right...
private async createAggregationResultFromResultSet<T extends AggregationQueryResult>( resultSet: relationalStore.ResultSet ): Promise<T> { const columnNames = resultSet.columnNames; // 根据聚合查询的特点,创建类型安全的结果对象 if (columnNames.length === 1) { const columnName = columnNames[0]; const col...
https://github.com/DaLongZhuaZi/manxia
a3a56069a21072336e178fbb3e8f630814e96130
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_short.ets
arkts
main
--- desc: check less or equal operation for short integer ---
function main(): void { const a: short = {{v.left}} const b: short = {{v.right}} assert (a <= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: short = {{v.left}} const b: short = {{v.right}} assert (a <= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ccdeaa565a7c01bd6d504baa115376fa07eb8362
gitee
SMAT-Lab/HapRepair
data/MyApplication2/entry/src/main/ets/performancecases/imported/Wifi_HeadComponent.ets
arkts
HeadComponentBuilder
head custom component Of WiFi test
@Builder function HeadComponentBuilder(isActive: boolean, icBackIsVisibility: boolean, headName: string | Resource, isTouch: boolean) { Row() { Stack({ alignContent : Alignment.Center }) { Image($r('app.media.ic_back')) .width($r('app.float.wh_value_30')) .height($r('app.float.wh_value_30'))...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left HeadComponentBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right ...
@Builder function HeadComponentBuilder(isActive: boolean, icBackIsVisibility: boolean, headName: string | Resource, isTouch: boolean) { Row() { Stack({ alignContent : Alignment.Center }) { Image($r('app.media.ic_back')) .width($r('app.float.wh_value_30')) .height($r('app.float.wh_value_30'))...
https://github.com/SMAT-Lab/HapRepair
fc2cfd497d22f87c8d7a0eab3d660262eb2d5ad0
github
ibestservices/ibest-ui
library/src/main/ets/apis/IBestDialog.ets
arkts
defaultContentBuilder
默认内容 Builder
@Builder function defaultContentBuilder(option: IBestDialogParams) { DialogContent({option}) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left defaultContentBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right...
@Builder function defaultContentBuilder(option: IBestDialogParams) { DialogContent({option}) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestDialog.ets#L364-L366
bd208adca25e4885b8fb434fbd36b27595a8d4e4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
setBookSortOrder
设置书籍排序顺序
async setBookSortOrder(bookId: string, sortOrder: number): Promise<void> { const store = this.getStore(); await store.executeSql( 'UPDATE novel_book SET sortOrder = ?, updateTime = ? WHERE id = ?', [sortOrder, Date.now(), bookId] ); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBookSortOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async setBookSortOrder(bookId: string, sortOrder: number): Promise<void> { const store = this.getStore(); await store.executeSql( 'UPDATE novel_book SET sortOrder = ?, updateTime = ? WHERE id = ?', [sortOrder, Date.now(), bookId] ); }
https://github.com/DaLongZhuaZi/manxia
9324db1c1cd48172d1c417d5d882c7df8af1d0b7
github
openharmony/applications_app_samples
code/BasicFeature/Media/Camera/entry/src/main/ets/common/SettingItem.ets
arkts
selectMode
Corresponding to the selected setting parameters in the click mode setting
selectMode() { switch (this.settingMessageNum) { case 2: this.settingDataObj.videoStabilizationMode = this.index; cameraDemo.isVideoStabilizationModeSupported(this.settingDataObj.videoStabilizationMode); break case 3: this.settingDataObj.exposureMode = this.index; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
selectMode() { switch (this.settingMessageNum) { case 2: this.settingDataObj.videoStabilizationMode = this.index; cameraDemo.isVideoStabilizationModeSupported(this.settingDataObj.videoStabilizationMode); break case 3: this.settingDataObj.exposureMode = this.index; ...
https://github.com/openharmony/applications_app_samples
44183b90c965c6c86dc71242b992ad2e9e8113ce
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/videoPlayer/entry/src/main/ets/view/VideoPlaySlider.ets
arkts
sliderOnchange
视频滑块组件
sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if(mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sliderOnchange 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 number AST#identifier#Rig...
sliderOnchange(value: number, mode: SliderChangeMode) { this.currentTime = Number.parseInt(value.toString()); this.controller.setCurrentTime(Number.parseInt(value.toString()), SeekMode.Accurate); if(mode === SliderChangeMode.Begin || mode === SliderChangeMode.Moving) { this.isOpacity = false; } ...
https://gitee.com/openharmony/vendor_unionman.git
5bf04b4490f814502b7ac7e9b87b253a09049909
gitee
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/services/HolidayCalendarService.ets
arkts
calendarForYear
Returns the holiday calendar for a given year, or null if none is available.
public calendarForYear(year: number): HolidayCalendarData | null { const result: HolidayCalendarData | undefined = this.calendars.get(year) return result !== undefined ? result : null }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calendarForYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public calendarForYear(year: number): HolidayCalendarData | null { const result: HolidayCalendarData | undefined = this.calendars.get(year) return result !== undefined ? result : null }
https://github.com/OMGCA/sakipay
90950b5aa6cb11e63ea7d734770c87a0d1813739
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ThemeManager.ets
arkts
getColors
获取当前主题颜色
getColors(): ThemeColors { return this.currentTheme === ThemeType.LIGHT ? LightTheme : DarkTheme; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColors 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 ThemeColors AST#identifier#Right AST#ERROR#Right AST...
getColors(): ThemeColors { return this.currentTheme === ThemeType.LIGHT ? LightTheme : DarkTheme; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
37c2520cc87f2c64afd659ba7dee8bab45961f3a
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/FeedbackRepository.ets
arkts
constructor
构造函数 @param networkDataSource 反馈网络数据源
constructor(networkDataSource?: FeedbackNetworkDataSource) { this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceImpl(); }
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 networkDataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
constructor(networkDataSource?: FeedbackNetworkDataSource) { this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS
8f8013987a9f722b3565630fdda3075e27810168
github
xiebyapps/ClipLink
entry/src/main/ets/services/HttpClient.ets
arkts
base64Encode
Simple base64 encoding
private base64Encode(str: string): string { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; const bytes: number[] = this.stringToBytes(str); let result = ''; for (let i = 0; i < bytes.length; i += 3) { const a: number = bytes[i]; const hasB = i + 1 < bytes...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64Encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
private base64Encode(str: string): string { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; const bytes: number[] = this.stringToBytes(str); let result = ''; for (let i = 0; i < bytes.length; i += 3) { const a: number = bytes[i]; const hasB = i + 1 < bytes...
https://github.com/xiebyapps/ClipLink
355f11f8dbdc6cf3e52c9012fa09fa5c23c0caa8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/LimitLine.ets
arkts
disableDashedLine
Disables the line to be drawn in dashed mode.
public disableDashedLine() { this.mDashPathEffect = null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disableDashedLine 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#{#Le...
public disableDashedLine() { this.mDashPathEffect = null; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d50bcb88bbad66d98ac483067a89d3c4f74bcd2c
gitee
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
saveFinalOperation
Save final operation.
private saveFinalOperation(): void { let crop = this.cropShow.getCropRect(); let image = this.cropShow.getImageRect(); crop.move(-image.left, -image.top); MathUtils.normalizeRect(crop, image.getWidth(), image.getHeight()); if (this.filter !== undefined) { this.filter.setCropRect(crop); }...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveFinalOperation 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 A...
private saveFinalOperation(): void { let crop = this.cropShow.getCropRect(); let image = this.cropShow.getImageRect(); crop.move(-image.left, -image.top); MathUtils.normalizeRect(crop, image.getWidth(), image.getHeight()); if (this.filter !== undefined) { this.filter.setCropRect(crop); }...
https://gitee.com/openharmony/codelabs.git
cd9fff51ea5ca8245bb15b50cf4f73e675015e89
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupTest.ets
arkts
testPerformanceMonitoring
测试性能监控
async testPerformanceMonitoring(): Promise<boolean> { logger.info('StartupTest', '🧪 开始测试性能监控'); try { // 开始监控 startupController.startMonitoring(); // 模拟慢速阶段 await this.simulatePhase(StartupPhase.ABILITY_STAGE_CREATE, 100); await this.simulatePhase(StartupPhase.ENTRY_...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testPerformanceMonitoring AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : A...
async testPerformanceMonitoring(): Promise<boolean> { logger.info('StartupTest', '🧪 开始测试性能监控'); try { // 开始监控 startupController.startMonitoring(); // 模拟慢速阶段 await this.simulatePhase(StartupPhase.ABILITY_STAGE_CREATE, 100); await this.simulatePhase(StartupPhase.ENTRY_...
https://github.com/DaLongZhuaZi/manxia
1267cbcd576faeffa112fdb693d9ca14908e8c84
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
ldelim
Write length prefix and append child buffer
ldelim(child: Writer): Writer { const buf = child.finish() this.uint32(buf.length) for (let i = 0; i < buf.length; i++) this.push(buf[i]) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ldelim AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left child AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Writer AST#identifier#Right AST#)#Left ) AST#)#R...
ldelim(child: Writer): Writer { const buf = child.finish() this.uint32(buf.length) for (let i = 0; i < buf.length; i++) this.push(buf[i]) return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
1709945dad0887ca1a9565b22f1793ceb89bd8b6
gitcode
Tianpei-Shi/MusicDash
src/services/CloudDBService.ets
arkts
getUserPlayHistory
获取用户的播放历史记录
async getUserPlayHistory(userId: number): Promise<CloudDBZoneObject[]> { try { // 模拟获取播放历史 console.log(`获取用户播放历史,用户ID: ${userId}`); const historyText = userId === 1001 ? "稻香,晴天,七里香" : "演员,绅士,意外"; const songTitles: string[] = historyText.split(','); const songs: CloudDBZoneObje...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserPlayHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async getUserPlayHistory(userId: number): Promise<CloudDBZoneObject[]> { try { // 模拟获取播放历史 console.log(`获取用户播放历史,用户ID: ${userId}`); const historyText = userId === 1001 ? "稻香,晴天,七里香" : "演员,绅士,意外"; const songTitles: string[] = historyText.split(','); const songs: CloudDBZoneObje...
https://github.com/Tianpei-Shi/MusicDash
616ad8c6c742e13156ef3d4e6d9ea4fb555e609b
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/services/MusicImportService.ets
arkts
loadSongs
修正版:从数据库加载歌曲列表
static async loadSongs(context: common.Context, globalMusic: GlobalMusic): Promise<void> { try { // 1. 确保数据库已初始化 await RdbManager.initRdb(context); // 2. 从数据库获取最新数据 const allSongs = await RdbManager.getAllSongs(); // 3. 直接赋值给全局状态(配合 @Trace 触发 UI 刷新) // 不要用 forEach add,直接替换数组效...
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 loadSongs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
static async loadSongs(context: common.Context, globalMusic: GlobalMusic): Promise<void> { try { // 1. 确保数据库已初始化 await RdbManager.initRdb(context); // 2. 从数据库获取最新数据 const allSongs = await RdbManager.getAllSongs(); // 3. 直接赋值给全局状态(配合 @Trace 触发 UI 刷新) // 不要用 forEach add,直接替换数组效...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicImportService.ets#L95-L111
8155dd6f1091942fcdd39867de96a8e27cadeadb
github
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/material/pbr_ao.ets
arkts
toggleAoTexture
Toggle between the original AO texture and the alternative AO texture
toggleAoTexture() { if (this.label) { (this.materials[0] as MetallicRoughnessMaterial).ambientOcclusion.image = this.images[0]; (this.materials[1] as MetallicRoughnessMaterial).ambientOcclusion.image = this.images[1]; } else { (this.materials[0] as MetallicRoughnessMaterial).ambientOcclusion...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleAoTexture 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#Le...
toggleAoTexture() { if (this.label) { (this.materials[0] as MetallicRoughnessMaterial).ambientOcclusion.image = this.images[0]; (this.materials[1] as MetallicRoughnessMaterial).ambientOcclusion.image = this.images[1]; } else { (this.materials[0] as MetallicRoughnessMaterial).ambientOcclusion...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
3504425be2d9ad3a7fc2b3fdda1d2cfb2bdc91e2
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/signature/index.ets
arkts
setCanvasStyle
设置canvas 初始样式
setCanvasStyle(){ this.context.lineCap = "round" this.context.lineJoin = "round" this.context.lineWidth = this.lineWidth this.context.strokeStyle = this.penColor }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCanvasStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
setCanvasStyle(){ this.context.lineCap = "round" this.context.lineJoin = "round" this.context.lineWidth = this.lineWidth this.context.strokeStyle = this.penColor }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/signature/index.ets#L99-L104
9f5d68c8b13cfde3011c1ffd76b9921632c87a95
github
arkui-x/samples
CodeLab/Cases/feature/applicationexception/src/main/ets/model/DataSource.ets
arkts
pushData
TODO:知识点:存储数据到懒加载数据源中
pushData(data: string): void { this.faultMessage.unshift(data); // 在数组头部添加数据 this.notifyDataAdd(0); AppStorage.setOrCreate('faultDataSourceLength', this.totalCount()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#...
pushData(data: string): void { this.faultMessage.unshift(data); // 在数组头部添加数据 this.notifyDataAdd(0); AppStorage.setOrCreate('faultDataSourceLength', this.totalCount()); }
https://gitcode.com/arkui-x/samples
9775ccee6089f0825848e28a8921ab8b99ead51a
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/SettingsService.ets
arkts
getStreamConfig
从设置生成 StreamConfig
async getStreamConfig(): Promise<StreamConfig> { // 获取基础视频设置 const resolutionStr = await this.getString(SettingsKeys.RESOLUTION, '1080p'); const fpsStr = await this.getString(SettingsKeys.FPS, '60 FPS'); const bitrateRaw = await this.getNumber(SettingsKeys.BITRATE, 0); // 默认 0 表示自动计算 const hostSc...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStreamConfig 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#gene...
async getStreamConfig(): Promise<StreamConfig> { // 获取基础视频设置 const resolutionStr = await this.getString(SettingsKeys.RESOLUTION, '1080p'); const fpsStr = await this.getString(SettingsKeys.FPS, '60 FPS'); const bitrateRaw = await this.getNumber(SettingsKeys.BITRATE, 0); // 默认 0 表示自动计算 const hostSc...
https://github.com/AlkaidLab/moonlight-harmony
02d3064b8c981459734a382ee35adfbfd73eb392
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
constructor
Creates a new Segmenter instance with specified locales and options @param locales Optional locale or array of locales for segmentation @param options Optional segmentation configuration @remarks - Supports single or multiple locales - Automatically resolves the best-fit locale - Defaults to grapheme granularity if not...
public constructor( locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: SegmenterOptions ) { const picked = {localeMatcher: options?.localeMatcher} as PickLocaleMatchSegmenterOptions; const supported = Segmenter.supportedLocalesOf(lo...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locales AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
public constructor( locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: SegmenterOptions ) { const picked = {localeMatcher: options?.localeMatcher} as PickLocaleMatchSegmenterOptions; const supported = Segmenter.supportedLocalesOf(lo...
https://gitcode.com/iop123123/arkts-static-skills
262ebaa6fc34de8447e0d523483509191cf7dfc2
gitcode
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets
arkts
getAllWatchHistory
获取所有观看历史
getAllWatchHistory(): WatchHistoryModel[] { try { const prefs = this.getPreferences() if (!prefs) return [] const historyData = prefs.getSync(WatchHistoryManager.HISTORY_KEY, '[]') as string const historyList = JSON.parse(historyData) as WatchHistory[] return historyList.map(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllWatchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left WatchHistoryModel AST#identi...
getAllWatchHistory(): WatchHistoryModel[] { try { const prefs = this.getPreferences() if (!prefs) return [] const historyData = prefs.getSync(WatchHistoryManager.HISTORY_KEY, '[]') as string const historyList = JSON.parse(historyData) as WatchHistory[] return historyList.map(...
https://github.com/SMAT-Lab/PhantomRendering
4613edd313c03736ae9f310e6cb139992958fb14
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toExponential
Return a string representing the value of this Decimal in exponential notation. @returns { string } the string type
public toExponential(): string { let str = this.finiteToString(true); return this.isNegative() && !this.isZero() ? '-' + str : str; }
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#string#Left string AST#s...
public toExponential(): string { let str = this.finiteToString(true); return this.isNegative() && !this.isZero() ? '-' + str : str; }
https://gitcode.com/iop123123/arkts-static-skills
88b71e686e075a0ede2c79e6856fb795e49678ae
gitcode
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
removeSongFromPlaylist
从指定歌单中移除一首歌曲 @param playlistId 歌单 ID @param songId 歌曲 ID
async removeSongFromPlaylist(playlistId: number, songId: string): Promise<boolean> { if (!this.rdbStore) return false; try { const predicates = new relationalStore.RdbPredicates(this.tableNameMap); predicates.equalTo('playlist_id', playlistId) .and() .equalTo('song_id', songId); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left removeSongFromPlaylist AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playlistId AST#identif...
async removeSongFromPlaylist(playlistId: number, songId: string): Promise<boolean> { if (!this.rdbStore) return false; try { const predicates = new relationalStore.RdbPredicates(this.tableNameMap); predicates.equalTo('playlist_id', playlistId) .and() .equalTo('song_id', songId); ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L413-L428
b85b26142e5fc1d5eda42fdd429c9db1b8d4bf77
github
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getFile
@summary Get the original file of an item. @param {LibraryApiGetFileRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public getFile(requestParameters: LibraryApiGetFileRequest): Promise<string> { this.assertParam(requestParameters.itemId) return this.apiClient.createUrl({path: `/Items/${requestParameters.itemId}/File`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFile 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#identifier#...
public getFile(requestParameters: LibraryApiGetFileRequest): Promise<string> { this.assertParam(requestParameters.itemId) return this.apiClient.createUrl({path: `/Items/${requestParameters.itemId}/File`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
7ffc0b92d029f95456829ef7dbcac499d7ffc546
github
StarHeartY/CalculatorX
entry/src/main/ets/database/HistoryRepository.ets
arkts
queryRecords
查询历史记录 @param moduleType 模块类型,传 'all' 查全部,传 'basic,scientific' 查混排 @param limit 查询数量上限
public static async queryRecords(moduleType: string, limit: number = 50): Promise<HistoryRecord[]> { if (!HistoryRepository.rdbStore) { return []; } try { const predicates = new relationalStore.RdbPredicates('history'); if (moduleType && moduleType !== 'all') { // 【核心魔法】:如果检测到逗号...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left queryRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleType AST#ident...
public static async queryRecords(moduleType: string, limit: number = 50): Promise<HistoryRecord[]> { if (!HistoryRepository.rdbStore) { return []; } try { const predicates = new relationalStore.RdbPredicates('history'); if (moduleType && moduleType !== 'all') { // 【核心魔法】:如果检测到逗号...
https://github.com/StarHeartY/CalculatorX
8a8a7fa51c0d616fef72c1b093146cb9ded2e065
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/CategoryDao.ets
arkts
getAllCategories
查询所有分类 @returns 分类列表
public async getAllCategories(): Promise<Category[]> { const sql: string = `SELECT id, name, icon_name, type FROM ${DBManager.TABLE_CATEGORIES} ORDER BY id ASC`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql); const categories: Category[] = []; while (r...
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 getAllCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async getAllCategories(): Promise<Category[]> { const sql: string = `SELECT id, name, icon_name, type FROM ${DBManager.TABLE_CATEGORIES} ORDER BY id ASC`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql); const categories: Category[] = []; while (r...
https://github.com/fuhhhhhhhh/openharmony
70178b254bffae621807c7ac6e6c6c32ae58ae1d
github
LZZLHY/hlib
entry/src/main/ets/storage/AuthStore.ets
arkts
saveCredentials
写入完整凭证;同时把账号合并入 saved_accounts。敏感字段经 HUKS 加密。
static async saveCredentials(account: SavedAccount): Promise<void> { const encUserId: string = await SecretStore.encrypt(account.userId); const encUserKey: string = await SecretStore.encrypt(account.userKey); await PreferencesStore.putString('auth', KEY_USER_ID, encUserId); await PreferencesStore.put...
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 saveCredentials AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left ...
static async saveCredentials(account: SavedAccount): Promise<void> { const encUserId: string = await SecretStore.encrypt(account.userId); const encUserKey: string = await SecretStore.encrypt(account.userKey); await PreferencesStore.putString('auth', KEY_USER_ID, encUserId); await PreferencesStore.put...
https://github.com/LZZLHY/hlib
2ddd0d389bb8c9fa6fe94dc8812c28350ca68d40
github
openharmony/codelabs
ETSUI/Foodbook/entry/src/main/ets/pages/login.ets
arkts
generateRandomCode
生成随机验证码
generateRandomCode(): string { const code = Math.floor(1000 + Math.random() * 9000).toString(); return code; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateRandomCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta...
generateRandomCode(): string { const code = Math.floor(1000 + Math.random() * 9000).toString(); return code; }
https://gitcode.com/openharmony/codelabs
27f95b7860878a7f2e18cf162a6ae979d0bd5354
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/EventControl.ets
arkts
setAllEventDisable
禁用所有事件
public setAllEventDisable() { this.eventMap.forEach((val, key, m) => { m.set(key, false); }) return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAllEventDisable 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#{#L...
public setAllEventDisable() { this.eventMap.forEach((val, key, m) => { m.set(key, false); }) return this; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
06961711234131ff1272588b359292f630ad5d8e
gitee
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
handleBuildStart
建造开始 — 仅 Toast(与建造结果共用开关)
async function handleBuildStart(alert: BuildStartAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableBuildResultToast) return; const prefix = alert.isLarge ? '大型建造' : '开始建造'; const body = `🚢 ${prefix}:${alert.shipName}`; console.info(`[AlertExecutor] bu...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleBuildStart AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AST#t...
async function handleBuildStart(alert: BuildStartAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableBuildResultToast) return; const prefix = alert.isLarge ? '大型建造' : '开始建造'; const body = `🚢 ${prefix}:${alert.shipName}`; console.info(`[AlertExecutor] bu...
https://github.com/CsCesium/KantaiHomo
5d7fe169749e92b2cb1ffcdf5cb31b2325e04b54
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets
arkts
searchByPublisher
按出版社搜索书籍 @param publisher 出版社名称 @param limit 返回数量限制
public async searchByPublisher(publisher: string, limit: number = 20): Promise<ScraperSearchResult> { const query = `inpublisher:${publisher}`; return this.searchVolumes(query, limit); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left searchByPublisher AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left publisher AST#identifier#Right AST#ERROR#Left AST#:#L...
public async searchByPublisher(publisher: string, limit: number = 20): Promise<ScraperSearchResult> { const query = `inpublisher:${publisher}`; return this.searchVolumes(query, limit); }
https://github.com/DaLongZhuaZi/manxia
1636a28017640d588b4e46d7d963fc076cd60d25
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/presentation/progress/components/CircleProgress.ets
arkts
startOrResumeDownload
Starts or resumes the download
startOrResumeDownload() { this.currentState = DownloadState.DOWNLOADING; let increment: number = 0; this.timerId = setInterval(() => { // Guard clause to prevent execution if the component is unmounted // This stops the pending event loop callback from modifying destroyed state variables ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startOrResumeDownload 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...
startOrResumeDownload() { this.currentState = DownloadState.DOWNLOADING; let increment: number = 0; this.timerId = setInterval(() => { // Guard clause to prevent execution if the component is unmounted // This stops the pending event loop callback from modifying destroyed state variables ...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
f96579ce725d9db138e993de50cfb46e44d94964
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
setNamespace
设置缓存命名空间(用于多数据库隔离) @param namespace 命名空间标识(通常使用数据库名)
setNamespace(namespace: string): void { this.namespace = this.normalizeNamespace(namespace) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left namespace AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)...
setNamespace(namespace: string): void { this.namespace = this.normalizeNamespace(namespace) }
https://github.com/offlinecat-dev/OCNetORM
023ad902474cb229f1dd1c6891efd91d40e792e1
github
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/PhotoService.ets
arkts
searchPhotos
搜索图片(支持名称、分类和标签搜索) @param keyword 搜索关键词 @returns Promise<PhotoModel[]> 图片列表
searchPhotos(keyword: string): Promise<PhotoModel[]> { if (!this.rdbStore) { console.error('[PhotoService] 数据库未初始化'); return Promise.reject('DB not initialized'); } if (!keyword || keyword.trim() === '') { return this.queryAll(); } let predicates = new relationalStore.RdbPredic...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left searchPhotos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
searchPhotos(keyword: string): Promise<PhotoModel[]> { if (!this.rdbStore) { console.error('[PhotoService] 数据库未初始化'); return Promise.reject('DB not initialized'); } if (!keyword || keyword.trim() === '') { return this.queryAll(); } let predicates = new relationalStore.RdbPredic...
https://gitcode.com/openharmony/codelabs
8c6b0f0ff1e2410ca6a854d875a0e48e05dd0ebf
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
getTimestamp
获取格式化的时间戳 @returns 格式化的时间戳字符串
private getTimestamp(): string { return TimeUtils.formatTimestamp(Date.now(), 'HH:mm:ss.SSS'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTimestamp 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...
private getTimestamp(): string { return TimeUtils.formatTimestamp(Date.now(), 'HH:mm:ss.SSS'); }
https://github.com/DaLongZhuaZi/manxia
f310d4845b9ba1b0eac7db35f5e22647345d5ba2
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
toString
Returns a string representation of the LightWeightSet @returns a string representation of the LightWeightSet
toString(): String { const res: Array<T> = this.toArray(); return res.join(','); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identifier#Right AST#ERROR#Right AST#state...
toString(): String { const res: Array<T> = this.toArray(); return res.join(','); }
https://gitcode.com/iop123123/arkts-static-skills
1047265269e654d32ca643ae1c40876c59ca0286
gitcode
erosTeam/NextE
feature/search/src/main/ets/viewmodel/SearchViewModel.ets
arkts
reapplyFilters
Re-run the current query with the latest filters (called when the filter sheet live-edits).
async reapplyFilters(): Promise<void> { // Search filter live edits only re-run an existing submitted query. Empty favorite scope is still // a compose/search entry, not an implicit favcat browse. const canSearch: boolean = this.query.length > 0 if (!canSearch) { this.dataSource.clear() th...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reapplyFilters AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async reapplyFilters(): Promise<void> { // Search filter live edits only re-run an existing submitted query. Empty favorite scope is still // a compose/search entry, not an implicit favcat browse. const canSearch: boolean = this.query.length > 0 if (!canSearch) { this.dataSource.clear() th...
https://github.com/erosTeam/NextE
9b92af82dc15c65ef5aa29cea6d23bbfa95189d4
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/model/Schedule.ets
arkts
getDuration
获取日程时长(分钟)
getDuration(): number { return Math.floor((this.endTime - this.startTime) / 60000) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_...
getDuration(): number { return Math.floor((this.endTime - this.startTime) / 60000) }
https://gitcode.com/openharmony/codelabs
2004d5bbd689537fb88aac5fd1a8918f05091d57
gitcode
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets
arkts
applyValueTextStyle
Applies the required styling (provided by the DataSet) to the value-paint object. @param set
protected applyValueTextStyle(dateSet: IDataSet<EntryOhos>) { this.mValuePaint.setTypeface(dateSet.getValueTypeface()); this.mValuePaint.setTextSize(dateSet.getValueTextSize()); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left applyValueTextStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dateSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
protected applyValueTextStyle(dateSet: IDataSet<EntryOhos>) { this.mValuePaint.setTypeface(dateSet.getValueTypeface()); this.mValuePaint.setTextSize(dateSet.getValueTextSize()); }
https://gitee.com/openharmony/developtools_profiler.git
5e291e1bacba07338e4209ee46d6b917da0f66db
gitee
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/ObservedPageIndex.ets
arkts
setCurrentPageIndex
设置引导页index @param index 引导页索引
setCurrentPageIndex(index: number): void { this.globalCurrentPageIndex = index; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentPageIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
setCurrentPageIndex(index: number): void { this.globalCurrentPageIndex = index; }
https://github.com/wuba/omni-ui
98643202f72c5cc744f5eb542e28fe3c3f1aae2c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
get
Gets the value wrapped in this Box. @returns { T } The value wrapped in this Box @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get(): T { return this.value as T; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right...
public get(): T { return this.value as T; }
https://gitcode.com/iop123123/arkts-static-skills
0da29268c3f1e36eaa5c374345d4821c75974047
gitcode
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
attachToolResultPart
工具结果到达时, 按 toolCallId 回写到对应 ToolPart
private attachToolResultPart(aiMessage: ChatMessage, result: ToolResult): void { for (let i = 0; i < aiMessage.parts.length; i++) { const p = aiMessage.parts[i] if (p.kind === MessagePartKind.TOOL && p.toolCallId === result.toolCallId) { p.toolResult = result.content p.toolIsError = re...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left attachToolResultPart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private attachToolResultPart(aiMessage: ChatMessage, result: ToolResult): void { for (let i = 0; i < aiMessage.parts.length; i++) { const p = aiMessage.parts[i] if (p.kind === MessagePartKind.TOOL && p.toolCallId === result.toolCallId) { p.toolResult = result.content p.toolIsError = re...
https://github.com/LongLiveY96/chatcube
3f4d553de37f28e2da6c864bbc27d73dd2e9cee2
github
arkui-x/samples
CodeLab/Cases/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
addData
改变单个数据 @param {number} index - 索引值 @param {PanelDataType} data - 修改后的值
public addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://gitcode.com/arkui-x/samples
38b49673b4449dfb482a83cf8a65e48a2b08fda3
gitcode
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
startHeartbeat
---- 心跳保活 ----
private startHeartbeat(): void { this.stopHeartbeat(); const interval = PING_MIN_TIME + Math.floor(Math.random() * (PING_MAX_TIME - PING_MIN_TIME)); this.pingTimer = setInterval(() => { this.sendPing(); }, interval); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startHeartbeat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private startHeartbeat(): void { this.stopHeartbeat(); const interval = PING_MIN_TIME + Math.floor(Math.random() * (PING_MAX_TIME - PING_MIN_TIME)); this.pingTimer = setInterval(() => { this.sendPing(); }, interval); }
https://github.com/tdcare/tdwebrtc
b05fffae2ef002c724207e3649b8a246174d3591
github
YDYm233/EasyRandom_HarmonyNextApp
common/VitalUI/src/main/ets/components/chart/PieChart.ets
arkts
constructor
所有饼状图子类
constructor(chartName: string, chartDatas: Array<PieChartData>) { this.chartName = chartName; this.chartDatas = chartDatas; }
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#identifier#Left chartName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#...
constructor(chartName: string, chartDatas: Array<PieChartData>) { this.chartName = chartName; this.chartDatas = chartDatas; }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
4443b10a75022627cde24d1e4999648fe28b7eb0
github
openharmony/applications_settings
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
getResourceItemAndState
get resource information according to resource id @param index - array position @param count - array length @param data - data
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getResourceItemAndState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation...
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility...
https://gitee.com/openharmony/applications_settings.git
73beb230a62dce6ec581a6b078696b3521b5b121
gitee
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/CoffeeDao.ets
arkts
queryAll
查询所有记录
async queryAll(): Promise<CoffeeRecord[]> { const rdbStore = this.getRdbStore() if (!rdbStore) { console.warn('CoffeeDao queryAll: rdbStore is null') return []; } const predicates = new relationalStore.RdbPredicates(this.tableName); // 按时间倒序 predicates.orderByDesc('createTime'); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryAll 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_typ...
async queryAll(): Promise<CoffeeRecord[]> { const rdbStore = this.getRdbStore() if (!rdbStore) { console.warn('CoffeeDao queryAll: rdbStore is null') return []; } const predicates = new relationalStore.RdbPredicates(this.tableName); // 按时间倒序 predicates.orderByDesc('createTime'); ...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
0773c5cf2f0f4854827b5edf0e568ddfc72c69bf
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
instance
获取路由操作的实例,如跳转、返回等操作 @deprecated @param stackName 栈名,如果有多个Navigation,需要设置,如果一个应用只有一个,可不设置 @returns
public static instance<T>(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<T> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<T>(ZRouter.routerMgr, stackName) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left instance AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AS...
public static instance<T>(stackName: string = DEFAULT_STACK_NAME): NavDestBuilder<T> { if (ZRouter.routerMgr === undefined) { ZRouter.routerMgr = ZRouter.getRouterMgr() } return NavDestBuilder.create<T>(ZRouter.routerMgr, stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L184-L189
9170abf63717a5971066de8f79f855ff6522377c
github
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
batchAddStars
批量添加星星(用于成就解锁等)
public async batchAddStars(starsList: number[]): Promise<ScoreReward> { const totalStars = starsList.reduce((sum, stars) => sum + stars, 0); return await this.addStars(totalStars); }
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 batchAddStars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left starsList AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public async batchAddStars(starsList: number[]): Promise<ScoreReward> { const totalStars = starsList.reduce((sum, stars) => sum + stars, 0); return await this.addStars(totalStars); }
https://github.com/the-wwyang/kids-learning-app
5db578bf93985b92725a0b661a27a80110a2bccb
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
map
Creates a new Int16Array using fn(arr[i]) over all elements of current Int16Array. @param { function } fn - a function to apply for each element of current Int16Array @returns { Int16Array } - a new Int16Array where for each element from current Int16Array fn was applied @syscap SystemCapability.Utils.Lang @FaAndStageM...
public map(fn: (val: number, index: int, array: Int16Array) => number): Int16Array { let resBuf = new ArrayBuffer(this.lengthInt * Int16Array.BYTES_PER_ELEMENT) let res = new Int16Array(resBuf, 0, (resBuf.getByteLength() / Int16Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < this.lengt...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number, index: int, array: Int16Array) => number): Int16Array { let resBuf = new ArrayBuffer(this.lengthInt * Int16Array.BYTES_PER_ELEMENT) let res = new Int16Array(resBuf, 0, (resBuf.getByteLength() / Int16Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < this.lengt...
https://gitcode.com/iop123123/arkts-static-skills
42b29ef3d973249ebd32a4ef194c1d376ae0c762
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
extractDomainId
提取域名级ID,兼容带路径和尾部斜杠的情况
private extractDomainId(sourceId: string): string { const match = sourceId.match(/^(https?:\/\/[^\/]+)/i); if (match) { return match[1]; } return sourceId; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractDomainId 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#st...
private extractDomainId(sourceId: string): string { const match = sourceId.match(/^(https?:\/\/[^\/]+)/i); if (match) { return match[1]; } return sourceId; }
https://github.com/DaLongZhuaZi/manxia
7bfc5ea06ff6820868961cd52c150aa28d6e8543
github
CLMC2025/Vignette
entry/src/main/ets/manager/UserStateManager.ets
arkts
isWordReviewed
判断单词是否已复习
private isWordReviewed(word: string): boolean { const progress = this.userProgress.get(word); return progress !== undefined && progress.state === UserWordState.REVIEW; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isWordReviewed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private isWordReviewed(word: string): boolean { const progress = this.userProgress.get(word); return progress !== undefined && progress.state === UserWordState.REVIEW; }
https://github.com/CLMC2025/Vignette
8fbdd4fd5608f83a27ccf3b67c6d824c0c6218cc
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
getTransY
Returns the translation (drag / pan) distance on the y-axis @return
public getTransY(): number { return this.mTransY; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTransY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
public getTransY(): number { return this.mTransY; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f741e0669e8d16bd0c657609dc62ee10cb04706a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets
arkts
calculateCoverFontSize
根据标题长度计算合适的字体大小
static calculateCoverFontSize(title: string): number { const length = title.length; if (length <= 2) { return 70; } else if (length <= 4) { return 56; } else if (length <= 6) { return 48; } else if (length <= 8) { return 36; } else if (length <= 12) { return 32; ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateCoverFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
static calculateCoverFontSize(title: string): number { const length = title.length; if (length <= 2) { return 70; } else if (length <= 4) { return 56; } else if (length <= 6) { return 48; } else if (length <= 8) { return 36; } else if (length <= 12) { return 32; ...
https://github.com/DaLongZhuaZi/manxia
d4c291272c37c8778b5b98a003bf44f6203fc695
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/pages/MainPage.ets
arkts
selectListItem
选择列表项 此方法用于处理列表项选择逻辑它在选择一个账户数据后, 准备将这个数据应用到某个操作中这里主要是通过设置类内部状态, 来指示一个现有条目被选中,并且保存这个条目的所有相关信息 @param item 被选中的列表项,类型为 AccountData,包含账户的所有必要信息
selectListItem(item: AccountData) { // 设置插入标志为 false,表示当前操作不是插入新条目 this.isInsert = false; // 查找当前选中项在账户列表中的索引 this.index = this.accounts.indexOf(item); // 复制选中项的数据到新账户对象 // 这样可以确保操作现有数据时不会直接修改原始数据源 this.newAccount = { id: item.id, // 账户ID accountType: item.accountType, // 账户类...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectListItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountData AST#identifier...
selectListItem(item: AccountData) { // 设置插入标志为 false,表示当前操作不是插入新条目 this.isInsert = false; // 查找当前选中项在账户列表中的索引 this.index = this.accounts.indexOf(item); // 复制选中项的数据到新账户对象 // 这样可以确保操作现有数据时不会直接修改原始数据源 this.newAccount = { id: item.id, // 账户ID accountType: item.accountType, // 账户类...
https://github.com/yang-kun-long/HarmonyAccounting
6f9d2b70cd165dee45e8ceac9e4f6917826e8167
github
erosTeam/NextE
shared/src/main/ets/settings/CookieJarSettings.ets
arkts
removeAccount
Remove a saved account; if it was the active one, switch to another saved account or fully log out.
static async removeAccount(context: common.UIAbilityContext, memberId: string): Promise<void> { const wasActive: boolean = EhCookieStore.getInstance().get(EhConstants.COOKIE_MEMBER_ID) === memberId const remaining: string[] = await AccountListSettings.remove(context, memberId) if (wasActive) { ...
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 removeAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : ...
static async removeAccount(context: common.UIAbilityContext, memberId: string): Promise<void> { const wasActive: boolean = EhCookieStore.getInstance().get(EhConstants.COOKIE_MEMBER_ID) === memberId const remaining: string[] = await AccountListSettings.remove(context, memberId) if (wasActive) { ...
https://github.com/erosTeam/NextE
73ae31fca75d65e33b06e946402dc432a14bb918
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/settings/src/main/ets/viewmodel/SettingsViewModel.ets
arkts
getInstance
获取SettingsViewModel实例 @returns SettingsViewModel
public static getInstance(): SettingsViewModel { if (!SettingsViewModel.instance) { SettingsViewModel.instance = new SettingsViewModel() } return SettingsViewModel.instance }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): SettingsViewModel { if (!SettingsViewModel.instance) { SettingsViewModel.instance = new SettingsViewModel() } return SettingsViewModel.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
a35aa2d70c3a1565a9b6e7b55f17a72ee76031ed
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/InteractionManager.ets
arkts
getAllScenes
获取所有场景列表
public static getAllScenes(): VibrationScene[] { return [ VibrationScene.BUTTON_CLICK, VibrationScene.TOGGLE_SWITCH, VibrationScene.LIST_ITEM_SELECT, VibrationScene.LONG_PRESS, VibrationScene.SWIPE_ACTION, VibrationScene.PAGE_TURN, VibrationScene.CHAPTER_CHANGE, VibrationScene.BOOKMARK_ADD, Vibr...
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 getAllScenes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public static getAllScenes(): VibrationScene[] { return [ VibrationScene.BUTTON_CLICK, VibrationScene.TOGGLE_SWITCH, VibrationScene.LIST_ITEM_SELECT, VibrationScene.LONG_PRESS, VibrationScene.SWIPE_ACTION, VibrationScene.PAGE_TURN, VibrationScene.CHAPTER_CHANGE, VibrationScene.BOOKMARK_ADD, Vibr...
https://github.com/DaLongZhuaZi/manxia
ddbc454130efd735da507b4127665ea3a9af7edd
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
endSession
结束学习会话 @param session 学习会话 @returns 更新后的会话
static endSession(session: LearningSession): LearningSession { const endTime = new Date().toISOString(); const startDate = new Date(session.startTime); const endDate = new Date(endTime); const durationMs = endDate.getTime() - startDate.getTime(); const durationMinutes = Math.round(durationMs / 600...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left endSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left session AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Le...
static endSession(session: LearningSession): LearningSession { const endTime = new Date().toISOString(); const startDate = new Date(session.startTime); const endDate = new Date(endTime); const durationMs = endDate.getTime() - startDate.getTime(); const durationMinutes = Math.round(durationMs / 600...
https://github.com/the-wwyang/kids-learning-app
5b63e063dff1bc0b7706b09be47f993ec808a32b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint8ClampedArray with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type int in newly created Uint8ClampedArray @throws { RangeError...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
1ea8e5287971267bab43dc18328ec53a6a265f7e
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceField.ets
arkts
getValue
Reads the value from the instance field. @param { Object } thisObj The target object as the `this` context. @returns { Any } Returns the value read from the instance field. @throws { TypeError } Throws when `thisObj` is incompatible with the field. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getValue(thisObj: Object): Any { return super.getValueInternal(thisObj) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left thisObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#identifie...
public getValue(thisObj: Object): Any { return super.getValueInternal(thisObj) }
https://gitcode.com/iop123123/arkts-static-skills
0fe57185b0b0af4f41488f6f51865db48bc000da
gitcode
dingzhilin1990/zhilinclaw
src/agents/HanwudiWorkflow.ets
arkts
step1_Research
步骤 1: 研究调研
private async step1_Research(requirement: string): Promise<any> { this.addLog(1, 'Researcher', '开始背景调研', 'started'); const result = await this.researcher.process(requirement); this.addLog(1, 'Researcher', '背景调研完成', result.success ? 'completed' : 'failed', result.documents ); ...
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 step1_Research AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requirement AST#identifier#Right AST#ERROR#Left AST#:...
private async step1_Research(requirement: string): Promise<any> { this.addLog(1, 'Researcher', '开始背景调研', 'started'); const result = await this.researcher.process(requirement); this.addLog(1, 'Researcher', '背景调研完成', result.success ? 'completed' : 'failed', result.documents ); ...
https://github.com/dingzhilin1990/zhilinclaw
23e31092375b8b03bfe3b708938d62f640b4800f
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/FriendHandler.ets
arkts
deleteFriend
删除好友关系(双向删除)
async deleteFriend(myPhone: string, friendPhone: string): Promise<void> { if (!this.store) { return; } try { const predicates = new relationalStore.RdbPredicates('Friend'); // 删除两条记录:我与他,他与我 predicates.beginWrap() .equalTo('myPhone', myPhone) .and() .equalT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteFriend AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST...
async deleteFriend(myPhone: string, friendPhone: string): Promise<void> { if (!this.store) { return; } try { const predicates = new relationalStore.RdbPredicates('Friend'); // 删除两条记录:我与他,他与我 predicates.beginWrap() .equalTo('myPhone', myPhone) .and() .equalT...
https://gitcode.com/openharmony/codelabs
cfd09452ff45c81128b326042aa3a2c366494d2e
gitcode
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/search-box/TnSearchBox.ets
arkts
getSizeLineHeightKey
搜索框各尺寸对应行高属性名
function getSizeLineHeightKey(size: string): string { switch (size) { case "sm": return "lineHeightXs"; case "lg": return "lineHeightMd"; case "xl": return "lineHeightLg"; default: return "lineHeightSm"; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getSizeLineHeightKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left size AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function getSizeLineHeightKey(size: string): string { switch (size) { case "sm": return "lineHeightXs"; case "lg": return "lineHeightMd"; case "xl": return "lineHeightLg"; default: return "lineHeightSm"; } }
https://github.com/codelably/tuniao-ui
f68f11a753d587cb6a3cc7ee5e89af5a0b7adbbe
github
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
queryEpisodesByPodcastId
根据播客ID查询Episodes
async queryEpisodesByPodcastId(podcastId: string): Promise<Episode[]> { if (!this.rdbStore) return []; try { const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE); predicates.equalTo('podcastId', podcastId); predicates.orderByDesc('pubDate'); const resultSet =...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryEpisodesByPodcastId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left podcastId AST#identifier#Right AST#...
async queryEpisodesByPodcastId(podcastId: string): Promise<Episode[]> { if (!this.rdbStore) return []; try { const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE); predicates.equalTo('podcastId', podcastId); predicates.orderByDesc('pubDate'); const resultSet =...
https://github.com/pangpang20/antennaPodHM
477e1ff9243e08afa0100da452ddfd5d6da06b8e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
extractAuthor
提取作者(增强版,支持多种格式)
private static extractAuthor(headerText: string): string { // 清理头部文本 const cleanedHeader = TxtMetadataExtractor.cleanHeaderText(headerText); for (const pattern of TxtMetadataExtractor.AUTHOR_PATTERNS) { const match = cleanedHeader.match(pattern); if (match) { // 处理多个捕获组 co...
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 extractAuthor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left headerText AST#identifier#Right AST#ERROR#Left AST#:#...
private static extractAuthor(headerText: string): string { // 清理头部文本 const cleanedHeader = TxtMetadataExtractor.cleanHeaderText(headerText); for (const pattern of TxtMetadataExtractor.AUTHOR_PATTERNS) { const match = cleanedHeader.match(pattern); if (match) { // 处理多个捕获组 co...
https://github.com/DaLongZhuaZi/manxia
2f23e781282d2e40316441ad0e4558ba6fe6c7fe
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the Int8Array with specified value @param { number } value - new value @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { this } - modified Int8Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): this { this.fill(Int8Array.doubleToInt(value), start, end) 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 fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start?: int, end?: int): this { this.fill(Int8Array.doubleToInt(value), start, end) return this }
https://gitcode.com/iop123123/arkts-static-skills
df16769140358335dbcc130a3811b0b38e8a1f5b
gitcode
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
setTransient
设置临时数据(非数据库字段) @param key 键名 @param value 值
setTransient(key: string, value: ValueType): void { this.transientData.set(key, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTransient 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#identifier#Right AST#,#Left , AST...
setTransient(key: string, value: ValueType): void { this.transientData.set(key, value) }
https://github.com/offlinecat-dev/OCNetORM
f69ee731113d1ce9a2e903b0d0c3c0566ba30d14
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
and
Does logical `and` on this instance and provided instance @param { Boolean } other provided instance @returns { Boolean } The logical AND result of both Boolean instances @syscap SystemCapability.Utils.Lang @FaAndStageModel
public and(other: Boolean): Boolean { return new Boolean(this.value && other) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left and AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public and(other: Boolean): Boolean { return new Boolean(this.value && other) }
https://gitcode.com/iop123123/arkts-static-skills
347f81d220d82b1cb5d187ebcfca7d7309e66a13
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/RomParser.ets
arkts
bytesToInt
将小端字节数组转换为整数
function bytesToInt(data: Uint8Array, offset: number): number { return (data[offset] & 0xFF) | ((data[offset + 1] & 0xFF) << 8) | ((data[offset + 2] & 0xFF) << 16) | ((data[offset + 3] & 0xFF) << 24); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left bytesToInt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function bytesToInt(data: Uint8Array, offset: number): number { return (data[offset] & 0xFF) | ((data[offset + 1] & 0xFF) << 8) | ((data[offset + 2] & 0xFF) << 16) | ((data[offset + 3] & 0xFF) << 24); }
https://github.com/richshaw2015/nds
e7a9db77e1268857a0f2e8ff042782637d905897
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
from
Creates an Float32Array from array-like argument @param o array-like object to initialize Float32Array @returns new Float32Array
public from(o: Object): Float32Array { throw new Error("Float32Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Float32Array { throw new Error("Float32Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
73db2adbf7c6db7fa8a87f8f991f4bb5d8f178ea
gitee
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleEvents.ets
arkts
consentForInternalEvent
Map a [CLY]_* internal event key to the feature consents that gate it. Returns an OR-set: any single consent in the array unlocks the event. Unknown internal events return `[]` (allow). Reflects the dev guide's "Internal Events" consent mapping table.
private static consentForInternalEvent(key: string): string[] { if (key === '[CLY]_view') return [CountlyFeature.VIEWS]; if (key === '[CLY]_nps' || key === '[CLY]_survey') return [CountlyFeature.FEEDBACK]; // Rating + action events accept multiple consents, gives integrators // the flexibility to gran...
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 consentForInternalEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST...
private static consentForInternalEvent(key: string): string[] { if (key === '[CLY]_view') return [CountlyFeature.VIEWS]; if (key === '[CLY]_nps' || key === '[CLY]_survey') return [CountlyFeature.FEEDBACK]; // Rating + action events accept multiple consents, gives integrators // the flexibility to gran...
https://github.com/Countly/countly-sdk-hos
993f5684ea8b59c79826d46911048c99b8ec84c6
github
OHPG/FinSdk
emby/src/main/ets/api/UserApi.ets
arkts
deleteUser
deleteUser @summary Deletes a user. @param userId requestParameters Request parameters. @throws {RequiredError} @memberof UserApi
public async deleteUser(userId: string): Promise<void> { return this.apiClient.post({ path: `/Users/${userId}/Delete` }) }
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 deleteUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#...
public async deleteUser(userId: string): Promise<void> { return this.apiClient.post({ path: `/Users/${userId}/Delete` }) }
https://github.com/OHPG/FinSdk
b8649fe6d271b15cb9679dbdc9b6b1706df7b9f8
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/sub_pages/metronome/MetronomePage.ets
arkts
changeBPM
调整BPM
changeBPM(value: number): void { this.bpm = Math.max(this.minBPM, Math.min(this.maxBPM, value)) // 如果正在运行,重启定时器以应用新的BPM if (this.isRunning) { this.stopMetronome() this.startMetronome() } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left changeBPM 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 number AST#identifier#Right AST#)#Left ) AST#...
changeBPM(value: number): void { this.bpm = Math.max(this.minBPM, Math.min(this.maxBPM, value)) // 如果正在运行,重启定时器以应用新的BPM if (this.isRunning) { this.stopMetronome() this.startMetronome() } }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
cd053ca0460c94b4cc9627176ed8de429250444e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/SuwayomiTracker.ets
arkts
search
==================== BaseTracker 抽象方法实现 ==================== 搜索(用于跟踪绑定)
public async search(query: string): Promise<TrackSearchResult[]> { // 从库中搜索 const graphqlQuery = ` query SearchLibrary($query: String!) { mangas(condition: { inLibrary: true }, filter: { title: { includesInsensitive: $query } }) { nodes { id title th...
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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Rig...
public async search(query: string): Promise<TrackSearchResult[]> { // 从库中搜索 const graphqlQuery = ` query SearchLibrary($query: String!) { mangas(condition: { inLibrary: true }, filter: { title: { includesInsensitive: $query } }) { nodes { id title th...
https://github.com/DaLongZhuaZi/manxia
5edb9c135b351d4e487713190ffc157c4800b712
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaDaysInYear
@see ECMA-262, 20.4.1.3 @returns number of days in the given year.
function ecmaDaysInYear(year: int): int { if ((year % 4 != 0) || ((year % 100 == 0) && (year % 400 != 0))) { return dayCountInYear; } return dayCountInLeapYear; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaDaysInYear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function ecmaDaysInYear(year: int): int { if ((year % 4 != 0) || ((year % 100 == 0) && (year % 400 != 0))) { return dayCountInYear; } return dayCountInLeapYear; }
https://gitcode.com/iop123123/arkts-static-skills
70e6cfca2920b9b4e9f8e4836f806f05aeaa3f4d
gitcode
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/DataManager.ets
arkts
saveHealthGoal
保存健康目标
async saveHealthGoal(goal: HealthGoal): Promise<boolean> { try { const goals = await this.getAllHealthGoals(); const index = goals.findIndex(g => g.id === goal.id); if (index >= 0) { goals[index] = goal; } else { goals.push(goal); } await this.dataPreferences?...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveHealthGoal AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goal AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async saveHealthGoal(goal: HealthGoal): Promise<boolean> { try { const goals = await this.getAllHealthGoals(); const index = goals.findIndex(g => g.id === goal.id); if (index >= 0) { goals[index] = goal; } else { goals.push(goal); } await this.dataPreferences?...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
83836dd8595ab4468cecd549074e01fc8f4ee1c6
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/PageRepository.ets
arkts
constructor
构造函数 @param networkDataSource 页面网络数据源
constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); }
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 networkDataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS
3179a1ba295fafbbf2a64f1405e7222a1fbe9df9
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSourceImpl.ets
arkts
createSession
创建客服会话 @returns {Promise<NetworkResponse<CsSession>>} 会话信息
async createSession(): Promise<NetworkResponse<CsSession>> { const resp: AxiosResponse<NetworkResponse<CsSession>> = await NetworkClient.http.post("cs/session/create"); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createSession AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async createSession(): Promise<NetworkResponse<CsSession>> { const resp: AxiosResponse<NetworkResponse<CsSession>> = await NetworkClient.http.post("cs/session/create"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
5672169855764e93fff03498f4c499921babe570
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 { number } value - value to set @returns { Float32Array } - an Float32Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndS...
public with(index: int, value: number): Float32Array { let res = new Float32Array(this) res.set(index, value.toFloat()) 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: number): Float32Array { let res = new Float32Array(this) res.set(index, value.toFloat()) return res }
https://gitcode.com/iop123123/arkts-static-skills
c82b1e90a8af3ac42f980e9ee6e2254af47d6fb2
gitcode
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets
arkts
decrypt
Decryption @param content Decryption content. @param authTag AuthTag content. @returns Promise object with decrypted content.
async decrypt(content: string, authTag: string): Promise<string> { // Initialize the encryption operating environment: Start decryption. let mode = cryptoFramework.CryptoMode.DECRYPT_MODE; let gcmParams = await this.genGcmParamsSpec(); let authTagBlob: cryptoFramework.DataBlob = { data: DataTran...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left decrypt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async decrypt(content: string, authTag: string): Promise<string> { // Initialize the encryption operating environment: Start decryption. let mode = cryptoFramework.CryptoMode.DECRYPT_MODE; let gcmParams = await this.genGcmParamsSpec(); let authTagBlob: cryptoFramework.DataBlob = { data: DataTran...
https://gitee.com/openharmony/codelabs.git
09fc0d00ae5f924e7e0de2b087188f6a7550090b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceSearchService.ets
arkts
getSearchableSourceCount
获取可用书源数量
getSearchableSourceCount(): number { return this.getSearchableSources().length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSearchableSourceCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
getSearchableSourceCount(): number { return this.getSearchableSources().length; }
https://github.com/DaLongZhuaZi/manxia
71e24816cb52ac9e2237c61137573b51fe8ca3cf
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/MockWriterCoreBridge.ets
arkts
listVolumes
Volume methods
async listVolumes(projectId: string): Promise<ResultEnvelope<Volume[]>> { await this.delay(100) return this.success(this.mockVolumes.get(projectId) || [] as Volume[]) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listVolumes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left projectId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async listVolumes(projectId: string): Promise<ResultEnvelope<Volume[]>> { await this.delay(100) return this.success(this.mockVolumes.get(projectId) || [] as Volume[]) }
https://github.com/Xiwei753/xiezuoruanjian
935b10843ec24f0c780a72c10f3e998a4d0e08e6
github