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
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/config/MessageListConfig.ets
arkts
isSupportCopy
Message action getters
get isSupportCopy(): boolean { if (this.userIsSupportCopy !== undefined) { return this.userIsSupportCopy; } return AppBuilderConfig.getInstance().messageActionList.some(action => action === 'copy'); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isSupportCopy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#...
get isSupportCopy(): boolean { if (this.userIsSupportCopy !== undefined) { return this.userIsSupportCopy; } return AppBuilderConfig.getInstance().messageActionList.some(action => action === 'copy'); }
https://github.com/Tencent-RTC/TUIKit_Harmony
9ac6b8bb4b6d65d637e3d0203fc4358758b76358
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/InterceptorHttpClient.ets
arkts
enqueue
Execute an HTTP request asynchronously with interceptors applied. @param config The request configuration. @param onResponse Callback for successful responses. @param onFailure Callback for failed requests.
enqueue<T>(config: HttpRequestConfig, onResponse: (response: Response<T>) => void, onFailure: (error: Error) => void): void { try { // Create the interceptor chain const chain = new RealInterceptorChain( this.interceptors, 0, config, this.delegate, config.connec...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left enqueue AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identif...
enqueue<T>(config: HttpRequestConfig, onResponse: (response: Response<T>) => void, onFailure: (error: Error) => void): void { try { // Create the interceptor chain const chain = new RealInterceptorChain( this.interceptors, 0, config, this.delegate, config.connec...
https://github.com/killetom/ktretrofit
6f83487b3411da6aa7db7531c09a678900a61f74
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
executeLogin
执行登录工作流
async executeLogin(username: string, password: string): Promise<EngineResult<string>> { if (!this.config) { logger.error(TAG, '配置未加载,无法执行登录'); throw new MangaSourceError( MangaSourceErrorCode.CONFIG_NOT_LOADED, '配置未加载' ); } const startTime = Date.now(); logger.info(T...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeLogin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AS...
async executeLogin(username: string, password: string): Promise<EngineResult<string>> { if (!this.config) { logger.error(TAG, '配置未加载,无法执行登录'); throw new MangaSourceError( MangaSourceErrorCode.CONFIG_NOT_LOADED, '配置未加载' ); } const startTime = Date.now(); logger.info(T...
https://github.com/DaLongZhuaZi/manxia
774f968f74ad701e7923c9fcd280ae1adc26c55e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToSharedBill
转换为SharedBill
static convertToSharedBill(resultSet: relationalStore.ResultSet): SharedBill { const bill = new SharedBill(); bill.billId = DAOHelper.getNumberValue(resultSet, 'bill_id'); bill.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id'); bill.creatorId = DAOHelper.getNumberValue(resultSet, 'creator_id...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToSharedBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_...
static convertToSharedBill(resultSet: relationalStore.ResultSet): SharedBill { const bill = new SharedBill(); bill.billId = DAOHelper.getNumberValue(resultSet, 'bill_id'); bill.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id'); bill.creatorId = DAOHelper.getNumberValue(resultSet, 'creator_id...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3f8071ae49c383a3b20d37010c7d24be2ab828c0
github
Bistu-OSSDT-2024/16-ArkNotes
Index.ets
arkts
aboutToAppear
页面初始化前向页面加载数据
aboutToAppear() { this.originMemoList = [] this.memoList = [] this.order = false this.keywords = '' this.isAddDialogShow = false this.isEditDialogShow = false this.addContent = '' this.editingMemoIndex = -1 this.editContent = '' this.MemoTable.getRdbStore(() => { this.Me...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.originMemoList = [] this.memoList = [] this.order = false this.keywords = '' this.isAddDialogShow = false this.isEditDialogShow = false this.addContent = '' this.editingMemoIndex = -1 this.editContent = '' this.MemoTable.getRdbStore(() => { this.Me...
https://github.com/Bistu-OSSDT-2024/16-ArkNotes
c5cbafd48a676644014ec83b3b22594974e7ec8d
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets
arkts
urlEncode
URL编码对象 @param data 数据对象 @return string URL编码字符串
protected urlEncode(data: Record<string, string>): string { const pairs: string[] = []; const entries = Object.entries(data); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][1]; pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(val...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left urlEncode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation...
protected urlEncode(data: Record<string, string>): string { const pairs: string[] = []; const entries = Object.entries(data); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][1]; pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(val...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L296-L305
5fc089cb6740f90d6aa0a833ecb86f13df1d6d9b
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideorecommended/src/main/ets/view/PopularVideo.ets
arkts
updateVideoGridColumn
Updates grid column template based on current width breakpoint.
updateVideoGridColumn(): void { if (this.curBp === WidthBreakpoint.WIDTH_XS) { this.videoGridColumn = MainPageConstants.VIDEO_GRID_COLUMNS[0]; } else if (this.curBp === WidthBreakpoint.WIDTH_SM) { this.videoGridColumn = MainPageConstants.VIDEO_GRID_COLUMNS[0]; } else if (this.curBp === WidthBr...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateVideoGridColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statem...
updateVideoGridColumn(): void { if (this.curBp === WidthBreakpoint.WIDTH_XS) { this.videoGridColumn = MainPageConstants.VIDEO_GRID_COLUMNS[0]; } else if (this.curBp === WidthBreakpoint.WIDTH_SM) { this.videoGridColumn = MainPageConstants.VIDEO_GRID_COLUMNS[0]; } else if (this.curBp === WidthBr...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
c1e6361ae4ab1148280a5dd517388444be2d086f
gitcode
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
translate
Translate method
translate(translateX: number, translateY: number): Offset { return new Offset(this.dx + translateX, this.dy + translateY); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left translate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left translateX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#R...
translate(translateX: number, translateY: number): Offset { return new Offset(this.dx + translateX, this.dy + translateY); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L108-L110
36f6d7499abf5c6b643a0a96f03d759844613463
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets
arkts
createWantAgent
创建WantAgent(简化版本,先不处理)
private async createWantAgent(): Promise<SimpleWantAgent | undefined> { try { // 暂时不创建WantAgent return undefined; } catch (error) { console.error('创建WantAgent失败:', this.formatError(error)); return undefined; } }
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 createWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async createWantAgent(): Promise<SimpleWantAgent | undefined> { try { // 暂时不创建WantAgent return undefined; } catch (error) { console.error('创建WantAgent失败:', this.formatError(error)); return undefined; } }
https://gitcode.com/openharmony/codelabs
4cd18612dd313e24fbbc825477a0034a5ea28e8f
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/pages/Index.ets
arkts
aboutToDisappear
组件即将消失时的生命周期回调 移除主题变更监听器
aboutToDisappear(): void { // 移除主题变更监听器 if (this.themeChangeListener) { this.themeManager.removeListener(this.themeChangeListener); this.themeChangeListener = null; hilog.info(DOMAIN, TAG, 'Theme change listener removed'); } // 移除显示变化监听器 try { display.off('change', this.dis...
AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#co...
aboutToDisappear(): void { // 移除主题变更监听器 if (this.themeChangeListener) { this.themeManager.removeListener(this.themeChangeListener); this.themeChangeListener = null; hilog.info(DOMAIN, TAG, 'Theme change listener removed'); } // 移除显示变化监听器 try { display.off('change', this.dis...
https://github.com/richshaw2015/nds
c16c68332b1b738d4fc416a68b92e6d227ccc20d
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/AdviceFeedback.ets
arkts
isRejected
判断是否已拒绝
isRejected(): boolean { return this.feedbackStatus === FEEDBACK_REJECTED; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRejected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statemen...
isRejected(): boolean { return this.feedbackStatus === FEEDBACK_REJECTED; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3b668f1fdb7a2b7c6cf864a2dd6b99a2f54b7ac7
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test42_original_index.ets
arkts
testReduceGroupBy
=== Round 42: Array.reduce multi-accumulator, String.replaceAll, Object.keys iteration, Validator chain pattern, coprime check, nested Map iteration, array reverse sort === --- Array.reduce with object accumulator via Map ---
function testReduceGroupBy(): string { let words: string[] = ['ant', 'bee', 'ape', 'bat', 'bear', 'cat']; let groups: Map<string, string[]> = new Map(); for (let i: number = 0; i < words.length; i++) { let w: string = words[i]; let key: string = w.charAt(0); let existing: string[] | undefined = groups...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testReduceGroupBy 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#predefine...
function testReduceGroupBy(): string { let words: string[] = ['ant', 'bee', 'ape', 'bat', 'bear', 'cat']; let groups: Map<string, string[]> = new Map(); for (let i: number = 0; i < words.length; i++) { let w: string = words[i]; let key: string = w.charAt(0); let existing: string[] | undefined = groups...
https://github.com/miaochiahao/ark-ghidra
1282734ea5e46aa4775e69b2810191ea851c2c26
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
onAddAddress
点击新增地址 @returns {void} 无返回值
onAddAddress(): void { UserNavigator.toAddressDetail().then((result?: RefreshResult): void => { if (result?.refresh) { this.onRefresh(); } }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAddAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block...
onAddAddress(): void { UserNavigator.toAddressDetail().then((result?: RefreshResult): void => { if (result?.refresh) { this.onRefresh(); } }); }
https://github.com/Joker-x-dev/CoolMallArkTS
7b07c8834a27171dd5974d91da952a90c3fd535e
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/CheatManager.ets
arkts
getCheatsDir
======================================================================== 路径工具 ======================================================================== 获取 cheats 根目录: {downloadDir}/cheats/
private getCheatsDir(): string { const downloadDir = DownloadDirManager.getInstance().getDownloadDirPath(); if (!downloadDir) return ''; return `${downloadDir}/cheats`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCheatsDir 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 getCheatsDir(): string { const downloadDir = DownloadDirManager.getInstance().getDownloadDirPath(); if (!downloadDir) return ''; return `${downloadDir}/cheats`; }
https://github.com/richshaw2015/nds
f21930a1ac8abb2cbb2f9ce0e035d9af0aedd1c0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
getName
获取控制器名称
getName(): string { return this.deviceName; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bloc...
getName(): string { return this.deviceName; }
https://github.com/AlkaidLab/moonlight-harmony
82a8878b4f8235e098d7fb613f23483d801073b8
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyTypes.ets
arkts
buildNumberPresets
构建数字 0-9 预设列表
function buildNumberPresets(): KeyPreset[] { const list: KeyPreset[] = []; for (let i = 0; i < 10; i++) { const preset: KeyPreset = { label: i.toString(), action: { type: 'keyboard', vk: 0x30 + i } as KeyboardAction, }; list.push(preset); } return list; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildNumberPresets 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#array_ty...
function buildNumberPresets(): KeyPreset[] { const list: KeyPreset[] = []; for (let i = 0; i < 10; i++) { const preset: KeyPreset = { label: i.toString(), action: { type: 'keyboard', vk: 0x30 + i } as KeyboardAction, }; list.push(preset); } return list; }
https://github.com/AlkaidLab/moonlight-harmony
24c25d2ae60eedb5afa71b2e48925d8dcffd1de4
github
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
getShadow
获取设备影子 @param shadowRequest 请求设备影子参数 @param listener 发布监听器
getShadow(shadowRequest: ShadowRequest, qos: IoTMqttQos = 0) { const topic = `$oc/devices/${this.clientConf.deviceId}/sys/shadow/get/request_id=${util.generateRandomUUID()}}`; const publishOption: IoTMqttPublishOptions = { topic: topic, qos: qos, payload: JSON.stringify(shadowRequest) }...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getShadow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shadowRequest AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ShadowRequest AST#iden...
getShadow(shadowRequest: ShadowRequest, qos: IoTMqttQos = 0) { const topic = `$oc/devices/${this.clientConf.deviceId}/sys/shadow/get/request_id=${util.generateRandomUUID()}}`; const publishOption: IoTMqttPublishOptions = { topic: topic, qos: qos, payload: JSON.stringify(shadowRequest) }...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
c8fddc1cde033a2142e91aea7b85a31bb741e239
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/navigation/pages/NavigationDemo2_Page3.ets
arkts
navigationDemo2_page3_builder
NavDestination - 导航组件(Navigation)导航到的目标页 路由表中 routerMap 的 buildFunction 指定的 @Builder 函数,用于构造此路由指向的组件 name - 路由名称 param - 传递过来的数据
@Builder function navigationDemo2_page3_builder(name: string, param: Object) { NavigationDemo2_Page3() }
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 navigationDemo2_page3_builder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST...
@Builder function navigationDemo2_page3_builder(name: string, param: Object) { NavigationDemo2_Page3() }
https://github.com/webabcd/HarmonyDemo
ba0799a312a8711277b6e0e4d7dc1f3fee6489ec
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
some
Determines whether the specified callback function returns true for any element of an array. @param { function } predicate - A function that accepts three arguments. The some method calls the predicate function for each element in the array until the predicate returns a true or until the end of the array. @returns { bo...
public some(predicate: (element: number, index: int, array: Int8Array) => boolean): boolean { for (let i = 0; i < this.lengthInt; ++i) { if (predicate((this.getUnsafe(i)).toDouble(), i, this)) { return true } } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left predicate AST#identifi...
public some(predicate: (element: number, index: int, array: Int8Array) => boolean): boolean { for (let i = 0; i < this.lengthInt; ++i) { if (predicate((this.getUnsafe(i)).toDouble(), i, this)) { return true } } return false }
https://gitcode.com/iop123123/arkts-static-skills
d7169d0ba5050be2fea21c1746c015cf8d306481
gitcode
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
getTodoRepository
=== 懒加载获取 Repository ===
private getTodoRepository(): TodoRepository { if (!this.todoRepository) { this.todoRepository = new TodoRepository(); } return this.todoRepository; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTodoRepository 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 T...
private getTodoRepository(): TodoRepository { if (!this.todoRepository) { this.todoRepository = new TodoRepository(); } return this.todoRepository; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L301-L306
bdaecf86e36dbe5d7d5b16eb728069ba5074cc7d
github
Vsolon0401/MallShopping
common/src/main/ets/service/ShoppingCartService.ets
arkts
updateCartItem
更新购物车中指定商品规格 @param cartItem @returns
async updateCartItem(cartItem: CartItem) { return Request.post('/cart/update/attr', cartItem) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateCartItem AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cartItem AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async updateCartItem(cartItem: CartItem) { return Request.post('/cart/update/attr', cartItem) }
https://github.com/Vsolon0401/MallShopping
b0efaf7fd8743171c09a6af8b88953ab42cfc2be
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataValidator.ets
arkts
combineResults
组合多个验证结果 @param results - 验证结果数组 @returns 合并后的验证结果
static combineResults(results: ValidationResult[]): ValidationResult { const allErrors: string[] = []; let isValid = true; for (const result of results) { if (!result.isValid) { isValid = false; allErrors.push(...result.errors); } } return new ValidationResult...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left combineResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr...
static combineResults(results: ValidationResult[]): ValidationResult { const allErrors: string[] = []; let isValid = true; for (const result of results) { if (!result.isValid) { isValid = false; allErrors.push(...result.errors); } } return new ValidationResult...
https://github.com/DaLongZhuaZi/manxia
19e7d0ce183dc3b0b2b7ea8f602aa83167120f85
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
cancelSync
取消正在进行的同步
static async cancelSync(userId: number): Promise<boolean> { try { const inProgressSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getInProgressSync(userId); if (!inProgressSync) { return false; } await CloudSyncRecordDAO.updateStatus(inProgressSync.syncId, 'failed', '用户取消'...
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 cancelSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#...
static async cancelSync(userId: number): Promise<boolean> { try { const inProgressSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getInProgressSync(userId); if (!inProgressSync) { return false; } await CloudSyncRecordDAO.updateStatus(inProgressSync.syncId, 'failed', '用户取消'...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ea120a6f7e8f818f53c4fd3a00bc5b38c4887414
github
popsiclelmlm/Hey
entry/src/main/ets/features/assets/AssetsController.ets
arkts
copyLocalFileToAssets
流式拷贝文件到沙箱
async copyLocalFileToAssets( context: common.Context, srcUri: string, destFileName: string, language: AppLanguage, onSuccess: () => void, onError: (errMsg: string) => void ): Promise<boolean> { const destPath = `${context.filesDir}/${destFileName}`; const tempPath = `${context.filesD...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left copyLocalFileToAssets AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST...
async copyLocalFileToAssets( context: common.Context, srcUri: string, destFileName: string, language: AppLanguage, onSuccess: () => void, onError: (errMsg: string) => void ): Promise<boolean> { const destPath = `${context.filesDir}/${destFileName}`; const tempPath = `${context.filesD...
https://github.com/popsiclelmlm/Hey
6ac41e4893e676a09decf8843b4452fcefab3cd2
github
HarmonyOS_Samples/MultiPictureBeautification
multipicturecommon/src/main/ets/utils/WindowUtil.ets
arkts
setFullScreen
Set fullscreen mode: content extends under system bars
setFullScreen(isFullScreen: boolean): void { if (!this.mainWindow) { return; } this.mainWindow.setWindowLayoutFullScreen(isFullScreen) .then(() => { Logger.info(LogConstants.LOG_TAG_WINDOW_UTIL, 'Succeeded in setting full-screen mode.'); this.mainWindowInfo.isFullScreen = isFul...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFullScreen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ...
setFullScreen(isFullScreen: boolean): void { if (!this.mainWindow) { return; } this.mainWindow.setWindowLayoutFullScreen(isFullScreen) .then(() => { Logger.info(LogConstants.LOG_TAG_WINDOW_UTIL, 'Succeeded in setting full-screen mode.'); this.mainWindowInfo.isFullScreen = isFul...
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
d87837df0600e5c6d266d1990c01ecb654e8cb43
gitcode
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGPath.ets
arkts
setPathLength
设置路径长度 @param newPathLength 路径长度
public setPathLength(newPathLength: number): void{ this._pathLength = newPathLength; this._pathResultObj['pathLength'] = newPathLength; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPathLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newPathLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public setPathLength(newPathLength: number): void{ this._pathLength = newPathLength; this._pathResultObj['pathLength'] = newPathLength; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
17246544b299962272494af8414248abec95570b
gitee
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/LoggingInterceptor.ets
arkts
constructor
Create a new LoggingInterceptor. @param tag The tag to use for logging (default: 'Retrofit'). @param logLevel The level of logging detail (default: LogLevel.BASIC).
constructor(tag: string = 'Retrofit', logLevel: LogLevel = LogLevel.BASIC) { this.tag = tag; this.logLevel = logLevel; }
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 tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left...
constructor(tag: string = 'Retrofit', logLevel: LogLevel = LogLevel.BASIC) { this.tag = tag; this.logLevel = logLevel; }
https://github.com/killetom/ktretrofit
fb0925e2abbdbd589694fc6630890e9c98a51907
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/logger/AGenUILogger.ets
arkts
onLogFromNative
Handle log message from native C++ layer This method is called from NAPI layer @param level Log level @param tag Log tag @param func Function name @param line Line number @param message Log message
public onLogFromNative(level: number, tag: string, func: string, line: number, message: string): void { if (level < this.minLogLevel) { return; } if (this.customLogger) { try { this.customLogger.onLog(level, tag, func, line, message); } catch (error) { hilog.error(this.do...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onLogFromNative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public onLogFromNative(level: number, tag: string, func: string, line: number, message: string): void { if (level < this.minLogLevel) { return; } if (this.customLogger) { try { this.customLogger.onLog(level, tag, func, line, message); } catch (error) { hilog.error(this.do...
https://github.com/AGenUI/AGenUI
7de1f976ffe3ee05c9a989225b1dd817e21ca421
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelReplaceRuleManager.ets
arkts
parseSourceIds
解析sourceIds字符串
private parseSourceIds(str: string): string[] | undefined { if (!str || str === '') { return undefined; } try { return SafeUtils.parseArr(str) as string[]; } catch { return undefined; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSourceIds 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...
private parseSourceIds(str: string): string[] | undefined { if (!str || str === '') { return undefined; } try { return SafeUtils.parseArr(str) as string[]; } catch { return undefined; } }
https://github.com/DaLongZhuaZi/manxia
62d9c0c919ad2bdb8f25431319c3ac2de5063cd7
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/GlobalContextUtil.ets
arkts
deleteObject
删除对象 @param key 键
public deleteObject(key: string): void { this._objects.delete(key) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteObject 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 stri...
public deleteObject(key: string): void { this._objects.delete(key) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
6d9187aab769befd664097e2ac3ac7641e234419
gitcode
HarmonyOS_Samples/HMRouter
entry/src/main/ets/component/shoppingBag/ShoppingBagContent.ets
arkts
networkRequest
[Start newwork_request]
@Concurrent async function networkRequest(lifecycle: string): Promise<string> { // [StartExclude newwork_request] return await new Promise<string>((resolve) => { setTimeout(() => { resolve(`${lifecycle} request Http sucess`); }, 5000); }); // [EndExclude newwork_request] }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left networkRequest AST#identifier#Right AST#formal_paramet...
@Concurrent async function networkRequest(lifecycle: string): Promise<string> { // [StartExclude newwork_request] return await new Promise<string>((resolve) => { setTimeout(() => { resolve(`${lifecycle} request Http sucess`); }, 5000); }); // [EndExclude newwork_request] }
https://gitcode.com/HarmonyOS_Samples/HMRouter
fbbd9bd36036a92b061d4327f72ec3938a5ba321
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setHitTestMode
Sets the hit test mode. @param {HitTestMode} hitTestMode - The hit test mode to set.
public setHitTestMode(hitTestMode: HitTestMode) { this.mHitTestMode = hitTestMode; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHitTestMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hitTestMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setHitTestMode(hitTestMode: HitTestMode) { this.mHitTestMode = hitTestMode; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
35f64893b8a56c23a8e54666783e5d01eb137376
gitee
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getGestureDistance
获取手势识别距离(基于屏幕尺寸调整)
static getGestureDistance(): number { // 基于屏幕宽度的2%作为手势识别距离 return Math.max(20, DeviceUtils.getWidthPercent(2)) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getGestureDistance 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 ...
static getGestureDistance(): number { // 基于屏幕宽度的2%作为手势识别距离 return Math.max(20, DeviceUtils.getWidthPercent(2)) }
https://github.com/SMAT-Lab/PhantomRendering
83434ffd20bcd8d00a556ea5219674ccaafea14d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
valueOf
Returns the object itself @returns { BigUint64Array } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): BigUint64Array { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf 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 BigUint64Array...
public valueOf(): BigUint64Array { return this }
https://gitcode.com/iop123123/arkts-static-skills
feccce061a826bbf87d39e1824bb3fb85fcb4fa4
gitcode
CPF-ApplicationTPC/imageknifepro
entry/src/main/ets/pages/TestDesiredSizeDecode.ets
arkts
layoutStackPx
预览区 Stack 宽高:取目标框与图片布局的最大外包矩形,避免 clip 裁切。
public static layoutStackPx( showFrame: boolean, frameW: number, frameH: number, imageW: number, imageH: number ): DesiredSizeLayoutPx { const image = DesiredSizeDemoDownSampling.imageLayoutPx(showFrame, frameW, frameH, imageW, imageH) let w = image.width let h = image.height if ...
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 layoutStackPx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showFrame AST#identifier#Right AST#ERROR#Left AST#:#Left...
public static layoutStackPx( showFrame: boolean, frameW: number, frameH: number, imageW: number, imageH: number ): DesiredSizeLayoutPx { const image = DesiredSizeDemoDownSampling.imageLayoutPx(showFrame, frameW, frameH, imageW, imageH) let w = image.width let h = image.height if ...
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/entry/src/main/ets/pages/TestDesiredSizeDecode.ets#L189-L205
63be03a1b9bb5be01a1ab6e5a1f7e2a4c5555fd9
gitcode
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Scroll.ets
arkts
build
构建垂直滚动布局 @returns {void} 无返回值
build(): void { Scroll(this.scroller) { if (this.content) { this.content(); } } .scrollBar(this.scrollBarState) .attributeModifier(this.buildScrollModifier()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Scroll(this.scroller) { if (this.content) { this.content(); } } .scrollBar(this.scrollBarState) .attributeModifier(this.buildScrollModifier()); }
https://github.com/Joker-x-dev/CoolMallArkTS
c32eb33686533d3029dfdfffef893733385b56be
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/DeleteSwipeButtonComponent.ets
arkts
build
构建列表右滑删除按钮。
build() { Button() { SymbolGlyph($r('sys.symbol.trash')) .fontSize(20) .fontColor(['#FFFFFF']) } .width(64) .height(60) .backgroundColor('#EF4444') .borderRadius(0) .onClick(this.onDelete) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Button() { SymbolGlyph($r('sys.symbol.trash')) .fontSize(20) .fontColor(['#FFFFFF']) } .width(64) .height(60) .backgroundColor('#EF4444') .borderRadius(0) .onClick(this.onDelete) }
https://github.com/ZestBox-18/kitebook-frontend
d1139581b6e067d4b0ebdfe2758dc8b3a4d460f2
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
addNode
Initialize the interface of the tree view. This interface is used to generate ListNodeDataSource data. addNode is only designed for initialization. It can only be invoked during initialization. A maximum of 50 directory levels can be added. @param nodeParam Configuration information of the newly added node. For details...
public addNode(nodeParam?: NodeParam): TreeController { if (nodeParam === undefined) { this.add(this.initBuild); return this; } else { for (let i: int = 0; i < this.nodeIdList.length; i++) { if (nodeParam.currentNodeId === this.nodeIdList[i]) { throw new Error('ListTreeNode...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeParam AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
public addNode(nodeParam?: NodeParam): TreeController { if (nodeParam === undefined) { this.add(this.initBuild); return this; } else { for (let i: int = 0; i < this.nodeIdList.length; i++) { if (nodeParam.currentNodeId === this.nodeIdList[i]) { throw new Error('ListTreeNode...
https://gitcode.com/openharmony/arkui_ace_engine
681f984d781c87cff4961f06a36d76c232ee309e
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ComponentReuse/entry/src/main/ets/pages/Index.ets
arkts
aboutToReuse
2.update data in aboutToReuse
aboutToReuse(params: Record<string, Object>): void { this.text = params.text as string; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ...
aboutToReuse(params: Record<string, Object>): void { this.text = params.text as string; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
2321e70b0a3589387e5d0cb3a2999ca868c62622
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
timestampToTimeString
时间戳转时间字符串
static timestampToTimeString(timestamp: number): string { const date = new Date(timestamp); let hours = date.getHours(); const minutes = date.getMinutes(); const ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; // 0点转为12 const minutesStr = minutes < 10 ? ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left timestampToTimeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
static timestampToTimeString(timestamp: number): string { const date = new Date(timestamp); let hours = date.getHours(); const minutes = date.getMinutes(); const ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; // 0点转为12 const minutesStr = minutes < 10 ? ...
https://gitcode.com/openharmony/codelabs
7ad857afc2f34d5ba9824eee313c97b575d5c67e
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
isExpandedLayout
判断是否是扩展布局(平板及以上)
public static isExpandedLayout(): boolean { const breakpoint = ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint(); return breakpoint === Breakpoint.MD || breakpoint === Breakpoint.LG; }
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 isExpandedLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public static isExpandedLayout(): boolean { const breakpoint = ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint(); return breakpoint === Breakpoint.MD || breakpoint === Breakpoint.LG; }
https://github.com/DaLongZhuaZi/manxia
5e86f0bc175ce73da1b2021664935fc9466891c9
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/Utils.ets
arkts
getDefaultValueFormatter
/// - returns: The default value formatter used for all chart components that needs a default
public static getDefaultValueFormatter(): IValueFormatter { return Utils.mDefaultValueFormatter; }
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 getDefaultValueFormatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
public static getDefaultValueFormatter(): IValueFormatter { return Utils.mDefaultValueFormatter; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2c7db238b9c359836aa5e0beb94c35dbe959876c
gitee
1ilI/WebViewJavascriptBridge_harmony
webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets
arkts
objToNum
传入任意 Object 类型,获得 number 数值 类型 @param obj 任意类型数据 @param def 默认值 @returns number 数值
public static objToNum(obj: Object | undefined | null, def?: number): number { let result: number = def ?? 0; // 传入的 obj 为空 if (obj === undefined || obj === null) { return result; } // 传入的是 字符串 if (typeof obj === 'number') { return obj; } // 是 字符串 类型的,"1"、"true"、"TRUE"、"ye...
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 objToNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Ri...
public static objToNum(obj: Object | undefined | null, def?: number): number { let result: number = def ?? 0; // 传入的 obj 为空 if (obj === undefined || obj === null) { return result; } // 传入的是 字符串 if (typeof obj === 'number') { return obj; } // 是 字符串 类型的,"1"、"true"、"TRUE"、"ye...
https://github.com/1ilI/WebViewJavascriptBridge_harmony
21d6ad3e0336598c2e19f9398d759c9e579b0153
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
toSafeArray
安全的数组转换 @param value - 要转换的值 @param defaultValue - 默认值 @returns 数组值
static toSafeArray(value: Object, defaultValue: Array<Object> = []): Array<Object> { if (TypeGuards.isArray(value)) { return value as Array<Object>; } return defaultValue; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSafeArray 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 Obj...
static toSafeArray(value: Object, defaultValue: Array<Object> = []): Array<Object> { if (TypeGuards.isArray(value)) { return value as Array<Object>; } return defaultValue; }
https://github.com/DaLongZhuaZi/manxia
d482deb4c30769b88743e75c6fc173bee5a2b19c
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
loginOut
登出,发布登出事件
async loginOut() { if (this.loginInfo !== null) { globalVM_WanDB.updateLoginState(this.loginInfo.id, 0) } await this.updateLoginInfo(null, null, null) await this.updateUserInfo(null) EventBus.getInstance().post(WanEventId.EVENT_LOGIN_OUT) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginOut AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right...
async loginOut() { if (this.loginInfo !== null) { globalVM_WanDB.updateLoginState(this.loginInfo.id, 0) } await this.updateLoginInfo(null, null, null) await this.updateUserInfo(null) EventBus.getInstance().post(WanEventId.EVENT_LOGIN_OUT) }
https://github.com/RedRackham-R/WanAndroidHarmoney
37f174e6efe3d809f7ccc226415b83e1c7e6eccc
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
warn
打印WARN级别日志 @param args
static warn(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.WARN); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left warn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args...
static warn(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.WARN); }
https://github.com/tdcare/tdwebrtc
edb21362752e5275d3b6624b3cacfa2f2f228d90
github
LZZLHY/hlib
entry/src/main/ets/utils/Layout.ets
arkts
showNavStyleSwitch
当前断点是否允许显示"导航样式切换"设置项(仅 ≥md)。
static showNavStyleSwitch(bp: Breakpoint): boolean { return bp !== 'sm'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showNavStyleSwitch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static showNavStyleSwitch(bp: Breakpoint): boolean { return bp !== 'sm'; }
https://github.com/LZZLHY/hlib
e478da2fac81b155bd8678f5a1b42246fa140ef9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
saveOnlineMangaToDatabaseAsync
异步保存漫画到数据库(不阻塞UI) [修复] 先快速保存基本信息,不预取页面,让UI立即响应
private async saveOnlineMangaToDatabaseAsync( manga: Manga, chapters: MangaChapter[], externalId: string, callback: MangaLoadProgressCallback ): Promise<void> { setTimeout(async () => { try { // 快速保存漫画和章节基本信息(不预取页面) await this.saveOnlineMangaToDatabaseFast(manga, chapters, ...
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 saveOnlineMangaToDatabaseAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#R...
private async saveOnlineMangaToDatabaseAsync( manga: Manga, chapters: MangaChapter[], externalId: string, callback: MangaLoadProgressCallback ): Promise<void> { setTimeout(async () => { try { // 快速保存漫画和章节基本信息(不预取页面) await this.saveOnlineMangaToDatabaseFast(manga, chapters, ...
https://github.com/DaLongZhuaZi/manxia
453ad294ca5fadab5865956bae2b3303bf7573da
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/HomeViewModel.ets
arkts
toFlashSalePage
跳转到限时精选页面 @returns {void} 无返回值
toFlashSalePage(): void { const params: GoodsCategoryParam = { typeId: undefined, featured: true, recommend: false, keyword: undefined }; GoodsNavigator.toCategory(params); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toFlashSalePage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
toFlashSalePage(): void { const params: GoodsCategoryParam = { typeId: undefined, featured: true, recommend: false, keyword: undefined }; GoodsNavigator.toCategory(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
0e9b870277ecfc40032626ba29c730bf9e643ee5
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/AssetAccountListSectionComponent.ets
arkts
build
构建资产账户列表区,负责空状态和账户卡片列表切换。
build() { if (this.assetAccounts.length === 0) { ListItem() { EmptyStateComponent({ text: '暂无资产账户数据', themeState: this.themeState }) } } else { ListItemGroup({ header: this.AssetListHeader(), style: ListItemGroupStyle.CARD }) { ForEach(this.assetAccounts...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i...
build() { if (this.assetAccounts.length === 0) { ListItem() { EmptyStateComponent({ text: '暂无资产账户数据', themeState: this.themeState }) } } else { ListItemGroup({ header: this.AssetListHeader(), style: ListItemGroupStyle.CARD }) { ForEach(this.assetAccounts...
https://github.com/ZestBox-18/kitebook-frontend
67b9c27105f6e95b39699ad8afb7895d3a72425c
github
arkui-x/samples
CodeLab/Cases/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets
arkts
registerCallback
TODO: 知识点: 注册日志回调函数
registerCallback(strLog: string, callBack : Function) : void { testNapi.setLogCallback(strLog, callBack); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strLog AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Lef...
registerCallback(strLog: string, callBack : Function) : void { testNapi.setLogCallback(strLog, callBack); }
https://gitcode.com/arkui-x/samples
e82a75004b54de60a7493073d9ba6c04ffa6bf86
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_bigint/user/main.ets
arkts
test_bigint_with_union
union @bigint Array<u64> @null string
function test_bigint_with_union() { // union bigInt let bigIntData = 1020847100762815390427017310442723737601n; bigint_new.showMyUnion(bigIntData); let bigIntResult = bigint_new.makeMyUnion(1); console.log("bigIntResult: ", bigIntResult); arktest.assertEQ(bigIntData, bigIntResult); // union...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_bigint_with_union 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#comm...
function test_bigint_with_union() { // union bigInt let bigIntData = 1020847100762815390427017310442723737601n; bigint_new.showMyUnion(bigIntData); let bigIntResult = bigint_new.makeMyUnion(1); console.log("bigIntResult: ", bigIntResult); arktest.assertEQ(bigIntData, bigIntResult); // union...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
fd2ab9f42ecf3e6fddbd76aa0826756a10661f2d
gitcode
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/services/LocalDeviceService.ets
arkts
initialize
初始化设备:创建默认设备实例并初始化筛选状态
initialize(): void { // 初始化默认设备 this.devices = [ new Light('L1', '客厅主灯', Location.LivingRoom), new AirConditioner('AC1', '卧室空调', Location.Bedroom), new SmartLock('LOCK1', '入户门锁', Location.Entrance) ] as T[]; // 初始化位置列表和筛选设备 this.updateLocations(); this.filterDevicesByLocatio...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
initialize(): void { // 初始化默认设备 this.devices = [ new Light('L1', '客厅主灯', Location.LivingRoom), new AirConditioner('AC1', '卧室空调', Location.Bedroom), new SmartLock('LOCK1', '入户门锁', Location.Entrance) ] as T[]; // 初始化位置列表和筛选设备 this.updateLocations(); this.filterDevicesByLocatio...
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
561afe7f40610481a3b7dd2a1a384cc27817edbd
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
enableGridDashedLine
Enables the grid line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance. @param lineLength the length of the line pieces @param spaceLength the length of space in between the pieces @param phase ...
public enableGridDashedLine(lineLength: number, spaceLength: number, phase: number): void { this.mGridDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableGridDashedLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public enableGridDashedLine(lineLength: number, spaceLength: number, phase: number): void { this.mGridDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d89460a37de44391d32f2d7abf58270e21633c95
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleSetMotionEventState
处理主机请求的运动传感器状态变更 由 StreamingSession 的 setMotionEventState 回调触发 逻辑参照 Android ControllerHandler.handleSetMotionEventState(): 1. 如果手柄自带传感器 → 使用手柄传感器(USB 控制器 IMU) 2. 如果手柄无传感器且用户启用了回退 → 使用设备传感器 3. 如果均不可用 → 忽略 @param controllerNumber 控制器编号 @param motionType LI_MOTION_TYPE_ACCEL (0x01) 或 LI_MOTION_TYPE_GYRO (0x02) @param repo...
handleSetMotionEventState(controllerNumber: number, motionType: number, reportRateHz: number): void { console.info(`[GAMEPAD] 主机请求传感器: ctrl=${controllerNumber}, type=${motionType}, rate=${reportRateHz}Hz`); if (!this.gamepadMotionSensorsEnabled) { console.info('[GAMEPAD] 传感器功能已被用户禁用'); return; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleSetMotionEventState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Righ...
handleSetMotionEventState(controllerNumber: number, motionType: number, reportRateHz: number): void { console.info(`[GAMEPAD] 主机请求传感器: ctrl=${controllerNumber}, type=${motionType}, rate=${reportRateHz}Hz`); if (!this.gamepadMotionSensorsEnabled) { console.info('[GAMEPAD] 传感器功能已被用户禁用'); return; ...
https://github.com/AlkaidLab/moonlight-harmony
16e9cdb6453fb5ae329bf12290739f880125337e
github
honjow/Next2V
shared/src/main/ets/components/StickerPickerPanel.ets
arkts
flattenStickerGroups
Flat view of every built-in sticker, in group order. ReplyComposerBar.expandStickerCodes walks this to turn "[name]" codes into bare URLs at submit; group display structure is irrelevant there. Names are unique across groups (overlaps were resolved to one group), so the flattened name->url map has no clashes.
function flattenStickerGroups(groups: StickerGroup[]): StickerItem[] { const out: StickerItem[] = [] for (const group of groups) { for (const sticker of group.stickers) { out.push(sticker) } } return out }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left flattenStickerGroups AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left groups AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function flattenStickerGroups(groups: StickerGroup[]): StickerItem[] { const out: StickerItem[] = [] for (const group of groups) { for (const sticker of group.stickers) { out.push(sticker) } } return out }
https://github.com/honjow/Next2V
a20b78d0faff0c3091218cfe11ae26a9272b623a
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
for
Increase the error correction level while the data still fits in the current version number
for (const newEcl of [QrCode.Ecc.MEDIUM, QrCode.Ecc.QUARTILE, QrCode.Ecc.HIGH]) { // From low to high if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8) ecl = newEcl; }
AST#program#Left AST#for_in_statement#Left AST#for#Left for AST#for#Right AST#(#Left ( AST#(#Right AST#const#Left const AST#const#Right AST#identifier#Left newEcl AST#identifier#Right AST#of#Left of AST#of#Right AST#array#Left AST#[#Left [ AST#[#Right AST#member_expression#Left AST#member_expression#Left AST#identifier...
for (const newEcl of [QrCode.Ecc.MEDIUM, QrCode.Ecc.QUARTILE, QrCode.Ecc.HIGH]) { // From low to high if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8) ecl = newEcl; }
https://gitee.com/openharmony/arkui_ace_engine.git
b6a1a49eb64e618e33a69453f6fa60fc0ed513ce
gitee
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
weeksBetweenDates
计算某个日期距离今天相差的周数,过去周用负数表示,未来周用正数表示 @param selectDay 日期 @returns 返回某个日期距离今天相差的周数
static weeksBetweenDates(selectDay: Date): number { const TODAY = new Date(); // 周视图中选中日期所属周的第一天(周日) let selectLastSunday: Date = TimeUtils.getLastSunday(selectDay); // 周视图中今天所属周的第一天(周日) let todayLastSunday: Date = TimeUtils.getLastSunday(TODAY); // 计算两个日期之间的毫秒差 const DIFF = todayLastSunda...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left weeksBetweenDates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selectDay AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#...
static weeksBetweenDates(selectDay: Date): number { const TODAY = new Date(); // 周视图中选中日期所属周的第一天(周日) let selectLastSunday: Date = TimeUtils.getLastSunday(selectDay); // 周视图中今天所属周的第一天(周日) let todayLastSunday: Date = TimeUtils.getLastSunday(TODAY); // 计算两个日期之间的毫秒差 const DIFF = todayLastSunda...
https://gitcode.com/arkui-x/samples
7878444dc454d269f50494ff4f25136c030d44f9
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/OneDriveManager.ets
arkts
getVirtio9pMountPoint
获取 Virtio-9p 挂载后在 VM 中的路径
public getVirtio9pMountPoint(): string { // 用户需要在 Windows VM 中执行: // net use O: \\10.0.2.4\onedrive // 或在 Linux VM 中: // mount -t 9p -o trans=virtio onedrive /mnt/onedrive return 'O:'; // 建议的盘符 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVirtio9pMountPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left stri...
public getVirtio9pMountPoint(): string { // 用户需要在 Windows VM 中执行: // net use O: \\10.0.2.4\onedrive // 或在 Linux VM 中: // mount -t 9p -o trans=virtio onedrive /mnt/onedrive return 'O:'; // 建议的盘符 }
https://github.com/AetheriumSimulator/qemu-hmos
adb18b72f0aa2164b0ec21e1bf0ae3df047a73b1
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
isNotNull
单个字段不为null @param field 字段 @returns Wrapper
isNotNull(field: string, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} is not null`) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNotNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#...
isNotNull(field: string, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} is not null`) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L227-L232
f23e25925f75f3ec91d18150b93000c18ba82a25
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets
arkts
requestListData
请求商品分页数据 @returns {Promise<NetworkResponse<NetworkPageData<Goods>>>} 网络请求 Promise
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> { const orderSortPair: OrderSortPair = this.getOrderSortPair(); const request: GoodsSearchRequest = new GoodsSearchRequest(); request.page = this.currentPage; request.size = this.pageSize; request.featured = this.isFeatu...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestListData 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 A...
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> { const orderSortPair: OrderSortPair = this.getOrderSortPair(); const request: GoodsSearchRequest = new GoodsSearchRequest(); request.page = this.currentPage; request.size = this.pageSize; request.featured = this.isFeatu...
https://github.com/Joker-x-dev/CoolMallArkTS
8b341868f67b36d214c5af1c94003e2a36466971
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/MdnsDiscovery.ets
arkts
discover
发现一段时间后返回结果
async discover(timeout: number = MdnsDiscovery.DISCOVERY_TIMEOUT): Promise<DiscoveredComputer[]> { await this.startDiscovery(); // 等待发现超时 await new Promise<void>((resolve: Function) => setTimeout(resolve, timeout)); this.stopDiscovery(); return Array.from(this.discoveredComputers.values()); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left discover AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left timeout AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async discover(timeout: number = MdnsDiscovery.DISCOVERY_TIMEOUT): Promise<DiscoveredComputer[]> { await this.startDiscovery(); // 等待发现超时 await new Promise<void>((resolve: Function) => setTimeout(resolve, timeout)); this.stopDiscovery(); return Array.from(this.discoveredComputers.values()); }
https://github.com/AlkaidLab/moonlight-harmony
ca30e34b1d18cd6085f6413b9358e94acedef790
github
openharmony-sig/ohos_checksum
library/src/main/ets/md5.ets
arkts
rstr2binl
Convert a raw string to an array of little-endian words Characters >255 have their high-byte silently ignored.
rstr2binl(input: string): number[] { let output: number[] = Array(input.length >> 2); for (let i = 0; i < output.length; i++) output[i] = 0; for (let i = 0; i < input.length * 8; i += 8) output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); return output; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left rstr2binl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS...
rstr2binl(input: string): number[] { let output: number[] = Array(input.length >> 2); for (let i = 0; i < output.length; i++) output[i] = 0; for (let i = 0; i < input.length * 8; i += 8) output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); return output; ...
https://gitee.com/openharmony-sig/ohos_checksum.git
c9077b3c5c8a7a78de6389d73bb501b89a188c94
gitee
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalDavSourceAdapter.ets
arkts
testConnection
-------- 连接与发现 --------
async testConnection(account: CalendarAccount): Promise<CalendarConnectionTestResult> { const providerType: string = account.providerType ?? inferCalendarProviderType(account.serverUrl); const serverUrl: string = normalizeServerUrl( normalizeProviderServerUrl(providerType, account.serverUrl, account.use...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testConnection AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left account AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async testConnection(account: CalendarAccount): Promise<CalendarConnectionTestResult> { const providerType: string = account.providerType ?? inferCalendarProviderType(account.serverUrl); const serverUrl: string = normalizeServerUrl( normalizeProviderServerUrl(providerType, account.serverUrl, account.use...
https://github.com/bluedeer000/HarmonyCalendar
0ab76adc2e29ab57b54b41d363eedda9e63c23c4
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/SpeedTestVM.ets
arkts
autoSwitchIfCurrentDead
测速完成后的自动择优。 策略(保守,避免打断用户/自定义线路): - 仅当「当前生效域名」确实被本轮测速覆盖且判定为不可达(latencyMs<=0)时,才自动切换; - 当前域名可用,或当前域名未被本轮测速覆盖(多为用户自定义线路),都不动。 切换时同步写入 HttpClient 与 AppStorage[DOMAIN],让 UI 线路指示与实际一致。 @param sorted 已按延迟升序排好的测速结果(首个可用项即最快)。
private static autoSwitchIfCurrentDead(sorted: DomainTestResult[]): void { const current: string = HttpClient.instance.getDomain(); let tested: boolean = false; let currentAlive: boolean = false; for (let i = 0; i < sorted.length; i++) { if (sorted[i].domain === current) { tested = true;...
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 autoSwitchIfCurrentDead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sorted AST#identifier#Right ...
private static autoSwitchIfCurrentDead(sorted: DomainTestResult[]): void { const current: string = HttpClient.instance.getDomain(); let tested: boolean = false; let currentAlive: boolean = false; for (let i = 0; i < sorted.length; i++) { if (sorted[i].domain === current) { tested = true;...
https://github.com/LZZLHY/hlib
ad957685a1b44230ae1a73c83984c544ee8ba3f9
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
onRequestSuccess
请求成功回调,回填表单数据 @param {Address} data - 地址数据 @returns {void} 无返回值
protected onRequestSuccess(data: Address): void { this.updateFormData(new Address(data)); super.onRequestSuccess(data); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left onRequestSuccess 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#identi...
protected onRequestSuccess(data: Address): void { this.updateFormData(new Address(data)); super.onRequestSuccess(data); }
https://github.com/Joker-x-dev/CoolMallArkTS
a5c41ed68c85c845882aa6ce114384ddb0a803dd
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint8Array using range [begin, this.lengthInt]. @param { int } begin - start index to be taken into slice. @returns { Uint8Array } - a new Uint8Array with elements of current Uint8Array[begin, this.lengthInt]. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public slice(begin: int): Uint8Array { return this.sliceFromTo(begin, this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public slice(begin: int): Uint8Array { return this.sliceFromTo(begin, this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
426007318f08484303d2c70519c931e8a0cf239f
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/MoreViewModel.ets
arkts
handleLogout
处理登出逻辑
async handleLogout() { try { // TODO 确认弹窗及登出操作 logger.info('User requested logout.'); // 执行登出清理 // await pixiv.logout() // 跳转回登录页 } catch (e) { logger.error('Logout failed: ' + e.message); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left handleLogout AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R...
async handleLogout() { try { // TODO 确认弹窗及登出操作 logger.info('User requested logout.'); // 执行登出清理 // await pixiv.logout() // 跳转回登录页 } catch (e) { logger.error('Logout failed: ' + e.message); } }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/MoreViewModel.ets#L59-L69
975cc4d0bf09b1da0a42c46fa695c200ba279de6
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
withParams
页面跳转携带的参数,map的方式 @param key @param value @returns
public withParams(paramMap: HashMap<string, ObjectOrNull>): NavDestBuilder<T> { this.paramMap = paramMap return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left withParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paramMap AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public withParams(paramMap: HashMap<string, ObjectOrNull>): NavDestBuilder<T> { this.paramMap = paramMap return this }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L103-L106
21b70f080dd35aa88e38524d7a3921f391319015
github
HarmonyOS_Samples/MusicHome
products/default/src/main/ets/pages/Index.ets
arkts
aboutToAppear
Initializes play queue ids from local DB for the session.
aboutToAppear() { this.appState.playQueueIds = MusicDbApi.getInstance().getSongList().map((dto) => dto.id); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.appState.playQueueIds = MusicDbApi.getInstance().getSongList().map((dto) => dto.id); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
c6b7c54865a5b8a6b082761e7e0b266ac661ce29
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
setDeviceLocation
设置设备物理位置信息(用于唯一标识)
setDeviceLocation(busNum: number, devAddress: number, serial: string): void { this.busNum = busNum; this.devAddress = devAddress; this.serial = serial; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDeviceLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left busNum AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Le...
setDeviceLocation(busNum: number, devAddress: number, serial: string): void { this.busNum = busNum; this.devAddress = devAddress; this.serial = serial; }
https://github.com/AlkaidLab/moonlight-harmony
ae78a7d6afd65accfd85d97ac6b922be6ae19294
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SettingsManager.ets
arkts
setBoolean
设置布尔值
async setBoolean(key: string, value: boolean): Promise<void> { await this.setValue(key, String(value), SettingType.BOOLEAN); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setBoolean AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async setBoolean(key: string, value: boolean): Promise<void> { await this.setValue(key, String(value), SettingType.BOOLEAN); }
https://github.com/DaLongZhuaZi/manxia
ef25afc2909a2da9ce057264ccf9b33129f5ea16
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
uint32
Read unsigned varint32 (returns uint32)
uint32(): number { let x = 0, s = 0 while (true) { const b = this.b[this.pos++]; x |= (b & 0x7F) << s; if ((b & 0x80) === 0) break; s += 7 } return x >>> 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left uint32 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_block...
uint32(): number { let x = 0, s = 0 while (true) { const b = this.b[this.pos++]; x |= (b & 0x7F) << s; if ((b & 0x80) === 0) break; s += 7 } return x >>> 0 }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
16e058c006777dec2eb679cd44ccb8fef3dd804d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
transformToChapterInfo
转换为章节信息
private transformToChapterInfo(data: Object): ChapterInfo { const item = data as Record<string, Object>; // 输出提取到的字段以便调试 const keys = Object.keys(item); logger.debug(TAG, `章节提取到的字段: ${keys.join(', ')}`); // [关键修复] 提取外部ID - 这是从API返回的原始章节ID const externalId = String(item.id || ''); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left transformToChapterInfo 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#identi...
private transformToChapterInfo(data: Object): ChapterInfo { const item = data as Record<string, Object>; // 输出提取到的字段以便调试 const keys = Object.keys(item); logger.debug(TAG, `章节提取到的字段: ${keys.join(', ')}`); // [关键修复] 提取外部ID - 这是从API返回的原始章节ID const externalId = String(item.id || ''); ...
https://github.com/DaLongZhuaZi/manxia
dfbe87f2db430a5840fd303d47c3968d1be2d27e
github
queueit/harmony-sdk
queueit_sdk/src/main/ets/view/QueueItViewManager.ets
arkts
handlePageEnd
Called by <Web onPageEnd={...}>
public handlePageEnd(event: OnPageEndEvent): void { this.isLoading = false; Logger.debug(QueueItViewManager.TAG, `onPageEnd: ${event?.url}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handlePageEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left O...
public handlePageEnd(event: OnPageEndEvent): void { this.isLoading = false; Logger.debug(QueueItViewManager.TAG, `onPageEnd: ${event?.url}`); }
https://github.com/queueit/harmony-sdk
dc8f1ac22ef03b75fb70169a0368ea5f6c859796
github
honjow/Next2V
shared/src/main/ets/storage/SyncedKv.ets
arkts
getAll
All entries in a namespace, keyed by the bare item key (namespace prefix stripped). [] on error.
static async getAll( context: common.UIAbilityContext, namespace: string, ): Promise<SyncedKvEntry[]> { const entries: SyncedKvEntry[] = [] const prefix = namespace + ':' try { const store = await LocalDataStore.open(context) // Range scan [prefix, prefix + U+FFFF) over the PK index,...
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 getAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R...
static async getAll( context: common.UIAbilityContext, namespace: string, ): Promise<SyncedKvEntry[]> { const entries: SyncedKvEntry[] = [] const prefix = namespace + ':' try { const store = await LocalDataStore.open(context) // Range scan [prefix, prefix + U+FFFF) over the PK index,...
https://github.com/honjow/Next2V
8192f499d8769bf4eb1ca4035f8e89a3ceffc830
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
getReadingProgress
获取阅读进度
private async getReadingProgress(bookId: string): Promise<EBookReadingProgress | null> { try { const sql = `SELECT * FROM ebook_reading_progress WHERE bookId = ? AND userId = ?`; const records = await this.dbManager.querySql(sql, [bookId, 'default_user']); if (records && records.length > ...
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 getReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#...
private async getReadingProgress(bookId: string): Promise<EBookReadingProgress | null> { try { const sql = `SELECT * FROM ebook_reading_progress WHERE bookId = ? AND userId = ?`; const records = await this.dbManager.querySql(sql, [bookId, 'default_user']); if (records && records.length > ...
https://github.com/DaLongZhuaZi/manxia
a40f30e56af3f7c2b00ba78f603575994c4faec9
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/AppDataViewModel.ets
arkts
calculateCacheSize
缓存管理 计算缓存大小 @param dir 不传则计算全部,传 'ImageKnife' 或 'Pixiv/Pictures' 计算指定目录
async calculateCacheSize(dir?: string) { if (!dir) { // 并发计算两个 await Promise.all([ this.calculateCacheSize('ImageKnife'), this.calculateCacheSize('Pixiv/Pictures') ]); return; } try { let totalSize = 0; const targetDir = `${this.context.filesDir}/${dir}...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left calculateCacheSize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left dir AST#identifier#Right A...
async calculateCacheSize(dir?: string) { if (!dir) { // 并发计算两个 await Promise.all([ this.calculateCacheSize('ImageKnife'), this.calculateCacheSize('Pixiv/Pictures') ]); return; } try { let totalSize = 0; const targetDir = `${this.context.filesDir}/${dir}...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/AppDataViewModel.ets#L248-L294
bd1c22bdc7c14ceb9467f2f54184ddaba0cafba3
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CloudSyncRecordDAO.ets
arkts
updateStatus
更新同步状态
static async updateStatus( syncId: number, status: 'pending' | 'in_progress' | 'completed' | 'failed', errorMessage?: string ): Promise<void> { const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); const now: string = DAOHelper.now(); let sql: string = `UPDATE ${CloudSyncRe...
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 updateStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left syncId AST#identifier#Right AST#:#Left : AS...
static async updateStatus( syncId: number, status: 'pending' | 'in_progress' | 'completed' | 'failed', errorMessage?: string ): Promise<void> { const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); const now: string = DAOHelper.now(); let sql: string = `UPDATE ${CloudSyncRe...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0ccf1cf25c5b6cf5312cba7606c2d41e59791939
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/progress/TnCircleProgress.ets
arkts
animatableDashArray
扩展 Circle 的 strokeDashArray 以支持动画插值
@AnimatableExtend(Circle) function animatableDashArray(point: DashPoint) { .strokeDashArray([point.x, point.y]) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left AnimatableExtend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Circle AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_...
@AnimatableExtend(Circle) function animatableDashArray(point: DashPoint) { .strokeDashArray([point.x, point.y]) }
https://github.com/codelably/tuniao-ui
f4a098b4bcd1c55f4d6b8a51853af95a3e3112aa
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/pages/HttpsPlayer.ets
arkts
playError
An error is reported during network video playback.
playError(errorInfo: string) { promptAction.showToast({ duration: 3000, message: errorInfo }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorInfo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#...
playError(errorInfo: string) { promptAction.showToast({ duration: 3000, message: errorInfo }); }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
a7edfffe276a41a38e2cbb5de44229c2484c0fa3
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/EventPersistenceManager.ets
arkts
cacheUserInfo
==================== 用户缓存(local_user_cache)====================
async cacheUserInfo(userId: number, token: string, nickname?: string, avatarUrl?: string, roleType?: string, expireTime?: number): Promise<void> { try { const predicates = new relationalStore.RdbPredicates(TABLE_USER_CACHE); predicates.equalTo(COLUMN_USER_ID, userId); const existingResultSet = a...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cacheUserInfo 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#:#Left :...
async cacheUserInfo(userId: number, token: string, nickname?: string, avatarUrl?: string, roleType?: string, expireTime?: number): Promise<void> { try { const predicates = new relationalStore.RdbPredicates(TABLE_USER_CACHE); predicates.equalTo(COLUMN_USER_ID, userId); const existingResultSet = a...
https://github.com/LJ666-ui/harmony-health-care
b7b85accd2aaa0c0fc5357bda34758938e197939
github
2763981847/Clock-Alarm
entry/src/main/ets/viewmodel/AlarmClockViewModel.ets
arkts
queryDatabaseAlarms
查询数据库中的闹钟项。 @param callback (alarms: Array<AlarmItem>) => void 回调函数,用于处理查询结果
private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) { // 获取全局上下文中的 PreferencesHandler 实例 let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; // 从数据库中获取闹钟项数据 preference.get(CommonConstants.ALARM_KEY).then((data: string) => { // 如果数据不为空 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left queryDatabaseAlarms AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Lef...
private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) { // 获取全局上下文中的 PreferencesHandler 实例 let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; // 从数据库中获取闹钟项数据 preference.get(CommonConstants.ALARM_KEY).then((data: string) => { // 如果数据不为空 ...
https://github.com/2763981847/Clock-Alarm
8912b6967885131b0fb359608998d5cb448e5fee
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedEnum
访问 repeated enum 字段
visitRepeatedEnum(value: number[], fieldNumber: number): void { for (const item of value) { this.visitEnum(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedEnum 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#subscript_expression#Left AST#identifier#Left number ...
visitRepeatedEnum(value: number[], fieldNumber: number): void { for (const item of value) { this.visitEnum(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
69a95f08d0181c79022babec27270b4c9c5ffecb
gitcode
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ImageGenerationViewModel.ets
arkts
loadInitialState
重入安全:第二次进入页面时只刷新外部数据(providers/gallery),保留任务相关状态 (prompt / referenceImages / isGenerating / currentImages 等不动)
async loadInitialState(): Promise<void> { await this.defaultModelService.loadConfig() this.providers = await this.providerViewModel.loadProviders() this.isProvidersLoaded = true // 只有还没选择模型时才应用默认值,避免覆盖用户上次的选择 if (this.selectedProviderId === '' || this.selectedModelId === '') { this.applyDefa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadInitialState AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async loadInitialState(): Promise<void> { await this.defaultModelService.loadConfig() this.providers = await this.providerViewModel.loadProviders() this.isProvidersLoaded = true // 只有还没选择模型时才应用默认值,避免覆盖用户上次的选择 if (this.selectedProviderId === '' || this.selectedModelId === '') { this.applyDefa...
https://github.com/LongLiveY96/chatcube
578ae43bbc1dfb7897236a595576c7f7cadb8c7b
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test18_original_index.ets
arkts
fastPow
--- Fast exponentiation (repeated squaring) ---
function fastPow(base: number, exp: number): number { let result: number = 1; let b: number = base; let e: number = exp; while (e > 0) { if (e % 2 === 1) { result = result * b; } b = b * b; e = e / 2; e = Math.floor(e); } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fastPow AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left base AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function fastPow(base: number, exp: number): number { let result: number = 1; let b: number = base; let e: number = exp; while (e > 0) { if (e % 2 === 1) { result = result * b; } b = b * b; e = e / 2; e = Math.floor(e); } return result; }
https://github.com/miaochiahao/ark-ghidra
23ee31e47b468a5f7d4f409f3f67eaeadb49e190
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
applyOrPredicate
处理 or 逻辑运算
private applyOrPredicate(elements: string[], predicateStr: string): string[] { const parts = predicateStr.split(/\s+or\s+/); const resultSet = new Set<string>(); for (const part of parts) { const pred = this.parseXPathPredicate(part.trim()); const matched = this.applyXPathPredicate(elements, p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyOrPredicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private applyOrPredicate(elements: string[], predicateStr: string): string[] { const parts = predicateStr.split(/\s+or\s+/); const resultSet = new Set<string>(); for (const part of parts) { const pred = this.parseXPathPredicate(part.trim()); const matched = this.applyXPathPredicate(elements, p...
https://github.com/DaLongZhuaZi/manxia
7e9b685c243d6b708619278af3482a35d5a76549
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
navigateToBlock
==================== 差异导航 ====================
navigateToBlock(index: number): void { if (index >= 0 && index < this.diffBlocks.length) { this.highlightBlockIndex = index; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateToBlock 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#)#Left ...
navigateToBlock(index: number): void { if (index >= 0 && index < this.diffBlocks.length) { this.highlightBlockIndex = index; } }
https://github.com/XJTUWYD/ArkDiff
e072a85633bc000e60c98b479531b25a0d5a80f3
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Int32Array starting from insertPos. @param arr array to copy data from @param insertPos start index where data from arr will be inserted {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public set(arr: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: int[]): size of arr is greater than Int32Array.length") } for (let i = 0; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: int[]): size of arr is greater than Int32Array.length") } for (let i = 0; ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
52875efda982a38b9c8cb74b43de36b619ca296e
gitee
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
sendVideoSosHangup
发送视频 SOS 挂断
public sendVideoSosHangup(toMac: string, roomId: string): void { const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_SOS_HANGUP, room_id: roomId, from_mac: this.mac, to_mac: toMac, msg: '', }; env.data = data; thi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendVideoSosHangup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public sendVideoSosHangup(toMac: string, roomId: string): void { const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_SOS_HANGUP, room_id: roomId, from_mac: this.mac, to_mac: toMac, msg: '', }; env.data = data; thi...
https://github.com/tdcare/tdwebrtc
33fae5662dcc50b8732588ce50381a90ff2f2ea6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/JSRuntime.ets
arkts
getNumSharedJSValues
=================== Internal api ===================
public static getNumSharedJSValues(): int { return JSRuntime.finQueue!.getSize(); }
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 getNumSharedJSValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
public static getNumSharedJSValues(): int { return JSRuntime.finQueue!.getSize(); }
https://gitcode.com/iop123123/arkts-static-skills
c14343b87f5c20ed0254737b9b30f51f8b51b510
gitcode
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
next
下一首 //
next() { // 防0检测 // if (this.play_list.length == 0) {return} // 随机模式 if (this.play_mode == 3) { // 防1死锁 // if (this.play_list.length == 1) {this.set_audio(); return} // 随机抽取 // let random_index = 0 while (true) { random_index = Math.floor(Math.random() * this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left next AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 防0检测 // AST#comm...
next() { // 防0检测 // if (this.play_list.length == 0) {return} // 随机模式 if (this.play_mode == 3) { // 防1死锁 // if (this.play_list.length == 1) {this.set_audio(); return} // 随机抽取 // let random_index = 0 while (true) { random_index = Math.floor(Math.random() * this....
https://github.com/Nekofox-POT/LinMusic
d605fc027678ed266e1781c3445b76a237c354a5
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/features/mydemo/src/main/ets/Video/components/CommentKeyboard.ets
arkts
deleteBuilderSpan
点击软键盘删除按钮,删除内容
deleteBuilderSpan() { const controller = this.richEditorController const range: RichEditorRange = { end: controller.getCaretOffset() } const index = this.getBuilderSpanCount(controller, range) - 1 this.builderSpans.splice(index, 1) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteBuilderSpan 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#...
deleteBuilderSpan() { const controller = this.richEditorController const range: RichEditorRange = { end: controller.getCaretOffset() } const index = this.getBuilderSpanCount(controller, range) - 1 this.builderSpans.splice(index, 1) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
babc292a59c2586d4cf2e5768580cca6804dbbeb
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getByEmail
获取用户的邀请
static async getByEmail(email: string): Promise<LedgerInvitation[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName); predicates.equalTo('invitee_email...
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 getByEmail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left email AST#identifier#Right AST#:#Left : AST#:...
static async getByEmail(email: string): Promise<LedgerInvitation[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName); predicates.equalTo('invitee_email...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
7556282f8b8422fad83b078349ef9536328a1253
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/FavoriteViewModel.ets
arkts
loadMore
--- 加载更多 ---
async loadMore(): Promise<void> { if (this.isLoadingMore || !this.hasMore) return; this.isLoadingMore = true; try { if (appSettings.novel_mode) { if (this.mainTabIndex === 0) await this.loadTrendNovelData(true); else if (this.mainTabIndex === 1) await this.loadCollectionNovelData(tru...
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadMore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#...
async loadMore(): Promise<void> { if (this.isLoadingMore || !this.hasMore) return; this.isLoadingMore = true; try { if (appSettings.novel_mode) { if (this.mainTabIndex === 0) await this.loadTrendNovelData(true); else if (this.mainTabIndex === 1) await this.loadCollectionNovelData(tru...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L377-L391
c9fb0db850552ebb199651a5b4137ad9e23512b7
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/Constituency-12-smarthome/entry/src/main/ets/view/Home.ets
arkts
Close
设置高电平
Close() { gpioled.setLedStatus(this.pin, gpioled.LED_ON) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Close AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
Close() { gpioled.setLedStatus(this.pin, gpioled.LED_ON) }
https://gitee.com/openharmony/vendor_unionman.git
06d21dd6429c95aa3c88fe523fb78e46f7e6c690
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets
arkts
setInterval
托管的 setInterval @param callback 回调函数 @param delay 间隔时间(毫秒) @returns 定时器 ID
setInterval(callback: Function, delay: number): number { this.checkDestroyed('setInterval'); this.checkTimerLimit(); const timerId = ++this.timerIdCounter; const actualTimerId = setInterval(() => { if (!this.isDestroyed) { try { callback(); } catch (error) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#,#Left...
setInterval(callback: Function, delay: number): number { this.checkDestroyed('setInterval'); this.checkTimerLimit(); const timerId = ++this.timerIdCounter; const actualTimerId = setInterval(() => { if (!this.isDestroyed) { try { callback(); } catch (error) { ...
https://github.com/DaLongZhuaZi/manxia
080548a85a288a95966ab4856f5fe88a0aa82e81
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets
arkts
sleepSync
Synchronous delay (busy-wait). Required because native SurfaceManager needs time to settle.
private sleepSync(ms: number): void { const end = Date.now() + ms; while (Date.now() < end) { /* busy wait */ } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sleepSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
private sleepSync(ms: number): void { const end = Date.now() + ms; while (Date.now() < end) { /* busy wait */ } }
https://github.com/AGenUI/AGenUI
b22787a2645d7d587699550533489f83c9197cbb
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getProcessingStep
获取优化后的处理步长
static getProcessingStep(baseStep: number): number { // 在高分辨率设备上可以使用更小的步长 const scale = Math.min(2.0, Math.max(0.5, DeviceUtils.getDensity())) return Math.round(baseStep / scale) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getProcessingStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseStep AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num...
static getProcessingStep(baseStep: number): number { // 在高分辨率设备上可以使用更小的步长 const scale = Math.min(2.0, Math.max(0.5, DeviceUtils.getDensity())) return Math.round(baseStep / scale) }
https://github.com/SMAT-Lab/PhantomRendering
0172cb521d7b74dcb4c043919fcc7adcc37010b2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Creates a new Uint32Array using initializer @param { FixedArray<number> } data - initializer @returns { Uint32Array } - a new Uint32Array from data @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(...data: FixedArray<number>): Uint32Array { throw new Error("Uint32Array.of: 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 of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left data A...
public of(...data: FixedArray<number>): Uint32Array { throw new Error("Uint32Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
50cbd4c010c3ed16f3c998f164648add8f5ec8d5
gitcode