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
YANGZX22/Voot
entry/src/main/ets/services/ContinuityService.ets
arkts
getAvailableDevices
获取已发现的可用设备列表
getAvailableDevices(): DeviceInfo[] { return [...this.availableDevices]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAvailableDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left DeviceInfo AST#identifier#R...
getAvailableDevices(): DeviceInfo[] { return [...this.availableDevices]; }
https://github.com/YANGZX22/Voot
cd0a8e440423e82275d231151ddfb65830a84638
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/PostHandler.ets
arkts
queryTimeline
关键修改:查询自己和好友的动态 @param myPhone 当前用户手机号 @param friendPhones 好友的手机号数组 严格过滤:只显示自己和已通过好友的动态
async queryTimeline(myPhone: string, friendPhones: string[]): Promise<PostItem[]> { let predicates = new relationalStore.RdbPredicates('Post'); // 构造“白名单”:我自己 + 我通过的好友 const allowedPhones = [myPhone, ...friendPhones]; // 数据库过滤:owner 必须在白名单内 predicates.in('owner', allowedPhones); predicates.o...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryTimeline AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST#type_annotation#Left AS...
async queryTimeline(myPhone: string, friendPhones: string[]): Promise<PostItem[]> { let predicates = new relationalStore.RdbPredicates('Post'); // 构造“白名单”:我自己 + 我通过的好友 const allowedPhones = [myPhone, ...friendPhones]; // 数据库过滤:owner 必须在白名单内 predicates.in('owner', allowedPhones); predicates.o...
https://gitcode.com/openharmony/codelabs
9c8dd459a0ce14f430b42e9c4d7888fd06277699
gitcode
openharmony/applications_settings
common/search/src/main/ets/default/page/resultComponent.ets
arkts
splitToHighlightText
split to highlight text @param text
splitToHighlightText(text: string): Info[] { let spans: Info[] = [] let lowerSpans: string[] = text.toLowerCase().split(this.highlightKeyword.toLowerCase()) let keywordStartIndex = 0 let keywordLength = this.highlightKeyword.length for (let i = 0; i < lowerSpans.length; i++) { let normalTe...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left splitToHighlightText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#L...
splitToHighlightText(text: string): Info[] { let spans: Info[] = [] let lowerSpans: string[] = text.toLowerCase().split(this.highlightKeyword.toLowerCase()) let keywordStartIndex = 0 let keywordLength = this.highlightKeyword.length for (let i = 0; i < lowerSpans.length; i++) { let normalTe...
https://gitee.com/openharmony/applications_settings.git
a66c4778301d7d5c9b36ecdf0e8cc61cf711fba8
gitee
openharmony/arkui_ace_engine
examples/Accessibility/AccessibilityCapi/entry/src/main/ets/pages/Index.ets
arkts
getTotalInterfaceCount
计算总接口数
getTotalInterfaceCount(): number { return this.loadedScenarios.reduce((sum: number, s: ScenarioData): number => sum + (s.interfaceCount || 0), 0); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalInterfaceCount 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...
getTotalInterfaceCount(): number { return this.loadedScenarios.reduce((sum: number, s: ScenarioData): number => sum + (s.interfaceCount || 0), 0); }
https://gitcode.com/openharmony/arkui_ace_engine
0ae8aaec0690b338edc33e34811bba471ae66bc3
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/view/TnRadioPage.ets
arkts
build
构建单选框展示页面
build() { AppNavDestination({ title: "单选框", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.PageContent(); } }
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({ title: "单选框", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.PageContent(); } }
https://github.com/codelably/tuniao-ui
a64b3257013db43bccc5c6c088660a139df8e356
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupController.ets
arkts
initializePhaseConfigs
初始化阶段配置
private initializePhaseConfigs(): void { const configs: StartupPhaseConfig[] = [ { phase: StartupPhase.ABILITY_STAGE_CREATE, name: 'AbilityStage创建', description: '应用生命周期初始化', timeout: 5000, retryable: false, critical: true, recoveryStrategies: [Recover...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializePhaseConfigs 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 ...
private initializePhaseConfigs(): void { const configs: StartupPhaseConfig[] = [ { phase: StartupPhase.ABILITY_STAGE_CREATE, name: 'AbilityStage创建', description: '应用生命周期初始化', timeout: 5000, retryable: false, critical: true, recoveryStrategies: [Recover...
https://github.com/DaLongZhuaZi/manxia
6e8a51cfdb2b3b445481570f870fc57b3bc8b02a
github
OHPG/FinVideo
entry/src/main/ets/player/VersionSelectStrategy.ets
arkts
selectAuto
─── Auto 策略 ──────────────────────────────────────────────────────────────
private static selectAuto(sources: FinItemSource[]): FinItemSource { const deviceType = deviceInfo.deviceType const isCellular = VersionSelectStrategy.isCellular() const screenLongEdge = VersionSelectStrategy.getScreenLongEdge() if (BuildProfile.DEBUG) { console.info(`[${VersionSelectStrategy.T...
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 selectAuto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left :...
private static selectAuto(sources: FinItemSource[]): FinItemSource { const deviceType = deviceInfo.deviceType const isCellular = VersionSelectStrategy.isCellular() const screenLongEdge = VersionSelectStrategy.getScreenLongEdge() if (BuildProfile.DEBUG) { console.info(`[${VersionSelectStrategy.T...
https://github.com/OHPG/FinVideo
dff9b106cc3b7e3dc7b83585b9cccf8b4aae54e5
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
insertWords
Insert multiple words (batch)
async insertWords(words: WordItem[]): Promise<number> { this.ensureInitialized(); let insertedCount = 0; if (words.length === 0) { console.info('[WordRepository] Batch insert: no words to insert'); return insertedCount; } console.info(`[WordRepository] Starting batch insert of ${word...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left words ...
async insertWords(words: WordItem[]): Promise<number> { this.ensureInitialized(); let insertedCount = 0; if (words.length === 0) { console.info('[WordRepository] Batch insert: no words to insert'); return insertedCount; } console.info(`[WordRepository] Starting batch insert of ${word...
https://github.com/CLMC2025/Vignette
012e67a9936dafd5768635bf657c823c65b77e0b
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/contentSource/facades/LoggingInterceptorFacade.ets
arkts
onRequest
请求拦截:记录请求方法和 URL @param options 原始请求配置 @returns 原始请求配置(不做修改)
async onRequest(options: NGFHttpRequestOptions): Promise<NGFHttpRequestOptions> { if (!this.enabled) { return options; } logger.info(TAG, '[请求] method=' + options.method + ', url=' + options.url); if (options.extraData.length > 0) { logger.debug(TAG, '[请求体] length=' + options.extraData.len...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onRequest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#ty...
async onRequest(options: NGFHttpRequestOptions): Promise<NGFHttpRequestOptions> { if (!this.enabled) { return options; } logger.info(TAG, '[请求] method=' + options.method + ', url=' + options.url); if (options.extraData.length > 0) { logger.debug(TAG, '[请求体] length=' + options.extraData.len...
https://github.com/DaLongZhuaZi/NGF
0a14264e2a6a744bd27ef4a293b60627a9fb5650
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/ComicInfoParser.ets
arkts
parseIntegerField
解析整数字段 @param value 字符串值 @returns 解析后的整数或undefined
private parseIntegerField(value: string): number | undefined { try { const parsed = parseInt(value, 10); return isNaN(parsed) ? undefined : parsed; } catch (error) { logger.warn(TAG, `解析整数字段失败: ${value}` + error); return undefined; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseIntegerField 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...
private parseIntegerField(value: string): number | undefined { try { const parsed = parseInt(value, 10); return isNaN(parsed) ? undefined : parsed; } catch (error) { logger.warn(TAG, `解析整数字段失败: ${value}` + error); return undefined; } }
https://github.com/DaLongZhuaZi/manxia
f6956a54b264211baad48c2612164e15a332afcd
github
openharmony/applications_settings
product/phone/src/main/ets/pages/searchPage.ets
arkts
setSearchKeyword
set search keyword
setSearchKeyword() { this.searchKeyword = SearchUtil.stripKeyword(this.inputKeyword).trim() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSearchKeyword 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...
setSearchKeyword() { this.searchKeyword = SearchUtil.stripKeyword(this.inputKeyword).trim() }
https://gitee.com/openharmony/applications_settings.git
fed740e362df6fada5270a2bf8fea6e5d3db95c2
gitee
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/Logger.ets
arkts
formatMessage
格式化消息,将参数拼接到消息中
private formatMessage(msg: string, args: (string | number | boolean | object | undefined | null)[]): string { if (args.length === 0) { return msg; } const argsStr = args.map(arg => { if (arg === null) return 'null'; if (arg === undefined) return 'undefined'; if (arg instanceof Erro...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private formatMessage(msg: string, args: (string | number | boolean | object | undefined | null)[]): string { if (args.length === 0) { return msg; } const argsStr = args.map(arg => { if (arg === null) return 'null'; if (arg === undefined) return 'undefined'; if (arg instanceof Erro...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
01a077071f9e71ac585fe6b6b98289084116100c
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
addToPlaylist
添加到播放列表
addToPlaylist(music: MusicInfo): void { this.playlist.push(music); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left music AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MusicInfo AST#identifier#Right AST#)#Left...
addToPlaylist(music: MusicInfo): void { this.playlist.push(music); }
https://github.com/cpdd5201314/harmonyOS-music-app
51115090237ecb37f4aeb43d9dd57784a1f5057a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
getLowSurrogate
getLowSurrogate(UTF_16_CodePoint) splits code point as a two code units and return the second one. The result can be malformed und thus has to be checked with {@link <isLowSurrogate(char)>}. @param value an encoded code point. @returns the low surrogate, possibly malformed.
public static getLowSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) & 0x3FF) + Char.LOW_SURROGATE_MIN) as char }
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 getLowSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left :...
public static getLowSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) & 0x3FF) + Char.LOW_SURROGATE_MIN) as char }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3f8a013fdd984495cc11bd42ebb47db47fe036e7
gitee
JackJiang2011/harmonychat
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
formatDate
对Date的扩展,将 Date 转化为指定格式的String。 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)。 【示例】: common.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss.S') ==> 2006-07-02 08:09:04.423 common.formatDate(new Date(), 'yyyy-M-d h:m:s.S') ==> 2006-7-2 8:9:4.18 common.formatDate(new Date(), ...
static formatDate(date: Date, fmt: string) { // let o = { // "M+": date.getMonth() + 1, //月份 // "d+": date.getDate(), //日 // "h+": date.getHours(), //小时 // "m+": date.getMinutes(), //分 // "s+": date.getSeconds(), //秒 // "q+": Math.floor((date.getMonth() + 3) / 3), //季度 // ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date ...
static formatDate(date: Date, fmt: string) { // let o = { // "M+": date.getMonth() + 1, //月份 // "d+": date.getDate(), //日 // "h+": date.getHours(), //小时 // "m+": date.getMinutes(), //分 // "s+": date.getSeconds(), //秒 // "q+": Math.floor((date.getMonth() + 3) / 3), //季度 // ...
https://github.com/JackJiang2011/harmonychat
c8f4d1e048562024886e197b59d3ecb3e9792225
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
handleIllustClick
插画点击逻辑
handleIllustClick(illust: PixivIllust) { const index = this.rankList.findIndex(i => i.id === illust.id); const params: DetailPageParams = { id: illust.id, swiperProvider: this, swiperIndex: index >= 0 ? index : 0, illust: illust.user ? illust : undefined }; PixState.pageStack.pushPathByNam...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleIllustClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left illust AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixivIllust AST#ident...
handleIllustClick(illust: PixivIllust) { const index = this.rankList.findIndex(i => i.id === illust.id); const params: DetailPageParams = { id: illust.id, swiperProvider: this, swiperIndex: index >= 0 ? index : 0, illust: illust.user ? illust : undefined }; PixState.pageStack.pushPathByNam...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/RankViewModel.ets#L169-L176
48cb2ac0c83dca52619b3b8dd9608df8f07e14d7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets
arkts
removeCallbacks
Remove a specific callback from the handler @param { Task } callback The callback function to remove @returns { boolean } True if the callback was successfully removed, false otherwise
public removeCallbacks(callback: Task): boolean { if (this.workerIsMain()) { return false; } return this.removeMessages((value: MessageStatus, key: Message) => { return key.getCallback() == callback && value == MessageStatus.NOT_EXECUTED; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Task AST#ide...
public removeCallbacks(callback: Task): boolean { if (this.workerIsMain()) { return false; } return this.removeMessages((value: MessageStatus, key: Message) => { return key.getCallback() == callback && value == MessageStatus.NOT_EXECUTED; ...
https://gitcode.com/iop123123/arkts-static-skills
5f3922142e07ab9fa66884ae06ef1e615ee22002
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
detectUnhandledUsbGamepadsThrottled
节流版本的检测:30 秒内只返回一次结果
detectUnhandledUsbGamepadsThrottled(): KnownUsbGamepadInfo[] { const now = Date.now(); if (now - this.lastUnhandledDetectAt < GamepadManager.UNHANDLED_DETECT_THROTTLE_MS) { return []; } const result = this.detectUnhandledUsbGamepads(); if (result.length > 0) { this.lastUnhandledDetectA...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left detectUnhandledUsbGamepadsThrottled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#L...
detectUnhandledUsbGamepadsThrottled(): KnownUsbGamepadInfo[] { const now = Date.now(); if (now - this.lastUnhandledDetectAt < GamepadManager.UNHANDLED_DETECT_THROTTLE_MS) { return []; } const result = this.detectUnhandledUsbGamepads(); if (result.length > 0) { this.lastUnhandledDetectA...
https://github.com/AlkaidLab/moonlight-harmony
46eb9ac55a4f2e593bffcf3e027525608540b3e3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
fixed
The fixed() method creates a string that embeds a string in a <tt> element (<tt>str</tt>), which causes a string to be displayed in a big font. @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fixed(): String{ return this.CreateHTMLString('tt', '') }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fixed 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#:#Rig...
public fixed(): String{ return this.CreateHTMLString('tt', '') }
https://gitcode.com/iop123123/arkts-static-skills
b97afc9b07a7e365ef06f26f36829513839955c9
gitcode
openharmony/applications_call
entry/src/main/ets/common/utils/Clone.ets
arkts
isObject
is object @param { any } target
private isObject(target) { const type = typeof target; return target !== null && (type === 'object' || type === 'function'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR...
private isObject(target) { const type = typeof target; return target !== null && (type === 'object' || type === 'function'); }
https://gitee.com/openharmony/applications_call.git
20d2e8b6f6d504d0f497298b8e0f877489ff58aa
gitee
PollenWang6/HiXD
entry/src/main/ets/services/UserInfoService.ets
arkts
fetchAll
从 Preference 读取已缓存的信息
async fetchAll(): Promise<UserInfo> { const info: UserInfo = new UserInfo(); info.name = PreferenceUtil.getString('user_name'); info.uid = PreferenceUtil.getString('cx_uid'); // 动态构造头像URL:从chaoxing UID拼接,80px缩略图可直接访问无需Referer if (info.uid.length > 0) { info.avatar = 'https://photo.chaoxing.c...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ...
async fetchAll(): Promise<UserInfo> { const info: UserInfo = new UserInfo(); info.name = PreferenceUtil.getString('user_name'); info.uid = PreferenceUtil.getString('cx_uid'); // 动态构造头像URL:从chaoxing UID拼接,80px缩略图可直接访问无需Referer if (info.uid.length > 0) { info.avatar = 'https://photo.chaoxing.c...
https://github.com/PollenWang6/HiXD
79067574d66d5cb1c07cdacce532b1b1e03f47ae
github
arkui-x/samples
CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
getWindowHeight
获取主窗口高度 @returns {Promise<number>}
async getWindowHeight(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType>; if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].height / globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getWindowHeight 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...
async getWindowHeight(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType>; if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].height / globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays...
https://gitcode.com/arkui-x/samples
eed661728e24f87255d2af165e9cde7311289cdb
gitcode
YANGZX22/Voot
entry/src/main/ets/services/SherpaWhisperMicService.ets
arkts
getCurrentModelType
获取当前加载的模型类型
getCurrentModelType(): AsrModelType { return this.currentModelType; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentModelType 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 AsrModelType AST#identifier#Right AST#ERRO...
getCurrentModelType(): AsrModelType { return this.currentModelType; }
https://github.com/YANGZX22/Voot
2ccfffa475e2e256eeb546c26ae228a86a4f2246
github
din0sauria/audio-deepfake-detection
entry/src/main/ets/Audio/AudioRecordComp.ets
arkts
build
新增方法:复制文件到指定路径
build() { Row() { Text() .width(60) .aspectRatio(1) .backgroundColor(Color.Red) .border({ width: 5, color: Color.White, radius: 30 }) .onClick(async () => { await this.startRecord() }) .bindSheet($$this.isRecording, this.recordBindBuilder(), ...
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() { Row() { Text() .width(60) .aspectRatio(1) .backgroundColor(Color.Red) .border({ width: 5, color: Color.White, radius: 30 }) .onClick(async () => { await this.startRecord() }) .bindSheet($$this.isRecording, this.recordBindBuilder(), ...
https://github.com/din0sauria/audio-deepfake-detection
46cd0d5a9a56ada9913fe0e20af2ad5c2dce3e87
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/permissionGroupManager/PermissionGroupManager.ets
arkts
getAllGroupConfigs
获取所有权限组config return
public getAllGroupConfigs(): PermissionGroupConfig[] { let allConfig: PermissionGroupConfig[] = []; this.permissionStrategies.forEach((strategy, permissionGroup) => { allConfig.push(strategy.getPermissionGroupConfig()); }) return allConfig; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllGroupConfigs 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 Per...
public getAllGroupConfigs(): PermissionGroupConfig[] { let allConfig: PermissionGroupConfig[] = []; this.permissionStrategies.forEach((strategy, permissionGroup) => { allConfig.push(strategy.getPermissionGroupConfig()); }) return allConfig; }
https://gitee.com/openharmony/applications_permission_manager.git
abe2d0be6ae54a23c45d355e8c10a99f3dd78cba
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
initialize
初始化客户端密钥对 如果证书文件已存在,则从文件加载;否则生成新的密钥对和证书 重要:必须保持同一个客户端证书用于所有服务器,否则之前配对的服务器会失效
async initialize(): Promise<void> { if (this.keyPair) { // 已初始化 return; } // 尝试从文件加载已存在的密钥对和证书 if (this.certFilePath && this.keyFilePath) { try { const certExists = fileIo.accessSync(this.certFilePath); const keyExists = fileIo.accessSync(this.keyFilePath); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async initialize(): Promise<void> { if (this.keyPair) { // 已初始化 return; } // 尝试从文件加载已存在的密钥对和证书 if (this.certFilePath && this.keyFilePath) { try { const certExists = fileIo.accessSync(this.certFilePath); const keyExists = fileIo.accessSync(this.keyFilePath); ...
https://github.com/AlkaidLab/moonlight-harmony
efd902abdb6e1c4e60b46d5879a052c46e392aa6
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
navigateToPayment
跳转到支付页面 @param {Order} order - 订单信息 @returns {void} 无返回值
private navigateToPayment(order: Order): void { const paymentPrice: number = order.price - order.discountPrice; OrderNavigator.toPay(order.id, paymentPrice, "confirm"); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left navigateToPayment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private navigateToPayment(order: Order): void { const paymentPrice: number = order.price - order.discountPrice; OrderNavigator.toPay(order.id, paymentPrice, "confirm"); }
https://github.com/Joker-x-dev/CoolMallArkTS
c71f1f33bae72cbbdc6e816d373813978f93e736
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
getAnnotationParam
获取栈顶的装饰器参数 @returns
public getAnnotationParam(): RouteMetadata | undefined { const state = this.getCurrentState() return state.stackTopInfo?.metadata }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAnnotationParam 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#L...
public getAnnotationParam(): RouteMetadata | undefined { const state = this.getCurrentState() return state.stackTopInfo?.metadata }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L721-L724
d0933231c51d795e26fa46926fdbe0ea8273d3cf
github
offlinecat-dev/OCNetORM
src/main/ets/core/OrmContext.ets
arkts
getInstance
获取 OrmContext 单例实例 @returns OrmContext 实例
static getInstance(): OrmContext { if (OrmContext.instance === null) { OrmContext.instance = new OrmContext() } return OrmContext.instance }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left OrmContext...
static getInstance(): OrmContext { if (OrmContext.instance === null) { OrmContext.instance = new OrmContext() } return OrmContext.instance }
https://github.com/offlinecat-dev/OCNetORM
f4ad90f440927e62970f1b949c2db72bb053007e
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentDetailViewModel.ets
arkts
initTopNavigationModel
初始化顶部导航模型
private initTopNavigationModel() { this.state.topNavigationModel = { title: `${this.componentName}`, titleColor: $r('sys.color.font_primary'), isFullScreen: true, isBlur: false, onBackClick: () => { this.pop() }, } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initTopNavigationModel 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 ...
private initTopNavigationModel() { this.state.topNavigationModel = { title: `${this.componentName}`, titleColor: $r('sys.color.font_primary'), isFullScreen: true, isBlur: false, onBackClick: () => { this.pop() }, } }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
46df126d668db36c6d035a684c3c7c1e99b188b9
gitcode
ZestBox-18/kitebook-frontend
commons/base/src/main/ets/entities/BillBean.ets
arkts
getDateString
获取日期字符串
getDateString(): string { const date = new Date(this.date); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${month}-${day}`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen...
getDateString(): string { const date = new Date(this.date); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${month}-${day}`; }
https://github.com/ZestBox-18/kitebook-frontend
63b7c2dcc8a621ba5b986930414dfe1c9a0a164a
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/tools.ets
arkts
insertIntoSortedArray
直接修改原升序无重复数字数组,插入指定数后保持升序且无重复 @param sortedArr 已升序排序、无重复的数字原数组(会被直接修改) @param num 待插入的数字
function insertIntoSortedArray(sortedArr: number[], num: number): void { if (sortedArr.includes(num)) { return; } // 二分查找核心逻辑:找第一个大于num的元素索引 let left = 0; let right = sortedArr.length - 1; let insertIndex = sortedArr.length; // 默认插尾部 while (left <= right) { const mid = Math.floor((left + right) ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left insertIntoSortedArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sortedArr AST#identifier#Right AST#type_annotation#Left AST#:#Le...
function insertIntoSortedArray(sortedArr: number[], num: number): void { if (sortedArr.includes(num)) { return; } // 二分查找核心逻辑:找第一个大于num的元素索引 let left = 0; let right = sortedArr.length - 1; let insertIndex = sortedArr.length; // 默认插尾部 while (left <= right) { const mid = Math.floor((left + right) ...
https://github.com/Your-USTC/DailyNic_HMOS
7cd7935c114ed22ad25864a96d9eb7a70bc94ce9
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
checkRoundingDigits
Check 5 rounding digits if `repeating` is undefined, 4 otherwise. `repeating == undefined` if caller is `log` or `pow`, `repeating != undefined` if caller is `naturalLogarithm` or `naturalExponential`.
public static checkRoundingDigits(d: Array<double>, i: double, rm: int, repeating?: int): boolean { let k: double; // Get the length of the first word of the array d. for (k = d[0]; k >= 10; k /= 10) { --i; } let di: int; // Is the rounding digit in the fi...
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 checkRoundingDigits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left :...
public static checkRoundingDigits(d: Array<double>, i: double, rm: int, repeating?: int): boolean { let k: double; // Get the length of the first word of the array d. for (k = d[0]; k >= 10; k /= 10) { --i; } let di: int; // Is the rounding digit in the fi...
https://gitcode.com/iop123123/arkts-static-skills
41258c8895195e9c13f4d8a678ee23333759d30f
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Long.ets
arkts
equals
Checks for equality this instance with provided object, treated as a Long @param other object to be checked against @returns true if provided object and this instance have same value, false otherwise Returns false if type of provided object is not the same as this type
public equals(other: Any): boolean { if (this === other) { return true } if (!(other instanceof Long)) { return false } return this.value == (other as Long).value }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Right...
public equals(other: Any): boolean { if (this === other) { return true } if (!(other instanceof Long)) { return false } return this.value == (other as Long).value }
https://gitcode.com/iop123123/arkts-static-skills
f39709596e31cfe85e10fe5ccba7b8293e26d52d
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new ExceptionInInitializerError instance with provided message and error specific information @param { String | undefined } message - Error text @param { ErrorOptions | undefined } options - Error options @syscap SystemCapability.Utils.Lang
constructor(message?: String, options?: ErrorOptions) { super("ExceptionInInitializerError", message, options) }
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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("ExceptionInInitializerError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
cf1a8f24f96aae88a8e68988c80297894ae21e64
gitcode
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/data/UserRdb.ets
arkts
getRdbStore
核心修复:初始化数据库(保存上下文,确保只初始化一次)
async getRdbStore(context: common.UIAbilityContext): Promise<relationalStore.RdbStore | null> { // 保存上下文,后续操作无需重复传递 this.context = context; if (this.rdbStore) { return this.rdbStore; } const STORE_CONFIG: relationalStore.StoreConfig = { name: 'ItemManager.db', // 和物品数据库共用 securi...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async getRdbStore(context: common.UIAbilityContext): Promise<relationalStore.RdbStore | null> { // 保存上下文,后续操作无需重复传递 this.context = context; if (this.rdbStore) { return this.rdbStore; } const STORE_CONFIG: relationalStore.StoreConfig = { name: 'ItemManager.db', // 和物品数据库共用 securi...
https://gitcode.com/openharmony/codelabs
7fb263f03765d34adfd222f0009864f20273d485
gitcode
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
getVerticalBarBgColor
Get verticalBar background color @param folderDataArray - Folder data list @param uuid - note's folder_uuid @return Resource | string - color value
getVerticalBarBgColor(folderDataArray: FolderData[], uuid: string): Resource | string { let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid) if (folderData == undefined) { LogUtil.info(TAG, "NoteBgColor is ffffff") return $r("app.color.color_ffffff") } LogUtil.info(...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getVerticalBarBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Le...
getVerticalBarBgColor(folderDataArray: FolderData[], uuid: string): Resource | string { let folderData: FolderData = FolderUtil.getFolderData(folderDataArray, uuid) if (folderData == undefined) { LogUtil.info(TAG, "NoteBgColor is ffffff") return $r("app.color.color_ffffff") } LogUtil.info(...
https://gitee.com/openharmony/applications_notes.git
6c07d0221152d716df83886f88a41529f0a1421b
gitee
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/AuthService.ets
arkts
setPin
设置/更新 PIN 码
static async setPin(context: common.UIAbilityContext, pin: string): Promise<void> { const store = await AuthService.getStore(context); await store.put(AuthService.KEY_PIN, pin); await store.flush(); Logger.info('[AuthService] PIN updated'); }
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 setPin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R...
static async setPin(context: common.UIAbilityContext, pin: string): Promise<void> { const store = await AuthService.getStore(context); await store.put(AuthService.KEY_PIN, pin); await store.flush(); Logger.info('[AuthService] PIN updated'); }
https://gitcode.com/openharmony/codelabs
f58410b967b6a098457e3fd95994e25610d6dade
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test36_original_index.ets
arkts
isNumeric
--- String parsing and validation ---
function isNumeric(s: string): boolean { if (s.length === 0) { return false; } for (let i: number = 0; i < s.length; i++) { let code: number = s.charCodeAt(i); if (code < 48 || code > 57) { return false; } } return true; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isNumeric AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
function isNumeric(s: string): boolean { if (s.length === 0) { return false; } for (let i: number = 0; i < s.length; i++) { let code: number = s.charCodeAt(i); if (code < 48 || code > 57) { return false; } } return true; }
https://github.com/miaochiahao/ark-ghidra
088d8a927e97f207fd698a82faca381f97180a33
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Int32Array with respect to buf. @param buf data initializer
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Int32Array.BYTES_PER_ELEMENT) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Int32Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
25146025821696e318638a8fdafddfe76a4bd51a
gitee
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqlCommand.ets
arkts
toValue
Handle list of int as byte[]
static toValue(value: ValueType): ValueType { return value; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toValue 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 ValueTy...
static toValue(value: ValueType): ValueType { return value; }
https://gitee.com/openharmony-sig/flutter_sqflite.git
29f25c5c6225792b678f2090a97f6f084d8cb7c9
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
subarray
Creates a Int32Array with the same underlying ArrayBuffer @param { int } [begin] - start index, inclusive @param { int } [end] - last index, exclusive @returns { Int32Array } - a new Int32Array with the same underlying ArrayBuffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public subarray(begin?: int, end?: int): Int32Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le...
public subarray(begin?: int, end?: int): Int32Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
https://gitcode.com/iop123123/arkts-static-skills
3c88ff7a4a10f96c630d33b54456f32d726e8221
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
handleRemodelResult
改修结果 — 仅 Toast
async function handleRemodelResult(alert: RemodelResultAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableRemodelResultToast) return; const starStr = alert.success && alert.level > 0 ? ` ★${alert.level}` : ''; const body = alert.success ? `🔨 改修成功:${a...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleRemodelResult AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AS...
async function handleRemodelResult(alert: RemodelResultAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableRemodelResultToast) return; const starStr = alert.success && alert.level > 0 ? ` ★${alert.level}` : ''; const body = alert.success ? `🔨 改修成功:${a...
https://github.com/CsCesium/KantaiHomo
4b1829731cb4d65620b865ef80648e58473d3fa3
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/highlight/Highlight.ets
arkts
getDrawY
Returns the y-position in pixels where this highlight object was last drawn. @return
public getDrawY(): number { return this.mDrawY; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDrawY 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...
public getDrawY(): number { return this.mDrawY; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1355fb54143460179760e224c16f979d85ee26c7
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
getRaw
原生查询(返回 ResultSetRow 数组) 支持 selectRaw/groupBy/having 等原生表达式
async getRaw(): Promise<Array<ResultSetRow>> { return await this.withStoreLease(async () => { const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try { const store = this.getStore() ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRaw AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#...
async getRaw(): Promise<Array<ResultSetRow>> { return await this.withStoreLease(async () => { const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try { const store = this.getStore() ...
https://github.com/offlinecat-dev/OCNetORM
febc41b8506421f5feab306263d8dea7d09f6a7b
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
resetTable
完全重置历史记录表 删除所有记录并重置自增ID
async resetTable(): Promise<void> { logger.debug('resetTable') return this.clearTable() }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resetTable 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#...
async resetTable(): Promise<void> { logger.debug('resetTable') return this.clearTable() }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L195-L198
229f05a9b22bef7633eec04265727ce0e7f984eb
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<int> } items - a set of elements to include in the new array object. @returns { BigUint64Array } - a new BigUint64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<int>): BigUint64Array { let res = new BigUint64Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
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#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<int>): BigUint64Array { let res = new BigUint64Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
64c63970ce500b6c625f0a8eed0caa0ce7ae4aff
gitcode
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/pages/Editor.ets
arkts
applyFormat
==================== 自动补全功能(已整体注释禁用) ==================== checkAndShowCompletion / updateCompletionPosition / hideCompletion / applyCompletion / completionUp / completionDown / completionConfirm / getCompletionIcon 已禁用,避免影响现有编辑与预览主流程。
applyFormat(prefix: string, suffix: string) { const start = this.selectionStart; const end = this.selectionEnd; const currentText = this.markdownText; const before = currentText.substring(0, start); const selected = currentText.substring(start, end); const after = currentText.substring(en...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left applyFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right...
applyFormat(prefix: string, suffix: string) { const start = this.selectionStart; const end = this.selectionEnd; const currentText = this.markdownText; const before = currentText.substring(0, start); const selected = currentText.substring(start, end); const after = currentText.substring(en...
https://github.com/electronicminer/Harmony-Markdown-Editor
ac6e1f0210a9ddeceb8f7f3fb0a816df7bf3602d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ChineseConverter.ets
arkts
traditionalToSimplified
繁体转简体
traditionalToSimplified(text: string): string { if (!text) { return text; } let result = text; ChineseConverter.t2sMap.forEach((simplified, traditional) => { if (result.includes(traditional)) { result = result.replace(new RegExp(traditional, 'g'), simplified); } }); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left traditionalToSimplified AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#...
traditionalToSimplified(text: string): string { if (!text) { return text; } let result = text; ChineseConverter.t2sMap.forEach((simplified, traditional) => { if (result.includes(traditional)) { result = result.replace(new RegExp(traditional, 'g'), simplified); } }); ...
https://github.com/DaLongZhuaZi/manxia
a389be3738248e9bc0fc375c7714359c49188c3e
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedInt64
访问 repeated int64 字段
visitRepeatedInt64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitInt64(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left bigint...
visitRepeatedInt64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitInt64(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
7b5394f10c86d2928d01ed88a951b2a3acd3c06b
gitcode
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
save
保存记录(新增或更新) @returns {Promise<void>} Promise<void>
async save(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { if (this.editingId > 0) { await this.updateById(this.editingId); } else { await this.demoRepository.createDemo(this.titleInput, this.descInput); } this.resetInputs(); await this.fetch...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left save AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Le...
async save(): Promise<void> { await this.runWithLoading(async (): Promise<void> => { if (this.editingId > 0) { await this.updateById(this.editingId); } else { await this.demoRepository.createDemo(this.titleInput, this.descInput); } this.resetInputs(); await this.fetch...
https://github.com/Joker-x-dev/HarmonyKit
2d6157a38f389a30090f49fa527ac195da298417
github
openharmony/applications_filepicker
entry/src/main/ets/base/utils/FilePickerUtil.ets
arkts
checkFileSelectable
根据文件后缀判断文件是否可选 @param item
function checkFileSelectable(item: FilesData, startModeOptions: StartModeOptions): boolean { // selectMode检查 let selectMode: number = startModeOptions.selectMode; let isFolder = false; if (ObjectUtil.hasKey(item, 'isFolder')) { isFolder = item.isFolder; } // 文件夹模式,直接返回 if (selectMode === SELECT_MODE.F...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkFileSelectable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function checkFileSelectable(item: FilesData, startModeOptions: StartModeOptions): boolean { // selectMode检查 let selectMode: number = startModeOptions.selectMode; let isFolder = false; if (ObjectUtil.hasKey(item, 'isFolder')) { isFolder = item.isFolder; } // 文件夹模式,直接返回 if (selectMode === SELECT_MODE.F...
https://gitee.com/openharmony/applications_filepicker.git
65a6ea44543299bd0c890ad28edc36121b2e1a8c
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test18_original_index.ets
arkts
testCodePoints
--- String.codePointAt and fromCodePoint ---
function testCodePoints(): string { let s: string = 'ABC'; let cp0: number | undefined = s.codePointAt(0); let cp1: number | undefined = s.codePointAt(1); if (cp0 !== undefined && cp1 !== undefined) { let rebuilt: string = String.fromCodePoint(cp0) + String.fromCodePoint(cp1); return rebuilt; } retu...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCodePoints 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_t...
function testCodePoints(): string { let s: string = 'ABC'; let cp0: number | undefined = s.codePointAt(0); let cp1: number | undefined = s.codePointAt(1); if (cp0 !== undefined && cp1 !== undefined) { let rebuilt: string = String.fromCodePoint(cp0) + String.fromCodePoint(cp1); return rebuilt; } retu...
https://github.com/miaochiahao/ark-ghidra
5d283fc70a0c170187edb8f6ad78f63a550d5880
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSettingsPage.ets
arkts
showChapterCountPicker
显示章节数选择器
showChapterCountPicker(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择默认加载章节数', buttons: [ { text: '20 章', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '50 章', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '100 章', colo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showChapterCountPicker 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#state...
showChapterCountPicker(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择默认加载章节数', buttons: [ { text: '20 章', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '50 章', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '100 章', colo...
https://github.com/DaLongZhuaZi/manxia
a1d36a7ae12891961c6673b6cffa9d7451f794d2
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
removeDataSetByIndex
Removes the DataSet at the given index in the DataSet array from the data object. Also recalculates all minimum and maximum values. Returns true if a DataSet was removed, false if no DataSet could be removed. @param index
public removeDataSetByIndex(index: number): boolean { if (!this.mDataSets) { return false; } if (index >= this.mDataSets.size() || index < 0) return false; let data: T = this.mDataSets.get(index); return this.removeDataSet(data); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeDataSetByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public removeDataSetByIndex(index: number): boolean { if (!this.mDataSets) { return false; } if (index >= this.mDataSets.size() || index < 0) return false; let data: T = this.mDataSets.get(index); return this.removeDataSet(data); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
29873f33fde91fbea73524a52350e66cdc524905
gitee
openharmony-sig/flutter_packages
packages/pigeon/example/app/ohos/entry/src/main/ets/plugins/Messages.ets
arkts
getCodec
The codec used by MessageFlutterApi.
static getCodec(): MessageCodec<Object> { return new StandardMessageCodec(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCodec 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_st...
static getCodec(): MessageCodec<Object> { return new StandardMessageCodec(); }
https://gitee.com/openharmony-sig/flutter_packages.git
4f3955d89d56fdbcd2e72f849276a45c1d940acd
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/06.numeric_contexts/01.unary_numeric_promotion/bitwise_complement.ets
arkts
foo
--- desc: >- Unary numeric promotion is performed on expressions in the following situation: The operand of a bitwise complement operator. params: {{c.type}} ---
function foo(a: Object): int { return 1; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_...
function foo(a: Object): int { return 1; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3c0c5ab3ef2bf42f4f3951399e8e91913a703c84
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
toSorted
Creates a sorted copy @returns { Uint8Array } - a sorted copy @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toSorted(): Uint8Array { return new Uint8Array(this).sort() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted 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 Uint8Array AS...
public toSorted(): Uint8Array { return new Uint8Array(this).sort() }
https://gitcode.com/iop123123/arkts-static-skills
d072b97adc3d2bf97e60fa5e8bc983d644fd5691
gitcode
heeh02/superconnect
harmony/entry/src/main/ets/services/WindowController.ets
arkts
start
App launch: windowed layout + register the fullscreen-exit notification capability.
start(): void { WindowMode.apply(this.ctx, DisplayMode.Windowed, this.onLog); FullscreenNotification.enable(this.ctx, this.onLog); }
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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
start(): void { WindowMode.apply(this.ctx, DisplayMode.Windowed, this.onLog); FullscreenNotification.enable(this.ctx, this.onLog); }
https://github.com/heeh02/superconnect
b2d0484f57ad0e38fe0b043772837b8eaee73d86
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/main/main.ets
arkts
onPageShow
在打开此页面时,清空返回栈内的index页面,以保证返回能直接退出应用
onPageShow() { //清空返回栈 router.clear() //执行初始化操作 if (this.mainViewModel.isProfileInit === false) { this.mainViewModel.initMyProfile() } if (this.mainViewModel.isRepoHistoriesInit === false) { this.mainViewModel.initRepoHistories() } }
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() { //清空返回栈 router.clear() //执行初始化操作 if (this.mainViewModel.isProfileInit === false) { this.mainViewModel.initMyProfile() } if (this.mainViewModel.isRepoHistoriesInit === false) { this.mainViewModel.initRepoHistories() } }
https://gitee.com/openharmony-sig/online_event.git
54658ab5306b441a05940b069bf700289ffef398
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setExtraOffsets
Sets extra offsets (around the chart view) to be appended to the auto-calculated offsets. @param left @param top @param right @param bottom
public setExtraOffsets(left: number, top: number, right: number, bottom: number) { this.setExtraLeftOffset(left); this.setExtraTopOffset(top); this.setExtraRightOffset(right); this.setExtraBottomOffset(bottom); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setExtraOffsets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setExtraOffsets(left: number, top: number, right: number, bottom: number) { this.setExtraLeftOffset(left); this.setExtraTopOffset(top); this.setExtraRightOffset(right); this.setExtraBottomOffset(bottom); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e851c7bbb899a675ffde5836d80148125d5a8e79
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/coze/CozeApiClient.ets
arkts
consultInternalMedicine
调用内科智能体
async consultInternalMedicine(symptoms: string, patientInfo: object): Promise<string> { const prompt = `患者信息:${JSON.stringify(patientInfo)} 症状描述:${symptoms} 请作为内科专家进行初步分析: 1. 可能的诊断 2. 建议的检查项目 3. 初步处理建议 4. 是否需要转诊专科`; return this.sendMessage(prompt, 'internal_medicine_bot', this.getBotId('internalMedicine'));...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left consultInternalMedicine AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left symptoms AST#identifier#Right AST#type_annotation#Left ...
async consultInternalMedicine(symptoms: string, patientInfo: object): Promise<string> { const prompt = `患者信息:${JSON.stringify(patientInfo)} 症状描述:${symptoms} 请作为内科专家进行初步分析: 1. 可能的诊断 2. 建议的检查项目 3. 初步处理建议 4. 是否需要转诊专科`; return this.sendMessage(prompt, 'internal_medicine_bot', this.getBotId('internalMedicine'));...
https://github.com/LJ666-ui/harmony-health-care
94563ee0075d123091164afd69984e4237912ef1
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/BillManager.ets
arkts
applyBillToAccountBalance
将账单影响同步到账户余额,正负方向由账单类型和账户类型共同决定。
private static async applyBillToAccountBalance(bill: BillBean, reverse: boolean = false): Promise<void> { if (bill.type === BillTypeEnum.TRANSFER) { await BillManager.applyTransferBill(bill, reverse); return; } const delta: number = await BillManager.calculateAccountBalanceDelta(bill); if ...
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 applyBillToAccountBalance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ident...
private static async applyBillToAccountBalance(bill: BillBean, reverse: boolean = false): Promise<void> { if (bill.type === BillTypeEnum.TRANSFER) { await BillManager.applyTransferBill(bill, reverse); return; } const delta: number = await BillManager.calculateAccountBalanceDelta(bill); if ...
https://github.com/ZestBox-18/kitebook-frontend
493ec93894191a7c80b49f22d80dda86352409b8
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundMethodChannel.ets
arkts
setMethodCallHandler
Registers a method call handler on this channel. <p>Overrides any existing handler registration for (the name of) this channel. <p>If no handler has been registered, any incoming method call on this channel will be handled silently by sending a null reply. This results in a <a href="https://api.flutter.dev/flutter/serv...
setMethodCallHandler(handler: SendableMethodCallHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingSendableMethodCallHandler(handler, this.codec), this.taskQueue, ...this.args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMethodCallHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left Senda...
setMethodCallHandler(handler: SendableMethodCallHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingSendableMethodCallHandler(handler, this.codec), this.taskQueue, ...this.args); }
https://gitee.com/openharmony-sig/flutter_engine.git
d761195797df465fd845061af96987f928f36c8d
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Assigns val as element on insertPos. @param { int } insertPos - index to change @param { long } val - value to set @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set(insertPos: int, val: long): void { this.$_set(insertPos, val) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
public set(insertPos: int, val: long): void { this.$_set(insertPos, val) }
https://gitcode.com/iop123123/arkts-static-skills
6b24a01a241f2a7e08339887922f1af6f9436fe5
gitcode
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
prefetchPagesAround
Prefetches pages around the center index and evicts caches for distant pages. @param centerIndex The current page index being viewed @param prefetchRange Number of pages to prefetch on each side (default: 3) @param evictionRange Pages beyond this range will have their viewer caches evicted (default: 5)
public prefetchPagesAround( centerIndex: number, prefetchRange: number = 3, evictionRange: number = 5, displayedPageIndices: number[] = [] ): void { const totalPages = this.totalPageCount(); if (totalPages <= 0) { return; } const clampedCenter = Math.max(0, Math.min(centerIndex...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left prefetchPagesAround AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left centerIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public prefetchPagesAround( centerIndex: number, prefetchRange: number = 3, evictionRange: number = 5, displayedPageIndices: number[] = [] ): void { const totalPages = this.totalPageCount(); if (totalPages <= 0) { return; } const clampedCenter = Math.max(0, Math.min(centerIndex...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L1114-L1164
d8a2a3c46f72e257697d80e97700719cdce9c478
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets
arkts
getCurrentBreakpoint
获取当前断点
public getCurrentBreakpoint(): Breakpoint { return this.getDeviceInfo().breakpoint; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentBreakpoint 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 B...
public getCurrentBreakpoint(): Breakpoint { return this.getDeviceInfo().breakpoint; }
https://github.com/DaLongZhuaZi/manxia
69e504c1814388c655e9bcd38209dfca347b1f13
github
CLMC2025/Vignette
entry/src/main/ets/context/OfflineContext.ets
arkts
getWordsByPos
根据词性获取词汇
getWordsByPos(pos: string): WordInfo[] { const results: WordInfo[] = []; this.wordDatabase.forEach((wordInfo: WordInfo) => { if (wordInfo.pos === pos) { results.push(wordInfo); } }); return results; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWordsByPos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
getWordsByPos(pos: string): WordInfo[] { const results: WordInfo[] = []; this.wordDatabase.forEach((wordInfo: WordInfo) => { if (wordInfo.pos === pos) { results.push(wordInfo); } }); return results; }
https://github.com/CLMC2025/Vignette
9d0da97f002c6d6292364e498c84c6682cc3cca0
github
openharmony/arkui_ace_engine
examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets
arkts
notifyDataReload
通知数据已重新加载
notifyDataReload() { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifyDataReload 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...
notifyDataReload() { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
https://gitee.com/openharmony/arkui_ace_engine.git
71c925dcc7abd8ab8fa9fae5dc9ea79ac2536525
gitee
who7708/harmonyos-codelabs
HmosWorld/features/learning/src/main/ets/model/LearningModel.ets
arkts
getInstance
Get learning model instance. @returns learning model instance.
public static getInstance(): LearningModel { let learningModel = AppStorage.get<LearningModel>('learningModel'); if (!learningModel) { learningModel = new LearningModel(); AppStorage.setOrCreate('learningModel', learningModel); } return learningModel; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): LearningModel { let learningModel = AppStorage.get<LearningModel>('learningModel'); if (!learningModel) { learningModel = new LearningModel(); AppStorage.setOrCreate('learningModel', learningModel); } return learningModel; }
https://github.com/who7708/harmonyos-codelabs
51671b5a2a202dd262c046c1b84924e4e533a287
github
openharmony/app_samples
ETSUI/Gallery/entry/src/main/ets/MainAbility/common/components/getColor.ets
arkts
colorPannel
绘制canvas
colorPannel(curColor) { //第一次填充 var grad = this.context.createLinearGradient(0, 0, this.size.width, 0) grad.addColorStop(0, 'white') grad.addColorStop(1, curColor) this.context.fillStyle = grad this.context.fillRect(0, 0, this.size.width, this.size.height) //第二次填充 var myGrad = this.con...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left colorPannel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left curColor AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#exp...
colorPannel(curColor) { //第一次填充 var grad = this.context.createLinearGradient(0, 0, this.size.width, 0) grad.addColorStop(0, 'white') grad.addColorStop(1, curColor) this.context.fillStyle = grad this.context.fillRect(0, 0, this.size.width, this.size.height) //第二次填充 var myGrad = this.con...
https://gitee.com/openharmony/app_samples.git
f57461bf0cd866cfa5835f9635f9df029c6625e8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
loadNewOnlineManga
加载全新的网络漫画(从网络获取)
private async loadNewOnlineManga(params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: false, sourceId: params.sourceId || 0, sourceName: params....
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 loadNewOnlineManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#...
private async loadNewOnlineManga(params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: false, sourceId: params.sourceId || 0, sourceName: params....
https://github.com/DaLongZhuaZi/manxia
bd88f28cc02f798e85005c79503f7347e83384b3
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
isArray
Checks whether the passed value is an Array. @param arr @returns true is arr is a non-null array, false otherwise
public static isArray<T>(arr: T[]): boolean { if(arr == null){ return false } return true }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left isArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST...
public static isArray<T>(arr: T[]): boolean { if(arr == null){ return false } return true }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e472828444c0b2b683ab6d0a870fcc206126e1f1
gitee
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getLeaveRecords
获取请假记录
async getLeaveRecords(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/leave', params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLeaveRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a...
async getLeaveRecords(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/leave', params) }
https://github.com/David8Idira/AI-OA
6b66b125b9941aea9bced843008a4fd1bc2b29bf
github
zgzm78/VMALL
entry/src/main/ets/view/WaterFlowComponent.ets
arkts
onCategoryIndexChange
Handle category index change.
onCategoryIndexChange(): void { this.updateDataSource(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCategoryIndexChange 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...
onCategoryIndexChange(): void { this.updateDataSource(); }
https://github.com/zgzm78/VMALL
fbca9e72501f8a5918a4d47f3970a34c24941fbf
github
arkui-x/samples
CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
constructor
存放省、市、区名
constructor(code: string = '', name: string = '') { this.code = code; this.name = name; }
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 code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Lef...
constructor(code: string = '', name: string = '') { this.code = code; this.name = name; }
https://gitcode.com/arkui-x/samples
eafb30dfbcb2c0167033a2ea278dac3c906a70f3
gitcode
kumaleap/ArkLuban
entry/src/main/ets/utils/PhotoHelper.ets
arkts
selectSingle
选择单张照片 @param supportTaking 是否支持拍照,默认 true @param supportEdit 是否支持编辑,默认 true @returns 返回单个图片 URI,如果没有选择则返回 null
static async selectSingle(supportTaking: boolean = true, supportEdit: boolean = true): Promise<string | null> { const options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; options.maxSelectNumber = 1; options.isPhotoTakingSupported = ...
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 selectSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left supportTaking AST#identifier#Right AST#:#Le...
static async selectSingle(supportTaking: boolean = true, supportEdit: boolean = true): Promise<string | null> { const options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; options.maxSelectNumber = 1; options.isPhotoTakingSupported = ...
https://github.com/kumaleap/ArkLuban
eb9b87836176cf9c40b1124d728d84ba77e87de6
github
751496032/DSBridge-HarmonyOS
library/src/main/ets/wait/BaseSendable.ets
arkts
complete
不能手动调用complete()、run()方法
async complete() { this._isCompleted = true }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left complete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right...
async complete() { this._isCompleted = true }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/wait/BaseSendable.ets#L20-L22
02a00893dd7219327bfe9c21cd5c39e6459899b0
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
getAppState
Shared observable app state (queue, play flag, progress) bound to AppStorageV2.
private getAppState(): MusicAppState { return AppStorageV2.connect(MusicAppState, AppStorageKeys.MUSIC_APP_STATE, () => new MusicAppState())!; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getAppState 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 MusicAp...
private getAppState(): MusicAppState { return AppStorageV2.connect(MusicAppState, AppStorageKeys.MUSIC_APP_STATE, () => new MusicAppState())!; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
c1b88976200a0c54b91f2ff063db9bc89cc980d5
gitcode
Joker-x-dev/CoolMallArkTS
core/result/src/main/ets/RequestHelper.ets
arkts
repository
配置请求源仓库(Repository/API 返回的 Promise) @param {Promise<NetworkResponse<T>>} promise - 原始请求 Promise @returns {RequestHelper<T>} 链式助手实例
static repository<T>(promise: Promise<NetworkResponse<T>>): RequestHelper<T> { return new RequestHelper<T>(promise); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left repository AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri...
static repository<T>(promise: Promise<NetworkResponse<T>>): RequestHelper<T> { return new RequestHelper<T>(promise); }
https://github.com/Joker-x-dev/CoolMallArkTS
7d024238fe151b0b7e6fde5a22ab514dbb0030b4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets
arkts
generateStrategyReason
生成策略原因
private generateStrategyReason(readingSpeed: string, forwardRatio: number, isWiFi: boolean): string { const reasons: string[] = []; if (readingSpeed === 'fast') { reasons.push('快速阅读'); } else if (readingSpeed === 'slow') { reasons.push('慢速阅读'); } if (forwardRatio > 0.8) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateStrategyReason AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left readingSpeed AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st...
private generateStrategyReason(readingSpeed: string, forwardRatio: number, isWiFi: boolean): string { const reasons: string[] = []; if (readingSpeed === 'fast') { reasons.push('快速阅读'); } else if (readingSpeed === 'slow') { reasons.push('慢速阅读'); } if (forwardRatio > 0.8) { ...
https://github.com/DaLongZhuaZi/manxia
86eed72e1c068832f9273e03409217a3ba0fa1ca
github
Vsolon0401/MallShopping
features/commoditydetail/src/main/ets/components/CommodityDetail.ets
arkts
createHistory
创建浏览记录
createHistory() { const product = this.info.product historyService.createReadHistory({ productId: product.id, productName: product.name, productPic: product.pic, productPrice: `${product.price}`, productSubTitle: product.subTitle, }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createHistory 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...
createHistory() { const product = this.info.product historyService.createReadHistory({ productId: product.id, productName: product.name, productPic: product.pic, productPrice: `${product.price}`, productSubTitle: product.subTitle, }) }
https://github.com/Vsolon0401/MallShopping
7e521144f322d2ddea2a1f91330242775194eeff
github
HarmonyOS_Samples/guide-snippets
Ability/GuideForAppExit/terminateSelf/src/main/ets/terminateselfability/TerminateSelfAbility.ets
arkts
onCreate
[StartExclude appStop_terminateSelf]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err)); ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
22bf201720ee137b780648dd9d299cbfa385747c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/ImageCacheManager.ets
arkts
loadFromNetwork
从网络加载图片
private async loadFromNetwork(url: string, options?: LoadOptions): Promise<image.PixelMap | null> { if (this.isPhotos18Url(url)) { logger.info(TAG, `Photos18缃戠粶鍥剧墖鏀惧叆OnlineImageLoader闃熷垪: ${url.substring(0, 80)}`); const onlineLoader = OnlineImageLoader.getInstance(); const onlineOptions: Online...
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 loadFromNetwork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left :...
private async loadFromNetwork(url: string, options?: LoadOptions): Promise<image.PixelMap | null> { if (this.isPhotos18Url(url)) { logger.info(TAG, `Photos18缃戠粶鍥剧墖鏀惧叆OnlineImageLoader闃熷垪: ${url.substring(0, 80)}`); const onlineLoader = OnlineImageLoader.getInstance(); const onlineOptions: Online...
https://github.com/DaLongZhuaZi/manxia
e758085740f084aff925f24724c169569e34a50c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/ComponentBase.ets
arkts
getXOffset
Returns the used offset on the x-axis for drawing the axis or legend labels. This offset is applied before and after the label. @return
public getXOffset(): number { return this.mXOffset; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getXOffset 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#numb...
public getXOffset(): number { return this.mXOffset; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6f0126122d1cb71bfc8dcbe2f9209ad6be8fb053
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/ApiClient.ets
arkts
getTopicsByIds
按 topic_ids 获取话题(用于“查看新话题”banner 增量插入) 请求格式:/latest.json?topic_ids=1,2,3
async getTopicsByIds(topicIds: number[]): Promise<TopicListResponse> { if (topicIds.length === 0) { return new TopicListResponse(); } const params: Record<string, Object> = {}; params['topic_ids'] = topicIds.join(','); const result: string = await this.http.get(ApiConstants.TOPIC_LIST, param...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getTopicsByIds AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left topicIds AST#identifier#Right ...
async getTopicsByIds(topicIds: number[]): Promise<TopicListResponse> { if (topicIds.length === 0) { return new TopicListResponse(); } const params: Record<string, Object> = {}; params['topic_ids'] = topicIds.join(','); const result: string = await this.http.get(ApiConstants.TOPIC_LIST, param...
https://github.com/Amaz1ny/HarmonyDO-public
3ba4000c4acb6e7fd50238c7560c61076a4e9237
github
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets
arkts
stop
Stop music
public async stop() { Logger.info(TAG, 'stop()'); if (this.isPrepared && this.avPlayer) { await this.avPlayer.stop(); this.updateIsPlay(false); this.state = AudioPlayerState.PAUSE; } }
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 stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right...
public async stop() { Logger.info(TAG, 'stop()'); if (this.isPrepared && this.avPlayer) { await this.avPlayer.stop(); this.updateIsPlay(false); this.state = AudioPlayerState.PAUSE; } }
https://gitee.com/harmonyos/codelabs.git
1abf179c67b03ce80844bb2d12a25bbe05001a5d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
sleep
延迟指定毫秒
private sleep(ms: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(resolve, ms); }); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left sleep AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#i...
private sleep(ms: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(resolve, ms); }); }
https://github.com/DaLongZhuaZi/manxia
8dc480bbfe389997e6f109ae989cfafd30b70150
github
HarmonyOS_Samples/MusicHome
features/playlist/src/main/ets/view/PlaylistDetailHeroSection.ets
arkts
build
Renders large-column stacked hero or compact row hero with optional path clip.
build() { if (isWidthBreakpointLgOrXl(this.breakpointEnv.widthBreakpoint)) { Column() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Stack({ alignContent: Alignment.BottomStart }) { Image($r('app.media.ic_list_cover...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i...
build() { if (isWidthBreakpointLgOrXl(this.breakpointEnv.widthBreakpoint)) { Column() { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Stack({ alignContent: Alignment.BottomStart }) { Image($r('app.media.ic_list_cover...
https://gitcode.com/HarmonyOS_Samples/MusicHome
34d8739412fa10b90525799bf018d7961cb21283
gitcode
openharmony/applications_permission_manager
permissionmanager/src/main/ets/PermissionSheet/GlobalSwitchSheetDialog.ets
arkts
revokeUserGrantedPermission
Deauthorize the app @param {Number} accessTokenId @param {String} permission permission name @param {Number} index Array index to modify permission status
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions, resolve: (value: number) => void) { abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( accessTokenId, permission, Constants.PERMISSION_FLAG ).then(() => { resolve(0); }).catch((error: BusinessError) => { ...
AST#program#Left AST#ERROR#Left AST#identifier#Left revokeUserGrantedPermission AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left accessTokenId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#ERROR#Left AST...
revokeUserGrantedPermission(accessTokenId: number, permission: Permissions, resolve: (value: number) => void) { abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( accessTokenId, permission, Constants.PERMISSION_FLAG ).then(() => { resolve(0); }).catch((error: BusinessError) => { ...
https://gitee.com/openharmony/applications_permission_manager.git
2b5104a56dffad6964b27f448babc3bfc3834818
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/clipboard/ClipboardSyncConfig.ets
arkts
build
Build a wire frame for sending clipboard data. @param kind Clipboard data type (KIND_TEXT or KIND_PNG) @param token Echo suppression token @param payload Data to send @returns Wire frame bytes
static build(kind: number, token: number, payload: Uint8Array): Uint8Array { const totalLen = ClipboardWireFrame.HEADER_SIZE + payload.length const frame = new Uint8Array(totalLen) const view = new DataView(frame.buffer, frame.byteOffset, totalLen) // Version view.setUint8(0, ClipboardWireFrame.W...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left build AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kind AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
static build(kind: number, token: number, payload: Uint8Array): Uint8Array { const totalLen = ClipboardWireFrame.HEADER_SIZE + payload.length const frame = new Uint8Array(totalLen) const view = new DataView(frame.buffer, frame.byteOffset, totalLen) // Version view.setUint8(0, ClipboardWireFrame.W...
https://github.com/AlkaidLab/moonlight-harmony
23dd33c9c244bf0d0336ee93757790c5e568ff16
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamInputHandler.ets
arkts
updateXComponentScreenPosition
更新 XComponent 在屏幕上的精确位置(由 onAreaChange 回调触发) C++ 鼠标 Monitor 使用窗口矩形映射,onAreaChange 时重新获取窗口矩形
updateXComponentScreenPosition(screenX: number, screenY: number): void { // 窗口大小或位置可能变化,重新获取窗口矩形 if (this.mouseInterceptorActive) { this.fetchAndUpdateWindowRect(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateXComponentScreenPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AS...
updateXComponentScreenPosition(screenX: number, screenY: number): void { // 窗口大小或位置可能变化,重新获取窗口矩形 if (this.mouseInterceptorActive) { this.fetchAndUpdateWindowRect(); } }
https://github.com/AlkaidLab/moonlight-harmony
fe768bde6cb8ccc37ac3dfc1e4520636d2534eb4
github
aimilin6688/KeePassHO
entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets
arkts
utf8ToBase32
UTF-8 字符串转 Base32 @param utf8String UTF-8 字符串 @returns Base32 编码的字符串
private utf8ToBase32(utf8String: string): string { // UTF-8 字符串转字节数组 const encoder = new util.TextEncoder(); const bytes = encoder.encodeInto(utf8String); // 字节数组转 Base32 return TotpService.getInstance().base32Encode(bytes); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left utf8ToBase32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left utf8String AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private utf8ToBase32(utf8String: string): string { // UTF-8 字符串转字节数组 const encoder = new util.TextEncoder(); const bytes = encoder.encodeInto(utf8String); // 字节数组转 Base32 return TotpService.getInstance().base32Encode(bytes); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets#L134-L141
c234f1ef86bc9577ae78aa3c953df32732eb9d34
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
generateCbzFileName
生成CBZ文件名
private generateCbzFileName(chapterInfo: ComicChapterInfo): string { const safeTitle = this.sanitizeFileName(chapterInfo.chapterTitle); const timestamp = TimeUtils.toISOString(Date.now()).replace(/[:.]/g, '-'); return `${safeTitle}_${timestamp}.cbz`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateCbzFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapterInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private generateCbzFileName(chapterInfo: ComicChapterInfo): string { const safeTitle = this.sanitizeFileName(chapterInfo.chapterTitle); const timestamp = TimeUtils.toISOString(Date.now()).replace(/[:.]/g, '-'); return `${safeTitle}_${timestamp}.cbz`; }
https://github.com/DaLongZhuaZi/manxia
f1f5de2aa7df8639e83bf7feca0e18b8b8b0b24a
github
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/LoggerFileUtil.ets
arkts
deleteOldLog
删除超过12小时的旧日志文件。 @returns 无返回值。
private deleteOldLog() { try { // 获取日志路径下的所有文件 const listFile = fs.listFileSync(this.logPath) // 遍历文件列表,删除超过12小时的文件 listFile.forEach((file) => { if (fs.statSync(`${this.logPath}${file}`).mtime * 1000 < Date.now() - 43200000) { fs.unlinkSync(`${this.logPath}${file}`) ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deleteOldLog 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 deleteOldLog() { try { // 获取日志路径下的所有文件 const listFile = fs.listFileSync(this.logPath) // 遍历文件列表,删除超过12小时的文件 listFile.forEach((file) => { if (fs.statSync(`${this.logPath}${file}`).mtime * 1000 < Date.now() - 43200000) { fs.unlinkSync(`${this.logPath}${file}`) ...
https://github.com/chenchl/GMLogger-HarmonyOS
6ce5c1d5c17d55cdf1456d5a1452a842900df22c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimatedGridState.ets
arkts
getLayoutConfig
获取当前布局配置
public getLayoutConfig(): GridLayoutConfig { return { columns: this.layoutConfig.columns, itemWidth: this.layoutConfig.itemWidth, itemHeight: this.layoutConfig.itemHeight, columnGap: this.layoutConfig.columnGap, rowGap: this.layoutConfig.rowGap, paddingLeft: this.layoutConfig.p...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLayoutConfig 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 GridLa...
public getLayoutConfig(): GridLayoutConfig { return { columns: this.layoutConfig.columns, itemWidth: this.layoutConfig.itemWidth, itemHeight: this.layoutConfig.itemHeight, columnGap: this.layoutConfig.columnGap, rowGap: this.layoutConfig.rowGap, paddingLeft: this.layoutConfig.p...
https://github.com/DaLongZhuaZi/manxia
b3fcff194226d6fa3c47aac0cb1f6f20afb33d95
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets
arkts
getValueAt
Finds the value of the index. @param index the index of the element to get the value of @returns the value of the index, or -1 if the index is not found
public getValueAt(index: int): T { this.checkIndexType(index); this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); return this.buckets.getValueAt(index)!; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
public getValueAt(index: int): T { this.checkIndexType(index); this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); return this.buckets.getValueAt(index)!; }
https://gitcode.com/iop123123/arkts-static-skills
e7e8811e3422809c5763b5eb7fcca57c2934797a
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toLocaleString
Converts BigInt64Array to a string with respect to locale @param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an array of such strings @param { object } [ options ] An object with configuration properties. @returns { string } - string representation @syscap SystemCapability.Utils.Lang @F...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): string { if (this.lengthInt > 0) { const res: StringBuilder = new StringBuilder() res.append(new BigInt(this.getUnsafe(0)).toLocaleString(locales, options)) for (let i: int = 1; i < this.len...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Rig...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): string { if (this.lengthInt > 0) { const res: StringBuilder = new StringBuilder() res.append(new BigInt(this.getUnsafe(0)).toLocaleString(locales, options)) for (let i: int = 1; i < this.len...
https://gitcode.com/iop123123/arkts-static-skills
b85fde421b4c932b4189123739e5538cdcadbaed
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
removeAllLimitLines
Removes all LimitLines from the axis.
public removeAllLimitLines(): void { this.mLimitLines.clear(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeAllLimitLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ex...
public removeAllLimitLines(): void { this.mLimitLines.clear(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9fa9d4fd96b69a19fee6b27c2152ed75a5c5d21a
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets
arkts
supports
判断是否为预置模板
supports(template: ITemplate): boolean { return isPresetTemplate(template); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left supports AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ITemplate AST#identifier#Right AST#)#Left )...
supports(template: ITemplate): boolean { return isPresetTemplate(template); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets#L124-L126
138d81c30902cc4485b8ecd668b0c9963f334863
github