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
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/storage/PreferencesUtil.ets
arkts
has
是否包含某个 key
static async has(key: string): Promise<boolean> { if (PreferencesUtil.preferencesInstance === null) { return false; } try { return await PreferencesUtil.preferencesInstance.has(key); } catch (err) { hilog.error(0x0000, TAG, 'has failed: %{public}s', JSON.stringify(err)); return...
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 has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS...
static async has(key: string): Promise<boolean> { if (PreferencesUtil.preferencesInstance === null) { return false; } try { return await PreferencesUtil.preferencesInstance.has(key); } catch (err) { hilog.error(0x0000, TAG, 'has failed: %{public}s', JSON.stringify(err)); return...
https://github.com/Amaz1ny/HarmonyDO-public
2770673f5b4e063b01506704b1fafaf25ef560b8
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
defineMetadata
Define metadata for a target
static defineMetadata(metadataKey: string, metadataValue: any, target: Object, propertyKey?: string | symbol): void { const targetKey = target.constructor.name + (propertyKey ? ':' + String(propertyKey) : ''); if (!this.metadataMap.has(targetKey)) { this.metadataMap.set(targetKey, new Map()); }...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left defineMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left metadataKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static defineMetadata(metadataKey: string, metadataValue: any, target: Object, propertyKey?: string | symbol): void { const targetKey = target.constructor.name + (propertyKey ? ':' + String(propertyKey) : ''); if (!this.metadataMap.has(targetKey)) { this.metadataMap.set(targetKey, new Map()); }...
https://github.com/killetom/ktretrofit
cdd7cb5f24b4e0d64d06df1b0c46f00a746a5eac
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
generateReminderId
生成提醒ID
private generateReminderId(): string { return `reminder_${Date.now()}_${Math.floor(Math.random() * 1000)}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateReminderId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left stri...
private generateReminderId(): string { return `reminder_${Date.now()}_${Math.floor(Math.random() * 1000)}`; }
https://gitcode.com/openharmony/codelabs
162e2a0ec6e650bfe2a2bb549c8d701cca9df9b8
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createUpdateBillCommand
创建账单更新命令 @param userId 用户ID @param billId 账单ID @param billData 账单数据 @param expectedVersion 期望版本号
static createUpdateBillCommand( userId: number, billId: number, billData: BillJSON, expectedVersion: number ): Command { const command = new Command( '', 'UpdateBill', AGGREGATE_TYPE_BILL, billId, userId, JSON.stringify(billData), COMMAND_STATUS_PENDING,...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUpdateBillCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
static createUpdateBillCommand( userId: number, billId: number, billData: BillJSON, expectedVersion: number ): Command { const command = new Command( '', 'UpdateBill', AGGREGATE_TYPE_BILL, billId, userId, JSON.stringify(billData), COMMAND_STATUS_PENDING,...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
624aa6c83cdb61fd063762b2dbc6e7de900e87ac
github
zmuxuny/ai-guardian-star
entry/src/main/ets/common/CloudService.ets
arkts
login
云端验证账号 + 拉取用户信息(换新手机时用)
async login(username: string, passwordHash: string): Promise<CloudResult> { const body: LoginRequest = { username: username, passwordHash: passwordHash }; return postJson('/api/login', body); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async login(username: string, passwordHash: string): Promise<CloudResult> { const body: LoginRequest = { username: username, passwordHash: passwordHash }; return postJson('/api/login', body); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/CloudService.ets#L122-L125
be9b0f86c7d77d26954604e58bf0b81fa8c119f8
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
setSyncConfig
设置同步配置
setSyncConfig(config: SyncConfig): void { this.syncConfig = config; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSyncConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SyncConfig AST#identifier#Right AST#)#Le...
setSyncConfig(config: SyncConfig): void { this.syncConfig = config; }
https://github.com/CLMC2025/Vignette
679648881cada192c414aa333d502453419afd4b
github
fbinba3955/Flymby
main/src/main/ets/utils/ScreenUtil.ets
arkts
getScreenSize
获取屏幕尺寸 @returns
static getScreenSize(): ScreenWidthHeightData | string { let displayClass: display.Display | null = null; try { displayClass = display.getDefaultDisplaySync() const data: ScreenWidthHeightData = { width: displayClass.width, height: displayClass.height, error: undefined ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getScreenSize 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#expressi...
static getScreenSize(): ScreenWidthHeightData | string { let displayClass: display.Display | null = null; try { displayClass = display.getDefaultDisplaySync() const data: ScreenWidthHeightData = { width: displayClass.width, height: displayClass.height, error: undefined ...
https://github.com/fbinba3955/Flymby
62871a87878017b51bcae2ed16a1bdff711470ac
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
uploadLocalReviewEvents
==================== Review Events Sync ====================
async uploadLocalReviewEvents(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uploadLocalReviewEvents 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 ...
async uploadLocalReviewEvents(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if...
https://github.com/CLMC2025/Vignette
18fa82d48d0d164e4d2097002059dfd732aaaa6e
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
getContrastRatio
计算对比度
public static getContrastRatio(color1: string, color2: string): number { const L1 = this.getRelativeLuminance(color1); const L2 = this.getRelativeLuminance(color2); const lighter = Math.max(L1, L2); const darker = Math.min(L1, L2); return (lighter + 0.05) / (darker + 0.05); }
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 getContrastRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color1 AST#identifier#Right AST#:#Left...
public static getContrastRatio(color1: string, color2: string): number { const L1 = this.getRelativeLuminance(color1); const L2 = this.getRelativeLuminance(color2); const lighter = Math.max(L1, L2); const darker = Math.min(L1, L2); return (lighter + 0.05) / (darker + 0.05); }
https://github.com/LJ666-ui/harmony-health-care
db84ecc09b7444b96b7d0f1c8b042e0f61dd2264
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
mockCloudDownload
云端下载( 真实云端下载:从华为云服务器获取备份数据
private static async mockCloudDownload(userId: number): Promise<CloudApiResponse> { const url = 'http://120.46.134.106:5000'; // 保持 IP 一致 console.info('[CloudSyncService] 正在从云端下载数据: ' + url); const httpRequest: HttpRequestLike = http.createHttp() as HttpRequestLike; try { const header: HttpUser...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left mockCloudDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le...
private static async mockCloudDownload(userId: number): Promise<CloudApiResponse> { const url = 'http://120.46.134.106:5000'; // 保持 IP 一致 console.info('[CloudSyncService] 正在从云端下载数据: ' + url); const httpRequest: HttpRequestLike = http.createHttp() as HttpRequestLike; try { const header: HttpUser...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
726469b2de51a12522cd3107d97852c81bf45e69
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
startup
🚀 记录应用启动过程 @param tag - 日志分类标签 @param step - 启动步骤 @param details - 步骤详情
public startup(tag: string, step: string, details?: string): void { const detailsText = details ? ` - ${details}` : ''; this.info(tag, `🚀 启动过程: ${step}${detailsText}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
public startup(tag: string, step: string, details?: string): void { const detailsText = details ? ` - ${details}` : ''; this.info(tag, `🚀 启动过程: ${step}${detailsText}`); }
https://github.com/DaLongZhuaZi/manxia
340d863fc4f45c0bfdd3d16f41ec9fa2c5eef6f7
github
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/FormContainer.ets
arkts
setFormValues
设置表单数据,并且通过IO设置到子表单项里
setFormValues(val: AnyType) { this.data.items.forEach(item => { const itemValue: AnyType = (val ?? {})?.[item.name ?? item.id]; this.childrenInputs?.[item.id]?.setValue(itemValue); }) this.formInstance.setValues(val) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFormValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AnyType AST#identifier#Right...
setFormValues(val: AnyType) { this.data.items.forEach(item => { const itemValue: AnyType = (val ?? {})?.[item.name ?? item.id]; this.childrenInputs?.[item.id]?.setValue(itemValue); }) this.formInstance.setValues(val) }
https://github.com/mybricks/comlib-harmony-normal
05390a5574065d9a4e8d4b4e71ea9819c83643b0
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
extractWeatherData
Extract weather data from tool message
private extractWeatherData(toolMessage?: ChatApiResponseMessage): WeatherData | undefined { if (!toolMessage?.artifact?.weather_api_response) { return undefined; } const weather = toolMessage.artifact.weather_api_response; const forecastDays = weather.forecast.forecastday; if (!forecastDay...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractWeatherData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toolMessage AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Righ...
private extractWeatherData(toolMessage?: ChatApiResponseMessage): WeatherData | undefined { if (!toolMessage?.artifact?.weather_api_response) { return undefined; } const weather = toolMessage.artifact.weather_api_response; const forecastDays = weather.forecast.forecastday; if (!forecastDay...
https://github.com/somnio-software/my-bot-pal
e9e327b60bf130351a1876a76698edc302b3fe24
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
clearDelayRefresh
Clear delay refresh.
private clearDelayRefresh(): void { clearTimeout(this.timeoutId); this.isWaitingRefresh = false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clearDelayRefresh 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 clearDelayRefresh(): void { clearTimeout(this.timeoutId); this.isWaitingRefresh = false; }
https://gitee.com/openharmony/codelabs.git
7b488b8c6069ac123c8e5c5983d8eba486d910ed
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/WebSearchService.ets
arkts
loadConfig
加载搜索服务配置(旧接口,保留)
async loadConfig(): Promise<void> { const runtime = await this.getRuntimeConfigSnapshot() this.applyRuntimeConfig(runtime) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadConfig 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_t...
async loadConfig(): Promise<void> { const runtime = await this.getRuntimeConfigSnapshot() this.applyRuntimeConfig(runtime) }
https://github.com/LongLiveY96/chatcube
e4b9e088054ccf811e131e4683c137304c60fd54
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
analyzeUnknownWord
分析未知词汇
analyzeUnknownWord(word: string, context: string): UnknownWordInfo { const existing = this.unknownWords.get(word.toLowerCase()); if (existing !== undefined) { // 更新现有记录 existing.frequency++; existing.timestamp = Date.now(); existing.context = context; return existing; } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left analyzeUnknownWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Lef...
analyzeUnknownWord(word: string, context: string): UnknownWordInfo { const existing = this.unknownWords.get(word.toLowerCase()); if (existing !== undefined) { // 更新现有记录 existing.frequency++; existing.timestamp = Date.now(); existing.context = context; return existing; } ...
https://github.com/CLMC2025/Vignette
a99a7b7f5e0b8612d9127934909da416fef634f3
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
currentTabSearchSetKey
IN-PAGE SEARCH Sets the current tab search key.
currentTabSearchSetKey(searchKey: string) { if (this.currentTab) { this.currentTab.inputSearchKey = searchKey; } else { meow(`No current tab found!`, 'meowTabBunch][setCurrentTabSearchKey', meowLevel.WARN); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left currentTabSearchSetKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR...
currentTabSearchSetKey(searchKey: string) { if (this.currentTab) { this.currentTab.inputSearchKey = searchKey; } else { meow(`No current tab found!`, 'meowTabBunch][setCurrentTabSearchKey', meowLevel.WARN); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
50dbb8958e00f6fe3edd949dd35cffc10b56c7fe
github
arkui-x/samples
CodeLab/Cases/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
addGridItem
向首页应用里添加应用的动画 @param item 被点击的gridItem @param appInfoList 首页应用里的所有GridItem
addGridItem(item: T, appInfoList: AppInfo[]): void { const index: number = this.sortAppData.indexOf(item); const appId: string = (item as AppInfo).name.toString(); animateTo({ curve: Curve.ExtremeDeceleration, duration: ADD_ANIMATION_DURATION, onFinish: () => { this.modifier[index].attribute...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addGridItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
addGridItem(item: T, appInfoList: AppInfo[]): void { const index: number = this.sortAppData.indexOf(item); const appId: string = (item as AppInfo).name.toString(); animateTo({ curve: Curve.ExtremeDeceleration, duration: ADD_ANIMATION_DURATION, onFinish: () => { this.modifier[index].attribute...
https://gitcode.com/arkui-x/samples
c7561de8ea8a91084f8a9374c7f082b80da312c2
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/CryptoDemo.ets
arkts
random
生成一个随机数,取值范围为 [0, 1),即大于等于 0 且小于 1
public static random(): number { return Math.random() }
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 random AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :...
public static random(): number { return Math.random() }
https://github.com/webabcd/HarmonyDemo
07c5596e3cdac191d7f6894f495f715c529e92e3
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/Database.ets
arkts
execute
/ execute
public static async execute(operation: Operation, db: relationalStore.RdbStore): Promise<void> { let command: SqlCommand = operation.getSqlCommand(); let sql: string = command.getSql(); let executeSuccess: boolean = false; let inTransactionChange: boolean = operation.getInTransactionChange(); let ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left execute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left operation ...
public static async execute(operation: Operation, db: relationalStore.RdbStore): Promise<void> { let command: SqlCommand = operation.getSqlCommand(); let sql: string = command.getSql(); let executeSuccess: boolean = false; let inTransactionChange: boolean = operation.getInTransactionChange(); let ...
https://gitee.com/openharmony-sig/flutter_sqflite.git
2b3c5ebc6eeee35a1b83d3da2199b2ddceadd3fc
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StorageUtil.ets
arkts
removeUserInfo
删除用户信息
static async removeUserInfo(): Promise<void> { try { const prefs: preferences.Preferences = await StorageUtil.getPreferences(); await prefs.delete(StorageUtil.USER_INFO_KEY); await prefs.flush(); } catch (error) { console.error('删除用户信息失败:', 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 removeUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async removeUserInfo(): Promise<void> { try { const prefs: preferences.Preferences = await StorageUtil.getPreferences(); await prefs.delete(StorageUtil.USER_INFO_KEY); await prefs.flush(); } catch (error) { console.error('删除用户信息失败:', error); } }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
8f7e9cf38d13a8cf9d6bde1679aaa748efae2392
github
heeh02/superconnect
harmony/entry/src/main/ets/session/Session.ets
arkts
onBytes
Feed raw bytes from the socket.
onBytes(data: Uint8Array): void { let frames: Frame[] = []; try { frames = this.decoder.push(data); } catch (e) { this.log('decode error: ' + JSON.stringify(e)); return; } for (const f of frames) { if (f.channel === Channel.CONTROL) { this.handleControl(f.payload); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#)#Left ) AST...
onBytes(data: Uint8Array): void { let frames: Frame[] = []; try { frames = this.decoder.push(data); } catch (e) { this.log('decode error: ' + JSON.stringify(e)); return; } for (const f of frames) { if (f.channel === Channel.CONTROL) { this.handleControl(f.payload); ...
https://github.com/heeh02/superconnect
1eb7c25f42434fb3b606d6aa68bd78c22644db89
github
the-wwyang/kids-learning-app
src/main/ets/storage/WrongQuestionStorageService.ets
arkts
getStats
获取错题统计信息 @returns 统计对象
static async getStats(): Promise<{ total: number; unmastered: number; mastered: number; lastSync: string; }> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); const stats = WrongQuestionService.calculateStats(records); const lastSync = await WrongQ...
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 getStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
static async getStats(): Promise<{ total: number; unmastered: number; mastered: number; lastSync: string; }> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); const stats = WrongQuestionService.calculateStats(records); const lastSync = await WrongQ...
https://github.com/the-wwyang/kids-learning-app
23cc583c67994b67878b95e8391db3459ab4442c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/StringBuilder.ets
arkts
append
Appends an object representation as string to the builder's internal buffer @param { object } o object that will be converted to a stringitg @returns { StringBuilder } builder with updated internal buffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public append(o: Object): StringBuilder { this.append(o.toString()); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#i...
public append(o: Object): StringBuilder { this.append(o.toString()); return this; }
https://gitcode.com/iop123123/arkts-static-skills
f91e365eec7b681cd764eb8d2998005b8f66f607
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets
arkts
setTimeValue
设置选中的时间值 @param value 时间字符串
setTimeValue(value: string): void { this.timeValue = value; this.selectedTime = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTimeValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A...
setTimeValue(value: string): void { this.timeValue = value; this.selectedTime = value; }
https://github.com/codelably/tuniao-ui
7eb888a87c2db44f159d0cefbb10359fc4a71a4b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
initializeHilogLevelFromIndex
🛠️ 从LOG_LEVEL_VALUES索引初始化hilog输出等级 用于应用启动时从SettingsManager加载保存的设置 @param levelIndex - 日志等级索引 (0=关闭, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL)
public initializeHilogLevelFromIndex(levelIndex: number): void { if (levelIndex >= 0 && levelIndex < LOG_LEVEL_VALUES.length) { this.hilogOutputLevel = LOG_LEVEL_VALUES[levelIndex]; console.log(`[NGF] 从Settings初始化hilog输出等级: ${LOG_LEVEL_NAMES[levelIndex]}`); } else { console.log(`[NGF] 无效的日志等...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initializeHilogLevelFromIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left levelIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ...
public initializeHilogLevelFromIndex(levelIndex: number): void { if (levelIndex >= 0 && levelIndex < LOG_LEVEL_VALUES.length) { this.hilogOutputLevel = LOG_LEVEL_VALUES[levelIndex]; console.log(`[NGF] 从Settings初始化hilog输出等级: ${LOG_LEVEL_NAMES[levelIndex]}`); } else { console.log(`[NGF] 无效的日志等...
https://github.com/DaLongZhuaZi/manxia
27396b87b8686a93c4a2a83902347b5dd2085521
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
prepare
加载播放资源 @param finishTask prepare完成时的任务 @returns {Promise<void}
async prepare(finishTask?: Function): Promise<void> { if (!this.curMusicModelRaw) { return; } await this.avplayerModel.prepare(this.curMusicModelRaw.res, finishTask); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left prepare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left finishTask AST#identifier#Right AST#?...
async prepare(finishTask?: Function): Promise<void> { if (!this.curMusicModelRaw) { return; } await this.avplayerModel.prepare(this.curMusicModelRaw.res, finishTask); }
https://gitcode.com/arkui-x/samples
a25cb40969ac45e16041602bc39f9251e81b7b31
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ai/AIOrchestrator.ets
arkts
formatRiskVoiceResponse
格式化风险评估的语音回复
private formatRiskVoiceResponse(result: any): string { const levelMap: Record<string, string> = { low: '低风险', medium: '中等风险', high: '高风险', critical: '严重风险' }; let response = `您的综合健康评估结果为${levelMap[result.overallLevel]}。`; if (result.hypertensionRisk > 0.6) { response +=...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatRiskVoiceResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left result AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#any#Left any AST#an...
private formatRiskVoiceResponse(result: any): string { const levelMap: Record<string, string> = { low: '低风险', medium: '中等风险', high: '高风险', critical: '严重风险' }; let response = `您的综合健康评估结果为${levelMap[result.overallLevel]}。`; if (result.hypertensionRisk > 0.6) { response +=...
https://github.com/LJ666-ui/harmony-health-care
2342cc2e5dd2a598d68c40dd14a81ba83e02bfa8
github
Vsolon0401/MallShopping
common/src/main/ets/service/ShoppingCartService.ets
arkts
clearCartList
清除购物车 @returns
async clearCartList() { return Request.post('/cart/clear') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearCartList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#...
async clearCartList() { return Request.post('/cart/clear') }
https://github.com/Vsolon0401/MallShopping
40a80b4dde2d4985eb3075dc0397473d0c83ed1a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/ReminderService.ets
arkts
getActiveReminders
获取用户的所有活跃提醒
static async getActiveReminders(userId: number): Promise<Reminder[]> { try { return await ReminderDAO.getActiveReminders(userId); } catch (error) { const errorMsg: string = error instanceof Error ? error.message : String(error); console.error('[ReminderService] 获取活跃提醒失败:', error); thro...
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 getActiveReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef...
static async getActiveReminders(userId: number): Promise<Reminder[]> { try { return await ReminderDAO.getActiveReminders(userId); } catch (error) { const errorMsg: string = error instanceof Error ? error.message : String(error); console.error('[ReminderService] 获取活跃提醒失败:', error); thro...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6c3c485f2be0aaf069e569b2f0ab52533c879662
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/HttpClient.ets
arkts
setCookies
设置 Cookies
setCookies(cookies: string): void { const normalized: string = cookies.trim(); if (normalized.length === 0) { return; } this.cookieStore.ingestCookieHeader(normalized); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cookies AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
setCookies(cookies: string): void { const normalized: string = cookies.trim(); if (normalized.length === 0) { return; } this.cookieStore.ingestCookieHeader(normalized); }
https://github.com/Amaz1ny/HarmonyDO-public
a0452bd56535b2fae548a4ba08c00829838cc396
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
copyUriFileToTemp
复制URI文件到临时目录 @param uriPath URI路径 @returns 临时文件路径
private async copyUriFileToTemp(uriPath: string): Promise<string> { try { // 生成临时文件路径 const fileName = this.getFileNameFromUri(uriPath); const timestamp = Date.now(); const tempDir = this.sandboxManager.getDirectory('temp'); const tempFilePath = `${tempDir}/temp_${timestamp}_${fileNa...
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 copyUriFileToTemp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uriPath AST#identifier#Right AST#ERROR#Left AST#:#...
private async copyUriFileToTemp(uriPath: string): Promise<string> { try { // 生成临时文件路径 const fileName = this.getFileNameFromUri(uriPath); const timestamp = Date.now(); const tempDir = this.sandboxManager.getDirectory('temp'); const tempFilePath = `${tempDir}/temp_${timestamp}_${fileNa...
https://github.com/DaLongZhuaZi/manxia
64e40efd5282ea8246cf65d2d6d4b6a7df5b98f0
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridViewManager.ets
arkts
onInvokeArkTsView
Invokes an ArkTS view event. @param nodeId Node ID @param key Event key @param params Event parameters
public onInvokeArkTsView(nodeId: string, key: string, params: HybridInvokeCallback) { let view: HybridBaseView | undefined = this.hybridViews.get(nodeId); if (view) { view.toInvokeArkTsView(key, params); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onInvokeArkTsView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public onInvokeArkTsView(nodeId: string, key: string, params: HybridInvokeCallback) { let view: HybridBaseView | undefined = this.hybridViews.get(nodeId); if (view) { view.toInvokeArkTsView(key, params); } }
https://github.com/AGenUI/AGenUI
82ef67e26db0a38aae0b15b2ae48151a903dc478
github
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets
arkts
saveAccount
保存账号 @returns {Promise<void>} Promise<void>
async saveAccount(): Promise<void> { const account: string = this.accountInput.trim(); if (!account) { return; } await this.repository.saveAccount(account); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveAccount 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 saveAccount(): Promise<void> { const account: string = this.accountInput.trim(); if (!account) { return; } await this.repository.saveAccount(account); }
https://github.com/Joker-x-dev/HarmonyKit
4befd0c3e99d9f10159a6fa7c1003c4b67b784aa
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/trackmanager/TrackManager.ets
arkts
initTrackManager
Init the track service, register the uiObserver 'willClick' and 'navigationSwitch' event.
public initTrackManager(): void { PreferenceManager.getInstance().setValue<TrackModel[]>(StorageKey.APP_TRACK_DATA, []); this.initTrackCommonData().then(async () => { TrackManager.uiContext = AppStorage.get<UIContext>(StorageKey.UI_CONTEXT) as UIContext; TrackManager.trackTable = new TrackTable();...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initTrackManager 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#expre...
public initTrackManager(): void { PreferenceManager.getInstance().setValue<TrackModel[]>(StorageKey.APP_TRACK_DATA, []); this.initTrackCommonData().then(async () => { TrackManager.uiContext = AppStorage.get<UIContext>(StorageKey.UI_CONTEXT) as UIContext; TrackManager.trackTable = new TrackTable();...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
1e010905661b9bd1cf159e7eca3a2d25d5db10d1
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeLoop
执行循环操作(用于分页递归获取等场景)
private async executeLoop(action: LoopAction, context: ActionContext): Promise<ActionResult[]> { const maxIterations = action.maxIterations || 100; const results: ActionResult[] = []; logger.info(TAG, `开始循环操作, 最大迭代次数: ${maxIterations}`); for (let i = 0; i < maxIterations; i++) { // 检查跳...
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 executeLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : ...
private async executeLoop(action: LoopAction, context: ActionContext): Promise<ActionResult[]> { const maxIterations = action.maxIterations || 100; const results: ActionResult[] = []; logger.info(TAG, `开始循环操作, 最大迭代次数: ${maxIterations}`); for (let i = 0; i < maxIterations; i++) { // 检查跳...
https://github.com/DaLongZhuaZi/manxia
a35d72b9b2fa2cbf0aad87ff3f6722e95871da6a
github
rg2304luyue/ToDoList
entry/src/main/ets/pages/ToDoListPage.ets
arkts
checkDueReminders
自动检测到期提醒
checkDueReminders() { let todayStr = new Date().toISOString().slice(0, 10); let overdueCount = 0; this.totalTasks.forEach(task => { if (!task.isComplete && task.dueDate <= todayStr) { overdueCount++; } }); if (overdueCount > 0) { promptAction.showToast({ message: ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkDueReminders 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#...
checkDueReminders() { let todayStr = new Date().toISOString().slice(0, 10); let overdueCount = 0; this.totalTasks.forEach(task => { if (!task.isComplete && task.dueDate <= todayStr) { overdueCount++; } }); if (overdueCount > 0) { promptAction.showToast({ message: ...
https://github.com/rg2304luyue/ToDoList
7821a6c917f982ee3d6f0b7ab2150caeec74425b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/AppSettingsService.ets
arkts
getCurrencySymbol
获取货币符号
static async getCurrencySymbol(): Promise<CurrencySymbol> { await AppSettingsService.ensureInitialized(); const value = await AppSettingsService.preferencesInstance!.get(KEY_CURRENCY, CurrencySymbol.CNY); return value as CurrencySymbol; }
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 getCurrencySymbol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async getCurrencySymbol(): Promise<CurrencySymbol> { await AppSettingsService.ensureInitialized(); const value = await AppSettingsService.preferencesInstance!.get(KEY_CURRENCY, CurrencySymbol.CNY); return value as CurrencySymbol; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
382548b50419c8ff20e32dd28c81e33f3b1d90a7
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
getColorConfig
获取颜色配置
public getColorConfig(): ColorConfig { // 高对比度模式 if (this.config.isHighContrastMode) { return { primary: '#0000FF', background: '#FFFFFF', text: '#000000', textSecondary: '#333333', error: '#FF0000', success: '#00AA00', warning: '#FF8800' }; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getColorConfig 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 ColorCo...
public getColorConfig(): ColorConfig { // 高对比度模式 if (this.config.isHighContrastMode) { return { primary: '#0000FF', background: '#FFFFFF', text: '#000000', textSecondary: '#333333', error: '#FF0000', success: '#00AA00', warning: '#FF8800' }; ...
https://github.com/LJ666-ui/harmony-health-care
5c1b64f70237471070a71f2e47eb6f24040253ee
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
trunc
Return a new Decimal whose value is `n` truncated to an integer. @param { Value } n {double | string | Decimal} @returns { Decimal } the Decimal type
static trunc(n: Value): Decimal { return new Decimal(n).trunc(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left trunc AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
static trunc(n: Value): Decimal { return new Decimal(n).trunc(); }
https://gitcode.com/iop123123/arkts-static-skills
07e9729865b48167d70f52f0f7a3b6fdfd63e85a
gitcode
erosTeam/NextE
shared/src/main/ets/state/GalleryReadProgressState.ets
arkts
getIndex
Saved page index for a gallery (0 when none). Reads `revision` so callers subscribe.
getIndex(gid: string): number { // Always-false guard whose sole purpose is to read `revision`, establishing the reactive // dependency for any build()-scope caller (so returning from the reader updates the label). if (this.revision < 0) { return 0 } if (gid.length === 0) { return 0 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#R...
getIndex(gid: string): number { // Always-false guard whose sole purpose is to read `revision`, establishing the reactive // dependency for any build()-scope caller (so returning from the reader updates the label). if (this.revision < 0) { return 0 } if (gid.length === 0) { return 0 ...
https://github.com/erosTeam/NextE
24c440ea52ca8ddf238339a59feb761b5141401e
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/lazyforeach/LazyForEachPage.ets
arkts
getData
获取指定位置的数据 注意:这里函数的返回类型应该与后端返回数据列表的数据类型一致 @param index 索引 @returns 指定位置的数据
public getData(index: number): string { return this.originDataArray[index] }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public getData(index: number): string { return this.originDataArray[index] }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
9bec725bb1c23874f1a1348a3ca7c38b0487b6e9
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/export/utils/EncryptionModule.ets
arkts
deriveKey
从密码派生加密密钥 使用 PBKDF2-HMAC-SHA256 算法从用户密码派生 AES-256 密钥 @param password 用户密码 @param salt 盐值(随机生成) @returns 派生的对称密钥 @throws ExportError 当密钥派生失败时抛出
static async deriveKey( password: string, salt: Uint8Array ): Promise<cryptoFramework.SymKey> { try { EncryptionModule.logInfo(`开始密钥派生,迭代次数: ${EncryptionModule.PBKDF2_ITERATIONS}`); // 创建 PBKDF2 密钥派生器 const kdfAlg = 'PBKDF2|SHA256'; const kdf = cryptoFramework.createKdf(kdfAlg);...
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 deriveKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static async deriveKey( password: string, salt: Uint8Array ): Promise<cryptoFramework.SymKey> { try { EncryptionModule.logInfo(`开始密钥派生,迭代次数: ${EncryptionModule.PBKDF2_ITERATIONS}`); // 创建 PBKDF2 密钥派生器 const kdfAlg = 'PBKDF2|SHA256'; const kdf = cryptoFramework.createKdf(kdfAlg);...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b4e3ffc88d2264eb3aa61cbe5434131373927de3
github
openharmony-sig/flutter_packages
packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/HttpAuthHandlerFlutterApiImpl.ets
arkts
create
Stores the `HttpAuthHandler` instance and notifies Dart to create and store a new `HttpAuthHandler` instance that is attached to this one. If `instance` has already been added, this method does nothing.
create(instance: ESObject, callback: Reply<void>) { if (!this.instanceManager.containsInstance(instance)) { this.api.create(this.instanceManager.addHostCreatedInstance(instance), callback); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ESObject AST#identifier#Right ...
create(instance: ESObject, callback: Reply<void>) { if (!this.instanceManager.containsInstance(instance)) { this.api.create(this.instanceManager.addHostCreatedInstance(instance), callback); } }
https://gitee.com/openharmony-sig/flutter_packages.git
8bf175d25db15644a19351c53189f14cef6396b2
gitee
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/view/ProfilePage.ets
arkts
build
构建个人中心页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this.ProfileContent(); IBestDialog({ visible: this.vm.showLogoutDialog, title: $r("app.string.logout_confirm_title"), message: $r("app.string.logout_confirm_message"), ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.profile_title"), viewModel: this.vm }) { this.ProfileContent(); IBestDialog({ visible: this.vm.showLogoutDialog, title: $r("app.string.logout_confirm_title"), message: $r("app.string.logout_confirm_message"), ...
https://github.com/Joker-x-dev/CoolMallArkTS
d898500c75a53067b3dc0809f64bfb35510a91e5
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
clearValues
Removes all DataSets (and thereby Entries) from the chart. Does not set the data object to null. Also refreshes the chart by calling invalidate().
public clearValues() { if (this.mData) { this.mData.clearValues(); } this.invalidate(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearValues 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 { A...
public clearValues() { if (this.mData) { this.mData.clearValues(); } this.invalidate(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a8fdee0b7672223eb787a45204e130f13c687aca
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/ftp/SFTPHandler.ets
arkts
isDirectory
检查是否是目录
private async isDirectory(path: string): Promise<boolean> { try { await this.exec(`test -d "${path}"`); return true; } catch { return false; } }
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 isDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AS...
private async isDirectory(path: string): Promise<boolean> { try { await this.exec(`test -d "${path}"`); return true; } catch { return false; } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/SFTPHandler.ets#L101-L108
a3128fc0307f95cecb98a81b560d84eded75abe3
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets
arkts
hasAnyGoalAchieved
检查是否有任何目标达成
hasAnyGoalAchieved(distance: number, duration: number, calories: number): boolean { return this.checkGoalAchievement(distance, duration, calories).length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAnyGoalAchieved AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left distance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , ...
hasAnyGoalAchieved(distance: number, duration: number, calories: number): boolean { return this.checkGoalAchievement(distance, duration, calories).length > 0; }
https://gitcode.com/openharmony/codelabs
2aac5d068e3349c14e8b2ba41458cbac33d62e7e
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/app/pages/components/info/RemodelInfoPage.ets
arkts
amountText
"普通 (确保)" 文本:确保值无效(<=0)或与普通相同时只显示普通值。
function amountText(normal: number, ensure: number): string { if (normal < 0) return '?'; return ensure > 0 && ensure !== normal ? `${normal} (${ensure})` : `${normal}`; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left amountText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left normal AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function amountText(normal: number, ensure: number): string { if (normal < 0) return '?'; return ensure > 0 && ensure !== normal ? `${normal} (${ensure})` : `${normal}`; }
https://github.com/CsCesium/KantaiHomo
d12fdd43082a8e44ebcd9cedf4d4aed6462b37e5
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/StepDao.ets
arkts
getRecentStepRecords
获取最近的N条步数记录
async getRecentStepRecords(limit: number = 7): Promise<StepRecord[]> { const rdbStore = await this.initDatabase(); const records: StepRecord[] = []; try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.orderByDesc('date'); // 按日期降序排列,最新的在前 const result...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecentStepRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left limit AST#identifier#Right AST#type_annotation#Left AST#:#...
async getRecentStepRecords(limit: number = 7): Promise<StepRecord[]> { const rdbStore = await this.initDatabase(); const records: StepRecord[] = []; try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.orderByDesc('date'); // 按日期降序排列,最新的在前 const result...
https://gitcode.com/openharmony/codelabs
ab160dff2d00ebd195236bd22a7a14ba0304807f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
constructor
Constructs view @param buffer underlying buffer
public constructor(buffer: Buffer) { this(buffer, 0) }
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 buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bu...
public constructor(buffer: Buffer) { this(buffer, 0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
38dd875ccd114a4f601b980f306b05ba1dd8499c
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setUndefined
Sets a current JsonElement to an undefined value.
setUndefined(): void { this.maybeStringValue = undefined this.maybeDoubleValue = undefined this.maybeBoolValue = undefined this.maybeObjectValues = undefined this.maybeArrayValues = undefined this.maybeNullValue = undefined ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUndefined 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...
setUndefined(): void { this.maybeStringValue = undefined this.maybeDoubleValue = undefined this.maybeBoolValue = undefined this.maybeObjectValues = undefined this.maybeArrayValues = undefined this.maybeNullValue = undefined ...
https://gitcode.com/iop123123/arkts-static-skills
517dc56927c396c2717081ac652f19507564a9f1
gitcode
popsiclelmlm/Hey
entry/src/main/ets/features/runtime/RuntimeController.ets
arkts
coreLabelText
当前内核标签(运行中反映实际内核),供日志页等复用,避免各自从全局设置重算。
coreLabelText(): string { return this.coreLabel; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left coreLabelText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen...
coreLabelText(): string { return this.coreLabel; }
https://github.com/popsiclelmlm/Hey
87f47f927e7fbd66a3eb181046d98e5aa0dbc878
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CloudCredentials.ets
arkts
injectPreferences
Override the storage backend; tests inject an in-memory stub.
injectPreferences(p: StringPreferencesLike): void { this.prefs = p; this.ready = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left injectPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StringPreferencesLike AST#identifier#Righ...
injectPreferences(p: StringPreferencesLike): void { this.prefs = p; this.ready = true; }
https://github.com/terryma2024/happyword
32c71a32d73b7487da2f38a7c0a0c4ed722e9b92
github
LJ666-ui/harmony-health-care
entry/src/main/ets/rag/VectorRetriever.ets
arkts
embed
文本向量化 @param text 文本 @returns 向量
private async embed(text: string): Promise<number[]> { // 实际项目中调用嵌入模型API // 这里返回模拟向量 const vector: number[] = []; for (let i = 0; i < this.config.dimension; i++) { vector.push(Math.random()); } return this.normalize(vector); }
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 embed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Ri...
private async embed(text: string): Promise<number[]> { // 实际项目中调用嵌入模型API // 这里返回模拟向量 const vector: number[] = []; for (let i = 0; i < this.config.dimension; i++) { vector.push(Math.random()); } return this.normalize(vector); }
https://github.com/LJ666-ui/harmony-health-care
7534fe9a197c4d578a0f28ba260a8a833fc953e5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
getMDLayoutParams
MD断点布局参数(平板)
private static getMDLayoutParams(): ResponsiveLayoutParams { return new ResponsiveLayoutParams(5, 20, 24, 800, true, 240, 1.1); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getMDLayoutParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private static getMDLayoutParams(): ResponsiveLayoutParams { return new ResponsiveLayoutParams(5, 20, 24, 800, true, 240, 1.1); }
https://github.com/DaLongZhuaZi/manxia
d672ea763f99a53697fb20c93cde8d0bf6543bd8
github
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
functionMap
获取各类topic处理的handler @return 各类topic处理的handler
public get functionMap(): Map<string, MessageReceivedHandler> { return this._functionMap; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left functionMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
public get functionMap(): Map<string, MessageReceivedHandler> { return this._functionMap; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
bfa2d012b42a056c8537cce30b8544042bd05415
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
requestSyncPermission
请求分布式数据同步权限 @param context UIAbilityContext @returns 是否授权成功
public static async requestSyncPermission(context: common.UIAbilityContext): Promise<boolean> { try { const atManager = abilityAccessCtrl.createAtManager(); const result = await atManager.requestPermissionsFromUser(context, ['ohos.permission.DISTRIBUTED_DATASYNC']); const granted = result.authRe...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left requestSyncPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L...
public static async requestSyncPermission(context: common.UIAbilityContext): Promise<boolean> { try { const atManager = abilityAccessCtrl.createAtManager(); const result = await atManager.requestPermissionsFromUser(context, ['ohos.permission.DISTRIBUTED_DATASYNC']); const granted = result.authRe...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L136-L147
5965ee6a800c9ed2decbe436fe518f8192f9fba5
github
openharmony/applications_mms
entry/src/main/ets/views/receive/receiveController.ets
arkts
checkSingle
Currently, only one recipient is supported. You can enter only one recipient first.
checkSingle() { if (this.selectContacts.length > 0) { prompt.showToast({ // Invalid Recipient // @ts-ignore message: '只支持单个收件人', duration: 1000, }); return true; } else { return false; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkSingle 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...
checkSingle() { if (this.selectContacts.length > 0) { prompt.showToast({ // Invalid Recipient // @ts-ignore message: '只支持单个收件人', duration: 1000, }); return true; } else { return false; ...
https://gitee.com/openharmony/applications_mms.git
9d936685e0d058c166a4f212daa46dc1f66e8851
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/MyMath.ets
arkts
toDegrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0. Params: angrad – an angle, in radians
public static toDegrees(ang: number) { return ang * MyMath.radians }
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 toDegrees AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ang AST#identifier#Right AST#:#Left : AST#:#R...
public static toDegrees(ang: number) { return ang * MyMath.radians }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5dac68337026df693310fdf4f8366a6654e321f7
gitee
openharmony/applications_contacts
entry/src/main/ets/presenter/dialer/DialerPresenter.ets
arkts
jumpToAccountants
Jump to New Contact
jumpToAccountants() { router.push({ url: 'pages/contacts/accountants/Accountants', params: { updataShow: false, phoneNumbers: [{ phoneNumber: AppStorage.Get('tele_number') }] }, }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToAccountants 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#...
jumpToAccountants() { router.push({ url: 'pages/contacts/accountants/Accountants', params: { updataShow: false, phoneNumbers: [{ phoneNumber: AppStorage.Get('tele_number') }] }, }) }
https://gitee.com/openharmony/applications_contacts.git
5a9ef6d42ef6f97a34b5cd75c068ec462c837f33
gitee
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets
arkts
Test002
E2E_002: DrawableDescriptor release() -> getPixelMap() 抛出 BusinessError 111002
Test002() { const id = 'E2E_002' try { let drawable = this.CreateDrawableFromRes() if (!drawable) { this.Fail(id, '无法创建 DrawableDescriptor') return } drawable.release() // 释放后调用 getPixelMap 应抛出 111002 try { drawable.getPixelMap() this.Fail(id...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test002 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#...
Test002() { const id = 'E2E_002' try { let drawable = this.CreateDrawableFromRes() if (!drawable) { this.Fail(id, '无法创建 DrawableDescriptor') return } drawable.release() // 释放后调用 getPixelMap 应抛出 111002 try { drawable.getPixelMap() this.Fail(id...
https://gitcode.com/openharmony/arkui_ace_engine
9b7dd24e39607e8d45954b04ba74eb95b39aada2
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleRumble
刷新 USB 设备 ==================== 震动处理(委托 GamepadVibrationService) ==================== 处理震动反馈
handleRumble(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void { this.vibrationService.handleRumble(controllerNumber, lowFreqMotor, highFreqMotor); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRumble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left ...
handleRumble(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void { this.vibrationService.handleRumble(controllerNumber, lowFreqMotor, highFreqMotor); }
https://github.com/AlkaidLab/moonlight-harmony
9b5bf94ca1daad2c7dc4f0989c9d429970c9cabe
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/DownloadDirManager.ets
arkts
activateDownloadPermission
激活下载目录的持久化权限
private async activateDownloadPermission(): Promise<void> { if (!this.downloadDirUri) return; console.info(`${TAG} Activating download permission for: ${this.downloadDirUri}`); try { // 检查设备是否支持持久化权限功能 if (!canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization')) { ...
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 activateDownloadPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
private async activateDownloadPermission(): Promise<void> { if (!this.downloadDirUri) return; console.info(`${TAG} Activating download permission for: ${this.downloadDirUri}`); try { // 检查设备是否支持持久化权限功能 if (!canIUse('SystemCapability.FileManagement.AppFileService.FolderAuthorization')) { ...
https://github.com/richshaw2015/nds
7ece8485e8fc3f863bcb059dbe6db74b2aeca425
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/MusicDbApi.ets
arkts
getCategoryTabs
@returns Category tab rows sorted by feed sort order.
public getCategoryTabs(): TabApiDto[] { return this.feedSorted() .filter((feedRow) => feedRow.kind === RecommendFeedKind.CATEGORY_TAB) .map((feedRow) => this.rowToTabApiDto(feedRow)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCategoryTabs 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#expres...
public getCategoryTabs(): TabApiDto[] { return this.feedSorted() .filter((feedRow) => feedRow.kind === RecommendFeedKind.CATEGORY_TAB) .map((feedRow) => this.rowToTabApiDto(feedRow)); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
155c0c8522c69a40b26fa8900558f1bf14dbbd9c
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
products/phone/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
Obtain the code value through the onNewWant callback in warm launch scenarios.
onNewWant(want: Want, _: AbilityConstant.LaunchParam): void { Logger.info(TAG, 'Ability onNewWant'); // Obtain the uri field from the want information. let uri = want?.uri; let status: router.RouterState = UIContextSelf.getRouter().getState(); if (status && status.name !== 'ScanAccess' && uri) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R...
onNewWant(want: Want, _: AbilityConstant.LaunchParam): void { Logger.info(TAG, 'Ability onNewWant'); // Obtain the uri field from the want information. let uri = want?.uri; let status: router.RouterState = UIContextSelf.getRouter().getState(); if (status && status.name !== 'ScanAccess' && uri) { ...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
5481f9c6509094f9a947ed16103b2e0718cef1d7
gitcode
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
symmetryName
Get human-readable symmetry name
public symmetryName(symmetry: number): string { return eulumdat_napi.symmetryName(symmetry); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left symmetryName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left symmetry AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
public symmetryName(symmetry: number): string { return eulumdat_napi.symmetryName(symmetry); }
https://github.com/holg/eulumdat-rs
0eee4981e0eab55ba5a1928e743f7ad471cd5a29
github
aimilin6688/KeePassHO
entry/src/main/ets/services/CrashLogService.ets
arkts
buildLogContent
构建日志内容
private buildLogContent(eventInfo: hiAppEvent.AppEventInfo, dateStr: string): string { const lines: string[] = []; lines.push('==================== Crash Log ===================='); lines.push(`App: KeePassHO`); lines.push(`Version: ${this.appVersion}`); lines.push(`Device: ${deviceInfo.productMod...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildLogContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e...
private buildLogContent(eventInfo: hiAppEvent.AppEventInfo, dateStr: string): string { const lines: string[] = []; lines.push('==================== Crash Log ===================='); lines.push(`App: KeePassHO`); lines.push(`Version: ${this.appVersion}`); lines.push(`Device: ${deviceInfo.productMod...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L264-L352
d90a79f207ccfc97108815cbe12c15cc32149073
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getRecordSummary
获取记录摘要
getRecordSummary(record: HealthRecord): string { const items: string[] = []; if (record.weight) items.push(`体重${record.weight}kg`); if (record.heartRate) items.push(`心率${record.heartRate}bpm`); if (record.steps) items.push(`步数${record.steps}`); return items.length > 0 ? items.join(' · ') : '无数据'; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecordSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HealthRecord AST#identifier#Right AST...
getRecordSummary(record: HealthRecord): string { const items: string[] = []; if (record.weight) items.push(`体重${record.weight}kg`); if (record.heartRate) items.push(`心率${record.heartRate}bpm`); if (record.steps) items.push(`步数${record.steps}`); return items.length > 0 ? items.join(' · ') : '无数据'; ...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
3777109876a1c13ab62790e124c1a25ca042b716
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/CategoryManager.ets
arkts
addSeedCategory
将默认分类以系统数据的方式插入数据库,供首次初始化时复用。
private static async addSeedCategory(category: CategoryBean): Promise<void> { const now: number = Date.now(); const data: relationalStore.ValuesBucket = { name: category.name, type: category.type, icon: category.icon, sort_order: category.sortOrder, is_system: category.isSystem ?...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left addSeedCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
private static async addSeedCategory(category: CategoryBean): Promise<void> { const now: number = Date.now(); const data: relationalStore.ValuesBucket = { name: category.name, type: category.type, icon: category.icon, sort_order: category.sortOrder, is_system: category.isSystem ?...
https://github.com/ZestBox-18/kitebook-frontend
28dbb534dcc02dfd8e526c1ed45d482aaf2a2cd2
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WishlistStore.ets
arkts
rehydrateForTest
V0.3.9: expose the cold-start parsing path so unit tests can simulate a persisted snapshot without spinning up a real UIAbilityContext. Production code uses `init(ctx)` which calls the same logic plus catalog backfill.
async rehydrateForTest(): Promise<void> { if (this.prefs === undefined) { return; } const raw: string = await this.prefs.getString(WISHLIST_PREFS_KEY); if (raw.length > 0) { this.snap = parseWishlistSnapshot(raw); } this.snap.version = 2; if (this.snap.wishes.length === 0) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left rehydrateForTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef...
async rehydrateForTest(): Promise<void> { if (this.prefs === undefined) { return; } const raw: string = await this.prefs.getString(WISHLIST_PREFS_KEY); if (raw.length > 0) { this.snap = parseWishlistSnapshot(raw); } this.snap.version = 2; if (this.snap.wishes.length === 0) { ...
https://github.com/terryma2024/happyword
f17fa693032e3256593587601acd0fe1d58a5a80
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets
arkts
release
全局释放 DDK
static release(): void { if (ddkInitialized && ddkNative) { try { ddkNative.release(); ddkInitialized = false; console.info(`${TAG} DDK 已释放`); } catch (err) { console.error(`${TAG} DDK release 异常:`, err); } } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
static release(): void { if (ddkInitialized && ddkNative) { try { ddkNative.release(); ddkInitialized = false; console.info(`${TAG} DDK 已释放`); } catch (err) { console.error(`${TAG} DDK release 异常:`, err); } } }
https://github.com/AlkaidLab/moonlight-harmony
7323af795653b379f83b0b652f58ce446a1253d1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets
arkts
isGreaterThan
Checks if this instance value is greater than value of provided instance @param { Short } other Right hand side of the comparison @returns { boolean } true if this value is greater than provided, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isGreaterThan(other: Short): boolean { return this.value > other.toShort(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left S...
public isGreaterThan(other: Short): boolean { return this.value > other.toShort(); }
https://gitcode.com/iop123123/arkts-static-skills
13c330d7485c10ed056e5f38ccec98a95abe81ce
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/PreferencesUtil.ets
arkts
has
检查是否包含指定键 @param key 键
static async has(key: string): Promise<boolean> { try { const prefs = await PreferencesUtil.getPreferences(); return await prefs.has(key); } catch (error) { console.error(`检查键是否存在失败: ${key}`, error); return false; } }
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 has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS...
static async has(key: string): Promise<boolean> { try { const prefs = await PreferencesUtil.getPreferences(); return await prefs.has(key); } catch (error) { console.error(`检查键是否存在失败: ${key}`, error); return false; } }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
406d1628d1c3d69e88c3bc3963b0c53324bf1917
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
getPermissions
获取权限列表
getPermissions(): string[] { try { const parsed = JSON.parse(this.permissionsJson) as string[]; return parsed; } catch (e) { return this.getDefaultPermissions(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
getPermissions(): string[] { try { const parsed = JSON.parse(this.permissionsJson) as string[]; return parsed; } catch (e) { return this.getDefaultPermissions(); } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ae7d427612ca428a87177da573d70b9d9320504f
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/ReminderSettingsPage.ets
arkts
getReminderTypeName
获取提醒类型名称
getReminderTypeName(type: ReminderType): string { switch (type) { case ReminderType.DAILY_RECORD: return '每日记录'; case ReminderType.DRINK_WATER: return '喝水提醒'; case ReminderType.EXERCISE: return '运动提醒'; case ReminderType.SLEEP: return '睡眠提醒'; case Remin...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getReminderTypeName 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 ReminderType AST#identifier#Right AS...
getReminderTypeName(type: ReminderType): string { switch (type) { case ReminderType.DAILY_RECORD: return '每日记录'; case ReminderType.DRINK_WATER: return '喝水提醒'; case ReminderType.EXERCISE: return '运动提醒'; case ReminderType.SLEEP: return '睡眠提醒'; case Remin...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
b1e157a10b8f6ac58864e48716ea750272e4e506
github
veaba/EsptouchForHarmony
entry/src/main/ets/esptouch/provision/APProvisioner.ets
arkts
waitForConfirmation
Wait for ESP32 to confirm receipt. Listens for TCP data and parses JSON responses.
private async waitForConfirmation(): Promise<string> { if (this.tcpSocket == null) { throw new Error('TCP socket not connected'); } let sock: socket.TCPSocket = this.tcpSocket; let received: string = ''; let decoder: util.TextDecoder = new util.TextDecoder(); return new Promise<string>...
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 waitForConfirmation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async waitForConfirmation(): Promise<string> { if (this.tcpSocket == null) { throw new Error('TCP socket not connected'); } let sock: socket.TCPSocket = this.tcpSocket; let received: string = ''; let decoder: util.TextDecoder = new util.TextDecoder(); return new Promise<string>...
https://github.com/veaba/EsptouchForHarmony
efe5a07d5e25cee3867bb76ab78ad936f2342016
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/PermissionUtils.ets
arkts
setPermission
Sets a specific permission state @param permission The permission to set @param granted Whether the permission is granted
public setPermission(permission: Permissions, granted: boolean): void { this.mockPermissions.set(permission, granted); console.log(`[MOCK] Permission ${permission} explicitly set to ${granted ? 'GRANTED' : 'DENIED'}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setPermission(permission: Permissions, granted: boolean): void { this.mockPermissions.set(permission, granted); console.log(`[MOCK] Permission ${permission} explicitly set to ${granted ? 'GRANTED' : 'DENIED'}`); }
https://github.com/somnio-software/my-bot-pal
2f48186aa9c04448a5c1f2391d70c2ae6653710e
github
2763981847/Accounting-app
entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
insertData
插入一条账目数据
insertData(account: Account, callback: Function) { // 生成值桶(ValuesBucket),包含要插入的数据 const valueBucket: relationalStore.ValuesBucket = generateBucket(account); // 调用 Rdb 对象的插入数据方法,并传入回调函数 this.accountTable.insertData(valueBucket, callback); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Account AST#identifier#Righ...
insertData(account: Account, callback: Function) { // 生成值桶(ValuesBucket),包含要插入的数据 const valueBucket: relationalStore.ValuesBucket = generateBucket(account); // 调用 Rdb 对象的插入数据方法,并传入回调函数 this.accountTable.insertData(valueBucket, callback); }
https://github.com/2763981847/Accounting-app
0f2f19291cbe4cc56a06a809f60e325407e554f7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
values
Returns array values iterator @returns an iterator
public values(): ValuesIterator<Byte> { const ret = new Byte[this.length]; for (let i: int = 0; i < this.length; i++) { ret[i] = this.at(i); } return new ValuesIterator<Byte>(ret); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#iden...
public values(): ValuesIterator<Byte> { const ret = new Byte[this.length]; for (let i: int = 0; i < this.length; i++) { ret[i] = this.at(i); } return new ValuesIterator<Byte>(ret); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
53c6caaff7c69a5577c3b129d2521b3b11d993b0
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Boolean.ets
arkts
equals
Checks for equality this instance with provided object, treated as a Boolean @param other object to be checked against @returns true if provided object and this instance have same value, false otherwise Returns false if type of provided object is not the same as this type
public override equals(other: Object|null): boolean { if (other instanceof Boolean) { return this.value == (other as Boolean).unboxed(); } return false; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#...
public override equals(other: Object|null): boolean { if (other instanceof Boolean) { return this.value == (other as Boolean).unboxed(); } return false; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
0d29e5a1ce5f99be5f22c6c39c14f66acfa7ac04
gitee
openharmony/arkui_advanced_ui_component
atomicservicenavigation/source/atomicservicenavigation.ets
arkts
setShowSideBar
设置侧边栏显示隐藏状态 @param value 显示或隐藏状态
public setShowSideBar(value: boolean): void { this.isExpandSideBar = value; if (this.listener) { this.listener(value); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShowSideBar 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 ...
public setShowSideBar(value: boolean): void { this.isExpandSideBar = value; if (this.listener) { this.listener(value); } }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
d31848af68d7408e2ee7bea90eaeb738bee1974c
gitee
openharmony/applications_app_samples
code/BasicFeature/DeviceManagement/Location/entry/src/ohosTest/ets/test/Ability.test.ets
arkts
getResourceString
本地化资源
async function getResourceString(resource: Resource): Promise<string> { let manage = delegator.getAppContext().resourceManager let text = await manage.getStringValue(resource) return text }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getResourceString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resource AST#identifier#Right A...
async function getResourceString(resource: Resource): Promise<string> { let manage = delegator.getAppContext().resourceManager let text = await manage.getStringValue(resource) return text }
https://github.com/openharmony/applications_app_samples
9f81c98dd34f556c25e617ae7eeaa9fdb7b832db
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
intersect
Returns the intersection of the current range and the range specified by the given lower and upper bounds. @param { ScopeType } lowerObj - A ScopeType value @param { ScopeType } upperObj - A ScopeType value @returns { ScopeHelper } Returns the intersection of the current range and the range specified by the given lower...
intersect(lowerObj: T, upperObj: T): ScopeHelper<T> { let lowerLimit = this._lowerLimit.compareTo(lowerObj) ? this._lowerLimit : lowerObj let upperLimit = this._upperLimit.compareTo(upperObj) ? upperObj : this._upperLimit return new ScopeHelper<T>(lowerLimit, upperLimit) ...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left intersect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lowerObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERRO...
intersect(lowerObj: T, upperObj: T): ScopeHelper<T> { let lowerLimit = this._lowerLimit.compareTo(lowerObj) ? this._lowerLimit : lowerObj let upperLimit = this._upperLimit.compareTo(upperObj) ? upperObj : this._upperLimit return new ScopeHelper<T>(lowerLimit, upperLimit) ...
https://gitcode.com/iop123123/arkts-static-skills
291fc2d0a3866c8cf53f814d23408c80428c623b
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/services/FamilyService.ets
arkts
setAuthorization
设置患者授权
async setAuthorization(patientId: string, familyId: string, authorizationLevel: number): Promise<boolean> { try { const data: Record<string, string> = { 'familyId': familyId, 'authorizationLevel': authorizationLevel.toString() }; const response = await HttpUtil.post<boolean>(`/pa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setAuthorization AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left patientId AST#identifier#Right AST#type_annotation#Left AST#:#...
async setAuthorization(patientId: string, familyId: string, authorizationLevel: number): Promise<boolean> { try { const data: Record<string, string> = { 'familyId': familyId, 'authorizationLevel': authorizationLevel.toString() }; const response = await HttpUtil.post<boolean>(`/pa...
https://github.com/LJ666-ui/harmony-health-care
be3cbe3d49089b5bf34494718f4805d18acf4bec
github
LJ666-ui/harmony-health-care
entry/src/main/ets/config/RouteConfigManager.ets
arkts
getRouteMeta
获取路由元信息 @param path 路由路径 @returns RouteMeta | undefined
public getRouteMeta(path: string): RouteMeta | undefined { const normalizedPath = this.normalizePath(path); return this.routeMetas.get(normalizedPath); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRouteMeta 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 str...
public getRouteMeta(path: string): RouteMeta | undefined { const normalizedPath = this.normalizePath(path); return this.routeMetas.get(normalizedPath); }
https://github.com/LJ666-ui/harmony-health-care
7e04ef186d4353424c01bf558b06fbb92187f565
github
aimilin6688/KeePassHO
entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets
arkts
getFieldValue
获取字段值 @param entry KeePass 条目 @param fieldName 字段名称 @returns 字段值
private getFieldValue(entry: KdbxEntry, fieldName: string): string { const value = entry.fields.get(fieldName); return value ? KdbxUtils.getValueString(value) : ''; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFieldValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private getFieldValue(entry: KdbxEntry, fieldName: string): string { const value = entry.fields.get(fieldName); return value ? KdbxUtils.getValueString(value) : ''; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets#L149-L152
8477620b3ace562e129a5cf894dc9e668850d4e4
github
dingzhilin1990/zhilinclaw
src/agents/HanwudiWorkflow.ets
arkts
step7_Archive
步骤 7: 成果归档
private async step7_Archive(executionResult: any, qualityResult: any): Promise<any> { this.addLog(7, 'Recorder', '开始成果归档', 'started'); const archiveResult = { finalDeliverables: executionResult.documents, qualityReport, archivedAt: Date.now() }; this.addLog(7, 'Recorder', '...
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 step7_Archive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left executionResult AST#identifier#Right AST#ERROR#Left AS...
private async step7_Archive(executionResult: any, qualityResult: any): Promise<any> { this.addLog(7, 'Recorder', '开始成果归档', 'started'); const archiveResult = { finalDeliverables: executionResult.documents, qualityReport, archivedAt: Date.now() }; this.addLog(7, 'Recorder', '...
https://github.com/dingzhilin1990/zhilinclaw
59f0cde8da2dcb64583fb9e3e821915bcfba3276
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { Float64Array } - a new Float64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): Float64Array { let res = new Float64Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): Float64Array { let res = new Float64Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
7a6f33ae0062b2c0f69f08ec0a6a87e8e70fe1c5
gitcode
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
runScheduledSync
Scheduler path for local-write/foreground follow-up syncs. Re-marking is idempotent and keeps the scheduled path robust after process restart, feature-toggle changes, or a missed startup mark.
static async runScheduledSync( context: common.UIAbilityContext, reason: string, ): Promise<boolean> { const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { DiagnosticLogger.info('cloud_sync', 'cloud_sync_scheduled_mark_skipped', { reason: reason }) return...
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 runScheduledSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left...
static async runScheduledSync( context: common.UIAbilityContext, reason: string, ): Promise<boolean> { const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { DiagnosticLogger.info('cloud_sync', 'cloud_sync_scheduled_mark_skipped', { reason: reason }) return...
https://github.com/honjow/Next2V
9fcd49ca96985d7dd98b0e11050bf7a79b785e27
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/ui/web_ui.ets
arkts
reg_webview_js
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Webview功能注册 // /////////////////
reg_webview_js() { try {this.web_ui_core.registerJavaScriptProxy({ ////////////// // 基础功能类 // ////////////// // ready // ready: () => { log('页面准备完成.') // 开启监听 // this.switch_emitter(true) this.ready = true }, // 震动 // vib: () => {vib...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reg_webview_js AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
reg_webview_js() { try {this.web_ui_core.registerJavaScriptProxy({ ////////////// // 基础功能类 // ////////////// // ready // ready: () => { log('页面准备完成.') // 开启监听 // this.switch_emitter(true) this.ready = true }, // 震动 // vib: () => {vib...
https://github.com/Nekofox-POT/LinMusic
0d16815051a105e4439a94ef056d6de566506d74
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
getDictionarySettings
==================== 字典设置 ==================== 获取字典设置
getDictionarySettings(): DictionarySettings { return this.cloneDictionarySettings(this.dictionarySettings); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDictionarySettings 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 DictionarySettings AST#identifier#Right ...
getDictionarySettings(): DictionarySettings { return this.cloneDictionarySettings(this.dictionarySettings); }
https://github.com/DaLongZhuaZi/manxia
0f0b0df404eacdf39c51aa15ae614e6c072c4363
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
loadMorePages
加载更多页面(用于动态翻页)
async loadMorePages(chapterId: string, mangaId?: string): Promise<EngineResult<Record<string, Object | undefined>>> { if (!this.config) { throw new MangaSourceError( MangaSourceErrorCode.CONFIG_NOT_LOADED, '配置未加载' ); } const startTime = Date.now(); logger.info(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 loadMorePages AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left chapterId AST#identifier#Right ...
async loadMorePages(chapterId: string, mangaId?: string): Promise<EngineResult<Record<string, Object | undefined>>> { if (!this.config) { throw new MangaSourceError( MangaSourceErrorCode.CONFIG_NOT_LOADED, '配置未加载' ); } const startTime = Date.now(); logger.info(TAG, `加载更多页面...
https://github.com/DaLongZhuaZi/manxia
b37557cde091bb0319576a945807425e94cab853
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
default
创建默认动画配置
static default(): AnimationConfig { return new AnimationConfig(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left default 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 AnimationConfi...
static default(): AnimationConfig { return new AnimationConfig(); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
ba74c18b191fa923e3fb1fc566b655f4647bfa4c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Data/UserManualData.ets
arkts
createUserManualChapters
创建使用手册章节列表
function createUserManualChapters(markdownContent: string): EBookChapter[] { const normalizedContent = markdownContent.replace(/\r\n/g, '\n'); const lines = normalizedContent.split('\n'); const chapters: EBookChapter[] = []; let currentTitle = '漫匣使用手册'; let currentLines: string[] = []; let currentStartPosit...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createUserManualChapters AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left markdownContent AST#identifier#Right AST#type_annotation#Left...
function createUserManualChapters(markdownContent: string): EBookChapter[] { const normalizedContent = markdownContent.replace(/\r\n/g, '\n'); const lines = normalizedContent.split('\n'); const chapters: EBookChapter[] = []; let currentTitle = '漫匣使用手册'; let currentLines: string[] = []; let currentStartPosit...
https://github.com/DaLongZhuaZi/manxia
4dd03831644ddeaf7edc7e67fbd0186cd7b5b6fe
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/DefaultProcessor.ets
arkts
doQuery
查询的公共方法 @param rdbStore rdb数据库 @param uri DataShare的uri @param columns 查询的列名 @param predicates 查询条件 @param callback 回调方法
doQuery(rdbStore: data_rdb.RdbStore, uri: string, columns: Array<string>, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { const table = getTableByUri(uri); let queryInnerFun = (err: BusinessError, resultSet: data_rdb.ResultSet) => { Log.log(this.logTag, `query ${tabl...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rdbStore AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left da...
doQuery(rdbStore: data_rdb.RdbStore, uri: string, columns: Array<string>, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { const table = getTableByUri(uri); let queryInnerFun = (err: BusinessError, resultSet: data_rdb.ResultSet) => { Log.log(this.logTag, `query ${tabl...
https://gitee.com/openharmony/applications_calendar_data.git
30162c7b89f77450565c95287ade227261d546e4
gitee
richshaw2015/nds
ohos/entry/src/test/AxisDeadZoneProperty.test.ets
arkts
nextFloat
Generate a float in [min, max]
nextFloat(min: number, max: number): number { return this.next() * (max - min) + min; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nextFloat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#...
nextFloat(min: number, max: number): number { return this.next() * (max - min) + min; }
https://github.com/richshaw2015/nds
ca8b5f074e0b22cabb601a283e88ea1b235fdd9b
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/JumpService.ets
arkts
jumpToSystemSettings
跳转到系统设置页 (权限设置)
public jumpToSystemSettings() { this.logger.info('Jumping to system settings...'); if (this.context) { const want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility' }; // 注意:不同系统的设置页 AbilityName 可能不同,这里仅作示例 this.context...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left jumpToSystemSettings 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#{...
public jumpToSystemSettings() { this.logger.info('Jumping to system settings...'); if (this.context) { const want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility' }; // 注意:不同系统的设置页 AbilityName 可能不同,这里仅作示例 this.context...
https://gitcode.com/openharmony/codelabs
6d519ed3accd5d70c7bc3333dd715df00d9f0bdf
gitcode
XHXYT/Pixark
entry/src/main/ets/common/entity/DownloadTask.ets
arkts
getSpeed
获取当前下载速度字符串 @returns 如 "1.2 MB/s" 或空字符串
getSpeed(): string { if (this.currentSpeed <= 0 || this.status !== request.agent.State.RUNNING) { return ''; } return `${this.formatFileSize(this.currentSpeed)}/s`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSpeed 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_blo...
getSpeed(): string { if (this.currentSpeed <= 0 || this.status !== request.agent.State.RUNNING) { return ''; } return `${this.formatFileSize(this.currentSpeed)}/s`; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/entity/DownloadTask.ets#L102-L107
6eb2c98617304a006f1f7dcc0b0751af8932246f
github
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
favCat
Favorite border-color (e.g. '#f00') → favcat slot index ('1'). Lazily built once.
static favCat(): Map<string, string> { if (EhConstants.favCatMap === null) { const m: Map<string, string> = new Map<string, string>() m.set('#000', '0') m.set('#f00', '1') m.set('#fa0', '2') m.set('#dd0', '3') m.set('#080', '4') m.set('#9f4', '5') m.set('#4bf', '6')...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left favCat 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_stat...
static favCat(): Map<string, string> { if (EhConstants.favCatMap === null) { const m: Map<string, string> = new Map<string, string>() m.set('#000', '0') m.set('#f00', '1') m.set('#fa0', '2') m.set('#dd0', '3') m.set('#080', '4') m.set('#9f4', '5') m.set('#4bf', '6')...
https://github.com/erosTeam/NextE
01797e136014328aa6d19d4db97bdf9459ebf9bd
github