nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
LJ666-ui/harmony-health-care
entry/src/main/ets/core/AlertManager.ets
arkts
notifySubscribers
通知订阅者
private notifySubscribers(): void { const alerts = this.getAlerts(); this.subscribers.forEach(callback => { try { callback(alerts); } catch (error) { console.error('AlertManager: Error in subscriber callback', error); } }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifySubscribers 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 AS...
private notifySubscribers(): void { const alerts = this.getAlerts(); this.subscribers.forEach(callback => { try { callback(alerts); } catch (error) { console.error('AlertManager: Error in subscriber callback', error); } }); }
https://github.com/LJ666-ui/harmony-health-care
3c9e4bbcea3dcae499fd73b022f4ab594cdaef46
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ConsolePanel.ets
arkts
getHelpText
获取帮助文本
getHelpText(): string { return [ '=== 调试命令帮助 ===', 'help, ? - 显示此帮助信息', 'clear, cls - 清空日志', 'status - 显示系统状态', 'memory - 显示内存信息', 'performance, perf - 显示性能信息', 'diagnosis, diag - 执行系统诊断', 'export-errors - 导出错误日志到文件', 'ex...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHelpText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_...
getHelpText(): string { return [ '=== 调试命令帮助 ===', 'help, ? - 显示此帮助信息', 'clear, cls - 清空日志', 'status - 显示系统状态', 'memory - 显示内存信息', 'performance, perf - 显示性能信息', 'diagnosis, diag - 执行系统诊断', 'export-errors - 导出错误日志到文件', 'ex...
https://github.com/DaLongZhuaZi/manxia
b6dd072c536937e7147eafef47463e410631ff9c
github
yangyongzhen/hmmovie
entry/src/main/ets/pages/StartPage.ets
arkts
onPageHide
只有被@Entry装饰的组件才可以调用页面的生命周期 页面每次隐藏时触发一次,可触发多次
onPageHide(): void { Log.info(`StartPage 页面隐藏:onPageHide`) this.privacyDialogController?.close() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onPageHide(): void { Log.info(`StartPage 页面隐藏:onPageHide`) this.privacyDialogController?.close() }
https://github.com/yangyongzhen/hmmovie
98136fe579d05c7d81db8feec3511be2303dd08c
github
the-wwyang/kids-learning-app
src/main/ets/services/ProfileService.ets
arkts
createProfile
创建新档案
public async createProfile(nickname: string, avatar: string = '👧'): Promise<UserProfile | null> { if (this.dataPreferences === null) { return null; } try { const profileId = this.generateUUID(); const profile = new UserProfile(profileId, nickname, avatar); // 保存档案 const pr...
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 createProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nickname AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public async createProfile(nickname: string, avatar: string = '👧'): Promise<UserProfile | null> { if (this.dataPreferences === null) { return null; } try { const profileId = this.generateUUID(); const profile = new UserProfile(profileId, nickname, avatar); // 保存档案 const pr...
https://github.com/the-wwyang/kids-learning-app
06296c449547bb61c34c49d8498ceb46794627b9
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imageAddText
图片添加文字 @param input 输入图片路径 @param output 输出图片路径 @param text 文字内容 @param fontSize 字体大小,默认 24 @param color 文字颜色,默认白色 'white' @param x X 坐标,默认 10 @param y Y 坐标,默认 10
public static imageAddText( input: string, output: string, text: string, fontSize: number = 24, color: string = 'white', x: number = 10, y: number = 10 ): string[] { return [ 'ffmpeg', '-i', input, '-vf', `drawtext=text='${text}':fontsize=${fontSize}:fontcolor=${col...
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 imageAddText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AS...
public static imageAddText( input: string, output: string, text: string, fontSize: number = 24, color: string = 'white', x: number = 10, y: number = 10 ): string[] { return [ 'ffmpeg', '-i', input, '-vf', `drawtext=text='${text}':fontsize=${fontSize}:fontcolor=${col...
https://github.com/jjjjjjava/ffmpeg_tools
82017a9c13c427255ae3ad74e47d725cff4590c8
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/BoundDeviceInfoFlow.ui.test.ets
arkts
nicknameFromRowText
Strip the leading avatar emoji prefix (e.g. "🦁 ") that the row Text concatenates from the BoundDeviceInfoPage view binding so the caller sees just the nickname portion. Returns the original string unmodified when no space is found.
function nicknameFromRowText(rowText: string): string { const sp: number = rowText.indexOf(' '); if (sp < 0) { return rowText; } return rowText.substring(sp + 1).trim(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left nicknameFromRowText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rowText AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function nicknameFromRowText(rowText: string): string { const sp: number = rowText.indexOf(' '); if (sp < 0) { return rowText; } return rowText.substring(sp + 1).trim(); }
https://github.com/terryma2024/happyword
1d647d1310d46390d40d76c605e3447e1342e1a4
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/input/search/components/MixedStyleSearch.ets
arkts
CategorySelect
Extract common Select dropdown
@Builder function CategorySelect() { Select([ { value: 'aaa', icon: $r('sys.media.ohos_app_icon') }, { value: 'bbb', icon: $r('sys.media.ohos_app_icon') }, { value: 'ccc', icon: $r('sys.media.ohos_app_icon') }, { value: 'ddd', icon: $r('sys.media.ohos_app_icon') } ]) .value($r('app.string.search...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left CategorySelect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#...
@Builder function CategorySelect() { Select([ { value: 'aaa', icon: $r('sys.media.ohos_app_icon') }, { value: 'bbb', icon: $r('sys.media.ohos_app_icon') }, { value: 'ccc', icon: $r('sys.media.ohos_app_icon') }, { value: 'ddd', icon: $r('sys.media.ohos_app_icon') } ]) .value($r('app.string.search...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
841cd5a2e46cf08c92790d4658a3e28184d78a62
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
isLineSearchMatch
O(1) 判断某行是否有搜索匹配(使用 Set 缓存)
isLineSearchMatch(lineIndex: number): boolean { return this._searchMatchLineSet.has(lineIndex); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLineSearchMatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ...
isLineSearchMatch(lineIndex: number): boolean { return this._searchMatchLineSet.has(lineIndex); }
https://github.com/XJTUWYD/ArkDiff
b35d9444732d5393a62fcad038da058a8dc0aa61
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/08.reference_types/02.object_class_type/class_methods.ets
arkts
main
--- desc: Inheritance methods from Object class. params: {{method}} ---
function main(): void { let s: String = new String("test"); s.{{method}} }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let s: String = new String("test"); s.{{method}} }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
266166a98e5888bc92c31bc907d1a95156d7a3aa
gitee
arkui-x/samples
CodeLab/Cases/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
documentViewPickerSelect
注意:仅供UI展示使用 封装后的documentViewPicker的Select方法,需要被注册到native侧 @param uiContext:调用本方法的UIContext @param options:拉起picker时的options参数 @param thenWrapper:开发者自定义的then回调 @param catchWrapper:开发者自定义的catch回调
function documentViewPickerSelect(uiContext: UIContext, options: picker.DocumentSelectOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { // TODO:知识点:使用对应UIAbility的UIContext.runScopedTask来执行方法,确保多实例情况下,事件在正确的窗口/UIAbility内发生 uiContext.runScopedTask(() => { logger.debug("enter ets ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left documentViewPickerSelect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uiContext AST#identifier#Right AST#type_annotation#Left AST#:...
function documentViewPickerSelect(uiContext: UIContext, options: picker.DocumentSelectOptions, thenWrapper: StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void { // TODO:知识点:使用对应UIAbility的UIContext.runScopedTask来执行方法,确保多实例情况下,事件在正确的窗口/UIAbility内发生 uiContext.runScopedTask(() => { logger.debug("enter ets ...
https://gitcode.com/arkui-x/samples
c951dc2335f0fcfd58bec4ee89d8916220d6381f
gitcode
erosTeam/NextE
shared/src/main/ets/backup/BackupPreferencesAdapter.ets
arkts
reapply
Re-run every *Settings.restore() so the freshly written store re-hydrates AppStorageV2/state holders (theme, cookies, layout, …) immediately instead of only on next launch.
static async reapply(context: common.UIAbilityContext): Promise<void> { await SettingsBootstrap.loadAll(context) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left reapply AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#...
static async reapply(context: common.UIAbilityContext): Promise<void> { await SettingsBootstrap.loadAll(context) }
https://github.com/erosTeam/NextE
3f36efbf32dc095c0c59f0a9c445e8dbe1f20cc7
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/components/CustomChartComponent.ets
arkts
parseColor
───────────────────────────────────────────── Helper methods ─────────────────────────────────────────────
private parseColor(hexColor: string): number { try { const cleaned: string = hexColor.replace('#', ''); if (cleaned.length === 6) { return parseInt('FF' + cleaned, 16); } else if (cleaned.length === 8) { return parseInt(cleaned, 16); } } catch (_e) { // fallback ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hexColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
private parseColor(hexColor: string): number { try { const cleaned: string = hexColor.replace('#', ''); if (cleaned.length === 6) { return parseInt('FF' + cleaned, 16); } else if (cleaned.length === 8) { return parseInt(cleaned, 16); } } catch (_e) { // fallback ...
https://github.com/AGenUI/AGenUI
3b1e409a19d6d7b20d7f0b62136742d06760ca16
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
isSupportedRom
检查文件是否是支持的 ROM
private isSupportedRom(fileName: string): boolean { const lowerName = fileName.toLowerCase(); return SUPPORTED_EXTENSIONS.some(ext => lowerName.endsWith(ext.toLowerCase())); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isSupportedRom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private isSupportedRom(fileName: string): boolean { const lowerName = fileName.toLowerCase(); return SUPPORTED_EXTENSIONS.some(ext => lowerName.endsWith(ext.toLowerCase())); }
https://github.com/richshaw2015/nds
66a7483e1e07e2444879219b184998250b2ad59c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets
arkts
clearTimeout
清除 setTimeout @param timerId 定时器 ID
clearTimeout(timerId: number): void { const timerInfo = this.timers.get(timerId); if (timerInfo) { clearTimeout(timerInfo.id); this.timers.delete(timerId); if (this.config.enableDebug) { logger.debug(TAG, `[${this.pageId}] clearTimeout: id=${timerId}`); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
clearTimeout(timerId: number): void { const timerInfo = this.timers.get(timerId); if (timerInfo) { clearTimeout(timerInfo.id); this.timers.delete(timerId); if (this.config.enableDebug) { logger.debug(TAG, `[${this.pageId}] clearTimeout: id=${timerId}`); } } }
https://github.com/DaLongZhuaZi/manxia
745fbcf558b2bf3e2699a003bdea44a5fab4913a
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/components/CustomChartComponent.ets
arkts
buildLineChart
───────────────────────────────────────────── Line chart ─────────────────────────────────────────────
private buildLineChart(data: NewLineData): void { const model: LineChartModel = new LineChartModel(); const description: Description = new Description(); description.setEnabled(false); model.setDescription(description); const xAxis: XAxis | null = model.getXAxis(); if (xAxis !== null) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildLineChart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private buildLineChart(data: NewLineData): void { const model: LineChartModel = new LineChartModel(); const description: Description = new Description(); description.setEnabled(false); model.setDescription(description); const xAxis: XAxis | null = model.getXAxis(); if (xAxis !== null) { ...
https://github.com/AGenUI/AGenUI
a85e7635c9c4eb23e2da4780e9fba35d8ad87aea
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
groupBy
分组查询,一般用getObject接收 @param fields 可以传多个字段 @returns Wrapper
groupBy(fields: string | string[], condition: boolean = true): Wrapper { if (condition) { if (Array.isArray(fields)) { this.groupSql = `group by ${fields.join(',')}` } else { this.groupSql = `group by ${fields}` } } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left groupBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fields AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#identifi...
groupBy(fields: string | string[], condition: boolean = true): Wrapper { if (condition) { if (Array.isArray(fields)) { this.groupSql = `group by ${fields.join(',')}` } else { this.groupSql = `group by ${fields}` } } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L263-L272
eaea441c5f50db95836f4eecacab013740ecf6ee
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getNonPrivateOnlineComics
[新增] 获取非隐私在线漫画列表 @returns Promise<OnlineComicInfo[]> 非隐私在线漫画列表
public async getNonPrivateOnlineComics(): Promise<OnlineComicInfo[]> { try { const records = await this.databaseManager.query( 'online_comic_info', undefined, '(isPrivate = ? OR isPrivate IS NULL)', [0], 'lastUpdateTime DESC' ); logger.info(TAG, `查询到 ${rec...
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 getNonPrivateOnlineComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
public async getNonPrivateOnlineComics(): Promise<OnlineComicInfo[]> { try { const records = await this.databaseManager.query( 'online_comic_info', undefined, '(isPrivate = ? OR isPrivate IS NULL)', [0], 'lastUpdateTime DESC' ); logger.info(TAG, `查询到 ${rec...
https://github.com/DaLongZhuaZi/manxia
3bef358908cc84b9d637e87bf1482282c16fd72c
github
openharmony/vendor_unionman
unionpi_tiger/sample_api11/app/A311D_FactoryTest_app/entry/src/main/ets/a311d/interfaceButton/headsetRecordingButton.ets
arkts
setAudioRecorderCallback
注册audioRecorder回调函数
setAudioRecorderCallback() { // 状态机变化回调函数 this.avRecorder.on('stateChange', (state, reason) => { console.log(`AudioRecorder current state is ${state}`); }) // 错误上报回调函数 this.avRecorder.on('error', (err) => { console.error(`AudioRecorder failed, code is ${err.code}, message is ${err.mess...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAudioRecorderCallback 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...
setAudioRecorderCallback() { // 状态机变化回调函数 this.avRecorder.on('stateChange', (state, reason) => { console.log(`AudioRecorder current state is ${state}`); }) // 错误上报回调函数 this.avRecorder.on('error', (err) => { console.error(`AudioRecorder failed, code is ${err.code}, message is ${err.mess...
https://gitee.com/openharmony/vendor_unionman.git
79071969483672d764c8af336f33e37ca690b18b
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an Uint16Array from array-like argument @param o array-like object to initialize Uint16Array @param mapFn function to apply for each @returns new Uint16Array
public from(o: Object, mapFn: (e: Object) => number): Uint16Array { let newF: (e: Object, index: int) => number = (e: Object, index: int): number => { return mapFn(e) } return this.from(o, newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object, mapFn: (e: Object) => number): Uint16Array { let newF: (e: Object, index: int) => number = (e: Object, index: int): number => { return mapFn(e) } return this.from(o, newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cfc4460628d86039553445eaac8a09c2289c2cb3
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testMapIteration
--- Map iteration with entries/keys/values ---
function testMapIteration(): string { let m: Map<string, number> = new Map<string, number>(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let keys: string[] = []; m.forEach((val: number, key: string): void => { keys.push(key); }); return keys.join(','); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapIteration 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...
function testMapIteration(): string { let m: Map<string, number> = new Map<string, number>(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let keys: string[] = []; m.forEach((val: number, key: string): void => { keys.push(key); }); return keys.join(','); }
https://github.com/miaochiahao/ark-ghidra
0d144f532aee387bbc4580a92fd27fb17a5da4c4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
offConfigChange
移除配置变化监听器
public offConfigChange(callback: (profile: UserThemeProfile) => void): void { this.changeCallbacks.delete(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left offConfigChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST...
public offConfigChange(callback: (profile: UserThemeProfile) => void): void { this.changeCallbacks.delete(callback); }
https://github.com/DaLongZhuaZi/manxia
fe625faa562d2026ce32175aa09c7243d9c94111
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
setNavigationMode
设置导航模式
public setNavigationMode(mode: NavigationMode): void { this.navigationState.navigationMode = mode; console.log('[ARNavigationService] 切换导航模式:', mode); // 根据模式启动/停止AR渲染 if (mode === NavigationMode.AR_MODE) { this.arRenderer.startRendering(); } else { this.arRenderer.stopRendering(); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNavigationMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setNavigationMode(mode: NavigationMode): void { this.navigationState.navigationMode = mode; console.log('[ARNavigationService] 切换导航模式:', mode); // 根据模式启动/停止AR渲染 if (mode === NavigationMode.AR_MODE) { this.arRenderer.startRendering(); } else { this.arRenderer.stopRendering(); ...
https://github.com/LJ666-ui/harmony-health-care
0abcf5aa4173f4f177f6cb7075a4cc10ee579f45
github
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
getFileSizeSync
获取path的文件大小 @param path 文件绝对路径
getFileSizeSync(path: string): number { try { let stat = fs.statSync(path) return stat.size } catch (e) { LogUtil.error('FileUtils getFileSize e ' + e) return -1 } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileSizeSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
getFileSizeSync(path: string): number { try { let stat = fs.statSync(path) return stat.size } catch (e) { LogUtil.error('FileUtils getFileSize e ' + e) return -1 } }
https://gitee.com/openharmony-tpc/ImageKnife.git
40150194ad813350da9b1598303478bddbb50755
gitee
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/metartc_app/entry/src/main/ets/module/db.ets
arkts
deletePreferences
删除数据,调用dataPreferences的deletePreferences接口
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'setting.db'); } catch(err) { console.error('[PreferenceModel]', `Failed to delete preferences, Cause: ${err}`); }; preference = null; this.showToastMessage($r('app.string.delete_success_msg')); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deletePreferences 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 { AS...
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'setting.db'); } catch(err) { console.error('[PreferenceModel]', `Failed to delete preferences, Cause: ${err}`); }; preference = null; this.showToastMessage($r('app.string.delete_success_msg')); }
https://gitee.com/openharmony/vendor_unionman.git
53c119a9b04f15f0060d2ef472121aba12cb1fb7
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isInteger
检查值是否为整数 @param value - 要检查的值 @returns 是否为整数
static isInteger(value: Object): boolean { if (!TypeGuards.isNumber(value)) { return false; } const numValue = value as number; return Number.isInteger(numValue); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInteger 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 Objec...
static isInteger(value: Object): boolean { if (!TypeGuards.isNumber(value)) { return false; } const numValue = value as number; return Number.isInteger(numValue); }
https://github.com/DaLongZhuaZi/manxia
a97d42cedc065e01b0aa2da82ddcb06a6e2332a1
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/AvPlayManager.ets
arkts
videoSpeedOnePointTwentyFive
调节1.25倍速
videoSpeedOnePointTwentyFive(): void { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_25_X); Logger.info(this.tag, 'videoSpeed_1_25'); } catch (e) { Logger.info(this.tag, `videoSpeed_1_25 err : ${JSON.stringify(e)}`); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left videoSpeedOnePointTwentyFive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#una...
videoSpeedOnePointTwentyFive(): void { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_25_X); Logger.info(this.tag, 'videoSpeed_1_25'); } catch (e) { Logger.info(this.tag, `videoSpeed_1_25 err : ${JSON.stringify(e)}`); } } }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
2e75fff9a316b289287eb0484d7685a1c01a0c37
gitee
codelably/HCompass
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onDestroy
应用销毁时调用 释放应用上下文、注销路由
onDestroy(): void { // 销毁所有模块 try { destroyModules(); } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to destroy modules. Cause: %{public}s', JSON.stringify(err)); } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy 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#Le...
onDestroy(): void { // 销毁所有模块 try { destroyModules(); } catch (err) { hilog.error(DOMAIN, 'testTag', 'Failed to destroy modules. Cause: %{public}s', JSON.stringify(err)); } hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); }
https://github.com/codelably/HCompass
e8dd8b8f4db38bf827cb37657ae149dafeb334f7
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
requiresMaxCompletionTokens
OpenAI gpt-5 系列与 o-系列推理模型在 Chat Completions 必须用 max_completion_tokens, 下发 max_tokens 会被官方接口拒绝(HTTP 400 unsupported_parameter)。 AiHubMix / 各种 OpenAI 代理透传请求,因此也会触发同样错误。
private requiresMaxCompletionTokens(model: string): boolean { const modelLower = this.normalizeModelId(model) return modelLower.startsWith('gpt-5') || modelLower.startsWith('o1') || modelLower.startsWith('o3') || modelLower.startsWith('o4') }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left requiresMaxCompletionTokens AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left model AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
private requiresMaxCompletionTokens(model: string): boolean { const modelLower = this.normalizeModelId(model) return modelLower.startsWith('gpt-5') || modelLower.startsWith('o1') || modelLower.startsWith('o3') || modelLower.startsWith('o4') }
https://github.com/LongLiveY96/chatcube
a80e0e7745db08acfb05c8f8e6ae35510ee7e0bb
github
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
safePadding
==================== 设计 Token ==================== 安全边距 (vp) — 圆形屏更大(需避开弧形裁切区域)
static get safePadding(): number { const screenSize = WearScreenUtil.screenSize; if (WearScreenUtil.isRoundScreen()) { if (screenSize === 'small') return 18; if (screenSize === 'large') return 28; // 暂无此设备,预留 return 24; // standard } if (screenSize === 'small') return 8; if (s...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left safePadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
static get safePadding(): number { const screenSize = WearScreenUtil.screenSize; if (WearScreenUtil.isRoundScreen()) { if (screenSize === 'small') return 18; if (screenSize === 'large') return 28; // 暂无此设备,预留 return 24; // standard } if (screenSize === 'small') return 8; if (s...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
7576f9094d5df1ee25c9ff7815ac7331e0389bbd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
setNovelLineHeight
设置小说阅读行高
async setNovelLineHeight(height: number): Promise<void> { this.settings.novelLineHeight = Math.max(1.0, Math.min(2.5, height)); await this.saveSettings(); this.notifyFontChange(FontScene.NOVEL); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setNovelLineHeight AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_p...
async setNovelLineHeight(height: number): Promise<void> { this.settings.novelLineHeight = Math.max(1.0, Math.min(2.5, height)); await this.saveSettings(); this.notifyFontChange(FontScene.NOVEL); }
https://github.com/DaLongZhuaZi/manxia
d1568e395f1d9593112b15ac7b9e131bbae0be8a
github
Joker-x-dev/CoolMallArkTS
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
parseCartList
解析购物车列表 @param {CartJson[]} jsonList JSON 数据列表 @returns {Cart[]} 购物车列表
private parseCartList(jsonList: CartJson[]): Cart[] { const result: Cart[] = []; for (const item of jsonList) { const cart = new Cart(); cart.goodsId = item.goodsId ?? 0; cart.goodsName = item.goodsName ?? ""; cart.goodsMainPic = item.goodsMainPic ?? ""; // 解析规格列表 const s...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseCartList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_e...
private parseCartList(jsonList: CartJson[]): Cart[] { const result: Cart[] = []; for (const item of jsonList) { const cart = new Cart(); cart.goodsId = item.goodsId ?? 0; cart.goodsName = item.goodsName ?? ""; cart.goodsMainPic = item.goodsMainPic ?? ""; // 解析规格列表 const s...
https://github.com/Joker-x-dev/CoolMallArkTS
0d9e796e9477d111df3a2b31e5cdbe0e82af5210
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideorecommended/src/main/ets/view/IconView.ets
arkts
getSpace
Calculates spacing between icon items based on window width and breakpoint.
getSpace(windowWidth: number, currentWidthBreakpoint: number): number { try { if (!this.getUIContext() || this.getUIContext().getHostContext() === undefined) { return 0; } let result: number = this.getUIContext().px2vp(windowWidth) - (new BreakpointType(MainPageConstant...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#R...
getSpace(windowWidth: number, currentWidthBreakpoint: number): number { try { if (!this.getUIContext() || this.getUIContext().getHostContext() === undefined) { return 0; } let result: number = this.getUIContext().px2vp(windowWidth) - (new BreakpointType(MainPageConstant...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
3f8ac121cecd4cd98b7afee0270bbed319326d17
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
resolve
Resolves type by descriptor @param {TypeDescriptor} td type descriptor @returns {Type | undefined} instance of appropriate type or undefined if resolving is failed @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static resolve(td: TypeDescriptor): Type | undefined { const callerClass = Class.ofCaller() const contextLinker = callerClass == undefined ? getBootRuntimeLinker() : callerClass.getLinker() const internalTd: RuntimeTypeDescriptor = TypeAPI.convertTypeDescriptor(td) return Type...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left resolve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left td AST#identifier#Right AST#:#Left : AST#:#Righ...
public static resolve(td: TypeDescriptor): Type | undefined { const callerClass = Class.ofCaller() const contextLinker = callerClass == undefined ? getBootRuntimeLinker() : callerClass.getLinker() const internalTd: RuntimeTypeDescriptor = TypeAPI.convertTypeDescriptor(td) return Type...
https://gitcode.com/iop123123/arkts-static-skills
f99cf14babd33020787e60a7d4b4486472c379fb
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/AccountKitService.ets
arkts
exchangeAuthCode
使用 Authorization Code 换取 Access Token (OAuth 2.0 Token Exchange) 调用华为 AGC OAuth Token Endpoint @param clientId AGC OAuth 2.0 client_id @param clientSecret AGC OAuth 2.0 client_secret @returns Access Token 字符串, 失败时返回 undefined
async exchangeAuthCode(clientId: string, clientSecret: string): Promise<string | undefined> { const authCode = this.getAuthorizationCode(); if (!authCode) { hilog.error(DOMAIN, TAG, '[exchangeAuthCode] 无可用的 Authorization Code'); return undefined; } try { const body = "grant_type=aut...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exchangeAuthCode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left clientId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async exchangeAuthCode(clientId: string, clientSecret: string): Promise<string | undefined> { const authCode = this.getAuthorizationCode(); if (!authCode) { hilog.error(DOMAIN, TAG, '[exchangeAuthCode] 无可用的 Authorization Code'); return undefined; } try { const body = "grant_type=aut...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
6cadc4e8da09e86442cc19c09f2651cecbde6bc8
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getInputStyle
获取输入框样式
static getInputStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; const borderRadius = theme.borderRadius; const fontSize = theme.fontSize; return { backgroundColor: theme.colors.surface, color: theme.colors.onSurface, fontSize: `${font...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInputStyle 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 {...
static getInputStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; const borderRadius = theme.borderRadius; const fontSize = theme.fontSize; return { backgroundColor: theme.colors.surface, color: theme.colors.onSurface, fontSize: `${font...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
997d57c264070207abd573a39d7d70b8edf8e628
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/HistoryViewModel.ets
arkts
deleteSelected
批量删除选中
private async deleteSelected() { if (this.selectedIds.size === 0) return; const idsToDelete = Array.from(this.selectedIds); if (this.isNovelMode()) { await this.getNovelDB().deleteByIds(idsToDelete); } else { await this.getIllustDB().deleteByIds(idsToDelete); } this.toggleEditMod...
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 deleteSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async deleteSelected() { if (this.selectedIds.size === 0) return; const idsToDelete = Array.from(this.selectedIds); if (this.isNovelMode()) { await this.getNovelDB().deleteByIds(idsToDelete); } else { await this.getIllustDB().deleteByIds(idsToDelete); } this.toggleEditMod...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/HistoryViewModel.ets#L164-L176
5c941a7ab3cfbbe8548aa5001adaf0c78bff26cc
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/SettingsPage.ets
arkts
handleInvitation
弹窗控制器 TODO: 代码库中缺少 InvitationProcessingDialog。 invitationController: CustomDialogController = new CustomDialogController({ builder: InvitationProcessingDialog({ invitations: $pendingInvitations, onHandle: (invite, action) => this.handleInvitation(invite, action) }), autoCancel: false, customStyle: true });
handleInvitation(invite: LedgerInvitation, action: string) { // TODO: 实现 handleInvitation console.info(`Handling invitation: ${JSON.stringify(invite)}, action: ${action}`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleInvitation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left invite AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LedgerInvitation AST#i...
handleInvitation(invite: LedgerInvitation, action: string) { // TODO: 实现 handleInvitation console.info(`Handling invitation: ${JSON.stringify(invite)}, action: ${action}`); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b8e05d53b16f05a15c7bc6e869b739b7b1c86344
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
serialize
将配置序列化为 v3 管道格式(QR/压缩用,最紧凑)
static serialize(profileName: string, keys: CustomKeyDef[]): string { return serializeV3(profileName, keys); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left serialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left profileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
static serialize(profileName: string, keys: CustomKeyDef[]): string { return serializeV3(profileName, keys); }
https://github.com/AlkaidLab/moonlight-harmony
a1d2062cee00c81aacf608606abf6ca0dbe71c48
github
the-wwyang/kids-learning-app
src/main/ets/storage/LearningRecordStorageService.ets
arkts
resetAllRecords
重置所有学习记录(用于测试)
static async resetAllRecords(): Promise<void> { try { await dataStorage.clear(LearningRecordStorageService.STORE_NAME); console.log('[LearningRecordStorage] All records reset'); } catch (error) { console.error('[LearningRecordStorage] Failed to reset:', error); throw error; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left resetAllRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async resetAllRecords(): Promise<void> { try { await dataStorage.clear(LearningRecordStorageService.STORE_NAME); console.log('[LearningRecordStorage] All records reset'); } catch (error) { console.error('[LearningRecordStorage] Failed to reset:', error); throw error; } }
https://github.com/the-wwyang/kids-learning-app
aae92d2086e17d99b5bc470b4309dcc1a88f9f2a
github
honjow/Next2V
shared/src/main/ets/parser/V2exAccountParser.ets
arkts
extractNavBalance
STRICT balance read from the top-right `balance_area` widget V2EX renders on every signed-in page (feed, topic, notifications…). Unlike extractBalance(), this NEVER falls back to scanning the whole page for "N 铜币" text — so a topic/feed body mentioning 铜币 cannot fabricate a balance. Returns null when the widget is abse...
static extractNavBalance(html: string): V2exBalance | null { const tagRe = /<(a|div)[^>]*class=['"][^'"]*\bbalance_area\b[^'"]*['"][^>]*>/i const m = html.match(tagRe) if (!m || m.index === undefined || !m[1]) { return null } const start = m.index + m[0].length const closeTag = '</' + m[...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractNavBalance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static extractNavBalance(html: string): V2exBalance | null { const tagRe = /<(a|div)[^>]*class=['"][^'"]*\bbalance_area\b[^'"]*['"][^>]*>/i const m = html.match(tagRe) if (!m || m.index === undefined || !m[1]) { return null } const start = m.index + m[0].length const closeTag = '</' + m[...
https://github.com/honjow/Next2V
cf36a2297d2131d2017b828ec82f16e5c32b4458
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
getAllCachedDefinitions
获取所有缓存的定义
private async getAllCachedDefinitions(): Promise<ExportedDefinition[]> { const rows = await this.dbManager.getAllDefinitions(); return rows.map((row): ExportedDefinition => new ExportedDefinition( row.word, row.definition, row.source, row.createdAt )); }
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 getAllCachedDefinitions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async getAllCachedDefinitions(): Promise<ExportedDefinition[]> { const rows = await this.dbManager.getAllDefinitions(); return rows.map((row): ExportedDefinition => new ExportedDefinition( row.word, row.definition, row.source, row.createdAt )); }
https://github.com/CLMC2025/Vignette
979d1d8ad70929995061850f54293e5f698ff99b
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/data/UserRdb.ets
arkts
initDefaultUserInfo
初始化默认用户信息(彻底移除 id 逻辑)
private async initDefaultUserInfo(): Promise<void> { if (this.isMock || !this.rdbStore) { return; } // 查询表中是否有数据(无 id 条件) const predicates = new relationalStore.RdbPredicates(this.tableName); const resultSet = await this.rdbStore.query(predicates); if (resultSet.rowCount === 0) { ...
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 initDefaultUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async initDefaultUserInfo(): Promise<void> { if (this.isMock || !this.rdbStore) { return; } // 查询表中是否有数据(无 id 条件) const predicates = new relationalStore.RdbPredicates(this.tableName); const resultSet = await this.rdbStore.query(predicates); if (resultSet.rowCount === 0) { ...
https://gitcode.com/openharmony/codelabs
7f30a2cb083f547c6377030055a6dbf33c8ed945
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/StringUtils.ets
arkts
getPinyin
获取字符串的拼音 @param str @returns 结果
public static getPinyin(str: string): string { if (!str || str.length === 0) { return ''; } return pinyin4js.convertToPinyinString(str, '', PinyinFormat.WITHOUT_TONE) ?? str; }
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 getPinyin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#R...
public static getPinyin(str: string): string { if (!str || str.length === 0) { return ''; } return pinyin4js.convertToPinyinString(str, '', PinyinFormat.WITHOUT_TONE) ?? str; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/StringUtils.ets#L80-L85
98ea43ff8b6c2cba29ae21df74f1f7501b4edbca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
replaceVariableReferences
替换变量引用
private replaceVariableReferences(str: string, variables: Record<string, Object | undefined>): string { return str.replace(/\{\{([a-zA-Z0-9_.]+)\}\}/g, (match: string, varName: string): string => { const value: Object | undefined = variables[varName]; if (value === undefined) return match; retur...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceVariableReferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private replaceVariableReferences(str: string, variables: Record<string, Object | undefined>): string { return str.replace(/\{\{([a-zA-Z0-9_.]+)\}\}/g, (match: string, varName: string): string => { const value: Object | undefined = variables[varName]; if (value === undefined) return match; retur...
https://github.com/DaLongZhuaZi/manxia
07f5e9892d5dabf87409e7cfe7755db8f94484ae
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets
arkts
getCalDegree
计算设备倾斜角度
getCalDegree(x: number, y: number, z: number): number { let degree: number = 0; // 判断设备是否处于水平状态 if ((x * x + y * y) * 3 < z * z) { return degree; } // 计算角度值 degree = 90 - (Number)(Math.round(Math.atan2(y, -x) / Math.PI * 180)); return degree >= 0 ? degree % 360 : degree % 360 + 360; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCalDegree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,...
getCalDegree(x: number, y: number, z: number): number { let degree: number = 0; // 判断设备是否处于水平状态 if ((x * x + y * y) * 3 < z * z) { return degree; } // 计算角度值 degree = 90 - (Number)(Math.round(Math.atan2(y, -x) / Math.PI * 180)); return degree >= 0 ? degree % 360 : degree % 360 + 360; ...
https://github.com/ZestBox-18/kitebook-frontend
dd6459594f3038c6a6422a688eb10b4495da89ab
github
openharmony-tpc/mp4parser
library/src/main/ets/mp4parser/MP4Parser.ets
arkts
audioClip
Audio clipping @param startTime @param endTime @param sourcePath @param outPath @param callBack
static audioClip(startTime: string, endTime: string, sourcePath: string, outPath: string, callBack: ICallBack) { mp4parser_napi.exeFFmpegCmd("ffmpeg -y -i " + sourcePath + " -vn -acodec copy -ss " + startTime + " -to " + endTime + " " + outPath) .then((res: number) => { callBack.callBackResult(res)...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left audioClip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static audioClip(startTime: string, endTime: string, sourcePath: string, outPath: string, callBack: ICallBack) { mp4parser_napi.exeFFmpegCmd("ffmpeg -y -i " + sourcePath + " -vn -acodec copy -ss " + startTime + " -to " + endTime + " " + outPath) .then((res: number) => { callBack.callBackResult(res)...
https://gitee.com/openharmony-tpc/mp4parser.git
fb790de74ad4b4599abd351ff2b117b2f0cf81f3
gitee
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
stopSync
同步停止所有振动
static stopSync(): void { try { vibrator.stopVibrationSync(); } catch (err) { VibratorManager.logError('stopSync', err as Error); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stopSync 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...
static stopSync(): void { try { vibrator.stopVibrationSync(); } catch (err) { VibratorManager.logError('stopSync', err as Error); } }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
c154759fdad98d8bbce39f2d9f521885525f5c3b
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets
arkts
setDrawingThreadType
@param type One of THREAD_TYPE_MAIN_THREAD, THREAD_TYPE_HIGH_PRIORITY, THREAD_TYPE_NORMAL_PRIORITY, or THREAD_TYPE_LOW_PRIORITY.
setDrawingThreadType(threadType: number): void{ this.delegate.setDrawingThreadType(threadType) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDrawingThreadType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left threadType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Lef...
setDrawingThreadType(threadType: number): void{ this.delegate.setDrawingThreadType(threadType) }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
df58d1252a8340f9533373033e9aeebe16a7f573
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
onCommand
命令回调函数,由SDK自动调用 @param requestId 请求id @param command 命令
public onCommand(requestId: string, command: Command): void { const service = this.getService(command.service_id); if (service !== null && service !== undefined) { const rsp = service.onCommand(command); this.client.respondCommand(requestId, rsp); return; } this.client?.respondComm...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
public onCommand(requestId: string, command: Command): void { const service = this.getService(command.service_id); if (service !== null && service !== undefined) { const rsp = service.onCommand(command); this.client.respondCommand(requestId, rsp); return; } this.client?.respondComm...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
623084c1137ec5b5f9cdfd7cd3323f99260b0c83
github
openharmony/arkui_ace_engine
examples/Image/TestNavigation/entry/src/main/ets/pages/PageThree.ets
arkts
<arrow>
设置转场动画终点,根据不同的转场类型分别设置
(isPush: boolean, isExit: boolean) => { if (isPush) { if (isExit) { this.translateY = '0'; } else { this.translateY = '0'; } } else { if (isExit) { this.translateY = '100%'; } else { this.translateY =...
AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isPush AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#boolean#Left boolean AST#boolean#Right AST...
(isPush: boolean, isExit: boolean) => { if (isPush) { if (isExit) { this.translateY = '0'; } else { this.translateY = '0'; } } else { if (isExit) { this.translateY = '100%'; } else { this.translateY =...
https://gitcode.com/openharmony/arkui_ace_engine
32265286b0be6953930e10677b06801241a301c9
gitcode
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
onceNodeMove
Node move event registration and processing (once). @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
public onceNodeMove(callback: OnChangedCallback): void { this.nodeMoveOnceEvents.push(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onceNodeMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public onceNodeMove(callback: OnChangedCallback): void { this.nodeMoveOnceEvents.push(callback); }
https://gitcode.com/openharmony/arkui_ace_engine
df6555e6b063b6974c5eaff647ee046f1440fb6a
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringify
Converts char to JSON format @param d: char - char to be converted to a JSON as a String @returns String - JSON representation of char
public static stringify(d: char): String { let sb = new StringBuilder('"') sb.append(d) sb.append('"') return sb.toString() }
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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig...
public static stringify(d: char): String { let sb = new StringBuilder('"') sb.append(d) sb.append('"') return sb.toString() }
https://gitcode.com/iop123123/arkts-static-skills
fb7592990c4b44f7e1f9f5a670d2cd8e509e81e2
gitcode
openharmony/applications_call
entry/src/main/ets/common/utils/utils.ets
arkts
formatPhoneNum
format phone number @param { string } phoneNumber
public formatPhoneNum(phoneNumber) { if (/^1\d{10}$/.test(phoneNumber)) { const str01 = phoneNumber.substring(0, 3); const str02 = phoneNumber.substring(3, 7); const str03 = phoneNumber.substring(7, 11); return `${str01} ${str02} ${str03}`; } return phoneNumber; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left formatPhoneNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left phoneNumber AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
public formatPhoneNum(phoneNumber) { if (/^1\d{10}$/.test(phoneNumber)) { const str01 = phoneNumber.substring(0, 3); const str02 = phoneNumber.substring(3, 7); const str03 = phoneNumber.substring(7, 11); return `${str01} ${str02} ${str03}`; } return phoneNumber; }
https://gitee.com/openharmony/applications_call.git
d2df36cf3fca4b0ff7134552c6189307a63cc3c1
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectMethod.ets
arkts
getParameterType
Gets the type of the parameter at the specified index by index. @param { int } idx Index position of the parameter. @returns { Class | undefined } Returns the Class object of the parameter type at the specified index, returns undefined if the index is invalid.
public getParameterType(idx: int): Class | undefined { return Method.getParameterTypeByIdxImpl(this.methodPtr, idx) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParameterType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left idx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public getParameterType(idx: int): Class | undefined { return Method.getParameterTypeByIdxImpl(this.methodPtr, idx) }
https://gitcode.com/iop123123/arkts-static-skills
3750b085b16dd26c998355091b2db7c64708ebbf
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets
arkts
release
release avPlayer.
public release() { if (this.avPlayer && this.session && this.context) { this.updateIsPlay(false); this.stop(); this.reset(); this.avPlayer.release(); this.state = AudioPlayerState.IDLE; BackgroundUtil.stopContinuousTask(this.context); this.unregisterSessionListener(); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left release 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#{...
public release() { if (this.avPlayer && this.session && this.context) { this.updateIsPlay(false); this.stop(); this.reset(); this.avPlayer.release(); this.state = AudioPlayerState.IDLE; BackgroundUtil.stopContinuousTask(this.context); this.unregisterSessionListener(); ...
https://gitee.com/harmonyos/codelabs.git
24649860faab6a2ed7a9f39833207abe1a942676
gitee
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
init
初始化 Preferences 存储
async init(): Promise<void> { if (this.isInitialized && this.preference) { return; } try { const context: Context = getContext(this) as Context; this.preference = await dataPreferences.getPreferences(context, this.dbName); this.isInitialized = true; Logger.info(this.LOG_TAG,...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init 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...
async init(): Promise<void> { if (this.isInitialized && this.preference) { return; } try { const context: Context = getContext(this) as Context; this.preference = await dataPreferences.getPreferences(context, this.dbName); this.isInitialized = true; Logger.info(this.LOG_TAG,...
https://github.com/Kira-Yagami-Light/Kira-Projects
b7bb64bbb31f1a80892e2062e54afe164a070a8b
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ThreadPaginationManager.ets
arkts
commitPrefetchedPage
提交某页预取缓存,合并进 posts(按 lou 去重)。 @param page - 页码 @returns 实际新增的帖子(空数组表示无缓存或全部去重)
commitPrefetchedPage(page: number): PostInfo[] { const holder = this.getPrefetchedRaw(page) if (holder === undefined) return [] const posts: PostInfo[] = [] for (let i = 0; i < holder.items.length; i++) { posts.push(holder.items[i] as PostInfo) } if (posts.length === 0) { this.dele...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left commitPrefetchedPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
commitPrefetchedPage(page: number): PostInfo[] { const holder = this.getPrefetchedRaw(page) if (holder === undefined) return [] const posts: PostInfo[] = [] for (let i = 0; i < holder.items.length; i++) { posts.push(holder.items[i] as PostInfo) } if (posts.length === 0) { this.dele...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L166-L180
3e5378c32a28546b9615179e28faba1f6bd7cb83
github
YANGZX22/Voot
entry/src/main/ets/storage/AsrModelStorage.ets
arkts
setSelectedSourceLanguage
设置选中的原始语言
static async setSelectedSourceLanguage(ctx: common.UIAbilityContext, langCode: string): Promise<void> { const config = await AsrModelStorage.loadConfig(ctx); config.selectedSourceLanguage = langCode; await AsrModelStorage.saveConfig(ctx, config); }
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 setSelectedSourceLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:...
static async setSelectedSourceLanguage(ctx: common.UIAbilityContext, langCode: string): Promise<void> { const config = await AsrModelStorage.loadConfig(ctx); config.selectedSourceLanguage = langCode; await AsrModelStorage.saveConfig(ctx, config); }
https://github.com/YANGZX22/Voot
cc43834103c23f467a97ef976dde2b05eb948585
github
LongLiveY96/chatcube
entry/src/main/ets/services/ThemeService.ets
arkts
updateDarkMode
更新深浅模式(由系统或用户设置触发)
updateDarkMode(isDarkMode: boolean): void { if (this.currentIsDarkMode === isDarkMode) { return } this.currentIsDarkMode = isDarkMode // 重新应用主题到 AppStorage this.applyThemeToStorage() void this.refreshDesktopForms() // 通知回调 this.notifyCallbacks() console.info('ThemeService...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateDarkMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isDarkMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left )...
updateDarkMode(isDarkMode: boolean): void { if (this.currentIsDarkMode === isDarkMode) { return } this.currentIsDarkMode = isDarkMode // 重新应用主题到 AppStorage this.applyThemeToStorage() void this.refreshDesktopForms() // 通知回调 this.notifyCallbacks() console.info('ThemeService...
https://github.com/LongLiveY96/chatcube
e46253f2508d09e163c1b174ba1a6620d26b4b07
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/FileStorageFactory.ets
arkts
getStorage
获取存储实现(带缓存装饰器) @param type 存储类型 @return IFileStorage 存储实现 @throws 如果指定类型的存储未注册则抛出异常
public getStorage(type: StorageType): IFileStorage { const storage = this.storageMap.get(type); if (!storage) { throw new Error(`Storage type ${type} is not registered`); } // 非 LOCAL 类型的存储使用缓存装饰器 if (type !== StorageType.LOCAL) { return new CacheStorage(storage); } return stor...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Stora...
public getStorage(type: StorageType): IFileStorage { const storage = this.storageMap.get(type); if (!storage) { throw new Error(`Storage type ${type} is not registered`); } // 非 LOCAL 类型的存储使用缓存装饰器 if (type !== StorageType.LOCAL) { return new CacheStorage(storage); } return stor...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/FileStorageFactory.ets#L60-L70
5d1fd37ad53dc988cdd7e74ad653a356f05252e3
github
OpenHarmonyPCDeveloper/GitNext
entry/src/main/ets/pages/main_bar.ets
arkts
funcClickHelpSshKeyConfig
‌主操作区背景‌:深空灰(#2B2B2B)或深蓝(#2D2E37) ‌文本/图标‌:白色(#FFFFFF)或浅灰(#CCCCCC) ‌高亮状态‌: 新增文件:绿色(#4CAF50) 修改文件:黄色(#FFC107) 冲突文件:红色(#F44336)
funcClickHelpSshKeyConfig(): void { hilog.debug(DOMAIN, TAG, 'call funcClickHelpSshKey'); const util = DebounceSingletonUtil.getInstance(); if (util.isOperationRunning('HelpSshKeyDialog')) { return; } util.startOperation('HelpSshKeyDialog'); try { this.DialogController = new Cust...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left funcClickHelpSshKeyConfig 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#st...
funcClickHelpSshKeyConfig(): void { hilog.debug(DOMAIN, TAG, 'call funcClickHelpSshKey'); const util = DebounceSingletonUtil.getInstance(); if (util.isOperationRunning('HelpSshKeyDialog')) { return; } util.startOperation('HelpSshKeyDialog'); try { this.DialogController = new Cust...
https://gitcode.com/OpenHarmonyPCDeveloper/GitNext
f2ccc3daf381c34c2749a6af073c5f304f1fa6b9
gitcode
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
checkRequiredArgs
Throws a {@link MissingArgumentException} if the current option didn't receive the number of arguments expected.
private checkRequiredArgs(): void { if (this.currentOption != null && this.currentOption.requiresArg()) { throw Error("Missing argument for option: " + this.currentOption.getKey()); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkRequiredArgs 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#e...
private checkRequiredArgs(): void { if (this.currentOption != null && this.currentOption.requiresArg()) { throw Error("Missing argument for option: " + this.currentOption.getKey()); } }
https://gitee.com/openharmony-sig/commons-cli.git
a23578332219e12b731be0ad4ab2eb0f866e83cc
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EpubParser.ets
arkts
validateFormat
验证EPUB格式
async validateFormat(filePath: string): Promise<boolean> { try { if (!filePath.toLowerCase().endsWith('.epub')) { return false; } // EPUB文件实际上是ZIP文件 // 可以通过检查文件头来验证 // ZIP文件头: 50 4B 03 04 return true; } catch (error) { logger.error(TAG, `验证EPUB格式失败: ${...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left validateFormat AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async validateFormat(filePath: string): Promise<boolean> { try { if (!filePath.toLowerCase().endsWith('.epub')) { return false; } // EPUB文件实际上是ZIP文件 // 可以通过检查文件头来验证 // ZIP文件头: 50 4B 03 04 return true; } catch (error) { logger.error(TAG, `验证EPUB格式失败: ${...
https://github.com/DaLongZhuaZi/manxia
040ff79bd7d225ff2125a2b91514c8320fc3d2f4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets
arkts
setNovelGoal
设置小说阅读目标
public async setNovelGoal(minutes: number): Promise<void> { this.goalsSettings.novelGoalMinutes = Math.max(0, minutes); await this.saveGoalsSettings(); logger.info(TAG, `小说阅读目标已设置为: ${minutes}分钟`); }
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 setNovelGoal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minutes AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async setNovelGoal(minutes: number): Promise<void> { this.goalsSettings.novelGoalMinutes = Math.max(0, minutes); await this.saveGoalsSettings(); logger.info(TAG, `小说阅读目标已设置为: ${minutes}分钟`); }
https://github.com/DaLongZhuaZi/manxia
c8d3c1e50512a5f53792902d1529b49bf8109f36
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
isHdSupported
查询当前设备是否支持高清振动(可调节强度) @returns true表示支持高清振动
static isHdSupported(): boolean { try { return vibrator.isHdHapticSupported(); } catch (err) { VibratorManager.logError('isHdSupported', err as Error); return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isHdSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
static isHdSupported(): boolean { try { return vibrator.isHdHapticSupported(); } catch (err) { VibratorManager.logError('isHdSupported', err as Error); return false; } }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
a3289be6ab2c2151a402fa66a1d480233cfdf2c7
github
openharmony-sig/applications_clock
common/src/main/ets/manager/SnoozeManager.ets
arkts
getPreferences
Get SnoozeManager Preferences instance. @return Preferences instance
private async getPreferences(): Promise<Preferences> { if (this.preferences) { return this.preferences; } this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext() .getObject('clockContext') as Context), ALARM_CLOCK_SNOOZE_STORE); return this.preferences as Prefer...
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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async getPreferences(): Promise<Preferences> { if (this.preferences) { return this.preferences; } this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext() .getObject('clockContext') as Context), ALARM_CLOCK_SNOOZE_STORE); return this.preferences as Prefer...
https://gitee.com/openharmony-sig/applications_clock.git
ddfd090c05850158ab06b95a5517d746f0fb6668
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint8Array with respect to data accessed via Iterable<Number> interface @param { Iterable<Number> } elements - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLengthInt = arr.length * Uint8Array.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 elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex...
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLengthInt = arr.length * Uint8Array.BYTES_PER_ELEMENT ...
https://gitcode.com/iop123123/arkts-static-skills
154e8ba8af782b984a8505ce95bd545a19d21eb5
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
map
Creates a new Uint8Array using fn(arr[i]) over all elements of current Uint8Array @param fn a function to apply for each element of current Uint8Array @returns a new Uint8Array where for each element from current Uint8Array fn was applied
public map(fn: (val: number) => number): Uint8Array { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number) => number): Uint8Array { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1efdf7a143c83080bb6b6bfa2cdf18931aa7c582
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
setYear
This function is an alias to @link{setFullYear} and left for compatibility with ECMA-262. @param value new year
public setYear(value: number): void { this.setYear(value as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public setYear(value: number): void { this.setYear(value as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eca56312754753a18d69f629494e21019ab6ac78
gitee
CPF-ApplicationTPC/ohos_dataorm
entry/src/main/ets/pages/SyncApi.ets
arkts
deleteByKeys
按Keys批量删除
deleteByKeys() { if (!this.noteDao) { return; } let notes = this.notesQuery?.listSync() ?? [] if (!notes || notes.length === 0) { return; } let ids = notes.map(note => note.getId()); this.noteDao.deleteByKeyInTxArrSync(...ids); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteByKeys 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 ...
deleteByKeys() { if (!this.noteDao) { return; } let notes = this.notesQuery?.listSync() ?? [] if (!notes || notes.length === 0) { return; } let ids = notes.map(note => note.getId()); this.noteDao.deleteByKeyInTxArrSync(...ids); }
https://gitcode.com/CPF-ApplicationTPC/ohos_dataorm/blob/fbc87b313143db372545fe1a46ca1dc6b45b13dd/entry/src/main/ets/pages/SyncApi.ets#L159-L169
ac4988b6022ec58f12b0cdfda09eac27b771f018
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitRepeatedInt64
访问 repeated int64 字段 JSON: array of string
visitRepeatedInt64(value: bigint[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.map(v => v.toString()) as Object }
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 { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.map(v => v.toString()) as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
2d541060f55e5337b1f569faec3e35109bf7bf58
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
executeStep
执行单个步骤
private async executeStep(step: TaskStep, context: TaskContext): Promise<StepExecutionResult> { logger.info(TAG, `开始执行步骤: ${step.id} - ${step.name || step.description || ''}`); const timeout = step.timeout || this.config.defaultTimeout || 30000; logger.debug(TAG, `步骤超时设置: ${timeout}ms`); let retryCou...
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 executeStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AS...
private async executeStep(step: TaskStep, context: TaskContext): Promise<StepExecutionResult> { logger.info(TAG, `开始执行步骤: ${step.id} - ${step.name || step.description || ''}`); const timeout = step.timeout || this.config.defaultTimeout || 30000; logger.debug(TAG, `步骤超时设置: ${timeout}ms`); let retryCou...
https://github.com/DaLongZhuaZi/manxia
d0ab38a45e2d2d6368187fbfae742bed74e673c5
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
isEffectSupported
═══════════════════════════════════════════════════════════════ 能力检测 ═══════════════════════════════════════════════════════════════ 查询是否支持指定预置振动效果 @param effectId 振动效果ID @returns 同步查询结果,支持返回true
static isEffectSupported(effectId: string): boolean { try { return vibrator.isSupportEffectSync(effectId); } catch (err) { VibratorManager.logError('isEffectSupported', err as Error); return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEffectSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left effectId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static isEffectSupported(effectId: string): boolean { try { return vibrator.isSupportEffectSync(effectId); } catch (err) { VibratorManager.logError('isEffectSupported', err as Error); return false; } }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
ce25467a59e3839f490b3808212222afd0fa9f92
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
changeSemesterStartTime
修改指定学期的开始时间 @param id 要修改的学期编号 @param newStartTime 新的学期开始时间(毫秒级时间戳) @returns 无异常时返回undefined,发生异常时返回异常信息的JSON字符串
changeSemesterStartTime(id: number, newStartTime: number): string | undefined { try { this.semesters[id].beginTime = newStartTime; UnifyPreferences.putSync('SemestersData', JSON.stringify(this.semesters)); return; } catch(err) { return JSON.stringify(err); } }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left changeSemesterStartTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
changeSemesterStartTime(id: number, newStartTime: number): string | undefined { try { this.semesters[id].beginTime = newStartTime; UnifyPreferences.putSync('SemestersData', JSON.stringify(this.semesters)); return; } catch(err) { return JSON.stringify(err); } }
https://github.com/Your-USTC/DailyNic_HMOS
f47952c8f7f76dd1648d24b13f51bebc6580c95d
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/ParentApiClient.ets
arkts
importLesson
V0.5.8 lesson-import endpoints under /api/v1/family/{family_id}/… . Auth is omitted in V0.5.8 (open admin); V0.6 will reattach a per-family bearer token. Upload a single textbook photo and let the server's vision model extract candidate words. The request is `multipart/form-data` with a single `image` part. Server retu...
async importLesson(image: PickedImage): Promise<LessonDraftDto> { if (image.sizeBytes > IMPORT_MAX_BYTES) { throw new LessonImportError( 'TOO_LARGE', `importLesson: image is ${image.sizeBytes} bytes, max ${IMPORT_MAX_BYTES}`, 0, ); } if (!ALLOWED_MIMES.includes(image.mi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left importLesson AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left image AST#identifier#Right AST#t...
async importLesson(image: PickedImage): Promise<LessonDraftDto> { if (image.sizeBytes > IMPORT_MAX_BYTES) { throw new LessonImportError( 'TOO_LARGE', `importLesson: image is ${image.sizeBytes} bytes, max ${IMPORT_MAX_BYTES}`, 0, ); } if (!ALLOWED_MIMES.includes(image.mi...
https://github.com/terryma2024/happyword
a2cc1a37fbf86e4a34477936cef3a29e3a3d6968
github
arkui-x/samples
CodeLab/Cases/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
transitionFromLeft
左侧弹出动画 @param duration 动画时间 @returns
static transitionFromLeft(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.START).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ del...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left transitionFromLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignmen...
static transitionFromLeft(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.START).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ del...
https://gitcode.com/arkui-x/samples
ca1ad7372da9eb053c0224ba6548752862e5a9a3
gitcode
openharmony/xts_tools
sample/AppSampleF/entry/src/main/ets/model/CameraModel.ets
arkts
initCamera
初始化相机 @param surfaceId
async initCamera(surfaceId: string): Promise<void> { Logger.info(TAG, `initCamera surfaceId:${surfaceId}`); await this.cameraRelease(); Logger.info(TAG, `initCamera this.cameraRelease surfaceId:${surfaceId}`); Logger.info(TAG, 'getCameraManager begin'); try { Logger.info(TAG, 'getCameraManag...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surfaceId AST#identifier#Right AST#type_annotation#Left AST...
async initCamera(surfaceId: string): Promise<void> { Logger.info(TAG, `initCamera surfaceId:${surfaceId}`); await this.cameraRelease(); Logger.info(TAG, `initCamera this.cameraRelease surfaceId:${surfaceId}`); Logger.info(TAG, 'getCameraManager begin'); try { Logger.info(TAG, 'getCameraManag...
https://gitee.com/openharmony/xts_tools.git
b1b485f00345c9363bfde9b3a81b56e881459788
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
getRdbStore
获取关系数据库存储对象 如果已初始化过,则直接返回之前获取的对象 如果没有初始化过,则使用接口获取对象,并执行数据库建表命令,如果表未创建,则会创建一张新的表 @return 关系数据库存储对象
async getRdbStore(): Promise<rdb.RdbStore> { const rdbStore = await super.getRdbStore(SQL_CREATE_TABLE); await this.initDefaultAlarms(rdbStore); return rdbStore; }
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#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async getRdbStore(): Promise<rdb.RdbStore> { const rdbStore = await super.getRdbStore(SQL_CREATE_TABLE); await this.initDefaultAlarms(rdbStore); return rdbStore; }
https://gitee.com/openharmony-sig/applications_clock.git
2255e61483f207e349d15f57174d9a8d9826c1d0
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnProgressViewModel.ets
arkts
increaseDynamicCircle
增加动态圆形进度值 @param step 步进值
increaseDynamicCircle(step: number): void { this.dynamicCirclePercent = Math.min(100, this.dynamicCirclePercent + step); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increaseDynamicCircle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#...
increaseDynamicCircle(step: number): void { this.dynamicCirclePercent = Math.min(100, this.dynamicCirclePercent + step); }
https://github.com/codelably/tuniao-ui
dd4eb04bf3ac3452c459e71eab135b8115d47fa2
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TrackpadGestureHandler.ets
arkts
onDown
==================== Down ====================
private onDown(touches: TouchObject[], changed: TouchObject[]): void { const now = Date.now(); this.activeCount = touches.length; if (this.activeCount > this.maxCountInGesture) { this.maxCountInGesture = this.activeCount; } for (const t of changed) { this.fingers.set(t.id, { s...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left onDown AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left touches AST#identifier#Right AST#:#Left : AST#:#Right AS...
private onDown(touches: TouchObject[], changed: TouchObject[]): void { const now = Date.now(); this.activeCount = touches.length; if (this.activeCount > this.maxCountInGesture) { this.maxCountInGesture = this.activeCount; } for (const t of changed) { this.fingers.set(t.id, { s...
https://github.com/AlkaidLab/moonlight-harmony
805676ab5884a16c0228bc51c06203b8d114a20e
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SettingsUtil.ets
arkts
isDoctorLoggedIn
检查医生是否已登录
async isDoctorLoggedIn(): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const token: string = await this.getDoctorToken(); return token.length > 0; } catch (e) { console.error('SettingsUtil - check doctor login status failed:', e); return f...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isDoctorLoggedIn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef...
async isDoctorLoggedIn(): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const token: string = await this.getDoctorToken(); return token.length > 0; } catch (e) { console.error('SettingsUtil - check doctor login status failed:', e); return f...
https://github.com/LJ666-ui/harmony-health-care
f15bc150b66aef5705a1a23df7953d96edb8f09d
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Connection.ets
arkts
execDML
执行:插入修改删除
async execDML(sql: string, params: Array<relationalStore.ValueType> = []): Promise<relationalStore.ValueType> { try { Connection.logger?.info('execDML:', sql, JSON.stringify(params)) return this.store.execute(sql, params) } catch (e) { Connection.logger?.error('execDML', e.message, e.code, J...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left execDML AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sql AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async execDML(sql: string, params: Array<relationalStore.ValueType> = []): Promise<relationalStore.ValueType> { try { Connection.logger?.info('execDML:', sql, JSON.stringify(params)) return this.store.execute(sql, params) } catch (e) { Connection.logger?.error('execDML', e.message, e.code, J...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Connection.ets#L75-L83
f4e3549e540d1a1512f1d9d69ccf72aa645dec8c
github
openharmony/applications_app_samples
code/ArkTS1.2/TabsSample/entry/src/main/ets/pages/functionalScenes/FunctionalScenes.ets
arkts
regDisplayListener
注册屏幕状态监听 (仅限折叠屏) @returns {void}
regDisplayListener(): void { this.changeNeedClear(display.getFoldStatus()); display.on('foldStatusChange', (curFoldStatus: display.FoldStatus) => { // 同一个状态重复触发不做处理 if (this.curFoldStatus === curFoldStatus) { return; } // 缓存当前折叠状态 this.curFoldStatus = curFoldStatus; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left regDisplayListener 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...
regDisplayListener(): void { this.changeNeedClear(display.getFoldStatus()); display.on('foldStatusChange', (curFoldStatus: display.FoldStatus) => { // 同一个状态重复触发不做处理 if (this.curFoldStatus === curFoldStatus) { return; } // 缓存当前折叠状态 this.curFoldStatus = curFoldStatus; ...
https://github.com/openharmony/applications_app_samples
94c526b4601d76b1127ca2e9acc2c545ba6b20ba
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
updateAllEnginesWebView
更新所有已缓存Engine的WebView控制器
private updateAllEnginesWebView(controller: webview.WebviewController): void { const engineCount = this.mangaEngines.size; if (engineCount === 0) { return; } logger.info(TAG, `更新 ${engineCount} 个缓存Engine的WebView控制器`); const engines = Array.from(this.mangaEngines.entries()); for (let...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateAllEnginesWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
private updateAllEnginesWebView(controller: webview.WebviewController): void { const engineCount = this.mangaEngines.size; if (engineCount === 0) { return; } logger.info(TAG, `更新 ${engineCount} 个缓存Engine的WebView控制器`); const engines = Array.from(this.mangaEngines.entries()); for (let...
https://github.com/DaLongZhuaZi/manxia
01a6e0bdc16b8659103bb917248a387746a546cb
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/request/GoodsCommentPageRequest.ets
arkts
constructor
@param {IGoodsCommentPageRequestInit} init - 初始化数据
constructor(init: IGoodsCommentPageRequestInit) { this.goodsId = init.goodsId; this.page = init.page ?? this.page; this.size = init.size ?? this.size; }
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 init AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IGoodsCommentPageRequestInit ...
constructor(init: IGoodsCommentPageRequestInit) { this.goodsId = init.goodsId; this.page = init.page ?? this.page; this.size = init.size ?? this.size; }
https://github.com/Joker-x-dev/CoolMallArkTS
46ed1a6ecdc1dca8b9351d0f7c0b9a11c869c5d6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/BookOfMoeScraper.ets
arkts
searchByTitle
按标题搜索书籍 @param title 书籍标题
public async searchByTitle(title: string): Promise<ScraperSearchResult> { try { logger.info(TAG, `搜索BookOf.Moe: title=${title}`); const encodedTitle = encodeURIComponent(title); const url = `${BookOfMoeScraper.BASE_URL}/book?title=${encodedTitle}`; const httpRequest = http.createHttp(); ...
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 searchByTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AS...
public async searchByTitle(title: string): Promise<ScraperSearchResult> { try { logger.info(TAG, `搜索BookOf.Moe: title=${title}`); const encodedTitle = encodeURIComponent(title); const url = `${BookOfMoeScraper.BASE_URL}/book?title=${encodedTitle}`; const httpRequest = http.createHttp(); ...
https://github.com/DaLongZhuaZi/manxia
f4bb191759ee83b260042d24d0b2598f80b2e533
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/CacheStatusService.ets
arkts
isDownloadWhileReadingEnabled
检查边看边下载是否开启
async isDownloadWhileReadingEnabled(sourceId: number): Promise<boolean> { try { const config = await this.permanentCacheManager.getSourceCacheConfig(sourceId); return config.downloadWhileReading; } catch (error) { logger.error(TAG, `检查边看边下载设置失败: ${String(error)}`); return true; // 默认开...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isDownloadWhileReadingEnabled AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation...
async isDownloadWhileReadingEnabled(sourceId: number): Promise<boolean> { try { const config = await this.permanentCacheManager.getSourceCacheConfig(sourceId); return config.downloadWhileReading; } catch (error) { logger.error(TAG, `检查边看边下载设置失败: ${String(error)}`); return true; // 默认开...
https://github.com/DaLongZhuaZi/manxia
e7ab228c6552d2e65772b84913eeb68dc2a13d6c
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets
arkts
getFirst
Returns the first element of the deque without removing it. @returns { T } The first element of the deque.
public getFirst(): T { this.checkEmptyContainer(); return this.buffer[this.front] as T; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identif...
public getFirst(): T { this.checkEmptyContainer(); return this.buffer[this.front] as T; }
https://gitcode.com/iop123123/arkts-static-skills
5d326736fb229aab9d84e4b2a08b50ea45bfb80c
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/InputInterceptorService.ets
arkts
stop
停止按键拦截器
stop(): void { if (!this.active || !this.native) { return; } this.native.removeKeyInterceptor(); this.active = false; console.info('InputInterceptor: 按键拦截器已停止'); }
AST#program#Left AST#ERROR#Left 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#v...
stop(): void { if (!this.active || !this.native) { return; } this.native.removeKeyInterceptor(); this.active = false; console.info('InputInterceptor: 按键拦截器已停止'); }
https://github.com/AlkaidLab/moonlight-harmony
775cc10287f6a45942491ba02d6dfe556110ba80
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_char.ets
arkts
main
--- desc: check postfix increment for char operand ---
function main(): void { let value: char = {{v.value}} let result: char = value++ assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: char = {{v.value}} let result: char = value++ assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1e9bb11e63a44d2b389c6a1a0b90153f1aaf77e3
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getByLedgerId
获取账本的所有邀请
static async getByLedgerId(ledgerId: number): Promise<LedgerInvitation[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName); predicates.equalTo('ledger_...
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 getByLedgerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async getByLedgerId(ledgerId: number): Promise<LedgerInvitation[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerInvitation.tableName); predicates.equalTo('ledger_...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
cfb30c6a5c8c7483b9e0822e74dfcc189836eb25
github
the-wwyang/kids-learning-app
src/main/ets/storage/DataStorageManager.ets
arkts
getString
读取字符串数据 @param storeName 存储文件名 @param key 键名 @param defaultValue 默认值 @returns 读取的值或默认值
async getString(storeName: string, key: string, defaultValue: string = ''): Promise<string> { try { const prefs = await this.getPreferences(storeName); const value = await prefs.get(key, defaultValue); return value as string; } catch (error) { console.error(`[DataStorageManager] Failed...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async getString(storeName: string, key: string, defaultValue: string = ''): Promise<string> { try { const prefs = await this.getPreferences(storeName); const value = await prefs.get(key, defaultValue); return value as string; } catch (error) { console.error(`[DataStorageManager] Failed...
https://github.com/the-wwyang/kids-learning-app
97d543faae80f6c066146f502996a56fa5969f5a
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/highlight/Highlight.ets
arkts
getXPx
returns the x-position of the highlight in pixels
public getXPx(): number { return this.mXPx; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getXPx 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#R...
public getXPx(): number { return this.mXPx; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
0ec0d19a1a3c0572a713f800b9296f2175e73704
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an Uint8Array from array-like argument @param o array-like object to initialize Uint8Array @returns new Uint8Array
public from(o: Object): Uint8Array { throw new Error("Uint8Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Uint8Array { throw new Error("Uint8Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
51273c13b31e67d687dace6a1762222d9c9d3da5
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
setTimezoneOffset
Sets the difference, in minutes, between a date as evaluated in the UTC time zone, and the same date as evaluated in the local time zone. @param value new timezone offset
public setTimezoneOffset(value: number): number { return this.setTimezoneOffset(value as int) as number }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTimezoneOffset 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#Le...
public setTimezoneOffset(value: number): number { return this.setTimezoneOffset(value as int) as number }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f9dd09b247fc768ea477ca01d0476f1da55b04ba
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
setInterpolator
设置插值器类型 @param interpolator 插值器类型
setInterpolator(interpolator: InterpolatorType): AnimationConfig { this.interpolator = interpolator; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInterpolator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interpolator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InterpolatorType AST#identifier#...
setInterpolator(interpolator: InterpolatorType): AnimationConfig { this.interpolator = interpolator; return this; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
78c9de4ecb99c7896c9aa75d9a36724f3ca89e77
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
italics
The italics() method creates a string that embeds a string in a <italics> element (<italics>str</italics>), which causes a string to be displayed in a big font.
public italics(): String{ return this.CreateHTMLString("italics", "") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left italics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#ide...
public italics(): String{ return this.CreateHTMLString("italics", "") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
00051c188aeaf5528d482020ccad17c4dd3bf155
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets
arkts
constructor
Constructs new empty UndefinableStringArray @syscap SystemCapability.Utils.Lang
constructor() { this(UndefinableStringArray.ArrayInitSize) }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this(UndefinableStringArray.ArrayInitSize) }
https://gitcode.com/iop123123/arkts-static-skills
b42f27ceeb3169eb098a4da599f73d239a697bad
gitcode
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
put
PUT请求
async put<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>> { return this.request<T>({ url, method: http.RequestMethod.PUT, extraData: data, header: headers }) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_id...
async put<T>(url: string, data?: any, headers?: Record<string, string>): Promise<ApiResponse<T>> { return this.request<T>({ url, method: http.RequestMethod.PUT, extraData: data, header: headers }) }
https://github.com/David8Idira/AI-OA
61b5cf4bb0c2efb3fadbf35919298821131c85ae
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/RecurringBillDatabase.ets
arkts
queryRecordsByConfigId
查询配置的所有生成记录
async queryRecordsByConfigId(configId: number): Promise<GeneratedBillRecord[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.RECORD_TABLE); predicates.equalTo('recurringConfigId', configId); predicates.orderByDesc('generatedD...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryRecordsByConfigId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left configId AST#identifie...
async queryRecordsByConfigId(configId: number): Promise<GeneratedBillRecord[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.RECORD_TABLE); predicates.equalTo('recurringConfigId', configId); predicates.orderByDesc('generatedD...
https://github.com/qiuhaotc/HarmonyOSPlayground
9732a15a48ba6fa39d2d8921ae51eafbf0930814
github