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 |
|---|---|---|---|---|---|---|---|---|---|---|
ibestservices/ibest-ui | library/src/main/ets/apis/IBestNotify.ets | arkts | autoClose | 开启自动关闭 | private autoClose(params: IBestNotifyParams){
if(this.timer > -1){
clearTimeout(this.timer)
this.timer = -1
}
this.timer = setTimeout(() => {
this.close()
}, params.duration)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left autoClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left I... | private autoClose(params: IBestNotifyParams){
if(this.timer > -1){
clearTimeout(this.timer)
this.timer = -1
}
this.timer = setTimeout(() => {
this.close()
}, params.duration)
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestNotify.ets#L166-L174 | 60191f29063dccbe11d00dacc9ce35a831aa6e0d | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/coze/CozeApiClient.ets | arkts | sendMessage | 发送消息给Coze Bot | async sendMessage(
message: string,
userId: string,
botId?: string,
history?: CozeMessage[]
): Promise<string> {
const request: CozeRequest = {
botId: botId || this.config.botId || '',
userId: userId,
messages: [
...(history || []),
{ role: 'user', content: mess... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async sendMessage(
message: string,
userId: string,
botId?: string,
history?: CozeMessage[]
): Promise<string> {
const request: CozeRequest = {
botId: botId || this.config.botId || '',
userId: userId,
messages: [
...(history || []),
{ role: 'user', content: mess... | https://github.com/LJ666-ui/harmony-health-care | 2b41a249526f3c37d0c261c50cb07381aade6524 | github |
HarmonyOS_Samples/paymentkit-samplecode-uxcodeproject-arkts | entry/src/main/ets/ui/CashierComponent.ets | arkts | build | Page Container | build() {
Column() {
this.cashierUI();
}
} | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Column() {
this.cashierUI();
}
} | https://gitcode.com/HarmonyOS_Samples/paymentkit-samplecode-uxcodeproject-arkts | b4141d60924e47c9b399180003dbccd79ddd6e5f | gitcode |
iop123123/arkts-static-skills | skills/arkts-auto-test/tests/bug-array-sort-single-int.ets | arkts | main | Bug: Array.sort with comparator on Array<int> where buffer contains undefined slots
triggers ClassCastError in wrap_default_sort path | function main(): int {
const suite = new arktest.ArkTestsuite("array-sort-bug");
suite.addTest("sort int array with undefined slots throws ClassCastError", () => {
// Create array with length 3, only set index 0 — indices 1,2 are undefined
const arr = new Array<int>(3);
arr[0] = 42;
... | 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#type_identifier#Left i... | function main(): int {
const suite = new arktest.ArkTestsuite("array-sort-bug");
suite.addTest("sort int array with undefined slots throws ClassCastError", () => {
// Create array with length 3, only set index 0 — indices 1,2 are undefined
const arr = new Array<int>(3);
arr[0] = 42;
... | https://gitcode.com/iop123123/arkts-static-skills | efd5c1a1bee018dc126e92eacd85ace974e636fb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | generateReport | 获取性能报告 | public generateReport(): string {
const report: PerformanceReport = {
timestamp: TimeUtils.toISOString(Date.now()),
metrics: this.metrics,
warnings: this.warnings,
recommendations: this.generateRecommendations()
};
return JSON.stringify(report, null, 2);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateReport 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#... | public generateReport(): string {
const report: PerformanceReport = {
timestamp: TimeUtils.toISOString(Date.now()),
metrics: this.metrics,
warnings: this.warnings,
recommendations: this.generateRecommendations()
};
return JSON.stringify(report, null, 2);
} | https://github.com/DaLongZhuaZi/manxia | 72439714db6f67b71959e343eb220819b560aeeb | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | applyCloudPull | V0.6.4: apply a single LWW pull from the cloud sync service.
Replaces the matching wordId entry when `lastAnsweredMs` strictly
exceeds the local one, otherwise the call is a no-op. The mutation
is debounced through the same timer as `recordAnswer` so the
on-disk snapshot eventually reflects the cloud pull. | applyCloudPull(stat: WordStat): boolean {
const idx: number = this.snapshot.stats.findIndex(
(s: WordStat): boolean => s.wordId === stat.wordId,
);
if (idx < 0) {
this.snapshot.stats.push(stat);
this.scheduleSave();
return true;
}
const local: WordStat = this.snapshot.stats... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyCloudPull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stat AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WordStat AST#identifier#Right AST#)#Left ... | applyCloudPull(stat: WordStat): boolean {
const idx: number = this.snapshot.stats.findIndex(
(s: WordStat): boolean => s.wordId === stat.wordId,
);
if (idx < 0) {
this.snapshot.stats.push(stat);
this.scheduleSave();
return true;
}
const local: WordStat = this.snapshot.stats... | https://github.com/terryma2024/happyword | eff2fba2264fe4a36f40ae4ccca51fe6cd78af92 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ProfileService.ets | arkts | constructor | 创建时间戳 | constructor(id: string, nickname: string, avatar: string = '👧', createTime: number = Date.now()) {
this.id = id;
this.nickname = nickname;
this.avatar = avatar;
this.createTime = createTime;
} | 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 id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | constructor(id: string, nickname: string, avatar: string = '👧', createTime: number = Date.now()) {
this.id = id;
this.nickname = nickname;
this.avatar = avatar;
this.createTime = createTime;
} | https://github.com/the-wwyang/kids-learning-app | 44f4270052c3738045423c2321026f79ffe0d4e2 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/pages/authority-management.ets | arkts | getLabelAndIcon | Get all permission label | getLabelAndIcon() {
this.allBundleInfo.forEach((bundleInfo: AppInfo) => {
this.updateAppLabel(bundleInfo);
this.updateAppIcon(bundleInfo);
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLabelAndIcon 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#Le... | getLabelAndIcon() {
this.allBundleInfo.forEach((bundleInfo: AppInfo) => {
this.updateAppLabel(bundleInfo);
this.updateAppIcon(bundleInfo);
})
} | https://gitee.com/openharmony/applications_permission_manager.git | 716073c9258b3368f959e0517e0aa5cbbe25fce4 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/FamilyService.ets | arkts | requestAuthorization | 请求查看授权 | async requestAuthorization(patientId: string): Promise<boolean> {
try {
const data: Record<string, string> = {
'familyId': this.currentFamilyId,
'patientId': patientId
};
const response = await HttpUtil.post<boolean>('/family/request-authorization', data);
return res... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestAuthorization AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left patientId AST#identifier#Right AST#type_annotation#Left AS... | async requestAuthorization(patientId: string): Promise<boolean> {
try {
const data: Record<string, string> = {
'familyId': this.currentFamilyId,
'patientId': patientId
};
const response = await HttpUtil.post<boolean>('/family/request-authorization', data);
return res... | https://github.com/LJ666-ui/harmony-health-care | 4946c995f27336e127779abc8483f90132147488 | github |
openharmony/app_samples | ETSUI/Game2048/entry/src/main/ets/MainAbility/pages/Game2048.ets | arkts | gameStart | restart game | gameStart() {
this.gameRule.init()
this.dataNumbers = this.gameRule.dataNumbers
this.gameStatus = GameStatus.RUNNING
this.handleLocalData('put')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left gameStart 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 AST... | gameStart() {
this.gameRule.init()
this.dataNumbers = this.gameRule.dataNumbers
this.gameStatus = GameStatus.RUNNING
this.handleLocalData('put')
} | https://gitee.com/openharmony/app_samples.git | e6da29cb3292313602e8e92974c78a17d08a6bd6 | gitee |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getTotalGames | 获取总游戏次数 | async getTotalGames(): Promise<number> {
return await getNumber('total_games', 0);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTotalGames 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#generi... | async getTotalGames(): Promise<number> {
return await getNumber('total_games', 0);
} | https://github.com/zcg741/chengyu-game | 244bd30ba3d9096ad5fb7721c67a4f084ed04fd3 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | setProviders | 给 state.providers 换成新数组,并自增 providersVersion。
@Trace 只能追踪数组“整体”变化,所以必须用新引用替换 | private setProviders(next: ModelProvider[]): void {
const state: AppSettingsState = getAppSettingsState()
state.providers = next
state.providersVersion = state.providersVersion + 1
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setProviders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left next AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres... | private setProviders(next: ModelProvider[]): void {
const state: AppSettingsState = getAppSettingsState()
state.providers = next
state.providersVersion = state.providersVersion + 1
} | https://github.com/LongLiveY96/chatcube | 2a13fb25b999f2be7eb7b1ff16338ec427b30c45 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ReplyManager.ets | arkts | send | 发送回复/编辑 | async send(userText: string, isAnonymous: boolean): Promise<PostReplyResult> {
if (!userText && this.ctx.type !== ReplyType.EDIT) {
const empty: PostReplyResult = new PostReplyResult()
empty.error = '内容不能为空'
return empty
}
if (this.ctx.type === ReplyType.COMMENT) {
const byteLen: n... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left send AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userText AST#identifier#Right AST#type_a... | async send(userText: string, isAnonymous: boolean): Promise<PostReplyResult> {
if (!userText && this.ctx.type !== ReplyType.EDIT) {
const empty: PostReplyResult = new PostReplyResult()
empty.error = '内容不能为空'
return empty
}
if (this.ctx.type === ReplyType.COMMENT) {
const byteLen: n... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ReplyManager.ets#L297-L333 | dc03800992b1facd72eb29064c03657cafc8342b | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets | arkts | replace | Replaces the value for the specified key in the HashMap
@param key the key to replace the value for
@param newValue the new value to set for the key
@returns true if the value was replaced, false otherwise | replace(key: K, newValue: V): boolean {
if (!this.buckets.has(key)) {
return false;
}
this.buckets.set(key, newValue);
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right A... | replace(key: K, newValue: V): boolean {
if (!this.buckets.has(key)) {
return false;
}
this.buckets.set(key, newValue);
return true;
} | https://gitcode.com/iop123123/arkts-static-skills | 3ee0de305a2135ba7aed92d978c59da738895493 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | moveItemsToCategory | 批量移动内容到分类 | async moveItemsToCategory(items: MoveItemInfo[], categoryId: string): Promise<void> {
for (const item of items) {
const key = `${item.contentType}_${item.itemId}`;
const existingItem = this.itemCategoryMap.get(key);
if (existingItem) {
existingItem.categoryId = categoryId;
}... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left moveItemsToCategory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left items AST#identifie... | async moveItemsToCategory(items: MoveItemInfo[], categoryId: string): Promise<void> {
for (const item of items) {
const key = `${item.contentType}_${item.itemId}`;
const existingItem = this.itemCategoryMap.get(key);
if (existingItem) {
existingItem.categoryId = categoryId;
}... | https://github.com/DaLongZhuaZi/manxia | 469c112e69d1e5b41beef6d25dad2844d7eeb70b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | checkPerformanceThresholds | 检查性能阈值 | private checkPerformanceThresholds(metrics: PerformanceMetrics): void {
const thresholds = this.config.performanceThresholds;
if (metrics.memoryUsage && metrics.memoryUsage > thresholds.memoryWarning) {
this.reportError({
code: 'MEMORY_WARNING',
message: `内存使用量过高: ${Math.round(metri... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkPerformanceThresholds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metrics AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | private checkPerformanceThresholds(metrics: PerformanceMetrics): void {
const thresholds = this.config.performanceThresholds;
if (metrics.memoryUsage && metrics.memoryUsage > thresholds.memoryWarning) {
this.reportError({
code: 'MEMORY_WARNING',
message: `内存使用量过高: ${Math.round(metri... | https://github.com/DaLongZhuaZi/manxia | fabe2aabb9cd47d0d893dc167d0b372c10f260c8 | github |
cduestc-course/ArkLearn | entry/src/main/ets/pages/06/6.2.3re3.ets | arkts | build | localStorage = this.getUIContext().getSharedLocalStorage() | build() {
Column() {
Row() {
// Image($r('sys.media.ohos_ic_back'))
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize(20)
.width(20)
.aspectRatio(1)
.onClick(() => {
})
Text('个人信息')
.fontWeight(FontWeight.Bold)
... | 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() {
Row() {
// Image($r('sys.media.ohos_ic_back'))
SymbolGlyph($r('sys.symbol.chevron_left'))
.fontSize(20)
.width(20)
.aspectRatio(1)
.onClick(() => {
})
Text('个人信息')
.fontWeight(FontWeight.Bold)
... | https://github.com/cduestc-course/ArkLearn | 3cf19a2bf4502215ee1a190f90ed2754df955586 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/Logger.ets | arkts | info | Writes an info line to hilog; joins all parts with " | ".
@param args Text segments to log. | static info(...args: Object[]): void {
hilog.info(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args... | static info(...args: Object[]): void {
hilog.info(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | ae3e29e58f8f05e873ea39853d501a43ebb50fdb | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | findOptionSeparator | 查找URL和选项JSON之间的分隔符位置
参考Legado原版: paramPattern = Pattern.compile("\\s*,\\s*(?=\\{)")
需要正确处理以下情况:
1. URL中可能包含逗号(如查询参数)
2. JSON选项以{开头
3. 需要找到最后一个有效的分隔符(逗号后紧跟{) | private findOptionSeparator(url: string): OptionSeparatorResult {
if (!url || !url.includes(',')) {
const result: OptionSeparatorResult = { found: false, index: -1 };
return result;
}
// 从后向前查找 ,{ 模式
// 这样可以正确处理URL中包含逗号的情况
let pos = url.length - 1;
let braceDepth = 0;
let ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findOptionSeparator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private findOptionSeparator(url: string): OptionSeparatorResult {
if (!url || !url.includes(',')) {
const result: OptionSeparatorResult = { found: false, index: -1 };
return result;
}
// 从后向前查找 ,{ 模式
// 这样可以正确处理URL中包含逗号的情况
let pos = url.length - 1;
let braceDepth = 0;
let ... | https://github.com/DaLongZhuaZi/manxia | 83326a71ca555f170d54a22581ccbb1e561324ce | github |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | getManyToManyRelation | 获取多对多关联关系
@param entityName 实体名称
@param propertyName 属性名
@returns 多对多关联关系元数据,如果不存在或不是多对多关系返回 null | getManyToManyRelation(entityName: string, propertyName: string): ManyToManyMetadata | null {
const relation = this.getRelation(entityName, propertyName)
if (relation && relation.type === RelationType.MANY_TO_MANY) {
return relation as ManyToManyMetadata
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getManyToManyRelation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | getManyToManyRelation(entityName: string, propertyName: string): ManyToManyMetadata | null {
const relation = this.getRelation(entityName, propertyName)
if (relation && relation.type === RelationType.MANY_TO_MANY) {
return relation as ManyToManyMetadata
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | de45cfe67a83aa83c52d7c14f495026b29517c8f | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | rawToSymKey | 将原始字节转换为 SymKey | private rawToSymKey(keyData: Uint8Array, algName: string): cryptoFramework.SymKey {
const keyGenerator = cryptoFramework.createSymKeyGenerator(algName);
const keyBlob: cryptoFramework.DataBlob = { data: keyData };
const symKey = keyGenerator.convertKeySync(keyBlob);
return symKey;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rawToSymKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private rawToSymKey(keyData: Uint8Array, algName: string): cryptoFramework.SymKey {
const keyGenerator = cryptoFramework.createSymKeyGenerator(algName);
const keyBlob: cryptoFramework.DataBlob = { data: keyData };
const symKey = keyGenerator.convertKeySync(keyBlob);
return symKey;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 4e0e99ab4cbd12833d0a6a7e992297e278b4ec76 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxCsvService.ets | arkts | import | 导入csv文件
@param csvFile
@returns | public static async import(csvFile: FileContentInfo): Promise<KdbxGroup> {
return new Promise<KdbxGroup>(async (resolve, reject) => {
try {
return resolve(KdbxCsvService.parseLines(csvFile.content));
} catch (e) {
return reject(e);
}
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#import#Left AST#import#Left import AST#import#Right AST#import#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#id... | public static async import(csvFile: FileContentInfo): Promise<KdbxGroup> {
return new Promise<KdbxGroup>(async (resolve, reject) => {
try {
return resolve(KdbxCsvService.parseLines(csvFile.content));
} catch (e) {
return reject(e);
}
});
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxCsvService.ets#L27-L35 | 3851a47d543481c961eee81cff7c84182d3b3d6c | github |
CLMC2025/Vignette | entry/src/main/ets/manager/DictionaryManager.ets | arkts | configure | 配置 AI 服务地址和 API 密钥
@param baseUrl AI 服务基础地址
@param apiKey API 密钥
@param model 模型名称
@throws Error 当 baseUrl 不是 HTTPS 协议时抛出错误 | configure(baseUrl: string, apiKey: string, model: string = 'deep-chat'): void {
// 强制要求 HTTPS 协议(本地开发环境除外)
if (Constants.SECURITY_REQUIRE_HTTPS_FOR_AI) {
const isLocalhost = baseUrl.startsWith('http://localhost') || baseUrl.startsWith('http://127.0.0.1');
if (!baseUrl.startsWith('https://') && !is... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Righ... | configure(baseUrl: string, apiKey: string, model: string = 'deep-chat'): void {
// 强制要求 HTTPS 协议(本地开发环境除外)
if (Constants.SECURITY_REQUIRE_HTTPS_FOR_AI) {
const isLocalhost = baseUrl.startsWith('http://localhost') || baseUrl.startsWith('http://127.0.0.1');
if (!baseUrl.startsWith('https://') && !is... | https://github.com/CLMC2025/Vignette | 2abbe03ca8aeffed8a40fdc2417ca65d1d793e87 | github |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | connect | connect a device through its mac without scan,whether or not it has been connected
@param device BleDevice or mac address
@param bleGattCallback
@return | public connect(device: BleDevice | string, bleGattCallback: BleGattCallback): void {
let bleDevice: BleDevice;
if (device instanceof BleDevice) {
bleDevice = device;
} else {
bleDevice = new BleDevice(device, '', 0, undefined, 0);
}
console.info("BleManager.connect device:" + bleDevice... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left connect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left... | public connect(device: BleDevice | string, bleGattCallback: BleGattCallback): void {
let bleDevice: BleDevice;
if (device instanceof BleDevice) {
bleDevice = device;
} else {
bleDevice = new BleDevice(device, '', 0, undefined, 0);
}
console.info("BleManager.connect device:" + bleDevice... | https://gitee.com/openharmony-sig/FastBle.git | be6190bdd3f6841a352e8142a4b7da6e29b0e003 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | findDeepestValidDirectory | 查找最深的有效目录(包含图片文件的目录)
@param startPath 起始路径
@returns 最深的有效目录路径 | private async findDeepestValidDirectory(startPath: string): Promise<string> {
try {
const files = await this.sandboxManager.listDirectory(startPath);
// 检查当前目录是否包含图片文件
const hasImages = await this.hasImageFiles(startPath);
// 如果当前目录有图片,返回当前目录
if (hasImages) {
lo... | 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 findDeepestValidDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startPath AST#identifier#Right AST#ERROR#L... | private async findDeepestValidDirectory(startPath: string): Promise<string> {
try {
const files = await this.sandboxManager.listDirectory(startPath);
// 检查当前目录是否包含图片文件
const hasImages = await this.hasImageFiles(startPath);
// 如果当前目录有图片,返回当前目录
if (hasImages) {
lo... | https://github.com/DaLongZhuaZi/manxia | 34dbc85bd9cce82a8cb9425427bd5e207daa3215 | github |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets | arkts | createFolder | 创建文件夹
@param path 文件夹绝对路径,只有是权限范围内的路径,可以生成 | static createFolder(path: string) {
if (!FileUtils.existFolder(path)) {
let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR);
if (lastInterval == 0) {
return;
}
let newPath = path.substring(0, lastInterval);
FileUtils.createFolder(newPath);
if (!FileUtils.existFolde... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | static createFolder(path: string) {
if (!FileUtils.existFolder(path)) {
let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR);
if (lastInterval == 0) {
return;
}
let newPath = path.substring(0, lastInterval);
FileUtils.createFolder(newPath);
if (!FileUtils.existFolde... | https://gitcode.com/arkui-x/samples | 6e7a21397e5ed8b3eebe9a678240fa42971b23b5 | gitcode |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/utils/fileUtils.ets | arkts | init | 需要先在 EntryAbility 或页面中初始化 Context | static init(context: common.UIAbilityContext) {
PreferencesUtil.context = context;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS... | static init(context: common.UIAbilityContext) {
PreferencesUtil.context = context;
} | https://github.com/luojiang001/Pulse | 36f951687b3cc592c91d1e49d7ba2ec8ac758c66 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | parseDurationToSeconds | 将 HH:MM:SS 或 MM:SS 或 秒数字符串 转成秒 | private parseDurationToSeconds(value: string): number {
if (!value) {
return 0;
}
const parts = value.split(':');
let seconds = 0;
if (parts.length === 3) {
seconds = parseInt(parts[0]) * 3600 + parseInt(parts[1]) * 60 + parseInt(parts[2]);
} else if (parts.length === 2) {
s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseDurationToSeconds 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#ident... | private parseDurationToSeconds(value: string): number {
if (!value) {
return 0;
}
const parts = value.split(':');
let seconds = 0;
if (parts.length === 3) {
seconds = parseInt(parts[0]) * 3600 + parseInt(parts[1]) * 60 + parseInt(parts[2]);
} else if (parts.length === 2) {
s... | https://github.com/pangpang20/antennaPodHM | 5a103c4826d60041a742457a9e495d3271c2023f | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/DownloadsViewModel.ets | arkts | toggleSelect | 切换选中状态 | toggleSelect(task_id: string) {
if (this.selectedIds.has(task_id)) {
this.selectedIds.delete(task_id);
} else {
this.selectedIds.add(task_id);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left task_id AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)... | toggleSelect(task_id: string) {
if (this.selectedIds.has(task_id)) {
this.selectedIds.delete(task_id);
} else {
this.selectedIds.add(task_id);
}
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L58-L64 | fb3a357e2c4fcc121d7415b701eafe98d177a257 | github |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | cancel | Cancel provisioning in progress | cancel(): void {
console.info(TAG, 'Cancel requested');
this.cancelled = true;
this.stopKeepalive();
this.closeTCPSocket();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancel 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 ... | cancel(): void {
console.info(TAG, 'Cancel requested');
this.cancelled = true;
this.stopKeepalive();
this.closeTCPSocket();
} | https://github.com/veaba/EsptouchForHarmony | aeb8be3a9ef9ac122bf724a05394227b43402890 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/pages/Search/SearchPage.ets | arkts | updateFilterList | 更新筛选列表 | updateFilterList() {
if (this.searchName) {
this.filterList = this.userList.filter(item => item.username.includes(this.searchName))
return
}
this.filterList = [] //列表为空
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateFilterList 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... | updateFilterList() {
if (this.searchName) {
this.filterList = this.userList.filter(item => item.username.includes(this.searchName))
return
}
this.filterList = [] //列表为空
} | https://github.com/SMAT-Lab/PhantomRendering | 0bcea38c7e232a7e69fec4c4663ebff8c2ba6434 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Message.ets | arkts | getWhat | Get the message identifier
@returns { int } The message identifier | public getWhat(): int {
return this.what;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWhat 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 int AST#identi... | public getWhat(): int {
return this.what;
} | https://gitcode.com/iop123123/arkts-static-skills | 3a88112a22d79a81bcf1f7b2acb6326cf3f537b6 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | keys | Returns an list of keys in Uint8ClampedArray
@returns { IterableIterator<int> } - iterator over keys
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public keys(): IterableIterator<int> {
return new Uint8ClampedArrayIteratorKeys(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys 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... | public keys(): IterableIterator<int> {
return new Uint8ClampedArrayIteratorKeys(this)
} | https://gitcode.com/iop123123/arkts-static-skills | b60d2f55639ffab20f3722cfef8a979657589d39 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getUserFavorites | 获取用户收藏列表 | public async getUserFavorites(userId: string): Promise<FavoriteInfo[]> {
try {
const records = await this.databaseManager.query(
'favorite',
undefined,
'userId = ?',
[userId],
'addTime DESC'
);
return records.map(record => this.convertRecordToFavoriteInfo(... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left ... | public async getUserFavorites(userId: string): Promise<FavoriteInfo[]> {
try {
const records = await this.databaseManager.query(
'favorite',
undefined,
'userId = ?',
[userId],
'addTime DESC'
);
return records.map(record => this.convertRecordToFavoriteInfo(... | https://github.com/DaLongZhuaZi/manxia | d18deb1501d3d08922655c91b33889574d2da3e9 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | getVersionstring | @return {@link VCardConfig#VERSION_30} | protected getVersionstring(): string {
return VCardConstants.VERSION_V21;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getVersionstring 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 ... | protected getVersionstring(): string {
return VCardConstants.VERSION_V21;
} | https://gitee.com/openharmony-tpc/VCard.git | e09ec0377c9228cd015e3e8166144740eae2ef36 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/ManyToManyMetadata.ets | arkts | constructor | 构造函数
@param sourceEntity 源实体名称
@param targetEntity 目标实体名称
@param propertyName 在源实体中的属性名
@param joinTable 中间表名
@param joinSourceKey 源实体在中间表的外键列名
@param joinTargetKey 目标实体在中间表的外键列名 | constructor(
sourceEntity: string,
targetEntity: string,
propertyName: string,
joinTable: string,
joinSourceKey: string,
joinTargetKey: string
) {
super(RelationType.MANY_TO_MANY, sourceEntity, targetEntity, propertyName, '')
this.joinTable = joinTable
this.joinSourceKey = joinSo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceEntity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A... | constructor(
sourceEntity: string,
targetEntity: string,
propertyName: string,
joinTable: string,
joinSourceKey: string,
joinTargetKey: string
) {
super(RelationType.MANY_TO_MANY, sourceEntity, targetEntity, propertyName, '')
this.joinTable = joinTable
this.joinSourceKey = joinSo... | https://github.com/offlinecat-dev/OCNetORM | c57538cd8e40fda1400ba5b35b833fd87f87efef | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | checkMemory | 检测内存是否足够
Windows 11 最低需要 4GB,推荐 8GB 以上 | private checkMemory(): boolean {
try {
// HarmonyOS 设备通常有足够的内存
// 由于 API 限制,我们检查设备类型来推断
const deviceType = deviceInfo.deviceType;
// 平板和电脑通常有 4GB 以上内存
if (deviceType === 'tablet' || deviceType === '2in1' || deviceType === 'pc') {
return true;
}
// 手机... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkMemory 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 AS... | private checkMemory(): boolean {
try {
// HarmonyOS 设备通常有足够的内存
// 由于 API 限制,我们检查设备类型来推断
const deviceType = deviceInfo.deviceType;
// 平板和电脑通常有 4GB 以上内存
if (deviceType === 'tablet' || deviceType === '2in1' || deviceType === 'pc') {
return true;
}
// 手机... | https://github.com/AetheriumSimulator/qemu-hmos | 1b48c2d88b567d53575ee7032b3f48c64b98edf5 | github |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | getMapStringValue | / 获取一个 Map 里面 string 类型的值 | public static getMapStringValue(map: Map<Object, Object> | undefined, key: string, def?: string): string {
let value = WebViewJavascriptBridgeTools.getMapOriginValue(map, key);
if (value === undefined || value === null) {
return def ?? "";
} else {
return WebViewJavascriptBridgeTools.objToStr(... | 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 getMapStringValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left :... | public static getMapStringValue(map: Map<Object, Object> | undefined, key: string, def?: string): string {
let value = WebViewJavascriptBridgeTools.getMapOriginValue(map, key);
if (value === undefined || value === null) {
return def ?? "";
} else {
return WebViewJavascriptBridgeTools.objToStr(... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | 065973746d1d513250fc2e8cf82432620db31c7d | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/PreferenceUtil.ets | arkts | saveValue | 保存首选项 | saveValue() {
this.preferences?.flush()
.catch(() => {
Logger.error(TAG, `保存首选项失败`)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveValue 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 AST... | saveValue() {
this.preferences?.flush()
.catch(() => {
Logger.error(TAG, `保存首选项失败`)
})
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 15ad9de0dcd5705298aa6a454d6ba547739293d6 | gitcode |
openharmony/communication_wifi | wifi/test/wifi_testapp/entry/src/main/ets/pages/subStabilityTest/hotspotStabilityTest.ets | arkts | startContinuousTask | 开始长时任务 | startContinuousTask() {
let context: Context = getContext(this);
// 通知参数,指定点击长时任务通知后跳转的应用
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants : [
{
bundleName : (context as common.UIAbilityContext).abilityInfo.bundleName ,
abilityName : (context as common.UIAbilityContex... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startContinuousTask 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_bloc... | startContinuousTask() {
let context: Context = getContext(this);
// 通知参数,指定点击长时任务通知后跳转的应用
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants : [
{
bundleName : (context as common.UIAbilityContext).abilityInfo.bundleName ,
abilityName : (context as common.UIAbilityContex... | https://gitee.com/openharmony/communication_wifi.git | 7f2231d93b27c980d6907cfe772cadf71183bb07 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test19_original_index.ets | arkts | testPromiseAll | === Round 19: Promise.all/race, Array.from/fill/copyWithin,
String.replaceAll/matchAll, Set operations, Map iteration,
labeled continue, nested destructuring, nullish coalescing chains,
optional chaining chains, computed property access ===
--- Promise.all and Promise.race --- | function testPromiseAll(): string {
let p1: Promise<number> = new Promise<number>((resolve: Function): void => {
resolve(1);
});
let p2: Promise<number> = new Promise<number>((resolve: Function): void => {
resolve(2);
});
let p3: Promise<number> = new Promise<number>((resolve: Function): void => {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testPromiseAll AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testPromiseAll(): string {
let p1: Promise<number> = new Promise<number>((resolve: Function): void => {
resolve(1);
});
let p2: Promise<number> = new Promise<number>((resolve: Function): void => {
resolve(2);
});
let p3: Promise<number> = new Promise<number>((resolve: Function): void => {
... | https://github.com/miaochiahao/ark-ghidra | 084f486dd265dca15ce2eb4907963f4c325ef521 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setAlignment | 弹窗在竖直方向上的对齐方式
@param alignment
@returns | setAlignment(alignment?: DialogAlignment): Builder {
this.dialogOptions.alignment = alignment
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAlignment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alignment AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DialogAlignme... | setAlignment(alignment?: DialogAlignment): Builder {
this.dialogOptions.alignment = alignment
return this
} | https://github.com/wuba/omni-ui | d9388def5a9ee643c46175ec8164e73489b1cf42 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a DoubleType
@param {Type} other type to be checked against
@returns {boolean} true if object also has DoubleType and
this type and other type both are reference or value
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAn... | public override equals(other: Type): boolean {
return other instanceof DoubleType
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
return other instanceof DoubleType
} | https://gitcode.com/iop123123/arkts-static-skills | 267e1dcc1f916074b84c294a4813b92eaf4bf4b4 | gitcode |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | constructor | 构造函数
@param parent 父容器(可选) | constructor(parent?: ServiceContainer) {
this.parent = parent;
} | 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 parent AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Se... | constructor(parent?: ServiceContainer) {
this.parent = parent;
} | https://github.com/codelably/HCompass | 2acbd5d350fd265d1c9a1d619d636fb8bd42dc66 | github |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets | arkts | onPageHide | [Start release_camera]
Trigger once every time the camera page is hidden. | onPageHide() {
setTimeout(this.releaseCamera, 200);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageHide() {
setTimeout(this.releaseCamera, 200);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | d03fd226531df420fb834927f41ecc811523124e | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | getTodayEvents | 获取今天的日程 | async getTodayEvents(): Promise<TodayEventsResult> {
try {
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
const events = await this.eventDao.getEventsByDateRange(
today.getTime(),
tomo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTodayEvents 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 getTodayEvents(): Promise<TodayEventsResult> {
try {
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
const events = await this.eventDao.getEventsByDateRange(
today.getTime(),
tomo... | https://gitcode.com/openharmony/codelabs | 92d74aad9a0f0a88af03e56370930379dbc499de | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/repository/BatchInsertResult.ets | arkts | getSuccessRate | 获取成功率(百分比)
@returns 成功率,0-100 | getSuccessRate(): number {
if (this.totalCount === 0) {
return 0
}
return (this.insertedCount / this.totalCount) * 100
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSuccessRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getSuccessRate(): number {
if (this.totalCount === 0) {
return 0
}
return (this.insertedCount / this.totalCount) * 100
} | https://github.com/offlinecat-dev/OCNetORM | fe7c4b9513fcdf6535209884bc715ebede2f7faa | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataManager.ets | arkts | deleteReminder | 删除提醒设置 | async deleteReminder(id: string): Promise<boolean> {
try {
const reminders = await this.getAllReminders();
const filteredReminders = reminders.filter(r => r.id !== id);
await this.dataPreferences?.put(KEY_REMINDERS, JSON.stringify(filteredReminders));
await this.dataPreferences?.flush();
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteReminder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async deleteReminder(id: string): Promise<boolean> {
try {
const reminders = await this.getAllReminders();
const filteredReminders = reminders.filter(r => r.id !== id);
await this.dataPreferences?.put(KEY_REMINDERS, JSON.stringify(filteredReminders));
await this.dataPreferences?.flush();
... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 30348900334eab6b4f179f7ad0c898eeddcb3259 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getMangaReadingProgressText | 获取漫画阅读进度文本
显示当前章节名称和页数 | private getMangaReadingProgressText(manga: Manga): string {
if (!manga.readingProgress) {
return '';
}
const progress = manga.readingProgress;
// 尝试获取当前章节名称
let chapterName = '';
if (progress.currentChapterId && manga.chapters && manga.chapters.length > 0) {
const currentChapt... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMangaReadingProgressText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private getMangaReadingProgressText(manga: Manga): string {
if (!manga.readingProgress) {
return '';
}
const progress = manga.readingProgress;
// 尝试获取当前章节名称
let chapterName = '';
if (progress.currentChapterId && manga.chapters && manga.chapters.length > 0) {
const currentChapt... | https://github.com/DaLongZhuaZi/manxia | 5313dd758dd0f23b64c7b2fa15ad3f364b836d92 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | stateChange | 🔄 记录状态变化
@param tag - 日志分类标签
@param from - 原状态
@param to - 新状态
@param details - 变化详情 | public stateChange(tag: string, from: string, to: string, details?: string): void {
const detailsText = details ? ` - ${details}` : '';
this.info(tag, `🔄 状态变化: ${from} → ${to}${detailsText}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | public stateChange(tag: string, from: string, to: string, details?: string): void {
const detailsText = details ? ` - ${details}` : '';
this.info(tag, `🔄 状态变化: ${from} → ${to}${detailsText}`);
} | https://github.com/DaLongZhuaZi/manxia | eb0e8de4770131eb0ae1c5a5fe9ab82d0eecd407 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | hasMangaReadingProgress | 检查漫画是否有阅读进度
判断条件:有 currentChapterId 或 currentPageIndex > 0 | private hasMangaReadingProgress(manga: Manga): boolean {
if (!manga.readingProgress) {
return false;
}
const progress = manga.readingProgress;
// 有章节ID表示有阅读记录
if (progress.currentChapterId && progress.currentChapterId.length > 0) {
return true;
}
// 页码大于 0 表示已经翻过页
if (progr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasMangaReadingProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private hasMangaReadingProgress(manga: Manga): boolean {
if (!manga.readingProgress) {
return false;
}
const progress = manga.readingProgress;
// 有章节ID表示有阅读记录
if (progress.currentChapterId && progress.currentChapterId.length > 0) {
return true;
}
// 页码大于 0 表示已经翻过页
if (progr... | https://github.com/DaLongZhuaZi/manxia | 421fe8e6b86a2848138baa6c3a061acaf7b5ed21 | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t12_basicStringify | T12: Basic stringify | t12_basicStringify(): void {
const obj: Record<string, Object> = {} as Record<string, Object>;
obj['a'] = '1'; obj['b'] = '2'; obj['c'] = '3';
const result: string = stringify(obj);
const passed: boolean = result === 'a=1&b=2&c=3';
this.record('T12 Basic stringify', passed,
'a=1&b=2&c=3', re... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t12_basicStringify 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... | t12_basicStringify(): void {
const obj: Record<string, Object> = {} as Record<string, Object>;
obj['a'] = '1'; obj['b'] = '2'; obj['c'] = '3';
const result: string = stringify(obj);
const passed: boolean = result === 'a=1&b=2&c=3';
this.record('T12 Basic stringify', passed,
'a=1&b=2&c=3', re... | https://github.com/wgli-collab/qs-arkts | fe159a54c64fbfb349c092e2ece9b6f6cf565377 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleShareIfNeeded | 处理分享数据 | private async handleShareIfNeeded(want: Want, launchReasonMessage?: string): Promise<void> {
if (launchReasonMessage === 'ReasonMessage_SystemShare') {
hilog.info(DOMAIN, 'testTag', 'App launched by system share');
try {
const sharedData = await systemShare.getSharedData(want);
const r... | 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 handleShareIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#L... | private async handleShareIfNeeded(want: Want, launchReasonMessage?: string): Promise<void> {
if (launchReasonMessage === 'ReasonMessage_SystemShare') {
hilog.info(DOMAIN, 'testTag', 'App launched by system share');
try {
const sharedData = await systemShare.getSharedData(want);
const r... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 7bab009e85c3ebae49189e0a311eba4e638af787 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setUTCFullYear | Sets the full year for a specified date according to universal time.
@param { int } value new year
@param { int } month new month
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setUTCFullYear(value: int, month: int): long {
this.setUTCFullYear(value);
this.setUTCMonth(month);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCFullYear 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#identifi... | public setUTCFullYear(value: int, month: int): long {
this.setUTCFullYear(value);
this.setUTCMonth(month);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | a339e530ec315ad5d65f68a89b120b67bc7dc4c2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array with respect to data accessed via Iterable<Number> interface
@param { Iterable<BigInt> } elements - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(elements: Iterable<BigInt>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<BigInt>(items as ArrayLike<BigInt>)
this.byteLengthInt = arr.length * BigUint64Array.BYTES_PER_ELEMENT... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex... | public constructor(elements: Iterable<BigInt>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<BigInt>(items as ArrayLike<BigInt>)
this.byteLengthInt = arr.length * BigUint64Array.BYTES_PER_ELEMENT... | https://gitcode.com/iop123123/arkts-static-skills | 89d1c9a7ef1b9b9cc76bcde1779f18aed62b55e9 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findIndex | Finds an index of the first element in the Uint16Array that satisfies the condition
@param fn condition
@returns the index of the first element that satisfies fn | public findIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public findIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 68a33d61f9a4ac91279774d2960756aeab71a0e2 | gitee |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/ApiClient.ets | arkts | createTopic | 创建新话题 | async createTopic(title: string, raw: string, categoryId: number, tags: string[] | null = null): Promise<number> {
const normalizedTitle: string = title.trim();
const normalizedRaw: string = raw.trim();
if (normalizedTitle.length === 0) {
throw new Error('请输入标题');
}
if (normalizedRaw.length ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createTopic AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async createTopic(title: string, raw: string, categoryId: number, tags: string[] | null = null): Promise<number> {
const normalizedTitle: string = title.trim();
const normalizedRaw: string = raw.trim();
if (normalizedTitle.length === 0) {
throw new Error('请输入标题');
}
if (normalizedRaw.length ... | https://github.com/Amaz1ny/HarmonyDO-public | dd12c142680f07a0fc822f020c33ffae9aefdd29 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/JSONPathParser.ets | arkts | parseBoolean | 解析布尔值 | static parseBoolean(data: Record<string, Object>, path: string): boolean {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (typeof result === 'boolean') {
return result;
}
if (typeof result === 'string') {
return result.toLowerCase() === 'true';
}
if (typeof res... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseBoolean 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... | static parseBoolean(data: Record<string, Object>, path: string): boolean {
const result: JSONPathResult = JSONPathParser.parse(data, path);
if (typeof result === 'boolean') {
return result;
}
if (typeof result === 'string') {
return result.toLowerCase() === 'true';
}
if (typeof res... | https://github.com/DaLongZhuaZi/manxia | 1465c47130e55d1ad9516587853231717e597436 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/FileUtils.ets | arkts | activatePermission | 激活文件权限
@param path 文件路径
@returns 结果
@throws BusinessError | public static activatePermission(path: string, operationMode: fileShare.OperationMode): Promise<void> {
if (!canIUse(FileUtils.FolderAuthorization)) {
throw new Error('this api is not supported on this device');
}
let policyInfo: fileShare.PolicyInfo = {
uri: path,
operationMode: operati... | 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 activatePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left... | public static activatePermission(path: string, operationMode: fileShare.OperationMode): Promise<void> {
if (!canIUse(FileUtils.FolderAuthorization)) {
throw new Error('this api is not supported on this device');
}
let policyInfo: fileShare.PolicyInfo = {
uri: path,
operationMode: operati... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FileUtils.ets#L20-L30 | 294bfc65e8f1121d0374f6b6089feffbdde5c602 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | slice | Creates a slice of current Uint8 with all elements.
@returns a new Uint8Array with elements of current Uint8Array | public slice(): Uint8Array {
return new Uint8Array(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): Uint8Array {
return new Uint8Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9a1010619c612a7e4390feea39ebbf7f541213e3 | gitee |
HarmonyOS_Samples/MusicHome | products/pc/src/main/ets/pcability/PcAbility.ets | arkts | onBackground | Logs background. | onBackground(): void {
Logger.info('PcAbility: Ability onBackground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground 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... | onBackground(): void {
Logger.info('PcAbility: Ability onBackground');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 2bbc2e784b346034f907ac62d192f8ec5b11a690 | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | ensureDirectoryExists | 确保目录存在 | private async ensureDirectoryExists(path: string): Promise<void> {
try {
const stat = fs.statSync(path);
if (!stat.isDirectory()) {
throw new Error(`${path} exists but is not a directory`);
}
} catch (e) {
// 目录不存在,创建它
fs.mkdirSync(path, true);
console.info(`[RDPDri... | 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 ensureDirectoryExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:... | private async ensureDirectoryExists(path: string): Promise<void> {
try {
const stat = fs.statSync(path);
if (!stat.isDirectory()) {
throw new Error(`${path} exists but is not a directory`);
}
} catch (e) {
// 目录不存在,创建它
fs.mkdirSync(path, true);
console.info(`[RDPDri... | https://github.com/AetheriumSimulator/qemu-hmos | 7accdd5641e36a98f3bba2bc13c26ae10b7943ff | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | selectRefundReason | 选择退款原因
@param {DictItem | null} reason - 退款原因
@returns {void} 无返回值 | selectRefundReason(reason: DictItem | null): void {
this.selectedRefundReason = reason;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectRefundReason AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left DictItem... | selectRefundReason(reason: DictItem | null): void {
this.selectedRefundReason = reason;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 03756e55c5a4c60e6da34e8697fddad04ccc0cbc | github |
cduestc-course/ArkLearn | entry/src/main/ets/pages/06/6.2.6.ets | arkts | delToken | 删除仓库中字段 | static delToken(content:Context, storeName:string=PreferencesClass.defaultStore) {
const store = preferences.getPreferencesSync(content,{name:storeName})
store.deleteSync(PreferencesClass.tokenKey)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left delToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Context AST#identifi... | static delToken(content:Context, storeName:string=PreferencesClass.defaultStore) {
const store = preferences.getPreferencesSync(content,{name:storeName})
store.deleteSync(PreferencesClass.tokenKey)
} | https://github.com/cduestc-course/ArkLearn | 771179c69883ef941e62b90c611319343e1b72df | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationErrorHandler.ets | arkts | createRouteNotFoundError | 创建路由不存在错误
@param url 路由路径
@returns NavigationError | public static createRouteNotFoundError(url: string): NavigationError {
return new NavigationError(
`Route not found: ${url}`,
NavigationErrorType.ROUTE_NOT_FOUND,
url
);
} | 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 createRouteNotFoundError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:... | public static createRouteNotFoundError(url: string): NavigationError {
return new NavigationError(
`Route not found: ${url}`,
NavigationErrorType.ROUTE_NOT_FOUND,
url
);
} | https://github.com/LJ666-ui/harmony-health-care | 08dd736159d71dcb6f439ffaef47d4f87099ff29 | github |
codelably/HCompass | core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets | arkts | warn | 警告级别日志
@param data 日志内容
@param tag 自定义标签 | static warn(data: Any, tag?: string) {
Logger.log(LogLevel.WARN, data, tag);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left warn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | static warn(data: Any, tag?: string) {
Logger.log(LogLevel.WARN, data, tag);
} | https://github.com/codelably/HCompass | 5336adcc9a3c22375bc258ec8e90ebf89bb0746a | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets | arkts | showAndResumeDrawTask | show the danmakuview again if you called hideAndPauseDrawTask()
@param position The position you want to resume
@see #hideAndPauseDrawTask | showAndResumeDrawTask(position: number): void{
this.delegate.showAndResumeDrawTask(position)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showAndResumeDrawTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left... | showAndResumeDrawTask(position: number): void{
this.delegate.showAndResumeDrawTask(position)
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 9f0c0826f633b8cd1698e575ad0a1b0db3a7d4d3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getChapterWithPagesByExternalId | 【WebView专用】根据外部章节ID获取完整章节信息(包括页面列表)
用于WebView图源阅读器,一次性获取章节和页面信息
@param comicId 漫画的内部ID
@param externalChapterId 章节的外部ID
@returns 包含章节信息和页面列表的对象,如果未找到则返回null | public async getChapterWithPagesByExternalId(
comicId: string,
externalChapterId: string
): Promise<ChapterWithPages | null> {
try {
logger.info(TAG, `🔍 [WebView专用方法] 查询章节及页面: comicId=${comicId}, externalChapterId=${externalChapterId}`);
// 1. 获取章节信息
const chapterInfo = await ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getChapterWithPagesByExternalId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#... | public async getChapterWithPagesByExternalId(
comicId: string,
externalChapterId: string
): Promise<ChapterWithPages | null> {
try {
logger.info(TAG, `🔍 [WebView专用方法] 查询章节及页面: comicId=${comicId}, externalChapterId=${externalChapterId}`);
// 1. 获取章节信息
const chapterInfo = await ... | https://github.com/DaLongZhuaZi/manxia | aa6590a674a76f47a6464df21f2bf1d626e63f7c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getChapterPages | 获取章节页面列表 | public async getChapterPages(chapterId: string): Promise<PageInfo[]> {
try {
const records = await this.databaseManager.query(
'page',
undefined,
'chapterId = ?',
[chapterId],
'pageNumber ASC'
);
return records.map(record => this.convertRecordToPageInfo(re... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getChapterPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async getChapterPages(chapterId: string): Promise<PageInfo[]> {
try {
const records = await this.databaseManager.query(
'page',
undefined,
'chapterId = ?',
[chapterId],
'pageNumber ASC'
);
return records.map(record => this.convertRecordToPageInfo(re... | https://github.com/DaLongZhuaZi/manxia | 69cb3b02915bcf57bb0d28fa86efeffd50565c98 | github |
codelably/HCompass | core/navigation/src/main/ets/NavigationService.ets | arkts | navigateBackWithResult | 携带结果返回上一页
@param result 返回结果
@param animated 是否需要动画 | navigateBackWithResult(result: Object, animated?: boolean): void {
if (!this.stack) {
return;
}
try {
this.stack.pop(result, animated);
this.log('Navigated back with result');
} catch (err) {
this.logError(`Navigate back with result failed: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateBackWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST... | navigateBackWithResult(result: Object, animated?: boolean): void {
if (!this.stack) {
return;
}
try {
this.stack.pop(result, animated);
this.log('Navigated back with result');
} catch (err) {
this.logError(`Navigate back with result failed: ${JSON.stringify(err)}`);
}
} | https://github.com/codelably/HCompass | aef370f8a0afc38d6acb36a42889cee716111824 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/RelationMetadata.ets | arkts | constructor | 构造函数
@param type 关系类型
@param sourceEntity 源实体名称
@param targetEntity 目标实体名称
@param propertyName 在源实体中的属性名
@param inverseKey 外键列名
@param foreignKeySide 外键位置(仅用于 ONE_TO_ONE 关系,默认 'source')
@param cascade 级联配置 | constructor(
type: RelationType,
sourceEntity: string,
targetEntity: string,
propertyName: string,
inverseKey: string,
foreignKeySide: string = 'source',
cascade: CascadeSetting | null = null
) {
this.type = type
this.sourceEntity = sourceEntity
this.targetEntity = targetEnti... | 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 type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RelationType AST#identifier#R... | constructor(
type: RelationType,
sourceEntity: string,
targetEntity: string,
propertyName: string,
inverseKey: string,
foreignKeySide: string = 'source',
cascade: CascadeSetting | null = null
) {
this.type = type
this.sourceEntity = sourceEntity
this.targetEntity = targetEnti... | https://github.com/offlinecat-dev/OCNetORM | 2f6355455f61fddc90679d62b83259ecd47f147f | github |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | defaultUserAgent | 默认 User-Agent(与 olib release 包逆向得到的 Android Chrome UA 一致)。
给下载(request.agent)/ 阅读器(ArkWeb)等不走 attemptOnce 的场景复用,
避免使用 HarmonyOS 默认 UA 暴露客户端身份导致被服务端 403 / 429。 | defaultUserAgent(): string {
return UA;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left defaultUserAgent 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... | defaultUserAgent(): string {
return UA;
} | https://github.com/LZZLHY/hlib | adec10fb4414222e7636c8d7bf069655f4541d9f | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleConfiguration.ets | arkts | applyRawSettings | -- Validation + apply -- | private applyRawSettings(raw: string, origin: string): void {
let parsed: Object;
try {
parsed = JSON.parse(raw);
} catch (err) {
this.config.logger.w(`[ModuleConfiguration] applyRawSettings (${origin}), JSON parse failed, ignoring: ${err}`);
return;
}
if (parsed === null || type... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyRawSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private applyRawSettings(raw: string, origin: string): void {
let parsed: Object;
try {
parsed = JSON.parse(raw);
} catch (err) {
this.config.logger.w(`[ModuleConfiguration] applyRawSettings (${origin}), JSON parse failed, ignoring: ${err}`);
return;
}
if (parsed === null || type... | https://github.com/Countly/countly-sdk-hos | abb4c142bd6737451a0f5b021d71ec771d873452 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/pages/Search/SearchPage.ets | arkts | getUserList | 获取用户列表 | getUserList() {
this.userList = new Tiktok(getContext()).getTikTokConnect()
this.updateFilterList()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getUserList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | getUserList() {
this.userList = new Tiktok(getContext()).getTikTokConnect()
this.updateFilterList()
} | https://github.com/SMAT-Lab/PhantomRendering | 2399634bfcc4059e0c22b47762c7206d2571f365 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/pages/friendCircle.ets | arkts | constructor | 内容图片列表 | constructor(nickName: string, content: string, images: ResourceStr[]) {
this.nickName = nickName;
this.content = content;
this.images = images;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nickName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | constructor(nickName: string, content: string, images: ResourceStr[]) {
this.nickName = nickName;
this.content = content;
this.images = images;
} | https://gitee.com/openharmony/vendor_unionman.git | ee901e4f87fad9bc34c31f92dfadf6211a72c3ee | gitee |
AGenUI/AGenUI | playground/harmony/entry/src/ohosTest/ets/test/tests/ReentrantDeadlockTest.ets | arkts | buildUpdateWithFunctionCallBinding | Build updateComponents with a function call data binding on text property | function buildUpdateWithFunctionCallBinding(surfaceId: string, funcName: string): string {
return `{"version":"v0.9","updateComponents":{"surfaceId":"${surfaceId}","components":[{"id":"root","component":"Column","children":["txt1"]},{"id":"txt1","component":"Text","text":{"call":"${funcName}","args":{"input":"test"}}... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildUpdateWithFunctionCallBinding 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#... | function buildUpdateWithFunctionCallBinding(surfaceId: string, funcName: string): string {
return `{"version":"v0.9","updateComponents":{"surfaceId":"${surfaceId}","components":[{"id":"root","component":"Column","children":["txt1"]},{"id":"txt1","component":"Text","text":{"call":"${funcName}","args":{"input":"test"}}... | https://github.com/AGenUI/AGenUI | 1a958cedbc06b21ce45e8136e521b56dbe7693e9 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | resetViewPortOffsets | Resets all custom offsets set via setViewPortOffsets(...) method. Allows
the chart to again calculate all offsets automatically. | public resetViewPortOffsets(): void {
this.mCustomViewPortEnabled = false;
this.calculateOffsets();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetViewPortOffsets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#e... | public resetViewPortOffsets(): void {
this.mCustomViewPortEnabled = false;
this.calculateOffsets();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | dd214d7e15dc7d9ee7e0c569144bda2caeb6fcf0 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | getPlayMode | Get music play mode.
@returns playMode. | public getPlayMode() {
return this.playMode;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPlayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public getPlayMode() {
return this.playMode;
} | https://gitee.com/harmonyos/codelabs.git | 03134d72342c5fc3cbcdc14073cb1bdb86a8fc2c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | UTC | Returns the number of milliseconds elapsed since the epoch,
which is defined as the midnight at the beginning of January 1, 1970, UTC.
@param { int } year to be converted to milliseconds.
@param { int } month to be converted to milliseconds.
@param { int } day to be converted to milliseconds.
@param { int } hours to be... | public static UTC(year: int, month: int, day?: int, hours?: int, minutes?: int, seconds?: int, ms?: int): long {
return ecmaMakeDate(
ecmaMakeDay(
ecmaMakeFullYear(year),
month,
day != undefined ? day : 1.0
),
ecmaMakeTime(
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left UTC AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left year AST#identifier#Right A... | public static UTC(year: int, month: int, day?: int, hours?: int, minutes?: int, seconds?: int, ms?: int): long {
return ecmaMakeDate(
ecmaMakeDay(
ecmaMakeFullYear(year),
month,
day != undefined ? day : 1.0
),
ecmaMakeTime(
... | https://gitcode.com/iop123123/arkts-static-skills | 921057ef5dcb96cdaebc92994a605f56a8f1e1e6 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/webdav/Sha256.ets | arkts | rotr | =====================================================
Sha256.ets - Pure ArkTS SHA-256 (Uint8Array -> Uint8Array)
Minimal, dependency-free.
===================================================== | function rotr(x: number, n: number): number {
return (x >>> n) | (x << (32 - n));
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rotr AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pred... | function rotr(x: number, n: number): number {
return (x >>> n) | (x << (32 - n));
} | https://github.com/CLMC2025/Vignette | baaf353144a44e5c826c03ee10e7207273ff3ae1 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | toReversed | Creates a reversed copy
@returns { Uint8Array } - a reversed copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toReversed(): Uint8Array {
let newArray = new Uint8Array(this.lengthInt)
if (this.lengthInt > 0) {
Uint8Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Uint8Array ... | public toReversed(): Uint8Array {
let newArray = new Uint8Array(this.lengthInt)
if (this.lengthInt > 0) {
Uint8Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt);
}
return newArray
} | https://gitcode.com/iop123123/arkts-static-skills | 53d10603be85ea2259a72448c3531e8fed5ccdfb | gitcode |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenUIContainer.ets | arkts | onDidBuild | Called after the component is built
Initializes AGenUI and builds the node tree. | onDidBuild(): void {
hilog.info(0x0000, 'agenui-ets', 'onDidBuild');
AppStorage.setOrCreate<UIContext>("context", this.getUIContext());
// Resolve instanceId from surfaceId via native mapping (registered when surface was created).
this.resolvedInstanceId = internal_a2ui.findInstanceIdBySurfaceId(this.... | 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 {
hilog.info(0x0000, 'agenui-ets', 'onDidBuild');
AppStorage.setOrCreate<UIContext>("context", this.getUIContext());
// Resolve instanceId from surfaceId via native mapping (registered when surface was created).
this.resolvedInstanceId = internal_a2ui.findInstanceIdBySurfaceId(this.... | https://github.com/AGenUI/AGenUI | 53fa7268aa9ee36c63a2ab9fb4a5a9a852a29b68 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneManager.ets | arkts | initializeMicrophoneStream | 初始化麦克风流 | async initializeMicrophoneStream(): Promise<boolean> {
if (!this.enableMic) {
console.info(TAG, '麦克风功能已禁用');
return false;
}
if (this.microphoneStream !== null) {
console.info(TAG, '麦克风流已存在');
return true;
}
// 检查权限
if (!await this.hasMicrophonePermission()) {... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initializeMicrophoneStream AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_anno... | async initializeMicrophoneStream(): Promise<boolean> {
if (!this.enableMic) {
console.info(TAG, '麦克风功能已禁用');
return false;
}
if (this.microphoneStream !== null) {
console.info(TAG, '麦克风流已存在');
return true;
}
// 检查权限
if (!await this.hasMicrophonePermission()) {... | https://github.com/AlkaidLab/moonlight-harmony | 2d00e551c8ec151ce167dbb99d8dd07700686b31 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/TrendsPage.ets | arkts | calculateMin | 计算最小值 | calculateMin(): number {
const values = this.records.map(r => this.getValueFromRecord(r)).filter(v => v > 0);
return values.length > 0 ? Math.min(...values) : 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement... | calculateMin(): number {
const values = this.records.map(r => this.getValueFromRecord(r)).filter(v => v > 0);
return values.length > 0 ? Math.min(...values) : 0;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 66f863144d6f8e71835cd4cc56052201a4a15165 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | exists | 检查文件是否存在
优先检查本地缓存
@param path 文件路径
@returns 文件是否存在 | public async exists(path: string): Promise<boolean> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.exists(path);
}
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const forceRefresh: boolean = CacheConstants.getForceRefresh();
// 如果强制刷... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Righ... | public async exists(path: string): Promise<boolean> {
// 如果禁用本地缓存
if(!CacheConstants.isEnableLocalCache()){
return this.decoratedStorage.exists(path);
}
const onlyUseCache: boolean = CacheConstants.getOnlyCache();
const forceRefresh: boolean = CacheConstants.getForceRefresh();
// 如果强制刷... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L119-L146 | ecf6e9effbd64e5674118e8b8e7c2e5325250438 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/pages/BillListPage.ets | arkts | onPageShow | 页面每次显示时刷新数据 | onPageShow() {
this.loadBills();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
this.loadBills();
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 989799c4a0943bf7fb1c886ff2a3aee9c9129be1 | github |
codelably/HCompass | core/network/src/main/ets/AxiosHttpClient.ets | arkts | getAxiosInstance | 获取 Axios 实例(高级用法)
@returns Axios 实例 | getAxiosInstance(): AxiosInstance {
return this.axiosInstance;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAxiosInstance 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 AxiosInstance AST#identifier#Right AST#ERROR#... | getAxiosInstance(): AxiosInstance {
return this.axiosInstance;
} | https://github.com/codelably/HCompass | e45d9c507543a2cef5ef94c5c5c64a9118cd3fbd | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/feedback/FeedbackNetworkDataSourceImpl.ets | arkts | submitFeedback | 提交反馈
@param {FeedbackSubmitRequest} params - 反馈内容
@returns {Promise<NetworkResponse<boolean>>} 是否提交成功 | async submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("app/feedback/submit", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitFeedback AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("app/feedback/submit", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 42b1593223a29f8f87c19aec1980c55e0b555ec5 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/service/ChartService.ets | arkts | getTimeKey | 获取时间键(用于分组) | private getTimeKey(time: Date, granularity: string): string {
const year = time.getFullYear();
const month = time.getMonth() + 1;
const day = time.getDate();
const hour = time.getHours();
switch (granularity) {
case 'hour':
return `${year}-${month}-${day}-${hour}`;
case 'd... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTimeKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Da... | private getTimeKey(time: Date, granularity: string): string {
const year = time.getFullYear();
const month = time.getMonth() + 1;
const day = time.getDate();
const hour = time.getHours();
switch (granularity) {
case 'hour':
return `${year}-${month}-${day}-${hour}`;
case 'd... | https://github.com/LJ666-ui/harmony-health-care | 40c8d98d36b7488cfb9a6866167798b6add7ca29 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Stack.ets | arkts | peek | Retrieves the top element in the Stack without removing it.
@returns The top element in the Stack. | public peek(): T {
this.checkEmptyContainer();
return this.buffer[this.length - 1];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left peek 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... | public peek(): T {
this.checkEmptyContainer();
return this.buffer[this.length - 1];
} | https://gitcode.com/iop123123/arkts-static-skills | 90d6016c98f03f5359c4d3032d37d5a9f8bc999e | gitcode |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/IWebDownloadFile.ets | arkts | copyFileContents | 复制文件内容 | private async copyFileContents(sourcePath: string, destPath: string) {
const sourceFd = await fileIo.open(sourcePath, fileIo.OpenMode.READ_ONLY)
const stat = await fileIo.stat(sourcePath)
const buffer = new ArrayBuffer(stat.size)
await fileIo.read(sourceFd.fd, buffer)
await fileIo.close(sourceFd)... | 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 copyFileContents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#... | private async copyFileContents(sourcePath: string, destPath: string) {
const sourceFd = await fileIo.open(sourcePath, fileIo.OpenMode.READ_ONLY)
const stat = await fileIo.stat(sourcePath)
const buffer = new ArrayBuffer(stat.size)
await fileIo.read(sourceFd.fd, buffer)
await fileIo.close(sourceFd)... | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 5c0c377c54bf732878496196e5536046f5ed42fa | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | createDoubleFromJSONValue | Creates a Double instance based on JSONValue
@param { Double } this JSONValue - a JSON representation
@param { JSONValue } json
@returns { Double } - true if JSON encodes true literal, false if JSON encodes false literal
@throws { JSONTypeError } if json does not encode a valid boolean literal | function createDoubleFromJSONValue(json: JSONValue): Double {
if (json instanceof JSONNumber) {
return new Double((json as JSONNumber).value)
}
throw new JSONTypeError('Cannot create Double from JSON', {cause: json as Object} as ErrorOptions)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createDoubleFromJSONValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | function createDoubleFromJSONValue(json: JSONValue): Double {
if (json instanceof JSONNumber) {
return new Double((json as JSONNumber).value)
}
throw new JSONTypeError('Cannot create Double from JSON', {cause: json as Object} as ErrorOptions)
} | https://gitcode.com/iop123123/arkts-static-skills | 989b74e976182b20d1e6bb3303b7de6b8e461c41 | gitcode |
erosTeam/NextE | shared/src/main/ets/state/LayoutSafeAreaState.ets | arkts | publishGalleryContentWidth | Cache the last measured gallery content width (or pass 0 to invalidate on window-size change). | static publishGalleryContentWidth(width: number): void {
const state = connectLayoutSafeArea()
if (state.galleryContentWidth !== width) {
state.galleryContentWidth = width
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left publishGalleryContentWidth 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#iden... | static publishGalleryContentWidth(width: number): void {
const state = connectLayoutSafeArea()
if (state.galleryContentWidth !== width) {
state.galleryContentWidth = width
}
} | https://github.com/erosTeam/NextE | ea9ecbbe469c4e6024c30c7fd565f2282411c628 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | setPopupCallback | 设置回调
@param popupCallback | setPopupCallback(popupCallback?: PopupCallback) {
this.popupCallback = popupCallback
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPopupCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left popupCallback AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | setPopupCallback(popupCallback?: PopupCallback) {
this.popupCallback = popupCallback
} | https://github.com/wuba/omni-ui | aa38950097a652f8f66a7d70f840a69f992687cf | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | fetchTopicEditFormWithCookie | Fetch the edit form to PRE-FILL the editor. V2EX serves /edit/topic/<id> only to the author and only
within the 600s edit window; once it closes the page has no form → EDIT_WINDOW_CLOSED. | async fetchTopicEditFormWithCookie(cookie: string, topicId: number): Promise<V2exTopicEditForm> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const editPath = `/edit/topic/${topicId}`
const res = await this.requestHtmlWithC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchTopicEditFormWithCookie AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#ident... | async fetchTopicEditFormWithCookie(cookie: string, topicId: number): Promise<V2exTopicEditForm> {
if (!cookie) {
throw ApiErrors.authRequired()
}
if (topicId <= 0) {
throw ApiErrors.invalidTopicId()
}
const editPath = `/edit/topic/${topicId}`
const res = await this.requestHtmlWithC... | https://github.com/honjow/Next2V | fc275b2d7ac47895d77c219ebf8a0778a35d2e48 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets | arkts | match | 检查是否匹配该技能 | static match(query: string): boolean {
const triggers = [
'我头疼', '头疼怎么办', '头痛',
'肚子疼', '胃疼', '腹痛',
'发烧', '咳嗽', '恶心', '呕吐',
'不舒服', '难受', '身体不适',
'看医生', '问诊', '看病',
'打开 AI 问诊', 'AI 问诊', '智能问诊',
'我感觉', '我觉得', '好像得了'
];
return triggers.some(trigger => query.inclu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left match AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | static match(query: string): boolean {
const triggers = [
'我头疼', '头疼怎么办', '头痛',
'肚子疼', '胃疼', '腹痛',
'发烧', '咳嗽', '恶心', '呕吐',
'不舒服', '难受', '身体不适',
'看医生', '问诊', '看病',
'打开 AI 问诊', 'AI 问诊', '智能问诊',
'我感觉', '我觉得', '好像得了'
];
return triggers.some(trigger => query.inclu... | https://github.com/LJ666-ui/harmony-health-care | f579627e65174c062d8fee9778c4bd4560a8dc43 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | getCurrentFlipImage | Get flip image.
@returns | getCurrentFlipImage(): RectF {
let center = this.getDisplayCenter();
let image = this.imageRect;
let flipImage = new RectF();
flipImage.left = this.isFlipHorizontal ? (2 * center.x - image.right) : image.left;
flipImage.top = this.isFlipVertically ? (2 * center.y - image.bottom) : image.top;
f... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentFlipImage 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 RectF AST#identifier#Right AST#ERROR#Right... | getCurrentFlipImage(): RectF {
let center = this.getDisplayCenter();
let image = this.imageRect;
let flipImage = new RectF();
flipImage.left = this.isFlipHorizontal ? (2 * center.x - image.right) : image.left;
flipImage.top = this.isFlipVertically ? (2 * center.y - image.bottom) : image.top;
f... | https://gitee.com/openharmony/codelabs.git | 57d11060c66d290a4a034b8af5664b6d64d236b0 | gitee |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/viewmodel/EntryViewModel.ets | arkts | aboutToDisappear | 入口页面销毁
由 EntryPage.aboutToDisappear 调用,释放窗口监听
@returns {void} 无返回值 | aboutToDisappear(): void {
this.windowAdapter.dispose();
} | AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
this.windowAdapter.dispose();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3f53603e627e0645a00d44feff390809f3b19256 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | takePicture | 以指定参数触发一次拍照 | async takePicture(): Promise<void> {
Logger.info(TAG, 'takePicture start');
let cameraDeviceIndex = GlobalContext.get().getT<number>('cameraDeviceIndex');
let photoSettings: camera.PhotoCaptureSetting = {
quality: camera.QualityLevel.QUALITY_LEVEL_HIGH,
mirror: cameraDeviceIndex ? true : false... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left takePicture AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | async takePicture(): Promise<void> {
Logger.info(TAG, 'takePicture start');
let cameraDeviceIndex = GlobalContext.get().getT<number>('cameraDeviceIndex');
let photoSettings: camera.PhotoCaptureSetting = {
quality: camera.QualityLevel.QUALITY_LEVEL_HIGH,
mirror: cameraDeviceIndex ? true : false... | https://gitee.com/openharmony/multimedia_camera_framework.git | 95b4bc80ec4ba8b29feab899c4252f081fcf6fe3 | gitee |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | lifecycleForeground | -- Lifecycle -- | public lifecycleForeground(): void {
// Post-halt fan-out gate. Module-level mutators already check
// `rejectIfHalted`, but the lifecycle hooks (`onEnterForeground`,
// `onEnterBackground`) call through to internal helpers
// (`recordViewEvent` → private `recordEventAt`) that bypass those gates.
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lifecycleForeground 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... | public lifecycleForeground(): void {
// Post-halt fan-out gate. Module-level mutators already check
// `rejectIfHalted`, but the lifecycle hooks (`onEnterForeground`,
// `onEnterBackground`) call through to internal helpers
// (`recordViewEvent` → private `recordEventAt`) that bypass those gates.
... | https://github.com/Countly/countly-sdk-hos | fbee5febba02b9f4e40414bffaaf21edc2c8653b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.