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
openharmony/arkui_ace_engine
examples/EventProject/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
[StartExclude entryAbility_start]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
https://gitcode.com/openharmony/arkui_ace_engine
ea9e1c48880faf3ceda34b31c08cd6c82f7740a8
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/DatabaseConfigOptimizer.ets
arkts
getConfig
获取当前数据库配置信息 @returns 配置信息对象
static async getConfig(): Promise<DatabaseConfig> { try { const store = DatabaseManager.getDatabase(); // 查询各项配置 const journalModeRs = await store.querySql('PRAGMA journal_mode;'); const cacheSizeRs = await store.querySql('PRAGMA cache_size;'); const synchronousRs = await stor...
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 getConfig 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 getConfig(): Promise<DatabaseConfig> { try { const store = DatabaseManager.getDatabase(); // 查询各项配置 const journalModeRs = await store.querySql('PRAGMA journal_mode;'); const cacheSizeRs = await store.querySql('PRAGMA cache_size;'); const synchronousRs = await stor...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
96f6fb57306b2c0c2978ee8df3fde82ed4665a86
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
getInstance
获取ImageKnife单例 @returns 返回ImageKnife单例对象
public static getInstance(): ImageKnife { if (!ImageKnife.instance) { ImageKnife.instance = new ImageKnife(); } return ImageKnife.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): ImageKnife { if (!ImageKnife.instance) { ImageKnife.instance = new ImageKnife(); } return ImageKnife.instance; }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L35-L40
df46192c53d6b3cf0a2c44e57164b6a5dd56a114
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/PreferencesService.ets
arkts
getChatFontSize
获取聊天字体大小
async getChatFontSize(): Promise<number> { return await this.getNumber(PreferenceKeys.CHAT_FONT_SIZE, 15) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getChatFontSize 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#gene...
async getChatFontSize(): Promise<number> { return await this.getNumber(PreferenceKeys.CHAT_FONT_SIZE, 15) }
https://github.com/LongLiveY96/chatcube
4912b1c2741b4cae66806b8980c732033f37a07b
github
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/Medicine/MedicineList.ets
arkts
onCartChange
监听购物车变化,强制刷新列表以更新购买数量显示 当购物车变化时,重新赋值 filteredList 触发 UI 更新
onCartChange() { // If not searching, refresh local list. If searching, we might want to keep search results? // For simplicity, just re-trigger filter logic this.onFilterChange() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCartChange 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 ...
onCartChange() { // If not searching, refresh local list. If searching, we might want to keep search results? // For simplicity, just re-trigger filter logic this.onFilterChange() }
https://github.com/luojiang001/Pulse
740ce687de69cbf9262c58240b448679d27721d3
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
arkts
constructor
月视图周信息。月视图上点击上个月日期进行月份切换时需要用到
constructor(year: number, month: number, date: number, week: number) { this.year = year; this.month = month; this.date = date; this.week = week; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A...
constructor(year: number, month: number, date: number, week: number) { this.year = year; this.month = month; this.date = date; this.week = week; }
https://gitcode.com/arkui-x/samples
6b4523a94242748174b0c3636576aa2574963049
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/NotificationService.ets
arkts
markAsRead
标记通知为已读 @param notificationId 通知ID
static async markAsRead(notificationId: number): Promise<void> { await NotificationDAO.markAsRead(notificationId); }
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 markAsRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left notificationId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async markAsRead(notificationId: number): Promise<void> { await NotificationDAO.markAsRead(notificationId); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
694dca55b523bc924d7ad0b79f43b1f72c641f63
github
ibestservices/ibest-ui
entry/src/main/ets/utils/routerUtil.ets
arkts
navPathStack
获取当前路由栈
public static get navPathStack(): NavPathStack { return RouterUtil.navPathStackList.length ? RouterUtil.navPathStackList[RouterUtil.navPathStackList.length - 1] : new NavPathStack() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left navPathStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right A...
public static get navPathStack(): NavPathStack { return RouterUtil.navPathStackList.length ? RouterUtil.navPathStackList[RouterUtil.navPathStackList.length - 1] : new NavPathStack() }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/entry/src/main/ets/utils/routerUtil.ets#L5-L7
d2ffb8e2bca919ceeb37c605b64a0dac39face21
github
HarmonyOS_Samples/BestPracticeSnippets
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
getData
Get the data corresponding to the index. @param {number} index Data index. @returns Return ProductItem.
public getData(index: number): MediaItem { return this.dataArray[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): MediaItem { return this.dataArray[index]; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
dffbee6bfb74a4325de1e827faadbb66a6b7deb2
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
updateBookshelfSettings
更新书架设置
async updateBookshelfSettings(settings: BookshelfSettings): Promise<void> { this.bookshelfSettings = this.cloneBookshelfSettings(settings); await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.BOOKSHELF_SETTINGS, this.bookshelfSettings); logger.info(TAG, '书架设置已更新'); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateBookshelfSettings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#iden...
async updateBookshelfSettings(settings: BookshelfSettings): Promise<void> { this.bookshelfSettings = this.cloneBookshelfSettings(settings); await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.BOOKSHELF_SETTINGS, this.bookshelfSettings); logger.info(TAG, '书架设置已更新'); }
https://github.com/DaLongZhuaZi/manxia
cba6f11fdc24abbb771de77afaf507c33ff7f01c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
parseChapterNumber
解析章节编号(支持中文数字)
private static parseChapterNumber(numStr: string): number { // 如果是纯数字 if (/^\d+$/.test(numStr)) { return parseInt(numStr, 10); } // 中文数字转换 let result = 0; let temp = 0; let prevUnit = 1; for (const char of numStr) { const num = TxtMetadataExtractor.CHINESE_NUM_MAP[char]; ...
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 parseChapterNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numStr AST#identifier#Right AST#:...
private static parseChapterNumber(numStr: string): number { // 如果是纯数字 if (/^\d+$/.test(numStr)) { return parseInt(numStr, 10); } // 中文数字转换 let result = 0; let temp = 0; let prevUnit = 1; for (const char of numStr) { const num = TxtMetadataExtractor.CHINESE_NUM_MAP[char]; ...
https://github.com/DaLongZhuaZi/manxia
623ebbec14bd28c1cc51d17e47cf04e8027ef682
github
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseConfig.ets
arkts
setQueryCache
配置查询缓存 @param enabled 是否启用 @param maxSize 最大条目数 @param ttlMs 缓存 TTL(毫秒) @returns this(支持链式调用)
setQueryCache(enabled: boolean, maxSize?: number, ttlMs?: number): DatabaseConfig { this.enableQueryCache = enabled if (maxSize !== undefined) { this.queryCacheMaxSize = maxSize } if (ttlMs !== undefined) { this.queryCacheTtlMs = ttlMs } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setQueryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#,#Left...
setQueryCache(enabled: boolean, maxSize?: number, ttlMs?: number): DatabaseConfig { this.enableQueryCache = enabled if (maxSize !== undefined) { this.queryCacheMaxSize = maxSize } if (ttlMs !== undefined) { this.queryCacheTtlMs = ttlMs } return this }
https://github.com/offlinecat-dev/OCNetORM
65aee847bfc816045b123859a6c37fcd61762c2a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getName
Returns name of type @throws {Error} error in case of absence of name @returns {string} type name @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override getName(): string { return "null" }
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 getName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public override getName(): string { return "null" }
https://gitcode.com/iop123123/arkts-static-skills
6a87d37d558c5e3e7f435f7fb517d53a03ec725e
gitcode
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/DefaultProcessor.ets
arkts
doBatchInsert
批量插入的公共方法 @param rdbStore rdb数据库 @param uri DataShare的uri @param values 插入的数据 @param callback 回调方法
doBatchInsert(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket[], callback: Function) { const table = getTableByUri(uri); rdbStore.batchInsert(table, values, (err, rowId) => { Log.log(this.logTag, `insert ${table} before callback`); callback(err, rowId); if (hasNoError...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doBatchInsert 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#L...
doBatchInsert(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket[], callback: Function) { const table = getTableByUri(uri); rdbStore.batchInsert(table, values, (err, rowId) => { Log.log(this.logTag, `insert ${table} before callback`); callback(err, rowId); if (hasNoError...
https://gitee.com/openharmony/applications_calendar_data.git
3e02ef479a2026611318cf500cc28269d93ef389
gitee
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets
arkts
getRdbPredicates
get RdbPredicates by table name @param tableName
getRdbPredicates(tableName: string) { return new relationalStore.RdbPredicates(tableName) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbPredicates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right...
getRdbPredicates(tableName: string) { return new relationalStore.RdbPredicates(tableName) }
https://gitee.com/openharmony/applications_notes.git
d04c144cb6f222b92d0c06a6385c8eac6a563482
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_ulong.ets
arkts
main
--- desc: check left shift operation for unsigned long integer ---
function main(): void { const a: ulong = {{v.left}} const b: int = {{v.right}} assert (a << b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ulong = {{v.left}} const b: int = {{v.right}} assert (a << b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
00886f1ee49d0d41b03f88fdcdba9a02ee4567a0
gitee
openharmony/applications_mms
entry/src/main/ets/pages/settings/settingsController.ets
arkts
integration
Notification information integration
integration(isOn: boolean) { let messageCode = common.route.MESSAGE_CODE_UPDATE_ARCHIVE_INFO_MESSAGES_VALUE; if (this.integrationSwitch.value != isOn) { globalThis.needToUpdate = true; } let actionData: LooseObject = {}; this.integrationSwitch.value = isOn; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left integration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isOn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right ...
integration(isOn: boolean) { let messageCode = common.route.MESSAGE_CODE_UPDATE_ARCHIVE_INFO_MESSAGES_VALUE; if (this.integrationSwitch.value != isOn) { globalThis.needToUpdate = true; } let actionData: LooseObject = {}; this.integrationSwitch.value = isOn; ...
https://gitee.com/openharmony/applications_mms.git
41cca3b70346948e14bc99e505e9e6209f421f34
gitee
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/call/common/CallStore.ets
arkts
reset
重置通话状态
reset(): void { this._stopTimer(); this.activeCall = new ActiveCallInfo(); this.selfInfo = new CallParticipantInfo(''); this.allParticipants = []; this.networkQualities = new Map(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this._stopTimer(); this.activeCall = new ActiveCallInfo(); this.selfInfo = new CallParticipantInfo(''); this.allParticipants = []; this.networkQualities = new Map(); }
https://github.com/Tencent-RTC/TUIKit_Harmony
b731f10fcc9b0789cef5c3fdef532c75b5f37aa1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
reduceRight
Executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value. Order is from right-to-left. @param fn reduce function @retu...
public reduceRight(fn: (a: T, b: T) => T): T { if (this.data.length == 0) { throw new TypeError("Reduce of empty array with no initial value") } let acc: T = this.data[this.data.length - 1] for(let i = this.data.length - 2; i >= 0; i--) { acc = fn(acc, this.da...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
public reduceRight(fn: (a: T, b: T) => T): T { if (this.data.length == 0) { throw new TypeError("Reduce of empty array with no initial value") } let acc: T = this.data[this.data.length - 1] for(let i = this.data.length - 2; i >= 0; i--) { acc = fn(acc, this.da...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
fabdc5c43836240d2414d05ce1513155105fa285
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toLocaleString
Converts Int8Array to a string with respect to locale @param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an array of such strings @param { object } [ options ] An object with configuration properties. @returns { string } - string representation @syscap SystemCapability.Utils.Lang @FaAnd...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): string { if (this.lengthInt > 0) { const res: StringBuilder = new StringBuilder() res.append(this.getUnsafe(0).toLocaleString(locales, options)) for (let i: int = 1; i < this.lengthInt; ++i)...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Rig...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): string { if (this.lengthInt > 0) { const res: StringBuilder = new StringBuilder() res.append(this.getUnsafe(0).toLocaleString(locales, options)) for (let i: int = 1; i < this.lengthInt; ++i)...
https://gitcode.com/iop123123/arkts-static-skills
a04fc8b7ce5f4671f1814267ae9e23762dbebd46
gitcode
AGenUI/AGenUI
playground/harmony/entry/src/ohosTest/ets/test/tests/ReentrantDeadlockTest.ets
arkts
buildCreateSurfaceJSON
Build createSurface JSON
function buildCreateSurfaceJSON(surfaceId: string): string { return `{"version":"v0.9","createSurface":{"surfaceId":"${surfaceId}","catalogId":"https://a2ui.org/specification/v0_9/basic_catalog.json"}}`; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildCreateSurfaceJSON AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surfaceId AST#identifier#Right AST#type_annotation#Left AST#:#L...
function buildCreateSurfaceJSON(surfaceId: string): string { return `{"version":"v0.9","createSurface":{"surfaceId":"${surfaceId}","catalogId":"https://a2ui.org/specification/v0_9/basic_catalog.json"}}`; }
https://github.com/AGenUI/AGenUI
c1a97124953e8a8900b449dc252a66d9aceaeab9
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets
arkts
finishAfterFeedbackHold
── Finish flow ────────────────────────────────────────────────────────────
private finishAfterFeedbackHold(endStatus: BattleStatus | undefined): void { this.transport.send(encodeEnd(endStatus === BattleStatus.Won ? 'won' : 'lost')); this.scheduler((): void => { if (this.disposed || this.finishNotified) { return; } this.finishNotified = true; // Termin...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left finishAfterFeedbackHold AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left endStatus AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
private finishAfterFeedbackHold(endStatus: BattleStatus | undefined): void { this.transport.send(encodeEnd(endStatus === BattleStatus.Won ? 'won' : 'lost')); this.scheduler((): void => { if (this.disposed || this.finishNotified) { return; } this.finishNotified = true; // Termin...
https://github.com/terryma2024/happyword
b7fd6964747870bff5583bebf8c49c943c95e0a4
github
PollenWang6/HiXD
entry/src/main/ets/services/DormWaterService.ets
arkts
login
===== 短信验证码登录 =====
async login(phone: string, smsCode: string): Promise<DormWaterLoginResult> { const headers: Record<string, string> = {}; for (const key of Object.keys(COMMON_HEADERS)) { headers[key] = COMMON_HEADERS[key]; } headers['content-type'] = 'application/json'; headers['User-Agent'] = USER_AGENT; const b...
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 phone AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async login(phone: string, smsCode: string): Promise<DormWaterLoginResult> { const headers: Record<string, string> = {}; for (const key of Object.keys(COMMON_HEADERS)) { headers[key] = COMMON_HEADERS[key]; } headers['content-type'] = 'application/json'; headers['User-Agent'] = USER_AGENT; const b...
https://github.com/PollenWang6/HiXD
748bc1db05a82819cfe1c847456311399141aeb7
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
handleRecordingComplete
录音完成处理
handleRecordingComplete(recording: Recording): void { this.newRecordings.push(recording) Logger.info(TAG, `New recording added: ${recording.id}`) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRecordingComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recording AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Recording AST#identifier#Ri...
handleRecordingComplete(recording: Recording): void { this.newRecordings.push(recording) Logger.info(TAG, `New recording added: ${recording.id}`) }
https://gitcode.com/openharmony/codelabs
afabb366726da87695de77549bb446c731461236
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
applyPcPlaybackDecorButtonStyle
For PC free-window + immersive title: dark title-bar control icons in full-screen playback, restore snapshot when leaving. Check {@link WindowInfo.immersiveDecor} to match the home page. @param enter True to apply dark playback style; false to restore the saved style.
applyPcPlaybackDecorButtonStyle(enter: boolean): void { if (this.mainWindow === undefined) { return; } const win = this.mainWindow; try { if (enter) { if (this.playbackSavedDecorButtonStyle === undefined) { this.playbackSavedDecorButtonStyle = win.getDecorButtonStyle(); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyPcPlaybackDecorButtonStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#...
applyPcPlaybackDecorButtonStyle(enter: boolean): void { if (this.mainWindow === undefined) { return; } const win = this.mainWindow; try { if (enter) { if (this.playbackSavedDecorButtonStyle === undefined) { this.playbackSavedDecorButtonStyle = win.getDecorButtonStyle(); ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
c2b7823644372238f38086b4eee70c9705fdd04e
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets
arkts
sendHttpRequest
发送HTTP请求 @param url 请求URL @param method 请求方法 @param body 请求体 @return Promise<Record<string, Object>> 响应数据 @throws 如果请求失败则抛出异常
protected async sendHttpRequest(url: string, method: http.RequestMethod, body?: Record<string, string>): Promise<Record<string, Object>> { const httpRequest = http.createHttp(); try { const options: http.HttpRequestOptions = { method: method, connectTimeout: this.requestTimeout, ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left sendHttpRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#...
protected async sendHttpRequest(url: string, method: http.RequestMethod, body?: Record<string, string>): Promise<Record<string, Object>> { const httpRequest = http.createHttp(); try { const options: http.HttpRequestOptions = { method: method, connectTimeout: this.requestTimeout, ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L217-L255
cd18754e11f708c864b218b3baccf2d7865e78f4
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GamepadManager.ets
arkts
handleAxisEvent
处理手柄轴事件 D-Pad HAT 轴 (axisId 15/16) 特殊处理: 部分手柄的 D-Pad 同时通过按键回调 (buttonCode 2012-2015) 和 HAT 轴回调报告。 为保证用户清空"方向键"手柄绑定后 HAT 轴也不再生效, 将 HAT 轴事件转换为等效的 D-Pad buttonCode,走 processGamepadButton 逻辑。
private handleAxisEvent(axisId: number, value: number): void { // D-Pad HAT 轴 → 转换为 D-Pad 按键事件,与 gamepadMappings 联动 if (axisId === 15 || axisId === 16) { this.handleHatAxisAsButton(axisId, value) return } const results: ProcessResult[] = this.inputProcessor.processGamepadAxis(axisId, value...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleAxisEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axisId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private handleAxisEvent(axisId: number, value: number): void { // D-Pad HAT 轴 → 转换为 D-Pad 按键事件,与 gamepadMappings 联动 if (axisId === 15 || axisId === 16) { this.handleHatAxisAsButton(axisId, value) return } const results: ProcessResult[] = this.inputProcessor.processGamepadAxis(axisId, value...
https://github.com/richshaw2015/nds
f54fc059cb268da180349394bc00f0f239387c8d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setUTCHours
Sets the hour for a specified date according to universal time. @param { int } value new hours @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setUTCHours(value: int): long { let hours = ecmaHourFromTime(this.ms); this.ms -= msPerHour * hours; this.ms += msPerHour * value; return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public setUTCHours(value: int): long { let hours = ecmaHourFromTime(this.ms); this.ms -= msPerHour * hours; this.ms += msPerHour * value; return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
81a64ad7e1d45ef802d97c280ea453facad23719
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
lastIndexOf
Finds the last occurrence of a character in this String. @param ch to find @returns index of the character from the beginning of this string, or -1 if not found
public lastIndexOf(ch: char): int { return this.lastIndexOf(ch, this.length()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left char A...
public lastIndexOf(ch: char): int { return this.lastIndexOf(ch, this.length()); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
19dd6fa2b07387b4fc073e20f50d95c79aa5438e
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/mindsphere/MindSporeLiteEngine.ets
arkts
assessRisk
执行共病风险评估(核心方法)
async assessRisk(input: RiskAssessmentInput): Promise<RiskAssessmentOutput> { const startTime = Date.now(); if (!this.isInitialized) { await this.initialize(); } try { let probabilities: number[]; if (this.useRealModel) { probabilities = await this.runRealInference(input);...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left assessRisk AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async assessRisk(input: RiskAssessmentInput): Promise<RiskAssessmentOutput> { const startTime = Date.now(); if (!this.isInitialized) { await this.initialize(); } try { let probabilities: number[]; if (this.useRealModel) { probabilities = await this.runRealInference(input);...
https://github.com/LJ666-ui/harmony-health-care
c0b5e53ba69bd5321f64567caff0177457c5abb1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Double.ets
arkts
toLocaleString
Without an argument method returns just toString value @returns result of the conversion
public toLocaleString(): String { return Double.toString(this.value, 10); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left String ...
public toLocaleString(): String { return Double.toString(this.value, 10); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
009cc54fc0f705a57e6a5b7000bdf8bed4af7fe1
gitee
axiomaster/bonio
harmonyos/entry/src/main/ets/voice/VoiceWakeManager.ets
arkts
handleEndOfSpeech
Handle end of speech — schedule restart to continue listening.
public handleEndOfSpeech(): void { this.scheduleRestart(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleEndOfSpeech 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#expr...
public handleEndOfSpeech(): void { this.scheduleRestart(); }
https://github.com/axiomaster/bonio
d4a0f9f4737fa61ff33fa21848ca0c6a86a0175b
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
toggleRound
切换圆角形状开关 @param value 新的开关状态
toggleRound(value: boolean): void { this.switchRound = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleRound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A...
toggleRound(value: boolean): void { this.switchRound = value; }
https://github.com/codelably/tuniao-ui
75589567c31c2778a80304c608e0251a016e8814
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test30_original_index.ets
arkts
safeDivide
--- Nested try-catch with throw ---
function safeDivide(a: number, b: number): number { try { if (b === 0) { throw new Error('Division by zero'); } return a / b; } catch (e) { return -1; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left safeDivide AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function safeDivide(a: number, b: number): number { try { if (b === 0) { throw new Error('Division by zero'); } return a / b; } catch (e) { return -1; } }
https://github.com/miaochiahao/ark-ghidra
60e78b3f9d0172cd27ff9a6f2bb1044d56d78de0
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
slow
创建慢速动画配置
static slow(): AnimationConfig { let config = new AnimationConfig(); config.duration = 400; config.interpolator = InterpolatorType.ACCELERATE_DECELERATE; return config; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left slow AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
static slow(): AnimationConfig { let config = new AnimationConfig(); config.duration = 400; config.interpolator = InterpolatorType.ACCELERATE_DECELERATE; return config; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
63429b21b6fc95697511c3957ff237fefbc8aa66
gitcode
Jack-TCN/richEditor
src/main/ets/controller/RichEditorController.ets
arkts
clearAllContent
清除所有内容 @param context
clearAllContent(context: UIContext) { context.showAlertDialog( { message: '是否确认删除所有文字?', autoCancel: true, alignment: DialogAlignment.Center, primaryButton: { value: '取消', action: () => { }, }, secondaryButton: { enabled...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearAllContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST#identifi...
clearAllContent(context: UIContext) { context.showAlertDialog( { message: '是否确认删除所有文字?', autoCancel: true, alignment: DialogAlignment.Center, primaryButton: { value: '取消', action: () => { }, }, secondaryButton: { enabled...
https://github.com/Jack-TCN/richEditor
0f3b9452d9026eebaad494ef48efe30a00601a13
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/StringReader.ets
arkts
_getCharLength
返回字符数,如果字符串中包含多字节字符,字符长度可能与字节长度不同 @param string
private _getCharLength(characters: string): number { let length:number=characters.length if (length < 2 || !this._multiByteMode) { return length; } return characters.replace(RegexConstants.REGEX_MULTIBYTE, '_').length; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _getCharLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left characters AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private _getCharLength(characters: string): number { let length:number=characters.length if (length < 2 || !this._multiByteMode) { return length; } return characters.replace(RegexConstants.REGEX_MULTIBYTE, '_').length; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
91857d1ed7f0f3821c6f7c5d31546f980e6acfb0
gitee
Jack-TCN/richEditor
src/main/ets/controller/RichEditorController.ets
arkts
addHistoryRecord
增加历史记录 @param styledString
addHistoryRecord(styledString: MutableStyledString){ this.currentIndex++; this.historyRecordArray.push(new ChangeRecord(styledString)) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addHistoryRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left styledString AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MutableStyledStr...
addHistoryRecord(styledString: MutableStyledString){ this.currentIndex++; this.historyRecordArray.push(new ChangeRecord(styledString)) }
https://github.com/Jack-TCN/richEditor
8f3c575c3f22bbe4bf12cfc0eb3c50622f3db311
github
erosTeam/NextE
shared/src/main/ets/services/EhPageCacheService.ets
arkts
homeProfileKey
Per-custom-profile home list cache key (uuid-scoped so two gallery-type profiles with different searches don't collide on the old source-based key).
static homeProfileKey(isEx: boolean, uuid: string): string { return EhPageCacheService.scopedKey(isEx, `home:profile:${EhPageCacheService.encode(uuid)}`) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left homeProfileKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isEx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left b...
static homeProfileKey(isEx: boolean, uuid: string): string { return EhPageCacheService.scopedKey(isEx, `home:profile:${EhPageCacheService.encode(uuid)}`) }
https://github.com/erosTeam/NextE
d06daf4f03b06abfc8a0cdd2384dbfaaa6363f8c
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/common/database/ExerciseRecordDao.ets
arkts
getWeeklyStats
【新增】专门给周趋势图表使用的方法 (返回格式优化为 MM-DD) ExercisePage.ets 里的 openWeekTrend() 调用的就是这个方法 =========================================================================
async getWeeklyStats(): Promise<WeeklyStatsItem[]> { const store = RdbManager.getInstance().getRdbStore(); if (!store) { return []; } const result: WeeklyStatsItem[] = []; // 循环获取过去 7 天 for (let i = 6; i >= 0; i--) { const d = new Date(); d.setDate(d.getDate() - i); c...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWeeklyStats 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#gener...
async getWeeklyStats(): Promise<WeeklyStatsItem[]> { const store = RdbManager.getInstance().getRdbStore(); if (!store) { return []; } const result: WeeklyStatsItem[] = []; // 循环获取过去 7 天 for (let i = 6; i >= 0; i--) { const d = new Date(); d.setDate(d.getDate() - i); c...
https://gitcode.com/openharmony/codelabs
4cd2eb2f83947de0d5e15155dd90618e7862807f
gitcode
xiebyapps/ClipLink
entry/src/main/ets/services/PollingController.ets
arkts
start
Start polling
start(intervalSeconds: number, callback: () => Promise<void> | void): void { if (this.isRunning) { this.stop(); } this.intervalSeconds = intervalSeconds; this.callback = callback; this.isRunning = true; console.info(`[PollingController] Starting with interval ${intervalSeconds}s`); ...
AST#program#Left AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left intervalSeconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#binary_expression#Left AST#call_ex...
start(intervalSeconds: number, callback: () => Promise<void> | void): void { if (this.isRunning) { this.stop(); } this.intervalSeconds = intervalSeconds; this.callback = callback; this.isRunning = true; console.info(`[PollingController] Starting with interval ${intervalSeconds}s`); ...
https://github.com/xiebyapps/ClipLink
5eff182f8a49cd019cbaa0ba4497143cef04f1a1
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitSfixed64
访问 sfixed64 字段 JSON: string (避免精度丢失)
visitSfixed64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSfixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigint AST#identifier#Right AST#,#Left , ...
visitSfixed64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
8b1c0235ccb85c5aa26220bce8b327009a6f10f8
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/EventSourcingService.ets
arkts
createSnapshot
==================== 快照管理 ==================== 创建聚合快照
static async createSnapshot( aggregateType: string, aggregateId: number ): Promise<boolean> { try { // 重建当前状态 const state = await EventSourcingService.rebuildAggregateState(aggregateType, aggregateId); if (!state) { return false; } // 创建快照 const snapshot = ne...
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 createSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AST#:#...
static async createSnapshot( aggregateType: string, aggregateId: number ): Promise<boolean> { try { // 重建当前状态 const state = await EventSourcingService.rebuildAggregateState(aggregateType, aggregateId); if (!state) { return false; } // 创建快照 const snapshot = ne...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ec46253ddd254412912a907f250f1e5573035ef0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/15.unary_expressions/06.unary_minus_operator/unary_minus_onbound.ets
arkts
main
--- desc: Unary minus operator (onbound) (these are special cases for numeric overflow behavior. Special attention wanted). params: {{onb.type}} {{onb.origin}} => {{onb.dest}} ---
function main(): void { let a: {{onb.type}} = {{onb.origin}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let a: {{onb.type}} = {{onb.origin}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
285f5957feb7b50a6222c24e43ba6043b7b61fd5
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/ChartTouchListener.ets
arkts
endAction
Calls the OnChartGestureListener to do the end callback @param me
public endAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) { let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureEnd(isTouchEvent, me, this.mLastGesture); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left endAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boole...
public endAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) { let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener(); if (l != null) { l.onChartGestureEnd(isTouchEvent, me, this.mLastGesture); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a37e725c7b1096a1f25b41600e6bc4af837e5f65
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets
arkts
createBookmark
Create a bookmark for manga/ebook/novel.
async createBookmark(input: CreateBookmarkInput): Promise<UnifiedAnnotationRecord> { await this.ensureSchema(); const anchor = input.anchor || {}; const existing = await this.findLatestByAnchor( input.contentType, input.contentId, UnifiedAnnotationType.BOOKMARK, anchor ); i...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createBookmark AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async createBookmark(input: CreateBookmarkInput): Promise<UnifiedAnnotationRecord> { await this.ensureSchema(); const anchor = input.anchor || {}; const existing = await this.findLatestByAnchor( input.contentType, input.contentId, UnifiedAnnotationType.BOOKMARK, anchor ); i...
https://github.com/DaLongZhuaZi/manxia
94cb8ee395cf028d8df0a4029b3fcd297f48597d
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
setUserIdBlackList
�������ε�Ļ�û�id , 0 ��ʾ�ο͵�Ļ @param ids @return
public setUserIdBlackList(ids: number[]): DanmakuContext { this.mUserIdBlackList.splice(0, this.mUserIdBlackList.length); if (ids == null || ids.length == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_USER_ID_FILTER }); } else { this.mUserIdBlackList.push(...ids) t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUserIdBlackList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ids AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr...
public setUserIdBlackList(ids: number[]): DanmakuContext { this.mUserIdBlackList.splice(0, this.mUserIdBlackList.length); if (ids == null || ids.length == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_USER_ID_FILTER }); } else { this.mUserIdBlackList.push(...ids) t...
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
a2364c4f212bae3415d2d79990ad554578fc1ba4
gitee
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/WindowUtil.ets
arkts
isPhone
是否为手机设备(宽度 < 600vp)
static isPhone(): boolean { return WindowUtil.getWidthBreakpoint() < 2; // md 以下为手机 }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boole...
static isPhone(): boolean { return WindowUtil.getWidthBreakpoint() < 2; // md 以下为手机 }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
1cd84677927a25a35a3d767effaf2de0d7295c61
github
Bistu-OSSDT-2024/16-ArkNotes
database/MemoTable.ets
arkts
constructor
构造函数,执行getRdbStore方法
constructor(callback: Function = () => { }) { this.memoTable.getRdbStore(callback); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier...
constructor(callback: Function = () => { }) { this.memoTable.getRdbStore(callback); }
https://github.com/Bistu-OSSDT-2024/16-ArkNotes
813405bf618e98106c46d3ae6dfad2643bbe2bdb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
shelfContainsType
检查书架是否包含指定内容类型
shelfContainsType(shelf: TypeShelf, contentType: ShelfContentType): boolean { return shelf.contentTypes.includes(contentType); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shelfContainsType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shelf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TypeShelf AST#identifier#Right AST#,#...
shelfContainsType(shelf: TypeShelf, contentType: ShelfContentType): boolean { return shelf.contentTypes.includes(contentType); }
https://github.com/DaLongZhuaZi/manxia
416d03c675ed73c0407456e3056a268897d39e15
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/Constituency-12-smarthome/entry/src/main/ets/viewmodel/IndexViewModel.ets
arkts
getSettingListData
获取设置列表数据
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData('推送通知', $r('app.media.news'),'开关'), new ItemData('数据管理', $r('app.media.data'), null), new ItemData('菜单设置', $r('app.media.menu'), null), new ItemData('关于', $r('app.media.about'), null), new ItemDa...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSettingListData 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#...
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData('推送通知', $r('app.media.news'),'开关'), new ItemData('数据管理', $r('app.media.data'), null), new ItemData('菜单设置', $r('app.media.menu'), null), new ItemData('关于', $r('app.media.about'), null), new ItemDa...
https://gitee.com/openharmony/vendor_unionman.git
9e0783c14c345129ab4e853df6250c2032e71eca
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
urlEncode
URL编码 @param data 要编码的数据 @returns 编码后的字符串
private urlEncode(data: Record<string, string>): string { const params: string[] = []; const entries: Array<[string, string]> = Object.entries(data); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][1]; params.push(`${encodeURIComponent(key)}...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left urlEncode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre...
private urlEncode(data: Record<string, string>): string { const params: string[] = []; const entries: Array<[string, string]> = Object.entries(data); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][1]; params.push(`${encodeURIComponent(key)}...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L221-L230
b2f1e2d248d836f237af58a5d2c01d8bebd7f65f
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/repo.ets
arkts
build
pr子页面的viewModel对象
build() { Column() { //顶部导航栏 TitleBar({ title: '仓库详情' }) //Tabs切换页面,包含:概况、源码、Issue、PullRequest页面 Tabs() { //概况子页面 TabContent() { GeneralPage({ viewModel: $repoViewModel }) }.width('100%') .tabBar($r("app.string.general")) //源码子页面 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { //顶部导航栏 TitleBar({ title: '仓库详情' }) //Tabs切换页面,包含:概况、源码、Issue、PullRequest页面 Tabs() { //概况子页面 TabContent() { GeneralPage({ viewModel: $repoViewModel }) }.width('100%') .tabBar($r("app.string.general")) //源码子页面 ...
https://gitee.com/openharmony-sig/online_event.git
de9b7d1351e2dd047a484492e4bc28e1f17bfc88
gitee
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
lcsSvg
Generate LCS (Luminaire Classification System) diagram SVG @param width SVG width in pixels @param height SVG height in pixels @param theme Light or Dark theme @returns SVG string
public lcsSvg(width: number = 500, height: number = 400, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.lcsSvg(width, height, theme); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lcsSvg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Le...
public lcsSvg(width: number = 500, height: number = 400, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.lcsSvg(width, height, theme); }
https://github.com/holg/eulumdat-rs
184f16c6f4d4a5453cba8f72622cb1587a26382b
github
CLMC2025/Vignette
entry/src/main/ets/context/OfflineContext.ets
arkts
importDatabase
导入词汇数据库
importDatabase(json: string): boolean { try { const data = JSON.parse(json) as Array<WordImportData>; const wordInfos = data.map((item) => new WordInfo(item.word, item.pos, item.meaning)); this.addWords(wordInfos); return true; } catch (e) { console.error('[OfflineContextGenerato...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
importDatabase(json: string): boolean { try { const data = JSON.parse(json) as Array<WordImportData>; const wordInfos = data.map((item) => new WordInfo(item.word, item.pos, item.meaning)); this.addWords(wordInfos); return true; } catch (e) { console.error('[OfflineContextGenerato...
https://github.com/CLMC2025/Vignette
b48ada55a0efcf231b7b08aa57ec124e8973b2c0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_long.ets
arkts
main
--- desc: check prefix decrement for long integer operand ---
function main(): void { let value: long = {{v.value}} let result: long = --value assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: long = {{v.value}} let result: long = --value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e0d56229dd60730540a817684f4f7ae7cbaa824c
gitee
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets
arkts
resume
恢复播放 @returns {void}
resume(): void { if (!this.avPlayer) { logger.error('avPlayer no create.'); return; } this.avPlayer.play(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left ...
resume(): void { if (!this.avPlayer) { logger.error('avPlayer no create.'); return; } this.avPlayer.play(); }
https://gitcode.com/arkui-x/samples
e5382af7d296b6475416a4b528d64f724fba4030
gitcode
arkui-x/samples
CodeLab/Cases/feature/barchart/src/main/ets/view/CustomMarkerView.ets
arkts
draw
在指定位置绘制MarkerView弹窗
draw(c: CanvasRenderingContext2D, posX: number, posY: number, e: EntryOhos, highlight: Highlight) { let offset: MPPointF = this.getOffsetForDrawingAtPoint(posX, posY); c.save(); // 设置MarkerView弹窗中的字体大小 c.font = "normal normal 10vp"; // 将x坐标和y坐标都保留到小数点后一位 let roundX = Number(e.getX().toFixed(1)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#identifier...
draw(c: CanvasRenderingContext2D, posX: number, posY: number, e: EntryOhos, highlight: Highlight) { let offset: MPPointF = this.getOffsetForDrawingAtPoint(posX, posY); c.save(); // 设置MarkerView弹窗中的字体大小 c.font = "normal normal 10vp"; // 将x坐标和y坐标都保留到小数点后一位 let roundX = Number(e.getX().toFixed(1)...
https://gitcode.com/arkui-x/samples
1725e53aec405084bbde28f56dc8027aebc6c9fc
gitcode
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/StringReader.ets
arkts
readMatchRegex
读取符合正则表达式的字符 @param {RegExp}regex 返回符合正则表达式的字符 @return 读取到的符合正则表达式的字符
public readMatchRegex(regex:RegExp): string { if (!regex.sticky) { throw new Error('`regex` must have a sticky flag ("y")'); } regex.lastIndex = this._charsToBytes[this.charIndex]; let result = regex.exec(this.xmlDetailInfo); if (result === null) { return this.emptyString; } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readMatchRegex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left regex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public readMatchRegex(regex:RegExp): string { if (!regex.sticky) { throw new Error('`regex` must have a sticky flag ("y")'); } regex.lastIndex = this._charsToBytes[this.charIndex]; let result = regex.exec(this.xmlDetailInfo); if (result === null) { return this.emptyString; } ...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
6febb6c74fbfd91063c1a1c88521921ea2865695
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
pullNow
手动触发拉取 (fire-and-forget, 内部用)
pullNow(): void { this.pullNowAsync(); // fire Promise, 不 await }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pullNow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
pullNow(): void { this.pullNowAsync(); // fire Promise, 不 await }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
598a9a485cda0b99e9db677a958e70cbf0e2a187
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BuiltinArray.ets
arkts
asIntOrDefault
NOTE: autogenerated file
function asIntOrDefault(n: int | undefined, def: int): int { return n ?? def }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left asIntOrDefault AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function asIntOrDefault(n: int | undefined, def: int): int { return n ?? def }
https://gitcode.com/iop123123/arkts-static-skills
fb09e5893050465da8892967fd70b733f3789bfa
gitcode
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
getAnnotationParam
获取当前页面的@Route或@ZRoute注解中的参数 @returns
public getAnnotationParam(): RouteMetadata | undefined { this.updateCurrentStackName() return this.routerMgr.getAnnotationParam() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAnnotationParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp...
public getAnnotationParam(): RouteMetadata | undefined { this.updateCurrentStackName() return this.routerMgr.getAnnotationParam() }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L478-L481
bfa1466abacd5c1609d24af1d7474886cafa410b
github
HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts
entry/src/main/ets/abilities/TestAbility.ets
arkts
onCreate
The app is not started, click the pop-up to invoke it
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); const value = want.parameters?.['testKey']; hilog.info(0x0000, 'testTag', 'Succeeded in getting message data, value is %{public}s', value??'default value'); this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); const value = want.parameters?.['testKey']; hilog.info(0x0000, 'testTag', 'Succeeded in getting message data, value is %{public}s', value??'default value'); this....
https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts
d5c807bab3164b53e33a11dafed64da6e5435155
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getGlassBlurStyle
获取通用玻璃模糊样式(不区分主题)
public getGlassBlurStyle(): BlurStyle { return this.getGlassToken(GlassLevel.CARD).blurStyle; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGlassBlurStyle 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 Blur...
public getGlassBlurStyle(): BlurStyle { return this.getGlassToken(GlassLevel.CARD).blurStyle; }
https://github.com/DaLongZhuaZi/manxia
f634c2cae058d34b8b414cce6e40b232b1fc406d
github
erosTeam/NextE
shared/src/main/ets/settings/ViewedHistorySettings.ets
arkts
add
Record a viewed gallery: dedup by gid (move to front), set its time, cap, persist.
static async add(context: common.UIAbilityContext, entry: ViewedGallery): Promise<void> { if (entry.gid.length === 0) { return } const state = connectViewedHistory() const next: ViewedGallery[] = [entry] state.items.forEach((it: ViewedGallery) => { if (it.gid !== entry.gid && next.leng...
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 add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Righ...
static async add(context: common.UIAbilityContext, entry: ViewedGallery): Promise<void> { if (entry.gid.length === 0) { return } const state = connectViewedHistory() const next: ViewedGallery[] = [entry] state.items.forEach((it: ViewedGallery) => { if (it.gid !== entry.gid && next.leng...
https://github.com/erosTeam/NextE
c58efa8fe798df800c2da0edae54d0d4113d8963
github
YANGZX22/Voot
entry/src/main/ets/services/ContinuityService.ets
arkts
buildContinuityState
构建流转状态数据
static buildContinuityState( isListening: boolean, isTranslating: boolean, originalText: string, translatedText: string, sessionId: number, fullOriginalText: string, fullTranslatedText: string, apiConfigJson: string ): ContinuityState { return { isListening, isTransla...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildContinuityState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isListening AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean...
static buildContinuityState( isListening: boolean, isTranslating: boolean, originalText: string, translatedText: string, sessionId: number, fullOriginalText: string, fullTranslatedText: string, apiConfigJson: string ): ContinuityState { return { isListening, isTransla...
https://github.com/YANGZX22/Voot
cbc20f136ea0814699e98e70e6c17224a6e97299
github
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
registerDeviceStateListener
Register the device status listener.
registerDeviceStateListener(): void { if (this.myDeviceManager === undefined) { Logger.error('RemoteDeviceModel', 'registerDeviceStateListener deviceManager has not initialized'); return; } try { // Registering a device status change listener. this.myDeviceManager.on('deviceStateC...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDeviceStateListener 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#...
registerDeviceStateListener(): void { if (this.myDeviceManager === undefined) { Logger.error('RemoteDeviceModel', 'registerDeviceStateListener deviceManager has not initialized'); return; } try { // Registering a device status change listener. this.myDeviceManager.on('deviceStateC...
https://gitee.com/openharmony/codelabs.git
74a896768ed85079fef3ada8d95f907869cc37d2
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
map
Creates a new Uint8ClampedArray using fn(arr[i]) over all elements of current Uint8ClampedArray @param fn a function to apply for each element of current Uint8ClampedArray @returns a new Uint8ClampedArray where for each element from current Uint8ClampedArray fn was applied
public map(fn: (val: number) => number): Uint8ClampedArray { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number) => number): Uint8ClampedArray { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
956cf3e4d222fd2e66a64d342a71bfb10e9117c0
gitee
openharmony/vendor_unionman
unionpi_tiger/sample_api11/app/A311D_FactoryTest_app/entry/src/main/ets/a311d/interfaceButton/headsetInButton.ets
arkts
aboutToDisappear
再调用AudioManager的方法创建AudioRoutingManager实例
aboutToDisappear() { clearInterval(this.intervalID); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { clearInterval(this.intervalID); }
https://gitee.com/openharmony/vendor_unionman.git
65bc5c25eebd03a059539d086671cb06fadf200c
gitee
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
reorderAssistants
按给定顺序 + sortOrder 持久化,同步到内存 入参数组的 sortOrder 会被覆写成 index,以保持与 DB 一致
async reorderAssistants(assistants: Assistant[]): Promise<void> { if (assistants.length === 0) { return } for (let i = 0; i < assistants.length; i++) { assistants[i].sortOrder = i } await this.db.saveAssistantSortOrders(assistants) // 以入参为新顺序;若原 state 里还有额外项(通常不会),兜底追加 const se...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reorderAssistants AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistants AST#identifier#R...
async reorderAssistants(assistants: Assistant[]): Promise<void> { if (assistants.length === 0) { return } for (let i = 0; i < assistants.length; i++) { assistants[i].sortOrder = i } await this.db.saveAssistantSortOrders(assistants) // 以入参为新顺序;若原 state 里还有额外项(通常不会),兜底追加 const se...
https://github.com/LongLiveY96/chatcube
15a2d78b4852a61414852b984e94abbdc8b799a2
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test4_original_index.ets
arkts
testMathOps
=== Math Operations ===
function testMathOps(): number { let a: number = Math.abs(-5); let b: number = Math.max(1, 2, 3); let c: number = Math.min(1, 2, 3); let d: number = Math.ceil(3.2); let e: number = Math.floor(3.8); let f: number = Math.round(3.5); let g: number = Math.sqrt(16); let h: number = Math.pow(2, 10); return ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMathOps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type...
function testMathOps(): number { let a: number = Math.abs(-5); let b: number = Math.max(1, 2, 3); let c: number = Math.min(1, 2, 3); let d: number = Math.ceil(3.2); let e: number = Math.floor(3.8); let f: number = Math.round(3.5); let g: number = Math.sqrt(16); let h: number = Math.pow(2, 10); return ...
https://github.com/miaochiahao/ark-ghidra
d15330b8e44f050f691c105b28ba415552bb42c0
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/DistributedControlTerminal/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
远程设备模型
aboutToAppear() { // 获取上下文和权限管理器 let context = getContext(this) as common.UIAbilityContext let atManager = abilityAccessCtrl.createAtManager() try { // 请求分布式数据同步权限 atManager.requestPermissionsFromUser(context,['ohos.permission.DISTRIBUTED_DATASYNC']).then((data) => { Logger.info(TAG, `d...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // 获取上下文和权限管理器 let context = getContext(this) as common.UIAbilityContext let atManager = abilityAccessCtrl.createAtManager() try { // 请求分布式数据同步权限 atManager.requestPermissionsFromUser(context,['ohos.permission.DISTRIBUTED_DATASYNC']).then((data) => { Logger.info(TAG, `d...
https://gitee.com/openharmony/vendor_unionman.git
bb0aa195c5096a05f2a41a81f1e051112e663d44
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/SearchFilter.ets
arkts
isEmpty
检查是否为空(没有任何过滤条件) 说明:不包含 inType
get isEmpty(): boolean { return this.categoryId === null && this.tags.length === 0 && this.status === null && this.beforeDate === null && this.afterDate === null; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ...
get isEmpty(): boolean { return this.categoryId === null && this.tags.length === 0 && this.status === null && this.beforeDate === null && this.afterDate === null; }
https://github.com/Amaz1ny/HarmonyDO-public
df56d066c049482bf6bbd89adc416544f41401a6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets
arkts
getRetryConfig
获取重试配置
getRetryConfig(context: WorkflowContext): RetryConfig | null { const capability = context.capabilities.get('errorRetry'); if (!capability) { return null; } return capability as RetryConfig; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRetryConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
getRetryConfig(context: WorkflowContext): RetryConfig | null { const capability = context.capabilities.get('errorRetry'); if (!capability) { return null; } return capability as RetryConfig; }
https://github.com/DaLongZhuaZi/manxia
8119c56bbf57d73df6af3f166efbbc62ad08ffd8
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/model/Light.ets
arkts
setBrightness
setBrightness 方法:设置亮度(添加边界约束) @param level 目标亮度(0~100范围内)
setBrightness(level: number): void { // 用 Math.max/Math.min 简化边界判断,确保亮度在0~100之间 this.brightness = Math.max(0, Math.min(100, level)); if (this.status === 'on') { logAction(`${this.getInfo()} 亮度已调整为:${this.brightness}%`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBrightness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
setBrightness(level: number): void { // 用 Math.max/Math.min 简化边界判断,确保亮度在0~100之间 this.brightness = Math.max(0, Math.min(100, level)); if (this.status === 'on') { logAction(`${this.getInfo()} 亮度已调整为:${this.brightness}%`); } }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
5a7510d9f24064873cd6c922e899853887d498ce
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets
arkts
trySetSimpleReminder
============ 私有方法 ============ 尝试使用日历提醒
private async trySetSimpleReminder( event: CalendarEvent, remindTime: number, ): Promise<boolean> { try { const remindDate = new Date(remindTime); // 创建提醒请求 const reminderRequest: SimplifiedReminderRequest = { reminderType: this.getReminderType(), dateTime: { ...
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 trySetSimpleReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:...
private async trySetSimpleReminder( event: CalendarEvent, remindTime: number, ): Promise<boolean> { try { const remindDate = new Date(remindTime); // 创建提醒请求 const reminderRequest: SimplifiedReminderRequest = { reminderType: this.getReminderType(), dateTime: { ...
https://gitcode.com/openharmony/codelabs
2aae0ccf16782e8230d8f92b3ca9503a2433b543
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getGlassBlur
获取玻璃效果模糊样式(根据当前主题返回不同的模糊样式)
private getGlassBlur(): BlurStyle | undefined { if (this.useTopTabsNavigation && this.getEffectiveTabletTopBarPosition() === 'bottom') { return BlurStyle.BACKGROUND_THIN; } // 使用StorageLink绑定的用户配置 if (!this.userThemeBlurEnabled) { return undefined; } if (this.themeState.currentThem...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGlassBlur 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...
private getGlassBlur(): BlurStyle | undefined { if (this.useTopTabsNavigation && this.getEffectiveTabletTopBarPosition() === 'bottom') { return BlurStyle.BACKGROUND_THIN; } // 使用StorageLink绑定的用户配置 if (!this.userThemeBlurEnabled) { return undefined; } if (this.themeState.currentThem...
https://github.com/DaLongZhuaZi/manxia
626fb4a4ce4b9222407b99bcb88275f73ecd9848
github
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/Index.ets
arkts
handleServerCommand
---- 服务器命令处理 ----
handleServerCommand(msg: string): void { LogStore.add('收到命令: ' + msg.substring(0, 80)); try { const cmd: ServerCommand = JSON.parse(msg) as ServerCommand; if (cmd.type === 'cmd') { if (cmd.action === 'setAlarm') { this.setAlarmMode(cmd.value as number, '远程'); } else if (c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleServerCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Lef...
handleServerCommand(msg: string): void { LogStore.add('收到命令: ' + msg.substring(0, 80)); try { const cmd: ServerCommand = JSON.parse(msg) as ServerCommand; if (cmd.type === 'cmd') { if (cmd.action === 'setAlarm') { this.setAlarmMode(cmd.value as number, '远程'); } else if (c...
https://github.com/LiHuaJZOAQ/GuardSysAPP
c747c868cbde8b2a34acfa8a067ffc47f489c103
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/RAGRetriever.ets
arkts
hashCode
计算字符串哈希值
private hashCode(str: string): number { let hash = 0; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit integer } return hash; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hashCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
private hashCode(str: string): number { let hash = 0; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; // Convert to 32bit integer } return hash; }
https://github.com/LJ666-ui/harmony-health-care
e0cecac784447f5a822241a2778e617b430e3e35
github
seagazer/cclyric
lib/src/main/ets/CcLyricController.ets
arkts
setKrcTextBgColor
Set the background text color of krc line, default is 0xff000000. @param color The background text color of krc line.
public setKrcTextBgColor(color: number): CcLyricController { this._krcTextBgColor = color this.invalidate() return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setKrcTextBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setKrcTextBgColor(color: number): CcLyricController { this._krcTextBgColor = color this.invalidate() return this }
https://github.com/seagazer/cclyric
ef1308cf5e9d410c6a0c01dc9c08e8873be5f9ac
github
aimilin6688/KeePassHO
kdbxweb/src/ohosTest/ets/test/test-support/Asserts.ets
arkts
assertArrayEqual
验证数组是否相等 @param actual @param expected @param message
public assertArrayEqual(expected: Uint8Array, message?: string): void { const actual = this.actual as Uint8Array; if(!ByteUtils.arrayBufferEquals(actual, expected)){ throw new Error(message || `Expected ${actual} equal to ${expected}`); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left assertArrayEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left expected AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public assertArrayEqual(expected: Uint8Array, message?: string): void { const actual = this.actual as Uint8Array; if(!ByteUtils.arrayBufferEquals(actual, expected)){ throw new Error(message || `Expected ${actual} equal to ${expected}`); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/kdbxweb/src/ohosTest/ets/test/test-support/Asserts.ets#L101-L106
56ebd4507a0aab8830a06f4ba8f8df8b4b21cc88
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets
arkts
password
Gets the password portion of the URL. @return {string} Returns the password portion of the URL.
get password(): string { return this.cPassword; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left password 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 AS...
get password(): string { return this.cPassword; }
https://gitcode.com/iop123123/arkts-static-skills
bf3e190414a71517890f3127f60f1e6c952b534e
gitcode
openharmony/arkui_ace_engine
examples/Image/entry/src/main/ets/pages/example/ImageFillColorContentExample.ets
arkts
getColorPreview
获取颜色预览 (用于指示器)
getColorPreview(color: Color | undefined | ColorMetrics | ColorContent): Color { if (color === undefined) { return Color.Transparent; } if (color === ColorContent.ORIGIN) { return Color.Blue; // ORIGIN 无法预览,用蓝色代替 } // ColorMetrics 无法直接转换,返回蓝色 if (color instanceof ColorMetrics) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColorPreview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#b...
getColorPreview(color: Color | undefined | ColorMetrics | ColorContent): Color { if (color === undefined) { return Color.Transparent; } if (color === ColorContent.ORIGIN) { return Color.Blue; // ORIGIN 无法预览,用蓝色代替 } // ColorMetrics 无法直接转换,返回蓝色 if (color instanceof ColorMetrics) { ...
https://gitcode.com/openharmony/arkui_ace_engine
3667404030180a723866bc4c54f43ae74db79f95
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
getAbrStatusText
获取 ABR 状态文本(用于性能面板)
getAbrStatusText(): string { return this.abrService?.getStatusText() ?? ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAbrStatusText 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#state...
getAbrStatusText(): string { return this.abrService?.getStatusText() ?? ''; }
https://github.com/AlkaidLab/moonlight-harmony
159147ca5ff58565a79510c25929ce9a398af385
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
onDidBuild
组件构建完成时触发动画同步 @returns {void} 无返回值
onDidBuild(): void { super.onDidBuild(); this.syncCurrentAnimation(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDidBuild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onDidBuild(): void { super.onDidBuild(); this.syncCurrentAnimation(); }
https://github.com/Joker-x-dev/CoolMallArkTS
b6f234ad70e4769994f8741f8a90b7a26f6a92e5
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/tests/NeurologyAgentTest.ets
arkts
testCanHandle
测试canHandle方法
async testCanHandle(): Promise<void> { console.log('【测试1】canHandle方法测试'); const testCases = [ { question: '我最近经常头痛', expected: true }, { question: '脑梗塞怎么治疗', expected: true }, { question: '帕金森病的症状', expected: true }, { question: '记忆力下降是什么原因', expected: true }, { question: '手...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testCanHandle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
async testCanHandle(): Promise<void> { console.log('【测试1】canHandle方法测试'); const testCases = [ { question: '我最近经常头痛', expected: true }, { question: '脑梗塞怎么治疗', expected: true }, { question: '帕金森病的症状', expected: true }, { question: '记忆力下降是什么原因', expected: true }, { question: '手...
https://github.com/LJ666-ui/harmony-health-care
1b20378011362caa6136b49721ee1aee1d688ab0
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets
arkts
applyCustomFields
应用自定义字段
private applyCustomFields(entry: KdbxEntry, preset: IPresetTemplate, opts: TemplateApplyOptions): void { if (!preset.customFields || preset.customFields.length === 0) { return; } for (let i = 0; i < preset.customFields.length; i++) { const field = preset.customFields[i]; const existingV...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyCustomFields 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...
private applyCustomFields(entry: KdbxEntry, preset: IPresetTemplate, opts: TemplateApplyOptions): void { if (!preset.customFields || preset.customFields.length === 0) { return; } for (let i = 0; i < preset.customFields.length; i++) { const field = preset.customFields[i]; const existingV...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets#L103-L119
fd6ab8bc65b65a7d63fa8094e6daa9eed71460cb
github
jiahaozheng406/huawei-travel-app-HarmonyOS
entry/src/main/ets/viewmodel/ArticleDetailViewModel.ets
arkts
getSwiper
获取文章详情
getSwiper(): Array<Resource> { let swiper: Resource[] = [ $r('app.media.Dt5'), $r('app.media.Dt2'), $r('app.media.Dt3'), $r('app.media.DT4'), ] return swiper; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSwiper 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 : ...
getSwiper(): Array<Resource> { let swiper: Resource[] = [ $r('app.media.Dt5'), $r('app.media.Dt2'), $r('app.media.Dt3'), $r('app.media.DT4'), ] return swiper; }
https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS
f51406d1e0de6dfd9b03b5c9f31f2c2454803152
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
map
Creates a new BigUint64Array using fn(arr[i]) over all elements of current BigUint64Array. @param fn a function to apply for each element of current BigUint64Array @returns a new BigUint64Array where for each element from current BigUint64Array fn was applied
public map(fn: (val: BigInt, index: int) => BigInt): BigUint64Array { let resBuf = new ArrayBuffer(this.length * BigUint64Array.BYTES_PER_ELEMENT) let res = new BigUint64Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return r...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: BigInt, index: int) => BigInt): BigUint64Array { let resBuf = new ArrayBuffer(this.length * BigUint64Array.BYTES_PER_ELEMENT) let res = new BigUint64Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return r...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
feb8cfdbbd00776a6837cfab286840acd5d850da
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint32Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new Uint32Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): Uint32Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): Uint32Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a73a19bee2177762d2ad6065f3a205e014ec4b36
gitee
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleViews.ets
arkts
activeViewIds
Snapshot all active view IDs. We materialize an array rather than iterating the Map directly so callers that mutate during iteration (stopView deletes the entry) don't invalidate the iterator.
private activeViewIds(): string[] { const ids: string[] = []; this.activeViews.forEach((_v: ActiveView, k: string) => { ids.push(k); }); return ids; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left activeViewIds 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 strin...
private activeViewIds(): string[] { const ids: string[] = []; this.activeViews.forEach((_v: ActiveView, k: string) => { ids.push(k); }); return ids; }
https://github.com/Countly/countly-sdk-hos
7ed45a6d202494c01ffc7b0583d8aa5c59f8f353
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
sint64
Read sint64 (zigzag) as bigint
sint64(): bigint { const v = this.int64(); return (v >> 1n) ^ (-(v & 1n)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sint64 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 bigint AST#identifier#Right AST#ERROR#Right AST#stateme...
sint64(): bigint { const v = this.int64(); return (v >> 1n) ^ (-(v & 1n)) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
e5e14ea279d9246c0f1410a75bdfb35be6beaed8
gitcode
Joker-x-dev/CoolMallArkTS
entry/src/main/ets/adapter/WindowAdapter.ets
arkts
init
初始化窗口能力(沉浸式、安全区、断点) @param {Context} context - 组件上下文 @returns {void} 无返回值
init(context: Context): void { window.getLastWindow(context, (err: BusinessError, data) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to obtain the top window. Cause code: ${err.code}, message: ${err.message}`); return; } this.windowClass = dat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Right AST#)#Left ) AST#)#...
init(context: Context): void { window.getLastWindow(context, (err: BusinessError, data) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to obtain the top window. Cause code: ${err.code}, message: ${err.message}`); return; } this.windowClass = dat...
https://github.com/Joker-x-dev/CoolMallArkTS
94f89f64732b7d01a5191fde97bee321902d8c83
github
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
getFilesInDir
获取目录中的文件名列表 @param path 文件绝对路径
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFilesInDir 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 st...
static getFilesInDir(path: string) { const fileNames = fs.listFileSync(path); return fileNames; }
https://gitcode.com/arkui-x/samples
7e2d2a7a1203e990d72faa060b85416e4e727660
gitcode
DaLongZhuaZi/manxia
tmp/ohpm_research/unrar/package/src/main/ets/components/MainPage/UnrarApi.ets
arkts
isEncrypted
判断文件是否加密 path:文件路径 number:返回值 0代表没加密,1代表加密
static isEncrypted(path: string): number { return unrar_napi.isEncrypted(path); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEncrypted 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 stri...
static isEncrypted(path: string): number { return unrar_napi.isEncrypted(path); }
https://github.com/DaLongZhuaZi/manxia
d214d04a81177bd2da087a9b394c041165257e65
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ContentPanel.ets
arkts
showEffects
显示特效展示(使用Markdown内容)
showEffects(title: string, content: string, source: ContentSource = ContentSource.INLINE): string { return this.addTab({ title, type: ContentPanelType.EFFECTS, source, content, icon: $r('sys.symbol.star_fill') }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showEffects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS...
showEffects(title: string, content: string, source: ContentSource = ContentSource.INLINE): string { return this.addTab({ title, type: ContentPanelType.EFFECTS, source, content, icon: $r('sys.symbol.star_fill') }); }
https://github.com/DaLongZhuaZi/manxia
554cc75162ea82873bca015ac6c9d3693784642a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getByOwnerId
获取用户拥有的账本
static async getByOwnerId(ownerId: number): Promise<SharedLedger[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(SharedLedger.tableName); predicates.equalTo('owner_id', ownerI...
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 getByOwnerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ownerId AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async getByOwnerId(ownerId: number): Promise<SharedLedger[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(SharedLedger.tableName); predicates.equalTo('owner_id', ownerI...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
43c129780c7190f4461ee4a1d53966dc1eebf746
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieRadarChartBaseModel.ets
arkts
getDiameter
returns the diameter of the pie- or radar-chart @return
public getDiameter(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); content.left += this.getExtraLeftOffset(); content.top += this.getExtraTopOffset(); content.right -= this.getExtraRightOffset(); content.bottom -= this.getExtraBottomOffset(); return Math.min(content.w...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDiameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#num...
public getDiameter(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); content.left += this.getExtraLeftOffset(); content.top += this.getExtraTopOffset(); content.right -= this.getExtraRightOffset(); content.bottom -= this.getExtraBottomOffset(); return Math.min(content.w...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
17ee2c51790fbce18e1f486ababf8aefdd52d36d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
getEnabledSourcesSortedByPinned
获取启用的图源(按置顶排序)
async getEnabledSourcesSortedByPinned(): Promise<SourceInfo[]> { const sources = await this.getEnabledSources(); return this.sortSourcesByPinned(sources); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEnabledSourcesSortedByPinned 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#...
async getEnabledSourcesSortedByPinned(): Promise<SourceInfo[]> { const sources = await this.getEnabledSources(); return this.sortSourcesByPinned(sources); }
https://github.com/DaLongZhuaZi/manxia
5e4b7c12f059de05a7260fc42f8d935ce43b4b34
github
CLMC2025/Vignette
entry/src/main/ets/ui/EnhancedCards.ets
arkts
outlined
创建轮廓卡片样式
static outlined(): CardStyle { return new CardStyle( CardType.OUTLINED, DesignTokens.Colors.SURFACE_PRIMARY, DesignTokens.BorderRadius.LG, 0, DesignTokens.Colors.PRIMARY, 0.2, { left: DesignTokens.Spacing.LG, right: DesignTokens.Spacing.LG, top:...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left outlined 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 CardStyle AST...
static outlined(): CardStyle { return new CardStyle( CardType.OUTLINED, DesignTokens.Colors.SURFACE_PRIMARY, DesignTokens.BorderRadius.LG, 0, DesignTokens.Colors.PRIMARY, 0.2, { left: DesignTokens.Spacing.LG, right: DesignTokens.Spacing.LG, top:...
https://github.com/CLMC2025/Vignette
d490032563246b698c08f603d707b30b7eab7a11
github