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
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileProcessorUtil.ets
arkts
splitListIntoChunks
智能分块算法:按文件大小和数量优化分块,提高负载均衡
static splitListIntoChunks(list: string[]): string[][] { const chunks: string[][] = [] const chunkCount = Math.min(FileProcessorUtil.MAX_CONCURRENT, list.length) // 实际需要分块数 // 如果文件数量较少,使用简单的平均分块 if (list.length <= chunkCount * 2) { const baseSize = Math.floor(list.length / chunkCount) con...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left splitListIntoChunks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
static splitListIntoChunks(list: string[]): string[][] { const chunks: string[][] = [] const chunkCount = Math.min(FileProcessorUtil.MAX_CONCURRENT, list.length) // 实际需要分块数 // 如果文件数量较少,使用简单的平均分块 if (list.length <= chunkCount * 2) { const baseSize = Math.floor(list.length / chunkCount) con...
https://github.com/Yebingiscn/SweetVideo
676b1b62f95e2779ac75a0939c2ff2e35f520f81
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
setStackSpace
sets the space that is left out between stacked forms (with no label) @param space
public setStackSpace(space: number): void { this.mStackSpace = space; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setStackSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left space AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public setStackSpace(space: number): void { this.mStackSpace = space; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
ddc63fe6edbb1540a9da77fb1af6dc8648e61936
gitee
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/basepage/ColumnPage.ets
arkts
onBackPress
生命周期回调:返回键 // darcyRefactor: 只限入口组件
onBackPress(): boolean | void { Log.info(TAG + "onBackPress"); return false; // 返回false不消费回退事件 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : ...
onBackPress(): boolean | void { Log.info(TAG + "onBackPress"); return false; // 返回false不消费回退事件 }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L26-L29
eb43df0aa9e51432dc4416393fae4ed1198d5a0a
github
tdcare/tdwebrtc
example/MediaStreamAdvancedExample.ets
arkts
isCodecAvailable
检查是否支持指定编解码器
private isCodecAvailable(codec: string): boolean { if (!this.codecCapabilities) { return codec === 'VP8'; // VP8 始终可用 } return this.codecCapabilities.canEncode.includes(codec); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isCodecAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private isCodecAvailable(codec: string): boolean { if (!this.codecCapabilities) { return codec === 'VP8'; // VP8 始终可用 } return this.codecCapabilities.canEncode.includes(codec); }
https://github.com/tdcare/tdwebrtc
4172c1df225e9788154f1128ea59af8ea08c840f
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallNotifier.ets
arkts
cancelNotificationById
cancel Missed Call Notification By NotificationId @param id Notification Id
public async cancelNotificationById(id: number, count: number) { HiLog.i(TAG, 'cancelNotificationById:' + id) NotificationManager.cancel(id, this.label).catch((error: Error) => { HiLog.e(TAG, `cancelNotificationById,err ${JSON.stringify(error)}}`) }); let badgeNumber = await this.getMissedBadgeNumber(...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cancelNotificationById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Lef...
public async cancelNotificationById(id: number, count: number) { HiLog.i(TAG, 'cancelNotificationById:' + id) NotificationManager.cancel(id, this.label).catch((error: Error) => { HiLog.e(TAG, `cancelNotificationById,err ${JSON.stringify(error)}}`) }); let badgeNumber = await this.getMissedBadgeNumber(...
https://gitee.com/openharmony/applications_contacts.git
a4d0ed8f4d49adbd8350a07558669c20eeae13ef
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPInputHandler.ets
arkts
sendMouseDoubleClick
发送鼠标双击
private sendMouseDoubleClick(x: number, y: number) { this.sendMouseClick(x, y, 1) setTimeout(() => { this.sendMouseClick(x, y, 1) }, 100) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendMouseDoubleClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private sendMouseDoubleClick(x: number, y: number) { this.sendMouseClick(x, y, 1) setTimeout(() => { this.sendMouseClick(x, y, 1) }, 100) }
https://github.com/AetheriumSimulator/qemu-hmos
ec6f815908f35d86bdf0a43577af8c87bdd00a9d
github
erosTeam/NextE
shared/src/main/ets/parser/EhUconfigParser.ets
arkts
parseCategories
Front-page category visibility: hidden inputs ct_<key>=0|1 (1 = hidden), label from the sibling div.
private static parseCategories(html: string): EhUconfigCategory[] { const out: EhUconfigCategory[] = [] const re: RegExp = /<input[^>]*name="ct_([a-z-]+)"[^>]*value="(\d)"[^>]*>/g let m: RegExpExecArray | null = re.exec(html) while (m !== null) { const slug: string = m[1] const hidden: boo...
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 parseCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left...
private static parseCategories(html: string): EhUconfigCategory[] { const out: EhUconfigCategory[] = [] const re: RegExp = /<input[^>]*name="ct_([a-z-]+)"[^>]*value="(\d)"[^>]*>/g let m: RegExpExecArray | null = re.exec(html) while (m !== null) { const slug: string = m[1] const hidden: boo...
https://github.com/erosTeam/NextE
94ceeac1226b911df0c43b6ec67b5e92dda1cb7c
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/NetworkBoostService.ets
arkts
start
串流会话开始:声明业务类型 + 订阅网络质量回调
start(): void { if (this.active) { return; } this.active = true; this.lastState = null; this.reportInternal('good'); this.subscribeQos(); this.subscribeScene(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start 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#...
start(): void { if (this.active) { return; } this.active = true; this.lastState = null; this.reportInternal('good'); this.subscribeQos(); this.subscribeScene(); }
https://github.com/AlkaidLab/moonlight-harmony
317b47d9495ceacd6ea16050a8fdc8a624d6ac32
github
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/pages/ListPage.ets
arkts
onPageShow
========================================== 🆕 页面显示时刷新数据(从详情页返回时) ==========================================
onPageShow() { console.info('[ListPage] 页面显示,刷新数据'); this.loadPhotos(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
onPageShow() { console.info('[ListPage] 页面显示,刷新数据'); this.loadPhotos(); }
https://gitcode.com/openharmony/codelabs
77cb3b064c3254d92d591f4ca4c6563f7d17c7aa
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitBool
访问 bool 字段 Wire type: 0 (varint)
visitBool(value: boolean, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).bool(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitBool 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 boolean AST#identifier#Right AST#,#Left , AST...
visitBool(value: boolean, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).bool(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
4ae9d217d3a7682bbd389aa398620b2d7148f534
gitcode
arkui-x/samples
CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets
arkts
getDate
从缓存的Preferences实例中获取键对应的值 @param { Context } Context - 应用上下文 @param { function } callback - 回调函数
static getDate(context: Context, callback: (dateModel: DateModel) => void) { let dateModel: DateModel = getRealTimeDate(); try { // 获取Preferences实例 // TODO: 知识点: 通过用户首选项实现数据持久化 let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferenc...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left getDate AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Right AST#,#Left , AST#,#R...
static getDate(context: Context, callback: (dateModel: DateModel) => void) { let dateModel: DateModel = getRealTimeDate(); try { // 获取Preferences实例 // TODO: 知识点: 通过用户首选项实现数据持久化 let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferenc...
https://gitcode.com/arkui-x/samples
e366a9e1268777f6e42b807805f1ace78723543a
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
getSize
获取当前缓存大小 @returns 缓存条目数
getSize(): number { return this.cache.size }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSize 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_bloc...
getSize(): number { return this.cache.size }
https://github.com/offlinecat-dev/OCNetORM
a967f0f192fcd975e674c26824f924f2181f4ed8
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getCount
获取可用优惠券数量
static async getCount(): Promise<ApiResponse> { const response = await httpClient.get('/coupons/count'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const apiResponse = new ApiResponse(); apiResponse.code = getResponseCod...
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 getCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
static async getCount(): Promise<ApiResponse> { const response = await httpClient.get('/coupons/count'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const apiResponse = new ApiResponse(); apiResponse.code = getResponseCod...
https://github.com/Harrisonls2004/WaterFlow
44fe43e094a020fe8a3f2f5521ddd5badbbb2fa6
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
dx
Getter for x component
get dx(): number { return this._dx; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Left AST#identifier#Left dx AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST...
get dx(): number { return this._dx; }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L73-L75
80e056360a88f43c9f764a098041ff54b7072b82
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
getCompletionPromise
获取完成Promise SplashPage可以await这个Promise来等待初始化完成
getCompletionPromise(): Promise<boolean> { if (!this.completionPromise) { this.completionPromise = new Promise<boolean>((resolve) => { this.completionResolve = resolve; // 如果已经完成,立即resolve if (this.state.isCompleted) { resolve(true); } else if (this.state.i...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCompletionPromise AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AS...
getCompletionPromise(): Promise<boolean> { if (!this.completionPromise) { this.completionPromise = new Promise<boolean>((resolve) => { this.completionResolve = resolve; // 如果已经完成,立即resolve if (this.state.isCompleted) { resolve(true); } else if (this.state.i...
https://github.com/DaLongZhuaZi/manxia
c6af2e93c729c61f025bb5671c1c9bdf037f2c72
github
XJTUWYD/ArkDiff
entry/src/main/ets/utils/ThemeColors.ets
arkts
setDarkMode
设置深色模式
setDarkMode(isDark: boolean): void { this._darkMode = isDark; this._isMonokai = false; this._cached = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDarkMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isDark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) ...
setDarkMode(isDark: boolean): void { this._darkMode = isDark; this._isMonokai = false; this._cached = null; }
https://github.com/XJTUWYD/ArkDiff
5151c92330194b0d0fe3fad502907d96d91f4eda
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/FriendHandler.ets
arkts
isFriend
检查两人是否已经是好友
async isFriend(myPhone: string, friendPhone: string): Promise<boolean> { if (!this.store) { return false; } let predicates = new relationalStore.RdbPredicates('Friend'); predicates.equalTo('myPhone', myPhone); predicates.equalTo('friendPhone', friendPhone); try { let resultSet = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isFriend AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST#typ...
async isFriend(myPhone: string, friendPhone: string): Promise<boolean> { if (!this.store) { return false; } let predicates = new relationalStore.RdbPredicates('Friend'); predicates.equalTo('myPhone', myPhone); predicates.equalTo('friendPhone', friendPhone); try { let resultSet = ...
https://gitcode.com/openharmony/codelabs
7545bec59820a73b1d53d2e90afb82e41e0cac83
gitcode
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
clickSmsDiv
Click the text line.
clickSmsDiv() { this.checkedValueOfSms = !this.checkedValueOfSms; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickSmsDiv AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
clickSmsDiv() { this.checkedValueOfSms = !this.checkedValueOfSms; }
https://gitee.com/openharmony/applications_mms.git
69565363d63a98ecbc2ed7480d4864b6901be15b
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/string_concatenation/string_concatenation_byte.ets
arkts
main
--- desc: check concatenation of string and byte ---
function main(): void { const a: {{v.left}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: {{v.left}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a47cdab1056afce5e8ffc10f46bc300c85c46172
gitee
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/view/MainPage.ets
arkts
build
构建主页面 @returns {void} 无返回值
build() { AppNavDestination({ hideTitleBar: true, viewModel: this.vm, safeAreaEnabled: false }) { this.MainContent(); } }
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#expression_statement#Left AST#c...
build() { AppNavDestination({ hideTitleBar: true, viewModel: this.vm, safeAreaEnabled: false }) { this.MainContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
f96c382bc4dc84c7e33a0022b3386c3dd92ff612
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
setUIContext
Caches {@link UIContext} from the main window; call after {@link setWindowStage}.
setUIContext(): void { try { this.uiContext = this.mainWindow!.getUIContext(); } catch (error) { let err = error as BusinessError; Logger.error(`getUIContext failed. Code: ${err.code}, message: ${err.message}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUIContext 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...
setUIContext(): void { try { this.uiContext = this.mainWindow!.getUIContext(); } catch (error) { let err = error as BusinessError; Logger.error(`getUIContext failed. Code: ${err.code}, message: ${err.message}`); } }
https://gitcode.com/HarmonyOS_Samples/MusicHome
f9ae3e5ef4e787b89290d104bf9b69b66b854b14
gitcode
openharmony/developtools_ace_ets2bundle
compiler/sample/pages/testcases/showcaseCovid19.ets
arkts
onApplyFiltersPressed
constructor(id: string, parent: View, params: { countriesData: Array<CountryVM> }) { super(id, parent); console.log(`Create PageView`); Properties 'firstCountry', 'countriesSortDirection', 'firstMonth' only change in this View when also 'showFilters' changes. same applies to countriesData Hence, we do not need to make ...
onApplyFiltersPressed(): void { this.showFilters = false; this.countriesPresentation.resetByFilters(this.countriesData); this.monthsPresentation.firstMonth_ = 8; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onApplyFiltersPressed 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...
onApplyFiltersPressed(): void { this.showFilters = false; this.countriesPresentation.resetByFilters(this.countriesData); this.monthsPresentation.firstMonth_ = 8; }
https://gitee.com/openharmony/developtools_ace_ets2bundle.git
bba5a69af72dae2e28debddecd99b2ead63a1c54
gitee
erosTeam/NextE
shared/src/main/ets/state/GalleryReadProgressState.ets
arkts
setIndex
Update one gallery's progress in memory. Last write wins (eros_fe's local GalleryCacheController.setIndex overwrites unconditionally — newest-wins is reconciled only at the sync layer, so `t` is recorded but NOT compared here). Disk flush is the caller's job.
setIndex(gid: string, index: number, time: number): void { if (gid.length === 0 || index < 0) { return } this.indexMap.set(gid, index) this.timeMap.set(gid, time) this.revision = this.revision + 1 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
setIndex(gid: string, index: number, time: number): void { if (gid.length === 0 || index < 0) { return } this.indexMap.set(gid, index) this.timeMap.set(gid, time) this.revision = this.revision + 1 }
https://github.com/erosTeam/NextE
50b4266c5bd2aa3de7ac88a30afd61d2360f25a6
github
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/CartPage.ets
arkts
onCartListChange
监听购物车列表变化,自动刷新总价和数量
onCartListChange() { console.log(`CartPage.onCartListChange: cartList.length=${this.cartList.length}`); // 打印每个商品的状态 for (let i = 0; i < this.cartList.length; i++) { const item = this.cartList[i]; console.log(`CartPage.onCartListChange: item[${i}] cartId=${item.cartId}, name=${item.name}, pric...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCartListChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
onCartListChange() { console.log(`CartPage.onCartListChange: cartList.length=${this.cartList.length}`); // 打印每个商品的状态 for (let i = 0; i < this.cartList.length; i++) { const item = this.cartList[i]; console.log(`CartPage.onCartListChange: item[${i}] cartId=${item.cartId}, name=${item.name}, pric...
https://github.com/Harrisonls2004/WaterFlow
e437bd992bd0b55929dfbb4aaab429b67e4cd339
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
checkFilePermission
检测文件是否与相关权限,如果有权限则激活该权限 @param path 文件路径 @param operationMode 权限模式 @returns 结果
private async checkFilePermission(path: string, operationMode: fileShare.OperationMode): Promise<boolean> { // 校验文件权限 return await FileUtils.checkPersistPermission(path, operationMode).then((result) => { if (result[0]) { return FileUtils.activatePermission(path, operationMode).then(() => { ...
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 checkFilePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#L...
private async checkFilePermission(path: string, operationMode: fileShare.OperationMode): Promise<boolean> { // 校验文件权限 return await FileUtils.checkPersistPermission(path, operationMode).then((result) => { if (result[0]) { return FileUtils.activatePermission(path, operationMode).then(() => { ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L40-L57
91ee0323d36630f8b110657425a36f054e7d41ce
github
wuba/omni-ui
omni_component/src/main/ets/components/toast/OmniToast.ets
arkts
showSuccess
成功提示 @param options
public static showSuccess(options?: ToastOptions) { if (options) { const op = options op.icon = $r('app.media.success') OmniToast.handleShowToast(op) } else { OmniToast.handleShowToast({ icon: $r('app.media.success') }) } }
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 showSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ? A...
public static showSuccess(options?: ToastOptions) { if (options) { const op = options op.icon = $r('app.media.success') OmniToast.handleShowToast(op) } else { OmniToast.handleShowToast({ icon: $r('app.media.success') }) } }
https://github.com/wuba/omni-ui
a91543a0f0458c60f0602f2112ecf49332a7d70b
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
setValueFormatter
Sets a custom IValueFormatter for all DataSets this data object contains. @param f
public setValueFormatter(f: IValueFormatter): void { if (f == null) return; else { if (this.mDataSets) { for (let data of this.mDataSets.dataSource) { data.setValueFormatter(f); } } } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValueFormatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left f AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left I...
public setValueFormatter(f: IValueFormatter): void { if (f == null) return; else { if (this.mDataSets) { for (let data of this.mDataSets.dataSource) { data.setValueFormatter(f); } } } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
094217721aab43af1d2b8031939de375a9c43960
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Set.ets
arkts
forEach
Applies a function over all elements of the Set @param fn to apply
forEach(fn: (k: K) => void): void { let l: (v: Boolean, k: K) => void = (v: Boolean, k: K): void => { fn(k) } throw new Error("Set.forEach: not implemented") // this.map.forEach(l) }
AST#program#Left AST#ERROR#Left AST#identifier#Left forEach AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#iden...
forEach(fn: (k: K) => void): void { let l: (v: Boolean, k: K) => void = (v: Boolean, k: K): void => { fn(k) } throw new Error("Set.forEach: not implemented") // this.map.forEach(l) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1c6cc66c5ac20f3556d6b52a05b573aeb2f12578
gitee
Joker-x-dev/CoolMallArkTS
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
getSelectedGoodsList
读取已选商品列表 @returns {Promise<SelectedGoods[] | null>} 已选商品列表
async getSelectedGoodsList(): Promise<SelectedGoods[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: SelectedGoodsJson[] = JSON.parse(va...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSelectedGoodsList 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...
async getSelectedGoodsList(): Promise<SelectedGoods[] | null> { const value: preferences.ValueType = await this.prefs.get(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST, ""); if (typeof value === "string" && value.length > 0) { try { const parsed: SelectedGoodsJson[] = JSON.parse(va...
https://github.com/Joker-x-dev/CoolMallArkTS
b60b3da7a58b5a898d718e3e79ccf48706024a26
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
extractStructuredData
提取结构化数据
private static extractStructuredData(rawText: string): ExtractedData { const result: ExtractedData = { merchantName: '', totalAmount: 0, transactionDate: '', confidence: 0.8, items: [] }; // 提取商家名称(第一行非空内容) const lines = rawText.split('\n'); for (let i = 0; i < lines...
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 extractStructuredData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawText AST#identifier#Right AST#ERROR#Left A...
private static extractStructuredData(rawText: string): ExtractedData { const result: ExtractedData = { merchantName: '', totalAmount: 0, transactionDate: '', confidence: 0.8, items: [] }; // 提取商家名称(第一行非空内容) const lines = rawText.split('\n'); for (let i = 0; i < lines...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
4f5a7b8fb3ac7adff5b990409510561e9715b26a
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnInputViewModel.ets
arkts
setSizeLgValue
设置大尺寸输入框的内容 @param value 新的输入值
setSizeLgValue(value: string): void { this.sizeLgValue = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSizeLgValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setSizeLgValue(value: string): void { this.sizeLgValue = value; }
https://github.com/codelably/tuniao-ui
2d7b6b72c5cab541be0e5177f4aaf8e8220e8577
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
startsWith
判断字符串是否以给定的字符串开头 @param string 要检索的字符串 @param target 要检索字符 @param position 检索的位置 @returns
static startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left startsWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left string AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi...
static startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
https://github.com/tdcare/tdwebrtc
ee9ab9349fcaec8e9f2a826a39311ab61ca107be
github
codelably/HCompass
entry/src/main/ets/entryability/AppInterceptors.ets
arkts
logErrorLines
输出 error 日志(支持多行与分段)
private logErrorLines(lines: string[]): void { this.logLines("error", lines); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logErrorLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lines AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr...
private logErrorLines(lines: string[]): void { this.logLines("error", lines); }
https://github.com/codelably/HCompass
9138e769c9473585fb53cfcbc0e5963c53ecb56d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleDeviceAdded
处理设备添加
private handleDeviceAdded(deviceId: number): void { // 如果该设备有待执行的移除定时器,取消之(USB 设备闪断后重新出现) const pendingTimer = this.pendingRemovalTimers.get(deviceId); if (pendingTimer !== undefined) { clearTimeout(pendingTimer); this.pendingRemovalTimers.delete(deviceId); console.info(`[GAMEPAD] USB 设备...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleDeviceAdded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#...
private handleDeviceAdded(deviceId: number): void { // 如果该设备有待执行的移除定时器,取消之(USB 设备闪断后重新出现) const pendingTimer = this.pendingRemovalTimers.get(deviceId); if (pendingTimer !== undefined) { clearTimeout(pendingTimer); this.pendingRemovalTimers.delete(deviceId); console.info(`[GAMEPAD] USB 设备...
https://github.com/AlkaidLab/moonlight-harmony
4687ed03d2d2faaac47ba3058d6518c256c80753
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets
arkts
loadWebDAVSettings
加载WebDAV设置
private async loadWebDAVSettings(): Promise<WebDAVSettings | null> { if (!this.context) return null; try { const options: preferences.Options = { name: 'webdav_settings' }; const dataPreferences = await preferences.getPreferences(this.context, options); const serverUrl = dataPref...
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 loadWebDAVSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async loadWebDAVSettings(): Promise<WebDAVSettings | null> { if (!this.context) return null; try { const options: preferences.Options = { name: 'webdav_settings' }; const dataPreferences = await preferences.getPreferences(this.context, options); const serverUrl = dataPref...
https://github.com/DaLongZhuaZi/manxia
f871a563736040c64640e015b041ddf94a30e885
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test4_original_index.ets
arkts
testTernaryChain
=== Conditional (ternary) chaining ===
function testTernaryChain(x: number): string { return x > 0 ? 'positive' : (x < 0 ? 'negative' : 'zero'); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTernaryChain AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function testTernaryChain(x: number): string { return x > 0 ? 'positive' : (x < 0 ? 'negative' : 'zero'); }
https://github.com/miaochiahao/ark-ghidra
03071fbadab7205cf14debd754523b802d06ca1d
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/UserProfileDAO.ets
arkts
getByUserId
根据用户ID获取画像
static async getByUserId(userId: number): Promise<UserProfile | null> { try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(UserProfile.tableName); predicates.equalTo('user_id', userId); const resultSet = await store.query(predicates); ...
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 getByUserId 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 getByUserId(userId: number): Promise<UserProfile | null> { try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(UserProfile.tableName); predicates.equalTo('user_id', userId); const resultSet = await store.query(predicates); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
8de258c485f62678d440cd322f63a51e715b3b86
github
honjow/Next2V
shared/src/main/ets/settings/LanguageSettings.ets
arkts
resolveTargetLanguage
Follow-system mode: resolve the current system language as the concrete value to set. setAppPreferredLanguage('default') cannot clear a previous pin at the OS level, so we must pass the resolved locale explicitly.
private static resolveTargetLanguage(mode: AppLanguageMode): string { if (mode !== LanguageSettings.MODE_SYSTEM) { return mode } try { const sys = i18n.System.getSystemLanguage() if (sys) { return sys } } catch (_e) {} return '' }
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 resolveTargetLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#...
private static resolveTargetLanguage(mode: AppLanguageMode): string { if (mode !== LanguageSettings.MODE_SYSTEM) { return mode } try { const sys = i18n.System.getSystemLanguage() if (sys) { return sys } } catch (_e) {} return '' }
https://github.com/honjow/Next2V
8123314a22a63a5ef2f0e1d5fc13aa3cd82d78ca
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
parse
Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or throws `RangeError` if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31). Only the @link{https://tc39.es/ecma262/#sec-date-time-string-format|ISO 8601 format...
public static parse(dateStr: string): long { return Date.parseDateFromString(dateStr); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Ri...
public static parse(dateStr: string): long { return Date.parseDateFromString(dateStr); }
https://gitcode.com/iop123123/arkts-static-skills
e98394ab6fd4e68e75ac79ace2b53ac0dd457f96
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AiKeyService.ets
arkts
resolveOverlaps
检测并修复按键重叠 基于按键尺寸计算最小安全距离,迭代推开过近的按键
function resolveOverlaps(keys: CustomKeyDef[]): void { const SCREEN_W = 720; const SCREEN_H = 360; const MAX_ITER = 10; for (let iter = 0; iter < MAX_ITER; iter++) { let hasOverlap = false; for (let i = 0; i < keys.length; i++) { for (let j = i + 1; j < keys.length; j++) { const a = keys[...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left resolveOverlaps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keys AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function resolveOverlaps(keys: CustomKeyDef[]): void { const SCREEN_W = 720; const SCREEN_H = 360; const MAX_ITER = 10; for (let iter = 0; iter < MAX_ITER; iter++) { let hasOverlap = false; for (let i = 0; i < keys.length; i++) { for (let j = i + 1; j < keys.length; j++) { const a = keys[...
https://github.com/AlkaidLab/moonlight-harmony
739993fbe68ceee8e3e47d5e28c86f2ba2cc9eaf
github
xufei5789651/HmWan
commons/utils/src/main/ets/web/WebNodeController.ets
arkts
aboutToResize
当布局大小发生变化时进行回调
aboutToResize(size: Size) { console.info(TAG, 'aboutToResize width : ' + size.width + ' height : ' + size.height); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToResize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Size AST#identifier#Right A...
aboutToResize(size: Size) { console.info(TAG, 'aboutToResize width : ' + size.width + ' height : ' + size.height); }
https://github.com/xufei5789651/HmWan
5e24bffe27cad917b4c4bbb8b8ef1c4ae1274a8d
github
LongLiveY96/chatcube
entry/src/main/ets/services/search/SearchEngineRegistry.ets
arkts
getApiKeyPrefKey
获取指定引擎的 API Key 字段的 preference key
getApiKeyPrefKey(id: SearchEngine): string { const desc = this.getById(id) if (desc === undefined) { return '' } for (const field of desc.configFields) { if (field.isPassword) { return field.key } } return '' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getApiKeyPrefKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SearchEngine AST#identifier#Right AST#)#L...
getApiKeyPrefKey(id: SearchEngine): string { const desc = this.getById(id) if (desc === undefined) { return '' } for (const field of desc.configFields) { if (field.isPassword) { return field.key } } return '' }
https://github.com/LongLiveY96/chatcube
c20a4fc0ba2f0fc475fb8d313f6efe436ab56072
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
isLetter
isLetter(char) checks whether the char is a letter. @param value a char to be tested. @returns true if the char is a letter.
public static isLetter(value: char): boolean { return (c'A' <= value) && (value <= c'Z') || (c'a' <= value) && (value <= c'z'); }
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 isLetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public static isLetter(value: char): boolean { return (c'A' <= value) && (value <= c'Z') || (c'a' <= value) && (value <= c'z'); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d612c49e43ca7016964bbb5d1e2a605bd961c806
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
getAllSessions
Get all active sessions
static getAllSessions(): SessionState[] { const result: SessionState[] = []; GlobalSessionManager.sessions.forEach((session: SessionState) => { result.push(session); }); return result; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllSessions 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 Session...
static getAllSessions(): SessionState[] { const result: SessionState[] = []; GlobalSessionManager.sessions.forEach((session: SessionState) => { result.push(session); }); return result; }
https://github.com/tangwengang-del/freerdp-harmonyos
6e8a2b80cb6ceb11da0a81e3bb32f616fe07b510
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets
arkts
formatToDate
计算运行时间:D天HH小时mm分
formatToDate(seconds: number) { // 依赖 duration 插件,duration 函数才能正常运行 // dayjs.extend(duration) // 根据秒数计算运行时长,返回 dayjs 对象 const dayjsInstance = dayjs.duration(seconds, 'seconds') // 格式化 dayjs 对象 return dayjsInstance.format('D天H小时mm分') }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left formatToDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)...
formatToDate(seconds: number) { // 依赖 duration 插件,duration 函数才能正常运行 // dayjs.extend(duration) // 根据秒数计算运行时长,返回 dayjs 对象 const dayjsInstance = dayjs.duration(seconds, 'seconds') // 格式化 dayjs 对象 return dayjsInstance.format('D天H小时mm分') }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
dad90224ef718f1918671ab8ebbec8d8c669ebcb
gitcode
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
loadRelatedSingle
延迟加载单个关联实体 @param propertyName 关联属性名
async loadRelatedSingle(propertyName: string): Promise<EntityData | null> { const value = await this.loadRelated(propertyName) if (value && !value.isArray) { return value.singleEntity } return null }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadRelatedSingle AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left propertyName AST#identifier#Right AST#type_annotation#Left AS...
async loadRelatedSingle(propertyName: string): Promise<EntityData | null> { const value = await this.loadRelated(propertyName) if (value && !value.isArray) { return value.singleEntity } return null }
https://github.com/offlinecat-dev/OCNetORM
c3b64e16a378262723176786cf4258081828f168
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
updateSaveStat
Saves the stat of this bunch to the disk. Works together with the web state system.
async updateSaveStat() { let stat = '0'; if (!this.currentTab) { meow(`No current tab`, 'meowTabsBunch][updateStat', meowLevel.WARN); } else { stat = `${this.tabs.indexOf(this.currentTab)}`; } const statPath = `${this.workingDir}/stat`; await saveHybrid(statPath, stat, true); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateSaveStat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expre...
async updateSaveStat() { let stat = '0'; if (!this.currentTab) { meow(`No current tab`, 'meowTabsBunch][updateStat', meowLevel.WARN); } else { stat = `${this.tabs.indexOf(this.currentTab)}`; } const statPath = `${this.workingDir}/stat`; await saveHybrid(statPath, stat, true); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
24e0b0bbc9376b3f43e72f46f9d1f4aac28083a5
github
harmonyos/codelabs
HarmonyOS_NEXT/PedometerApp/entry/src/main/ets/common/utils/StepsUtil.ets
arkts
getProgressValue
Get the progress value. @param {number} setSteps @param {number} currentSteps @return {number} progressValue
getProgressValue(setSteps: number, currentSteps: number): number { let progressValue: number = 0; if (setSteps > 0 && currentSteps > 0) { progressValue = Math.round((currentSteps / setSteps) * CommonConstants.ONE_HUNDRED); } return progressValue; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProgressValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left setSteps AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AS...
getProgressValue(setSteps: number, currentSteps: number): number { let progressValue: number = 0; if (setSteps > 0 && currentSteps > 0) { progressValue = Math.round((currentSteps / setSteps) * CommonConstants.ONE_HUNDRED); } return progressValue; }
https://gitee.com/harmonyos/codelabs.git
b3df6f56b45cf15399f0d89d58023a2fc38389a1
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
uint32
Write unsigned varint32
uint32(v: number): Writer { while (v >= 0x80) { this.push((v & 0x7F) | 0x80); v >>>= 7 } this.push(v) return this }
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#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right...
uint32(v: number): Writer { while (v >= 0x80) { this.push((v & 0x7F) | 0x80); v >>>= 7 } this.push(v) return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
dd5ff241c38772353de6a5ae710ba42806690493
gitcode
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
offBTStateChange
取消订阅蓝牙设备开关状态事件
private offBTStateChange() { Log.showInfo(TAG, `offBTStateChange`); try { access.off('stateChange'); } catch (err) { Log.showError(TAG, `offBTStateChange: err = ${err}`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left offBTStateChange 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#{#...
private offBTStateChange() { Log.showInfo(TAG, `offBTStateChange`); try { access.off('stateChange'); } catch (err) { Log.showError(TAG, `offBTStateChange: err = ${err}`); } }
https://gitcode.com/arkui-x/samples
17ad6deeaf12098339b09b3786e66fd0ce62ef51
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
index
Sets the starting index of the match result. @param { int | undefined } val The index value to be set. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set index(val: int | undefined) { if (val == undefined) { this.hasIndex_ = false return } this.hasIndex_ = true this.index_ = val }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef...
public set index(val: int | undefined) { if (val == undefined) { this.hasIndex_ = false return } this.hasIndex_ = true this.index_ = val }
https://gitcode.com/iop123123/arkts-static-skills
f4e2d8a17437defb6570a637a8f25bbe2304c480
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/OnlineComicConverter.ets
arkts
convertToOnlineChapterInfo
将数据库记录转换为 OnlineChapterInfo @param record 数据库记录 @returns OnlineChapterInfo 对象
public static convertToOnlineChapterInfo(record: DatabaseRecord): OnlineChapterInfo { const obj: DatabaseObject = record as DatabaseObject; // [调试] 输出原始数据 - 仅在出错时启用 // const rawId = obj.id; // const rawComicId = obj.comicId; const rawExternalId = obj.externalId; // const rawTitle = obj.ti...
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 convertToOnlineChapterInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right ...
public static convertToOnlineChapterInfo(record: DatabaseRecord): OnlineChapterInfo { const obj: DatabaseObject = record as DatabaseObject; // [调试] 输出原始数据 - 仅在出错时启用 // const rawId = obj.id; // const rawComicId = obj.comicId; const rawExternalId = obj.externalId; // const rawTitle = obj.ti...
https://github.com/DaLongZhuaZi/manxia
ae749a99eb7fc2f35211eafef9b364a542a1a13c
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/StringUtils.ets
arkts
formatFileSize
格式化文件大小 @param size 文件大小(字节) @returns 格式化后的字符串,如 "1.5 KB"
public static formatFileSize(size: number): string { if (size < 0) { return '-'; } if (size < 1024) { return size + ' B'; } else if (size < 1024 * 1024) { return (size / 1024).toFixed(1) + ' KB'; } else if (size < 1024 * 1024 * 1024) { return (size / (1024 * 1024)).toFixed(...
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 formatFileSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : A...
public static formatFileSize(size: number): string { if (size < 0) { return '-'; } if (size < 1024) { return size + ' B'; } else if (size < 1024 * 1024) { return (size / 1024).toFixed(1) + ' KB'; } else if (size < 1024 * 1024 * 1024) { return (size / (1024 * 1024)).toFixed(...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/StringUtils.ets#L92-L105
f8dceb9f69c32673fde526c11bc53bd9facb3adb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
performNetworkRequest
执行网络请求(模拟实现)
private performNetworkRequest(request: ImageRequestInfo): WebViewLoadingResult { // 这里应该通过WebView实际执行网络请求 // 由于ArkTS限制,这里只是模拟实现 logger.debug(TAG, `执行网络请求: ${request.url}`); // 直接返回模拟结果,避免使用Promise构造函数和setTimeout const result: WebViewLoadingResult = { success: false, data: null, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left performNetworkRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private performNetworkRequest(request: ImageRequestInfo): WebViewLoadingResult { // 这里应该通过WebView实际执行网络请求 // 由于ArkTS限制,这里只是模拟实现 logger.debug(TAG, `执行网络请求: ${request.url}`); // 直接返回模拟结果,避免使用Promise构造函数和setTimeout const result: WebViewLoadingResult = { success: false, data: null, ...
https://github.com/DaLongZhuaZi/manxia
e28332ba9202345d49c84ab3ae9db24388839858
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets
arkts
readKeyboardVisible
检测键盘是否可见,更新 cachedKeyboardVisible
private readKeyboardVisible(): void { if (!this.mainWindow) { return } try { const keyboardAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD) this.cachedKeyboardVisible = keyboardAvoidArea.bottomRect.height > 0 hilog.info(DOMAIN, TAG, `KeyboardVisibl...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left readKeyboardVisible 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 ...
private readKeyboardVisible(): void { if (!this.mainWindow) { return } try { const keyboardAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD) this.cachedKeyboardVisible = keyboardAvoidArea.bottomRect.height > 0 hilog.info(DOMAIN, TAG, `KeyboardVisibl...
https://github.com/Xiwei753/xiezuoruanjian
370db631d6c98f5626906ecde8146ecdecfa02e8
github
arkui-x/samples
CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/BottomDrawer.ets
arkts
build
list滚动控制器
build() { List({ scroller: this.listScroller, space: 16 }) { ListItem() { this.searchAddress() } .borderRadius({ topLeft: $r('app.integer.bottom_drawer_slide_border_radius_top_left_15'), topRight: $r('app.integer.bottom_drawer_slide_border_radius_top_right_15') }) ...
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#expression_statement#Left AST#c...
build() { List({ scroller: this.listScroller, space: 16 }) { ListItem() { this.searchAddress() } .borderRadius({ topLeft: $r('app.integer.bottom_drawer_slide_border_radius_top_left_15'), topRight: $r('app.integer.bottom_drawer_slide_border_radius_top_right_15') }) ...
https://gitcode.com/arkui-x/samples
23be8a1392e33354b0d2ecbc97382fe851da7637
gitcode
pangpang20/antennaPodHM
entry/src/main/ets/service/DownloadService.ets
arkts
downloadEpisode
下载Episode
async downloadEpisode(episode: Episode): Promise<void> { // 如果已经在下载或队列中,直接返回 if (this.downloadTasks.has(episode.id) || this.downloadQueue.find(e => e.id === episode.id)) { console.warn('Episode is already downloading or in queue'); return; } // 如果已下载,直接返回 if (episode.downloadStatus ==...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadEpisode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episode AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async downloadEpisode(episode: Episode): Promise<void> { // 如果已经在下载或队列中,直接返回 if (this.downloadTasks.has(episode.id) || this.downloadQueue.find(e => e.id === episode.id)) { console.warn('Episode is already downloading or in queue'); return; } // 如果已下载,直接返回 if (episode.downloadStatus ==...
https://github.com/pangpang20/antennaPodHM
55ed38c93754632f541abb855bc6d9589b7bd4e8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceSearchService.ets
arkts
getSearchableSources
获取所有可用于搜索的书源
getSearchableSources(): NovelSourceInfo[] { return this.sourceManager.getEnabledSources().filter(s => s.searchable); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getSearchableSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ...
getSearchableSources(): NovelSourceInfo[] { return this.sourceManager.getEnabledSources().filter(s => s.searchable); }
https://github.com/DaLongZhuaZi/manxia
4c294c927d1c3a1cd4b90d8bbd1a03b74cdff5a7
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
updateProxyTestSiteStatus
更新测试网站状态
private updateProxyTestSiteStatus(index: number, status: 'idle' | 'testing' | 'success' | 'failed', responseTime?: number, error?: string): void { const sites: ProxyTestSite[] = []; for (let i = 0; i < this.proxyTestSites.length; i++) { if (i === index) { const updatedSite: ProxyTestSite = ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateProxyTestSiteStatus 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#id...
private updateProxyTestSiteStatus(index: number, status: 'idle' | 'testing' | 'success' | 'failed', responseTime?: number, error?: string): void { const sites: ProxyTestSite[] = []; for (let i = 0; i < this.proxyTestSites.length; i++) { if (i === index) { const updatedSite: ProxyTestSite = ...
https://github.com/DaLongZhuaZi/manxia
c895544a9074d04841f5de133a1ddc9b2ab9d828
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/ReminderService.ets
arkts
requestNotificationPermission
请求通知权限
static async requestNotificationPermission(): Promise<boolean> { try { const isEnabled = await notificationManager.isNotificationEnabled(); if (!isEnabled) { console.warn('[ReminderService] 通知权限未开启'); return false; } return true; } catch (error) { console.error('[...
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 requestNotificationPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
static async requestNotificationPermission(): Promise<boolean> { try { const isEnabled = await notificationManager.isNotificationEnabled(); if (!isEnabled) { console.warn('[ReminderService] 通知权限未开启'); return false; } return true; } catch (error) { console.error('[...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
609a87a3324905afa87231421e0a61dd83657d28
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FilenameUtils.ets
arkts
replaceDateIfExists
替换字符串末尾的日期为指定日期 @param str 字符串 @param newDate 新日期 @returns 替换后的字符串
private static replaceDateIfExists(str: string, newDate: string): string { // 检查字符串是否以日期格式结尾 (yyyyMMdd) const datePattern = /(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/; const match = str.match(datePattern); if (match) { // 如果是日期结尾,替换为新日期 return str.substring(0, match.index) + newDate; ...
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 replaceDateIfExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#L...
private static replaceDateIfExists(str: string, newDate: string): string { // 检查字符串是否以日期格式结尾 (yyyyMMdd) const datePattern = /(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/; const match = str.match(datePattern); if (match) { // 如果是日期结尾,替换为新日期 return str.substring(0, match.index) + newDate; ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L79-L88
b085a91f13500d3e30da25b2b57704ce28e609d3
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitInt64
访问 int64 字段 JSON: string (避免精度丢失)
visitInt64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitInt64 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 bigint AST#identifier#Right AST#,#Left , AST...
visitInt64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
94a9efcdcc970713d5a7a09f5931da9d5174e7db
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets
arkts
search
使用第一个启用的规则搜索
async search(word: string): Promise<DictSearchResult> { const enabledRules = this.getEnabledRules(); if (enabledRules.length === 0) { return { word: word, content: '', source: '', success: false, error: '没有启用的字典规则' }; } return this.searchWithRule(en...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left search AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left word AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async search(word: string): Promise<DictSearchResult> { const enabledRules = this.getEnabledRules(); if (enabledRules.length === 0) { return { word: word, content: '', source: '', success: false, error: '没有启用的字典规则' }; } return this.searchWithRule(en...
https://github.com/DaLongZhuaZi/manxia
56a392c3781727beb259fc50adb63fe72c260bd4
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
isNotBlank
判断字符串是否为非空和空白符(空白符包括空格、制表符、全角空格和不间断空格)true为非空,否则false @param str @returns
static isNotBlank(str: string | undefined | null): boolean { return false === StrUtil.isBlank(str); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNotBlank 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#binary_expression#Left...
static isNotBlank(str: string | undefined | null): boolean { return false === StrUtil.isBlank(str); }
https://github.com/tdcare/tdwebrtc
8cc95331f9a54db26b3ed35009dc026d5b6cf11a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findIndex
Finds an index of the first element in the Int32Array that satisfies the condition @param fn condition @returns the index of the first element that satisfies fn
public findIndex(fn: (val: int) => boolean): int { let newF: (val: int, index: int, array: Int32Array) => boolean = (val: int, index: int, array: Int32Array): boolean => { return fn(val) } return this.findIndex(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public findIndex(fn: (val: int) => boolean): int { let newF: (val: int, index: int, array: Int32Array) => boolean = (val: int, index: int, array: Int32Array): boolean => { return fn(val) } return this.findIndex(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
610918fe2a746c6b843529d0e6c492d536d5e876
gitee
Yebingiscn/SweetVideo
entry/src/main/ets/utils/DebounceUtil.ets
arkts
throttle
节流执行函数 @param key 唯一标识键 @param func 要执行的函数 @param interval 执行间隔(毫秒) @returns 是否执行了函数
static throttle(key: string, func: Function, interval: number = 100): boolean { const now = Date.now() const lastTime = ThrottleUtil.lastExecuteTime.get(key) || 0 if (now - lastTime >= interval) { func() ThrottleUtil.lastExecuteTime.set(key, now) return true } return false }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left throttle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
static throttle(key: string, func: Function, interval: number = 100): boolean { const now = Date.now() const lastTime = ThrottleUtil.lastExecuteTime.get(key) || 0 if (now - lastTime >= interval) { func() ThrottleUtil.lastExecuteTime.set(key, now) return true } return false }
https://github.com/Yebingiscn/SweetVideo
0840749fdd905ed1ee4aa36a4c24575d5ae86cb1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
every
Checks that all elements of BigInt64Array satisfy the passed function @param fn check function @returns true if all elements satisfy fn
public every(fn: (element: long, index: int, array: BigInt64Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (!fn(this.at(i), i, this)) { return false } } return true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig...
public every(fn: (element: long, index: int, array: BigInt64Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (!fn(this.at(i), i, this)) { return false } } return true }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
10eae04615212a13381a9f317cbb38fd966f7b6b
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/OrmContext.ets
arkts
reset
重置上下文(主要用于测试) 恢复为默认的单例依赖
reset(): void { this.metadataStorage = MetadataStorage.getInstance() this.databaseManager = DatabaseManager.getInstance() this.logger = Logger.getInstance() this.configured = false OrmContext.clearGlobalHooks() OrmContext.clearEventListeners() OrmContext.slowQueryThresholdMs = 1000 Orm...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.metadataStorage = MetadataStorage.getInstance() this.databaseManager = DatabaseManager.getInstance() this.logger = Logger.getInstance() this.configured = false OrmContext.clearGlobalHooks() OrmContext.clearEventListeners() OrmContext.slowQueryThresholdMs = 1000 Orm...
https://github.com/offlinecat-dev/OCNetORM
1e5abb55b9d92135e7faa6cd3bac79f0209481d7
github
YDYm233/EasyRandom_HarmonyNextApp
common/VitalUI/src/main/ets/components/ColorPickerComponent/ColorPickerDialog.ets
arkts
hslToHslaString
HSL → hsla() 字符串
function hslToHslaString(h: number, s: number, l: number, a: number = 1): string { return `hsla(${h}°, ${s}%, ${l}%, ${a})` }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hslToHslaString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left h AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function hslToHslaString(h: number, s: number, l: number, a: number = 1): string { return `hsla(${h}°, ${s}%, ${l}%, ${a})` }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
97d7d88decb704fc04697df9f3dde8e3842f73c6
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/utils/PerformanceMonitor.ets
arkts
snapshotMemory
记录内存快照
snapshotMemory(): NGFMemorySnapshot { const now = Date.now(); let usedPssKb: number = 0; try { const memInfo = hidebug.getAppNativeMemInfo(); usedPssKb = Number(memInfo.pss); } catch { usedPssKb = 0; } const snapshot = new NGFMemorySnapshot(now, usedPssKb); this.memorySna...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left snapshotMemory 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 NGFMemorySnapshot AST#identifier#Right AST#ERRO...
snapshotMemory(): NGFMemorySnapshot { const now = Date.now(); let usedPssKb: number = 0; try { const memInfo = hidebug.getAppNativeMemInfo(); usedPssKb = Number(memInfo.pss); } catch { usedPssKb = 0; } const snapshot = new NGFMemorySnapshot(now, usedPssKb); this.memorySna...
https://github.com/DaLongZhuaZi/NGF
c1864fcd1d90edf02aa554660f82ef88041e7bff
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/StreamMenuManager.ets
arkts
getSession
获取串流会话
private getSession(): StreamingSession | null { return this.viewModel.getSession(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left A...
private getSession(): StreamingSession | null { return this.viewModel.getSession(); }
https://github.com/AlkaidLab/moonlight-harmony
5792d1db311c27ef01e72e0b3a4e79770a6fb0d8
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/AlbumService.ets
arkts
getWYAlbumInfo
获取网易云音乐专辑信息(使用 linux/forward 接口绕过风控) @param albumId 专辑ID @returns Promise<AlbumInfo>
private static async getWYAlbumInfo(albumId: string): Promise<AlbumInfo> { // 使用 linux/forward 接口 const url = 'https://music.163.com/api/linux/forward'; // 生成加密参数 const formData = await WYCrypto.generateLinuxForwardForm( 'POST', 'https://music.163.com/api/album/' + albumId, {} )...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getWYAlbumInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left albumId AST#ide...
private static async getWYAlbumInfo(albumId: string): Promise<AlbumInfo> { // 使用 linux/forward 接口 const url = 'https://music.163.com/api/linux/forward'; // 生成加密参数 const formData = await WYCrypto.generateLinuxForwardForm( 'POST', 'https://music.163.com/api/album/' + albumId, {} )...
https://github.com/cpdd5201314/harmonyOS-music-app
2bda4cb60dd4ad54ff535e7f7ea1fef397bbb36b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
updateAppointmentStatus
Action: 更新预约状态
public updateAppointmentStatus(id: string, status: 'pending' | 'confirmed' | 'completed' | 'cancelled'): void { const updatedAppointments: Appointment[] = []; for (let i = 0; i < this.state.appointments.length; i++) { const app = this.state.appointments[i]; if (app.id === id) { const updat...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateAppointmentStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public updateAppointmentStatus(id: string, status: 'pending' | 'confirmed' | 'completed' | 'cancelled'): void { const updatedAppointments: Appointment[] = []; for (let i = 0; i < this.state.appointments.length; i++) { const app = this.state.appointments[i]; if (app.id === id) { const updat...
https://github.com/LJ666-ui/harmony-health-care
240a867dda74fb2df9fdb7bed19b5a08a474be58
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
getStyleName
Get the registered style name by style ID @param styleId Style ID @return Style name
public getStyleName(styleId: number): string { if (this.nativeHandle == 0) { return ''; } return lib.HighlightEngine_GetStyleName(this.nativeHandle, styleId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStyleName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left styleId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
public getStyleName(styleId: number): string { if (this.nativeHandle == 0) { return ''; } return lib.HighlightEngine_GetStyleName(this.nativeHandle, styleId); }
https://github.com/FinalScave/SweetLine
63a1b8df846a60f388e26d3108e0caee18d18810
github
ChangJing01/HarmonyOS-FinalProject
entry/src/main/ets/viewmodel/InitialData.ets
arkts
constructor
1-5 星
constructor(user: string, content: string, rating: number) { this.user = user; this.avatar = $r('app.media.ic_avatar'); // 确保你有这个默认头像,或者用 goodsImg 代替 this.content = content; this.time = new Date().toLocaleDateString(); this.rating = rating; }
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 user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A...
constructor(user: string, content: string, rating: number) { this.user = user; this.avatar = $r('app.media.ic_avatar'); // 确保你有这个默认头像,或者用 goodsImg 代替 this.content = content; this.time = new Date().toLocaleDateString(); this.rating = rating; }
https://github.com/ChangJing01/HarmonyOS-FinalProject
2699c8fcf35b17f7da8b10a349e8476c01853cb5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test29_original_index.ets
arkts
testCompoundLogic
--- Compound logical expressions ---
function testCompoundLogic(): string { let a: boolean = true; let b: boolean = false; let c: boolean = true; let r1: boolean = a && b; let r2: boolean = a || b; let r3: boolean = a && c; let r4: boolean = !a; let r5: boolean = !(a && b); return String(r1) + ',' + String(r2) + ',' + String(r3) + ',' + ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCompoundLogic 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 testCompoundLogic(): string { let a: boolean = true; let b: boolean = false; let c: boolean = true; let r1: boolean = a && b; let r2: boolean = a || b; let r3: boolean = a && c; let r4: boolean = !a; let r5: boolean = !(a && b); return String(r1) + ',' + String(r2) + ',' + String(r3) + ',' + ...
https://github.com/miaochiahao/ark-ghidra
7b41036636eb688ec2f4157e37b326386e27e454
github
hhtczengjing/ohos_quickjs
quickjs/src/main/ets/JSValue.ets
arkts
getProperty
==================== Property Access ====================
getProperty(property: string): JSValue { const handle = qjs.getProperty(this.ctxHandle.engineHandle, this.handle, property); return new JSValue(this.ctxHandle, handle); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left property AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
getProperty(property: string): JSValue { const handle = qjs.getProperty(this.ctxHandle.engineHandle, this.handle, property); return new JSValue(this.ctxHandle, handle); }
https://github.com/hhtczengjing/ohos_quickjs
08267b68b158d25da9af6d41d9e2a23a55951271
github
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
onWillApplyTheme
主题即将应用 @param {Theme} theme - 主题对象 @returns {void} 无返回值
onWillApplyTheme(theme: Theme): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWillApplyTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Theme AST#identifier#Right AST#)#Left ...
onWillApplyTheme(theme: Theme): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
669c6301e28cdc45cbca9d8850bce2b86dd30c16
github
qiaomu8559968/FlipClock
clock_component/src/main/ets/components/FlipTimer.ets
arkts
updateDisplayState
更新显示状态(是否显示小时) 倒计时且不足1小时时隐藏小时 正计时始终显示小时
updateDisplayState() { if (this.isCountDown && this.currentSeconds < 3600) { if (this.showHour) { this.showHour = false // 状态改变,重新计算布局 this.calculateLayout(this.containerWidth, this.containerHeight) } } else { if (!this.showHour) { this.showHour = true ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateDisplayState 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...
updateDisplayState() { if (this.isCountDown && this.currentSeconds < 3600) { if (this.showHour) { this.showHour = false // 状态改变,重新计算布局 this.calculateLayout(this.containerWidth, this.containerHeight) } } else { if (!this.showHour) { this.showHour = true ...
https://gitcode.com/qiaomu8559968/FlipClock
5a80c6bc517ce9e5f7dd61ef2633854229fc5ab0
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets
arkts
constructor
Constructs a ArrayBlockingQueue with provided capaity from iterable. @param { int } capacity the capacity of the ArrayBlockingQueue @param { Iterable<T> } iterable the iterable instance to initialize ArrayBlockingQueue
constructor(capacity: int, iterable: Iterable<T>) { if (capacity <= 0) { throw new RangeError("ArrayBlockingQueue:: Invalid capacity"); } this.capacitySize = capacity; this.array = Array.create<T | undefined>(this.capacitySize, undefined); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ...
constructor(capacity: int, iterable: Iterable<T>) { if (capacity <= 0) { throw new RangeError("ArrayBlockingQueue:: Invalid capacity"); } this.capacitySize = capacity; this.array = Array.create<T | undefined>(this.capacitySize, undefined); ...
https://gitcode.com/iop123123/arkts-static-skills
778aa82b1d3d16137f114f68773e6665522773e4
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/HttpService.ets
arkts
options
OPTIONS 请求
async options( url: string, headers: Record<string, string> = {}, runtime?: HttpRequestRuntimeOptions ): Promise<HttpResponse> { const config: HttpRequestConfig = { url: url, method: HttpMethod.OPTIONS, headers: headers, body: '', timeout: runtime?.timeout !== undefined...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async options( url: string, headers: Record<string, string> = {}, runtime?: HttpRequestRuntimeOptions ): Promise<HttpResponse> { const config: HttpRequestConfig = { url: url, method: HttpMethod.OPTIONS, headers: headers, body: '', timeout: runtime?.timeout !== undefined...
https://github.com/LongLiveY96/chatcube
176e49701e95b6ae96daa30659642a8015efe734
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
searchLibrary
搜索库中的漫画
public async searchLibrary(searchQuery: string): Promise<ComicInfo[]> { const query = ` query SearchLibrary($query: String!) { mangas(condition: { inLibrary: true }, filter: { title: { includesInsensitive: $query } }) { nodes { id title thumbnailUrl ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left searchLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchQuery AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async searchLibrary(searchQuery: string): Promise<ComicInfo[]> { const query = ` query SearchLibrary($query: String!) { mangas(condition: { inLibrary: true }, filter: { title: { includesInsensitive: $query } }) { nodes { id title thumbnailUrl ...
https://github.com/DaLongZhuaZi/manxia
7b4bba853f23cfabddc5999b9dd3626231fb8e73
github
offlinecat-dev/OCNetORM
src/main/ets/query/WhereCondition.ets
arkts
inValues
创建 IN 条件 @param column 列名 @param values 值数组 @returns WhereCondition 实例
static inValues(column: string, values: Array<ValueType>): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.IN condition.value = values return condition }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left inValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static inValues(column: string, values: Array<ValueType>): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.IN condition.value = values return condition }
https://github.com/offlinecat-dev/OCNetORM
8936f56d3ce95cf86c292fb9817fa73c625f9910
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/wanAPI/WanHttpClient.ets
arkts
topArticle
首页置顶文章 https://www.wanandroid.com/article/top/json @returns
public topArticle(): Promise<AxiosResponse<IWanCommonResponse<Array<IArticle>>>> { return this.getRequest("/article/top/json") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left topArticle 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_...
public topArticle(): Promise<AxiosResponse<IWanCommonResponse<Array<IArticle>>>> { return this.getRequest("/article/top/json") }
https://github.com/RedRackham-R/WanAndroidHarmoney
d7bd10ae0feeb343575e1fcb81c949bf26272579
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
getPageList
获取页面列表
async getPageList(chapterId: string, mangaId?: string): Promise<EngineResult<PageInfo[]>> { const previousTail = this.pageListRequestTail; let releaseCurrent: () => void = () => {}; this.pageListRequestTail = new Promise<void>((resolve) => { releaseCurrent = resolve; }); const waitDepth = t...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPageList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left chapterId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async getPageList(chapterId: string, mangaId?: string): Promise<EngineResult<PageInfo[]>> { const previousTail = this.pageListRequestTail; let releaseCurrent: () => void = () => {}; this.pageListRequestTail = new Promise<void>((resolve) => { releaseCurrent = resolve; }); const waitDepth = t...
https://github.com/DaLongZhuaZi/manxia
6d47b388cd5d94d5a343e3629ac8eae681ef0c80
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/HealthQuerySkill.ets
arkts
formatResult
格式化输出结果
static formatResult(result: HealthQueryResult): string { const typeName = this.getDataTypeName(result.dataType); const timeStr = result.timestamp.toLocaleString('zh-CN'); let output = `📊 **${typeName}查询结果**\n\n`; output += `📌 当前值: ${result.value} ${result.unit}\n`; output += `⏰ 记录时间: ${time...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left H...
static formatResult(result: HealthQueryResult): string { const typeName = this.getDataTypeName(result.dataType); const timeStr = result.timestamp.toLocaleString('zh-CN'); let output = `📊 **${typeName}查询结果**\n\n`; output += `📌 当前值: ${result.value} ${result.unit}\n`; output += `⏰ 记录时间: ${time...
https://github.com/LJ666-ui/harmony-health-care
1a8a7d9f6e9275cb9745888431eeb3876e223409
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
detectEncodingFromBuffer
从文件头检测编码
private detectEncodingFromBuffer(buffer: ArrayBuffer): string { const bytes = new Uint8Array(buffer); const len = Math.min(bytes.length, 4096); // 检查前 4KB // 检查 BOM (Byte Order Mark) if (bytes.length >= 3 && bytes[0] === 0xEF && bytes[1] === 0xBB && bytes[2] === 0xBF) { return 'utf-8'; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectEncodingFromBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private detectEncodingFromBuffer(buffer: ArrayBuffer): string { const bytes = new Uint8Array(buffer); const len = Math.min(bytes.length, 4096); // 检查前 4KB // 检查 BOM (Byte Order Mark) if (bytes.length >= 3 && bytes[0] === 0xEF && bytes[1] === 0xBB && bytes[2] === 0xBF) { return 'utf-8'; ...
https://github.com/DaLongZhuaZi/manxia
90709289322caa086666b4e99b4f25c9719a41e0
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/pages/aiinsight/AIInsightState.ets
arkts
openRecord
查看历史记录(直接显示完整 Markdown)。
openRecord(record: InsightRecord): void { if (record.pending) { const generatingRecord = this.resolveGeneratingRecord(); if (generatingRecord !== null && generatingRecord.id === record.id) { this.activeRecord = generatingRecord; this.errorMessage = ''; this.viewMode = 'conversa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InsightRecord AST#identifier#Right AST#)#Le...
openRecord(record: InsightRecord): void { if (record.pending) { const generatingRecord = this.resolveGeneratingRecord(); if (generatingRecord !== null && generatingRecord.id === record.id) { this.activeRecord = generatingRecord; this.errorMessage = ''; this.viewMode = 'conversa...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L307-L322
eb3d946ce53091d856c898f20483ef2d6f1aed73
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
loadDocument
Load a managed document and get a document highlight analyzer @param document Managed document @returns Document highlight analyzer
public loadDocument(document: Document): DocumentAnalyzer | null { if (this.nativeHandle == 0) { return null; } let handle: number = lib.HighlightEngine_LoadDocument(this.nativeHandle, document.__getNativeHandle()); if (handle == 0) { return null; } return Documen...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadDocument AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left document AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public loadDocument(document: Document): DocumentAnalyzer | null { if (this.nativeHandle == 0) { return null; } let handle: number = lib.HighlightEngine_LoadDocument(this.nativeHandle, document.__getNativeHandle()); if (handle == 0) { return null; } return Documen...
https://github.com/FinalScave/SweetLine
030ac24d5282b2c747aba976fbd71398010f1602
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/PerformanceMonitorPage.ets
arkts
clearStats
清除性能统计
clearStats(): void { PerformanceMonitor.clearStats(); this.refreshData(); promptAction.showToast({ message: '性能统计已清除' }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearStats 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...
clearStats(): void { PerformanceMonitor.clearStats(); this.refreshData(); promptAction.showToast({ message: '性能统计已清除' }); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ec6f807691453ff686ba75f4c3900c36b19a75f2
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getDynamicShelfMatchedItems
获取动态书架匹配的内容列表(实时过滤)
private getDynamicShelfMatchedItems(shelf: TypeShelf): ShelfMixedItem[] { if (!shelf.dynamicFilter) return []; const filter = shelf.dynamicFilter; const items: ShelfMixedItem[] = []; logger.debug(TAG, `[动态书架] 开始匹配: filter.sourceNames=[${filter.sourceNames.join(',')}], mangaList=${this.mangaList.lengt...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDynamicShelfMatchedItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shelf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
private getDynamicShelfMatchedItems(shelf: TypeShelf): ShelfMixedItem[] { if (!shelf.dynamicFilter) return []; const filter = shelf.dynamicFilter; const items: ShelfMixedItem[] = []; logger.debug(TAG, `[动态书架] 开始匹配: filter.sourceNames=[${filter.sourceNames.join(',')}], mangaList=${this.mangaList.lengt...
https://github.com/DaLongZhuaZi/manxia
4f483fe53436deb8c468b9074f0a6f76ce02693d
github
openharmony-tpc/openharmony_tpc_samples
dialogs/library/src/main/ets/components/progress/base/LVBase.ets
arkts
getIsRestart
获取动画是否是重复执行后的第一个值
getIsRestart() { return this.isRestart; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIsRestart 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 ...
getIsRestart() { return this.isRestart; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
44da9f3567264796d8423a93c21eeb6d6b01b752
gitee
CLMC2025/Vignette
entry/src/main/ets/manager/ReviewTimeManager.ets
arkts
getActiveReviewCount
获取当前活动的复习数量
getActiveReviewCount(): number { return this.activeReviews.size; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getActiveReviewCount 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#s...
getActiveReviewCount(): number { return this.activeReviews.size; }
https://github.com/CLMC2025/Vignette
b4e255483559cec0338dac427403a8edbc8b1dcf
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Connection.ets
arkts
create
创建新连接
static async create(config: relationalStore.StoreConfig): Promise<Connection> { return new Promise((resolve, reject) => { relationalStore.getRdbStore(Connection.context, config) .then(store => { const db = new Connection(util.generateRandomUUID(), store) Connection.logger?.info(`...
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 create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Ri...
static async create(config: relationalStore.StoreConfig): Promise<Connection> { return new Promise((resolve, reject) => { relationalStore.getRdbStore(Connection.context, config) .then(store => { const db = new Connection(util.generateRandomUUID(), store) Connection.logger?.info(`...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Connection.ets#L58-L70
1fba7891c689f597aec266a21346edca95c187f5
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
isFileCacheInit
判断文件缓存初始化是否完成 @param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存 @returns 返回true表示初始化完成,返回false表示初始化未完成
isFileCacheInit(cacheName?:string): boolean { return nativeNode.isFileCacheInit(cacheName); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFileCacheInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheName AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER...
isFileCacheInit(cacheName?:string): boolean { return nativeNode.isFileCacheInit(cacheName); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L167-L169
b916227b598707757817184b92d5af495b2d9f53
gitcode
openharmony/applications_mms
entry/src/main/ets/service/ContractService.ets
arkts
queryContactDataByTelephone
Query a contact by mobile number. @param actionData @callback callback
queryContactDataByTelephone(actionData, callback) { globalThis.DataWorker.sendRequest('queryContactDataByTelephone', { actionData: actionData, context: globalThis.mmsContext }, contracts => { callback(contracts); }); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryContactDataByTelephone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Le...
queryContactDataByTelephone(actionData, callback) { globalThis.DataWorker.sendRequest('queryContactDataByTelephone', { actionData: actionData, context: globalThis.mmsContext }, contracts => { callback(contracts); }); },
https://gitee.com/openharmony/applications_mms.git
9af5cfe604b87c96c8bc20e189b0e6c06876c904
gitee
openharmony-sig/ohos_easyui
entry/src/main/ets/pages/TestCustomSteps.ets
arkts
build
当前的步骤
build() { Column(){ Text("基础用法") .alignSelf(ItemAlign.Start) .margin({left:20,top:20,bottom:20}) .fontSize(20) .fontColor("#ff797979") //使用组件 CustomSteps({ steps:this.steps, //传入步骤流程 currentStep:$currentStep //传入当前的步骤 }) Button("下一步") ...
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() { Column(){ Text("基础用法") .alignSelf(ItemAlign.Start) .margin({left:20,top:20,bottom:20}) .fontSize(20) .fontColor("#ff797979") //使用组件 CustomSteps({ steps:this.steps, //传入步骤流程 currentStep:$currentStep //传入当前的步骤 }) Button("下一步") ...
https://gitee.com/openharmony-sig/ohos_easyui.git
9d8d65507c253d1815b626e5a96aaec50374649e
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
send_timing
7x9 定时广播 //
private send_timing() { if (this.target_timed == 0) { emitter.emit({ eventId: 719 }, { data: { time: 0 } }) } else { emitter.emit({ eventId: 719 }, { data: { time: this.target_timed - Date.now() } }) } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_timing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private send_timing() { if (this.target_timed == 0) { emitter.emit({ eventId: 719 }, { data: { time: 0 } }) } else { emitter.emit({ eventId: 719 }, { data: { time: this.target_timed - Date.now() } }) } }
https://github.com/Nekofox-POT/LinMusic
731a747038b9d8e4095259203b0989d98c58771d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
generateQrCode
生成 QR 码 PixelMap 优先使用 ScanKit generateBarcode(系统级生成,识别率最高) 超过 ScanKit 512 字符限制时回退到自定义生成器 @param content 要编码的字符串 @param size 图片尺寸 (px) @param ecLevel 纠错级别
static async generateQrCode(content: string, size: number = 600, ecLevel?: ECLevel): Promise<QrCodeResult> { // 压缩数据用低纠错(zlib 自带校验) const level = ecLevel ?? (isCompressedData(content) ? ECLevel.L : ECLevel.M); // ScanKit 限制 512 字符,如果在范围内优先使用系统生成 if (content.length <= 512) { try { co...
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 generateQrCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async generateQrCode(content: string, size: number = 600, ecLevel?: ECLevel): Promise<QrCodeResult> { // 压缩数据用低纠错(zlib 自带校验) const level = ecLevel ?? (isCompressedData(content) ? ECLevel.L : ECLevel.M); // ScanKit 限制 512 字符,如果在范围内优先使用系统生成 if (content.length <= 512) { try { co...
https://github.com/AlkaidLab/moonlight-harmony
cfe1fcb8651c9578b69bdd1f031c1938fc3d8297
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mindsphere/MindSporeLiteEngine.ets
arkts
detectAnomaly
健康数据异常检测
async detectAnomaly( currentData: Record<string, number>, historicalData?: Record<string, number>[] ): Promise<AnomalyDetectionResult> { try { const anomalies: string[] = []; let maxConfidence = 0; for (const [key, value] of Object.entries(currentData)) { const normalRange = t...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left detectAnomaly AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left currentData AST#identifier#Right AST#type_annotation#Left AST#:#L...
async detectAnomaly( currentData: Record<string, number>, historicalData?: Record<string, number>[] ): Promise<AnomalyDetectionResult> { try { const anomalies: string[] = []; let maxConfidence = 0; for (const [key, value] of Object.entries(currentData)) { const normalRange = t...
https://github.com/LJ666-ui/harmony-health-care
309dfecf1a9a8dfe09a8542db471818d7490b232
github