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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets | arkts | has | Checks if the deque contains a specific element.
@param element - The element to check for.
@returns True if the element is found, false otherwise. | public has(element: T): boolean {
let i: int = this.front;
while (i != this.rear) {
if (this.buffer[i] === element) {
return true;
}
i = (i + 1) % this.capacity;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public has(element: T): boolean {
let i: int = this.front;
while (i != this.rear) {
if (this.buffer[i] === element) {
return true;
}
i = (i + 1) % this.capacity;
}
return false;
} | https://gitcode.com/iop123123/arkts-static-skills | 87357f55296a7087da19dd8fb5a842d64261be39 | gitcode |
robotzzh/AgricultureApp | entry/src/main/ets/DB/DistributedUtil.ets | arkts | putStoreData | 向键值数据库中插入数据 | async putStoreData(key: string, value: any) {
if (!key || !value) {
return
}
if(!kvStore) {
kvStore = await this.createKeyValueDB();
}
try {
kvStore.put(key, value, (err) => {
if (err !== undefined) {
console.error(`Failed to put data. Code:${err.code},message... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left putStoreData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#typ... | async putStoreData(key: string, value: any) {
if (!key || !value) {
return
}
if(!kvStore) {
kvStore = await this.createKeyValueDB();
}
try {
kvStore.put(key, value, (err) => {
if (err !== undefined) {
console.error(`Failed to put data. Code:${err.code},message... | https://github.com/robotzzh/AgricultureApp | ed36e3284eaca1a46e9bb8ea6c5cb915e4df4e9a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isUpperCase | isUpperCase() checks whether the underlying char is an upper case letter.
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isUpperCase(): boolean {
return Char.isUpperCase(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isUpperCase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | public isUpperCase(): boolean {
return Char.isUpperCase(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | c4f8eaad9c2b199d423b7d3da61fe45f3a2b5850 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | deleteCrashLog | 删除指定的崩溃日志 | public async deleteCrashLog(fileName: string): Promise<boolean> {
try {
if (!this.logDirPath) {
return false;
}
const filePath = `${this.logDirPath}/${fileName}`;
await fileIo.unlink(filePath);
hilog.info(DOMAIN, TAG, 'Deleted crash log: %{public}s', fileName);
return t... | 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 deleteCrashLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async deleteCrashLog(fileName: string): Promise<boolean> {
try {
if (!this.logDirPath) {
return false;
}
const filePath = `${this.logDirPath}/${fileName}`;
await fileIo.unlink(filePath);
hilog.info(DOMAIN, TAG, 'Deleted crash log: %{public}s', fileName);
return t... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L511-L525 | c61fa38532d8a1889f81749397be68226f711c50 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | setPlaybackSpeed | 设置播放速度 | async setPlaybackSpeed(speed: number): Promise<void> {
if (this.avPlayer) {
this.playbackSpeed = speed;
await this.avPlayer.setSpeed(speed);
console.info(`[PlayerService] Playback speed set to: ${speed}`);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setPlaybackSpeed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left speed AST#identifier#Right A... | async setPlaybackSpeed(speed: number): Promise<void> {
if (this.avPlayer) {
this.playbackSpeed = speed;
await this.avPlayer.setSpeed(speed);
console.info(`[PlayerService] Playback speed set to: ${speed}`);
}
} | https://github.com/pangpang20/antennaPodHM | 8d4bd6e7817ad06723e1551090383d271d4a1a3f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/FamilyService.ets | arkts | getRelatedPatients | 获取关联患者列表 | getRelatedPatients(): FamilyPatientRelation[] {
return Array.from(this.relations.values());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRelatedPatients 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 FamilyPatientRelation AST#identifier#Right ... | getRelatedPatients(): FamilyPatientRelation[] {
return Array.from(this.relations.values());
} | https://github.com/LJ666-ui/harmony-health-care | a4a423d3a8ead032190db0b0913e37ff2ae92422 | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/Index.ets | arkts | updateCurrentLocationFromState | --- 更新 城市管理页面 “当前位置” 卡片数据 --- | updateCurrentLocationFromState() {
this.currentLocation = {
cityName: this.cityName,
CurrentTemperature: this.currentTemp,
weather: this.WeatherConditions,
lowTemp: this.lowTemp,
highTemp: this.highTemp,
};
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateCurrentLocationFromState 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#sta... | updateCurrentLocationFromState() {
this.currentLocation = {
cityName: this.cityName,
CurrentTemperature: this.currentTemp,
weather: this.WeatherConditions,
lowTemp: this.lowTemp,
highTemp: this.highTemp,
};
} | https://github.com/OnceWeWere/Weather_HarmonyOS | c9af32278c5588b55492c63f58d686e544a3e58b | github |
mistrainn/harmonyTarget | entry/src/main/ets/pages/Index.ets | arkts | showDialog | 抽离出Dialog显示函数 | showDialog(title: string, message: string) {
try {
promptAction.showDialog({
title: title,
message: message,
buttons: [{ text: '好的', color: '#007DFF' }]
});
} catch (error) {
const err = error as BusinessError;
console.error(`showDialog failed, code is ${err.cod... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | showDialog(title: string, message: string) {
try {
promptAction.showDialog({
title: title,
message: message,
buttons: [{ text: '好的', color: '#007DFF' }]
});
} catch (error) {
const err = error as BusinessError;
console.error(`showDialog failed, code is ${err.cod... | https://github.com/mistrainn/harmonyTarget | 20db655f20dde0dddefa695f53266f9112e6b19c | github |
honjow/Next2V | feature/feed/src/main/ets/model/FeedModels.ets | arkts | appendData | Append data (load on scroll to bottom) | appendData(data: V2exTopic[]): void {
if (data.length === 0) {
return
}
const start = this.dataArray.length
this.dataArray = this.dataArray.concat(data)
this.listeners.forEach(listener => listener.onDataAdd(start))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left appendData 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#subscript_expression#Left AST#identifier#Left V2exTopic AST#i... | appendData(data: V2exTopic[]): void {
if (data.length === 0) {
return
}
const start = this.dataArray.length
this.dataArray = this.dataArray.concat(data)
this.listeners.forEach(listener => listener.onDataAdd(start))
} | https://github.com/honjow/Next2V | c9191fd27f0f857e7770c4bfd032ef2da1fe41fd | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleUserProfile.ets | arkts | scheduleUnconditionalSave | Explicit-save chain entry, flushes events first (so the wire orders
events= before user_details=) and then ships the bundled user_details.
Used by the public `save()` method so integrators (and
`saveUserProfileIfPending` callers) can land a user_details request
without first recording an event. | private scheduleUnconditionalSave(): Promise<void> {
const next: Promise<void> = this.chain.then((): Promise<void> => this.flushEventsThenSave());
this.chain = next.catch((err: Object): void => {
this.config.logger.e(`[ModuleUserProfile] explicit save failed: ${err}`);
});
return next;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleUnconditionalSave 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#instantia... | private scheduleUnconditionalSave(): Promise<void> {
const next: Promise<void> = this.chain.then((): Promise<void> => this.flushEventsThenSave());
this.chain = next.catch((err: Object): void => {
this.config.logger.e(`[ModuleUserProfile] explicit save failed: ${err}`);
});
return next;
} | https://github.com/Countly/countly-sdk-hos | 684ad3093b95d17da8ebf4ed2421d4410e65d832 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | calcTextWidth | calculates the approximate width of a text, depending on a demo text
avoid repeated calls (e.g. inside drawing methods)
@param paint
@param demoText
@return | public static calcTextWidth(paint: Paint, demoText: string): number {
Utils.resetContext2DFont(Utils.offCanvasContext2d, paint);
let textMetrics: TextMetrics = Utils.offCanvasContext2d.measureText(demoText);
return textMetrics.width;
} | 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 calcTextWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paint AST#identifier#Right AST#:#Left : A... | public static calcTextWidth(paint: Paint, demoText: string): number {
Utils.resetContext2DFont(Utils.offCanvasContext2d, paint);
let textMetrics: TextMetrics = Utils.offCanvasContext2d.measureText(demoText);
return textMetrics.width;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e3634e7b9635298cb99adb9eda4c1961de644074 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | $_invoke | Creates a new instance of BigInt from number instance
@param { number } value number value
@returns { BigInt } A new BigInt instance from number instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: Double): BigInt {
return new BigInt(value)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Double... | static $_invoke(value: Double): BigInt {
return new BigInt(value)
} | https://gitcode.com/iop123123/arkts-static-skills | 7be4c054dfad4e49f990ca0126e8542d9ce60708 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | getAllAlarms | 获取所有闹钟列表
@return 闹钟列表 | async getAllAlarms(): Promise<AlarmInfo[]> {
const rdbStore = await this.getRdbStore();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
predicates.orderByAsc('HOUR');
predicates.orderByAsc('MINUTE');
let resultSet: rdb.ResultSet = await rdbStore.query(predicates);
try {
return this... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllAlarms AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getAllAlarms(): Promise<AlarmInfo[]> {
const rdbStore = await this.getRdbStore();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
predicates.orderByAsc('HOUR');
predicates.orderByAsc('MINUTE');
let resultSet: rdb.ResultSet = await rdbStore.query(predicates);
try {
return this... | https://gitee.com/openharmony-sig/applications_clock.git | 0a1819c92775ed8e790f8ee3959bd42eed1f9034 | gitee |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/ReviewEventRepository.ets | arkts | deleteReviewEventsOlderThan | Delete review events older than a timestamp | async deleteReviewEventsOlderThan(timestampMs: number): Promise<number> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_REVIEW_EVENTS);
predicates.lessThan('timestamp', timestampMs);
try {
return await this.store!.delete(predicates);
} catch (e) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteReviewEventsOlderThan AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identi... | async deleteReviewEventsOlderThan(timestampMs: number): Promise<number> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_REVIEW_EVENTS);
predicates.lessThan('timestamp', timestampMs);
try {
return await this.store!.delete(predicates);
} catch (e) {
... | https://github.com/CLMC2025/Vignette | 6fe81c2102b73fb7d6c3202d97c214b79a66b875 | github |
openharmony/base_location | services/location_ui/entry/src/main/ets/common/PermissionUtils.ets | arkts | checkBluetoothShareCallerBluetoothPermission | 校验蓝牙分享普通ability调用方权限:蓝牙服务允许作为调用方拉起 | checkBluetoothShareCallerBluetoothPermission(want: Want): boolean {
const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string;
const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number;
console.info(TAG, `checkBluetoothPermission callerU... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkBluetoothShareCallerBluetoothPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#id... | checkBluetoothShareCallerBluetoothPermission(want: Want): boolean {
const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string;
const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number;
console.info(TAG, `checkBluetoothPermission callerU... | https://gitee.com/openharmony/base_location.git | 798a1c6e341d14aa8c2eb47917b21e197c04b9d1 | gitee |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getArtistDetail | 查询艺术家详情
@param id
@returns | public async getArtistDetail(id: string): Promise<BaseItemDto> {
return this.requireApi().getArtistDetail(id)
} | 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 getArtistDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST... | public async getArtistDetail(id: string): Promise<BaseItemDto> {
return this.requireApi().getArtistDetail(id)
} | https://github.com/OHPG/FinMusic | 4e239ca9c6af41e9a0fc56454ce39f00458b4067 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_char.ets | arkts | main | ---
desc: check not equal operation for two char operands
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a != b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d2e41cf75ebd5c36566ac0006a0bea31d98e22c2 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | getTotalStars | 获取星星总数 | public getTotalStars(): number {
const userData = appStorage.getCurrentUser();
return userData?.totalStars || 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTotalStars 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#n... | public getTotalStars(): number {
const userData = appStorage.getCurrentUser();
return userData?.totalStars || 0;
} | https://github.com/the-wwyang/kids-learning-app | 9f82aef07dc3ab31aec1c5be63f6d0828abe959f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getAvailableThemes | 获取所有可用主题 | public getAvailableThemes(): ThemeType[] {
return [ThemeType.LIGHT, ThemeType.DARK, ThemeType.AUTO, ThemeType.PRIVACY];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAvailableThemes 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 The... | public getAvailableThemes(): ThemeType[] {
return [ThemeType.LIGHT, ThemeType.DARK, ThemeType.AUTO, ThemeType.PRIVACY];
} | https://github.com/DaLongZhuaZi/manxia | 792856df07ab34747b48f0c6bac069e85228e8af | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | add | Adds a value to the LightWeightSet
@param value the value to add to the LightWeightSet
@returns true if the value was added, false otherwise | add(obj: T): boolean {
if (this.buckets.hasKey(obj)) {
return false;
}
if (this.buckets.length >= this.capacity) {
if (this.capacity * 2 > Int.MAX_VALUE) {
return false;
} else {
this.increaseCapacityTo(this.capacity * 2);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left obj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST#a... | add(obj: T): boolean {
if (this.buckets.hasKey(obj)) {
return false;
}
if (this.buckets.length >= this.capacity) {
if (this.capacity * 2 > Int.MAX_VALUE) {
return false;
} else {
this.increaseCapacityTo(this.capacity * 2);
... | https://gitcode.com/iop123123/arkts-static-skills | 8d47f0f9a4a82567e3d0afaedd4619b2d4b59398 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getContextLinker | getContextLinker
@returns {RuntimeLinker}
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | protected getContextLinker(): RuntimeLinker {
return this.contextLinker
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getContextLinker 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#L... | protected getContextLinker(): RuntimeLinker {
return this.contextLinker
} | https://gitcode.com/iop123123/arkts-static-skills | cb79abe552ed5a88863c3e1148a2a4daddbfcf99 | gitcode |
erosTeam/NextE | shared/src/main/ets/parser/EhGalleryDetailParser.ets | arkts | parseTags | Parse #taglist into namespace-grouped tags. | private static parseTags(html: string): TagGroup[] {
const listM: RegExpMatchArray | null = html.match(/<div id="taglist">([\s\S]*?)<\/table>/)
if (listM === null || listM[1] === undefined) {
return []
}
const groups: TagGroup[] = []
const rowRe: RegExp = new RegExp(
'<tr><td class="tc... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST... | private static parseTags(html: string): TagGroup[] {
const listM: RegExpMatchArray | null = html.match(/<div id="taglist">([\s\S]*?)<\/table>/)
if (listM === null || listM[1] === undefined) {
return []
}
const groups: TagGroup[] = []
const rowRe: RegExp = new RegExp(
'<tr><td class="tc... | https://github.com/erosTeam/NextE | e0fd3e7bccb99d8545349f78b43d898782f69345 | github |
2763981847/Clock-Alarm | entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets | arkts | aboutToAppear | 在对话框即将出现时的操作 | aboutToAppear(): void {
// 初始化状态变量为AlarmItem中的值
this.intervalMinuteSelect = this.alarmItem.intervalMinute;
this.intervalTimesSelect = this.alarmItem.intervalTimes;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
// 初始化状态变量为AlarmItem中的值
this.intervalMinuteSelect = this.alarmItem.intervalMinute;
this.intervalTimesSelect = this.alarmItem.intervalTimes;
} | https://github.com/2763981847/Clock-Alarm | 00194fb2bdd090a60504d1162544333a32d473c5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | autoFillMetadata | 自动填充元数据
根据标题搜索并返回最匹配的元数据 | public async autoFillMetadata(
title: string,
contentType?: ScraperContentType,
preferredSource?: ScraperSource
): Promise<ScrapedMetadata | null> {
logger.info(TAG, `自动填充元数据: title=${title}, preferredSource=${preferredSource}`);
// 如果指定了优先源,先尝试该源
if (preferredSource && this.isSourceEnabled... | 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 autoFillMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left :... | public async autoFillMetadata(
title: string,
contentType?: ScraperContentType,
preferredSource?: ScraperSource
): Promise<ScrapedMetadata | null> {
logger.info(TAG, `自动填充元数据: title=${title}, preferredSource=${preferredSource}`);
// 如果指定了优先源,先尝试该源
if (preferredSource && this.isSourceEnabled... | https://github.com/DaLongZhuaZi/manxia | 1e0f4a49c2031aa4592d9c0c2ae3daf6006ff2ed | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | performExtraction | 执行解压缩操作
@param archivePath 压缩文件路径(已经是实际的本地路径)
@param targetDir 目标目录
@param options 解压缩选项
@param result 结果对象 | private async performExtraction(
archivePath: string,
targetDir: string,
options: ExtractionOptions,
result: ExtractionResult
): Promise<void> {
await this.performExtractionEnhanced(archivePath, targetDir, options, result);
} | 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 performExtraction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left archivePath AST#identifier#Right AST#ERROR#Left AS... | private async performExtraction(
archivePath: string,
targetDir: string,
options: ExtractionOptions,
result: ExtractionResult
): Promise<void> {
await this.performExtractionEnhanced(archivePath, targetDir, options, result);
} | https://github.com/DaLongZhuaZi/manxia | 5703cc219a6ee2e9872e7b1fb2e17ebd62c7e969 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | getFolderIcon | Get Folder Icon
@param folderUuid - folder Uuid
@return Resource - Folder Icon Resource | getFolderIcon(folderUuid: string): Resource {
LogUtil.info(TAG, "folderUuid " + folderUuid)
if (folderIconMap[folderUuid] != undefined) {
return folderIconMap[folderUuid]
}
return $r("app.media.folder")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFolderIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderUuid AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | getFolderIcon(folderUuid: string): Resource {
LogUtil.info(TAG, "folderUuid " + folderUuid)
if (folderIconMap[folderUuid] != undefined) {
return folderIconMap[folderUuid]
}
return $r("app.media.folder")
} | https://gitee.com/openharmony/applications_notes.git | 032ecf51b6c211a27b4dce0f754a027ad8d2b233 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | loadMangaDetail | 加载漫画详情(主入口) | public async loadMangaDetail(params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> {
const result: MangaDetailLoadResult = {
success: false,
manga: null,
chapters: [],
isFavorite: false,
isLocalManga: false,
sourceId: 0,
sourceName: '',
coverHttpHeaders: {}... | 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 loadMangaDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left :... | public async loadMangaDetail(params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> {
const result: MangaDetailLoadResult = {
success: false,
manga: null,
chapters: [],
isFavorite: false,
isLocalManga: false,
sourceId: 0,
sourceName: '',
coverHttpHeaders: {}... | https://github.com/DaLongZhuaZi/manxia | 5458a701c735bdc263107a471a244b10a891ef8b | github |
bhengubv/aether-protocol | arkts/src/main/ets/protocol/MeshPacket.ets | arkts | canForward | True while the packet may still be forwarded (TTL not yet exhausted). | get canForward(): boolean {
return this.ttl > 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left canForward AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Rig... | get canForward(): boolean {
return this.ttl > 0;
} | https://github.com/bhengubv/aether-protocol | ac1ea07f80356b80c85f3e9f8963b816ddc2c07e | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | checkCpuSupport | 检测 CPU 支持
Windows 11 ARM 需要 ARMv8.0 或更高版本 | private checkCpuSupport(): boolean {
try {
// 获取 CPU 架构
const cpuArch = this.getCpuArch();
// 检查是否是 ARM64 架构
if (cpuArch.toLowerCase().includes('arm64') ||
cpuArch.toLowerCase().includes('aarch64')) {
return true;
}
// x86_64 也可以运行(通过 QEMU 模拟,但很... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkCpuSupport 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 boolea... | private checkCpuSupport(): boolean {
try {
// 获取 CPU 架构
const cpuArch = this.getCpuArch();
// 检查是否是 ARM64 架构
if (cpuArch.toLowerCase().includes('arm64') ||
cpuArch.toLowerCase().includes('aarch64')) {
return true;
}
// x86_64 也可以运行(通过 QEMU 模拟,但很... | https://github.com/AetheriumSimulator/qemu-hmos | 69a6c2edf8d8648975276649a84dcae3b5370f81 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/NetworkManager.ets | arkts | isCurrentlyReconnecting | Check if currently reconnecting | static isCurrentlyReconnecting(): boolean {
return isReconnecting;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCurrentlyReconnecting 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 b... | static isCurrentlyReconnecting(): boolean {
return isReconnecting;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 9d22857cd022a1fa7313af632299f3a2941558d0 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/PermissionDemo.ets | arkts | requestGlobalSwitch | 申请指定权限的系统级的全局开关 | requestGlobalSwitch(switchType: abilityAccessCtrl.SwitchType) {
let context: Context = this.getUIContext().getHostContext()!
/*
* abilityAccessCtrl.createAtManager() - 创建权限管理器
* requestGlobalSwitch() - 申请指定权限的系统级的全局开关,会弹出一个对话框(返回值用于说明此开关是否被打开)
* 可用开关有:abilityAccessCtrl.SwitchType.CAMERA, ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestGlobalSwitch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left switchType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#iden... | requestGlobalSwitch(switchType: abilityAccessCtrl.SwitchType) {
let context: Context = this.getUIContext().getHostContext()!
/*
* abilityAccessCtrl.createAtManager() - 创建权限管理器
* requestGlobalSwitch() - 申请指定权限的系统级的全局开关,会弹出一个对话框(返回值用于说明此开关是否被打开)
* 可用开关有:abilityAccessCtrl.SwitchType.CAMERA, ... | https://github.com/webabcd/HarmonyDemo | b12c382719276a66f1e91c93edb54d7e8dfc91fd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | extractPdfCover | 提取 PDF 封面
使用 PDF Kit 的 getPagePixelMap 方法获取第一页的 PixelMap,
然后使用 ImagePacker 异步打包为图片文件。
这种方式比 convertToImage 更不容易阻塞主线程。 | private static async extractPdfCover(filePath: string, savePath: string): Promise<EBookCoverExtractionResult> {
logger.info(EBookCoverExtractor.TAG, `开始提取 PDF 封面: ${filePath}`);
try {
// 创建输出目录
const outputDir = savePath.substring(0, savePath.lastIndexOf('/'));
// 确保目录存在
tr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left extractPdfCover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#i... | private static async extractPdfCover(filePath: string, savePath: string): Promise<EBookCoverExtractionResult> {
logger.info(EBookCoverExtractor.TAG, `开始提取 PDF 封面: ${filePath}`);
try {
// 创建输出目录
const outputDir = savePath.substring(0, savePath.lastIndexOf('/'));
// 确保目录存在
tr... | https://github.com/DaLongZhuaZi/manxia | a8694f883ebd1af5c1e6ff9fe65292aad888bcb3 | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/WenxinService.ets | arkts | buildHealthContext | 从 MqttManager 提取脱敏健康摘要
只取统计数字,不含任何可识别个人身份的字段 | private buildHealthContext(): HealthContext {
const mqtt = MqttManager.getInstance();
const falls = mqtt.fallRecords;
const sedentaries = mqtt.sedentaryRecords;
// 计算近7天的统计
const now = Date.now();
const sevenDaysAgo = now - 7 * 24 * 60 * 60 * 1000;
const fallCount7d = falls.filter(r => r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildHealthContext 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 ... | private buildHealthContext(): HealthContext {
const mqtt = MqttManager.getInstance();
const falls = mqtt.fallRecords;
const sedentaries = mqtt.sedentaryRecords;
// 计算近7天的统计
const now = Date.now();
const sevenDaysAgo = now - 7 * 24 * 60 * 60 * 1000;
const fallCount7d = falls.filter(r => r... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/WenxinService.ets#L96-L121 | ac447ea5701d38b308b79ef42c80dac637329266 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/storagemanager/rdb/TrackTable.ets | arkts | generateBucket | Convert the TrackTableData type to relationalStore.ValuesBucket type.
@param trackData
@returns | private generateBucket(trackData: TrackServiceData): relationalStore.ValuesBucket {
const trackBucket: relationalStore.ValuesBucket = {};
// Not null.
trackBucket.eventType = trackData.eventType ?? TrackEventType.UNKNOWN;
trackBucket.time = trackData.time ?? '';
// Can be null.
trackBucket.pag... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left trackData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private generateBucket(trackData: TrackServiceData): relationalStore.ValuesBucket {
const trackBucket: relationalStore.ValuesBucket = {};
// Not null.
trackBucket.eventType = trackData.eventType ?? TrackEventType.UNKNOWN;
trackBucket.time = trackData.time ?? '';
// Can be null.
trackBucket.pag... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 40407bfee8347da98f36314b181ca8320047db07 | gitcode |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/EventEmitter.ets | arkts | off | Unsubscribe from an event. | public off(event: string, callback: EventCallback): void {
const callbacks = this.listeners.get(event);
if (callbacks) {
this.listeners.set(event, callbacks.filter(cb => cb !== callback));
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left off AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public off(event: string, callback: EventCallback): void {
const callbacks = this.listeners.get(event);
if (callbacks) {
this.listeners.set(event, callbacks.filter(cb => cb !== callback));
}
} | https://github.com/UnbalancedCat/ohos-ssh-core | 14c021d19eda90e4a095d0c6f75822bebd1cc583 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | updateHealthRecord | Action: 更新健康记录 | public updateHealthRecord(id: string, updates: Partial<HealthRecord>): void {
const updatedRecords: HealthRecord[] = [];
for (let i = 0; i < this.state.healthRecords.length; i++) {
const record = this.state.healthRecords[i];
if (record.id === id) {
const updatedRecord: HealthRecord = {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateHealthRecord 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... | public updateHealthRecord(id: string, updates: Partial<HealthRecord>): void {
const updatedRecords: HealthRecord[] = [];
for (let i = 0; i < this.state.healthRecords.length; i++) {
const record = this.state.healthRecords[i];
if (record.id === id) {
const updatedRecord: HealthRecord = {
... | https://github.com/LJ666-ui/harmony-health-care | 57e4009a60c97bd5c95dfd86a7c40c020c1949ba | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/phonebackupextability/PhoneBackupExtAbility.ets | arkts | onRestore | Invoked when restoring from backup; receives source bundle version metadata. | async onRestore(bundleVersion: BundleVersion) {
Logger.info(`PhoneBackupExtAbility: onRestore ok ${JSON.stringify(bundleVersion)}`);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onRestore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bundleVersion AST#identifier#Right AST#type_annotation#Left ... | async onRestore(bundleVersion: BundleVersion) {
Logger.info(`PhoneBackupExtAbility: onRestore ok ${JSON.stringify(bundleVersion)}`);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | b5505639fd080dfeb7bb6d15d48ee9939dc68dad | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlaylistsApi.ets | arkts | removeItemFromPlaylist | @summary Removes items from a playlist.
@param {PlaylistsApiRemoveItemFromPlaylistRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof PlaylistsApi | public removeItemFromPlaylist(requestParameters: PlaylistsApiRemoveItemFromPlaylistRequest): Promise<void> {
return this.apiClient.delete({path: `/Playlists/${requestParameters.playlistId}/Items`, parameters: requestParameters, excludeParams: ['playlistId']})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeItemFromPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ... | public removeItemFromPlaylist(requestParameters: PlaylistsApiRemoveItemFromPlaylistRequest): Promise<void> {
return this.apiClient.delete({path: `/Playlists/${requestParameters.playlistId}/Items`, parameters: requestParameters, excludeParams: ['playlistId']})
} | https://github.com/OHPG/FinSdk | b181d37389a6a4a00d22cbdbc1a3af35d5bd08f4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | before | Executed before each test runs. Can be overridden in derived classes.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | before(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left before AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST... | before(): void {} | https://gitcode.com/iop123123/arkts-static-skills | 047e2865519675e85ffa970980983a62e96716df | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImageRestorationEngine.ets | arkts | batchProcess | 批量处理图像 | async batchProcess(
imageList: ImageTask[],
params?: ProcessingParams,
progressCallback?: (progress: BatchProgress) => void
): Promise<BatchProcessingResult> {
console.info(`[ImageRestorationEngine] 开始批量处理,数量: ${imageList.length}`);
const batchId = `BATCH_${Date.now()}`;
const startTime = D... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left batchProcess AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageList AST#identifier#Right AST#type_annotation#Left A... | async batchProcess(
imageList: ImageTask[],
params?: ProcessingParams,
progressCallback?: (progress: BatchProgress) => void
): Promise<BatchProcessingResult> {
console.info(`[ImageRestorationEngine] 开始批量处理,数量: ${imageList.length}`);
const batchId = `BATCH_${Date.now()}`;
const startTime = D... | https://github.com/LJ666-ui/harmony-health-care | 71c3acc7d3eb7df3efe4cdd0e4182b7848d78ca9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SourceContentCache.ets | arkts | has | 检查缓存是否存在且未过期 | has(sourceId: number, workflowKey: string): boolean {
const cached = this.get(sourceId, workflowKey);
return cached !== null;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST... | has(sourceId: number, workflowKey: string): boolean {
const cached = this.get(sourceId, workflowKey);
return cached !== null;
} | https://github.com/DaLongZhuaZi/manxia | a0ed438bf087e1b163e180ec9c72e2288786cfe3 | github |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | ProgressAnimation | 进度动画组件 | @Builder
function ProgressAnimation(
key: string,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.width('100%')
.animation({
duration: 300,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
})
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left ProgressAnimation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST... | @Builder
function ProgressAnimation(
key: string,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.width('100%')
.animation({
duration: 300,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
})
} | https://github.com/CLMC2025/Vignette | 2dd3adb18f0c9412d8ae9a1fa0dcb42963bcacd7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets | arkts | uploadBackup | 上传备份到云端 | async uploadBackup(localBackupPath: string): Promise<void> {
if (!this.client && !this.nativeClient) {
const errorMsg = 'WebDAV未配置';
throw new Error(errorMsg);
}
if (this.syncStatus.isUploading || this.syncStatus.isDownloading) {
throw new Error('同步任务正在执行,请稍后重试');
}
try {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left uploadBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left localBackupPath AST#identifier#R... | async uploadBackup(localBackupPath: string): Promise<void> {
if (!this.client && !this.nativeClient) {
const errorMsg = 'WebDAV未配置';
throw new Error(errorMsg);
}
if (this.syncStatus.isUploading || this.syncStatus.isDownloading) {
throw new Error('同步任务正在执行,请稍后重试');
}
try {
... | https://github.com/DaLongZhuaZi/manxia | 3e51f759bffc7aa4329f099d2519e20b4dff39f5 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/FilterRuleEngine.ets | arkts | deserializeConfig | 反序列化过滤配置 | static deserializeConfig(json: string): FilterConfig {
try {
const parsed: object = JSON.parse(json);
let result: FilterConfig = {
ignoreWhitespace: DEFAULT_FILTER_CONFIG.ignoreWhitespace,
ignoreAllWhitespace: DEFAULT_FILTER_CONFIG.ignoreAllWhitespace,
ignoreCase: DEFAULT_FILTE... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deserializeConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static deserializeConfig(json: string): FilterConfig {
try {
const parsed: object = JSON.parse(json);
let result: FilterConfig = {
ignoreWhitespace: DEFAULT_FILTER_CONFIG.ignoreWhitespace,
ignoreAllWhitespace: DEFAULT_FILTER_CONFIG.ignoreAllWhitespace,
ignoreCase: DEFAULT_FILTE... | https://github.com/XJTUWYD/ArkDiff | ab5940782c4a62fd8b0a81eb824279a8877d6c61 | github |
Joker-x-dev/CoolMallArkTS | feature/common/src/main/ets/view/UserAgreementPage.ets | arkts | build | 构建用户协议页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "用户协议",
viewModel: this.vm
}) {
this.UserAgreementContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "用户协议",
viewModel: this.vm
}) {
this.UserAgreementContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 51f69eb6ecc0698a696ff35e717bccb1cd2e5b7c | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/cells/SoundMessageView.ets | arkts | convertVoiceToText | Convert voice message to text
Called from MessageActionPanel | convertVoiceToText(): void {
if (!this.message || this.isConverting) {
return;
}
console.log(`[SoundMessageView] Starting voice to text conversion for message: ${this.message.msgID}`);
// Set converting state
this.isConverting = true;
this.isAsrExpanded = true;
if (this.asrDi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left convertVoiceToText 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#{#Left { AST#{#Right AST#... | convertVoiceToText(): void {
if (!this.message || this.isConverting) {
return;
}
console.log(`[SoundMessageView] Starting voice to text conversion for message: ${this.message.msgID}`);
// Set converting state
this.isConverting = true;
this.isAsrExpanded = true;
if (this.asrDi... | https://github.com/Tencent-RTC/TUIKit_Harmony | e6614307e4eaf90db83cc6db65c3fede5f8a4cb6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | extractChapterInfoFromName | 从文件夹/文件名称提取章节信息 | private extractChapterInfoFromName(name: string, path: string, pageCount: number): DetectedChapterInfo {
// 尝试从名称中提取章节编号
let chapterNumber = 0;
let chapterTitle = name;
// 常见的章节编号模式
const patterns: RegExp[] = [
/第(\d+)[话話章回卷]/, // 第1话、第1章
/[话話章回卷](\d+)/, // 话1、章... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractChapterInfoFromName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private extractChapterInfoFromName(name: string, path: string, pageCount: number): DetectedChapterInfo {
// 尝试从名称中提取章节编号
let chapterNumber = 0;
let chapterTitle = name;
// 常见的章节编号模式
const patterns: RegExp[] = [
/第(\d+)[话話章回卷]/, // 第1话、第1章
/[话話章回卷](\d+)/, // 话1、章... | https://github.com/DaLongZhuaZi/manxia | 2f6e4ee8f667672fb6f1937d2d61f23003f768af | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/UnknownFields.ets | arkts | toString | 调试输出
@returns 未知字段的十六进制表示 | toString(): string {
if (this.isEmpty()) {
return '[UnknownFields: empty]'
}
// 转换为十六进制字符串(最多显示前 32 字节)
const maxBytes = Math.min(32, this.data.length)
let hex = ''
for (let i = 0; i < maxBytes; i++) {
const byte = this.data[i]
hex += (byte < 16 ? '0' : '') + byte.toString(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
if (this.isEmpty()) {
return '[UnknownFields: empty]'
}
// 转换为十六进制字符串(最多显示前 32 字节)
const maxBytes = Math.min(32, this.data.length)
let hex = ''
for (let i = 0; i < maxBytes; i++) {
const byte = this.data[i]
hex += (byte < 16 ? '0' : '') + byte.toString(... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | a4000fd12aa1509b6a70779f26ee1835d3bbb2e9 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/CryptoService.ets | arkts | getVersion | 获取加密格式版本号,非加密数据返回 0 | static getVersion(data: Uint8Array): number {
if (data.length < MAGIC_SIZE) return 0;
// 检查前 4 字节 "MLBK"
if (data[0] !== 0x4D || data[1] !== 0x4C || data[2] !== 0x42 || data[3] !== 0x4B) return 0;
return data[4]; // version byte
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8... | static getVersion(data: Uint8Array): number {
if (data.length < MAGIC_SIZE) return 0;
// 检查前 4 字节 "MLBK"
if (data[0] !== 0x4D || data[1] !== 0x4C || data[2] !== 0x42 || data[3] !== 0x4B) return 0;
return data[4]; // version byte
} | https://github.com/AlkaidLab/moonlight-harmony | 76fa1b6eb6596fab871c30fa417744f52ebbbad7 | github |
ibestservices/ibest-ui | library/src/main/ets/components/rollingText/index.ets | arkts | getItemArr | 获取每项数字数组 | getItemArr(index: number) {
const startNumArr = padZero(this.startNum, this.getLength()).split('')
const targetNumArr = this.getTargetNumArr()
const result: number[] = []
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getItemArr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | getItemArr(index: number) {
const startNumArr = padZero(this.startNum, this.getLength()).split('')
const targetNumArr = this.getTargetNumArr()
const result: number[] = []
... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/rollingText/index.ets#L100-L116 | e6bbca2688151b10a1d38d54e40c6114bc1fbf98 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | greet | --- String template in function args --- | function greet(name: string, age: number): string {
return 'Hello ' + name + ', age ' + String(age);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left greet AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function greet(name: string, age: number): string {
return 'Hello ' + name + ', age ' + String(age);
} | https://github.com/miaochiahao/ark-ghidra | b7b6a8a32df00baa148884130e2b39128e89349f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceMethod.ets | arkts | equals | Compares whether two instance methods are equal.
@param { InstanceMethod } other Another instance method object used for comparison.
@returns { boolean } Returns true if the two methods are equal, otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: InstanceMethod): boolean {
return this.methodPtr == other.methodPtr
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Instance... | public equals(other: InstanceMethod): boolean {
return this.methodPtr == other.methodPtr
} | https://gitcode.com/iop123123/arkts-static-skills | 506815acce04e3872becc81b749434371d26f9e8 | gitcode |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets | arkts | bankDailyVoluntaryOT | Converts the daily accumulated OT seconds into money and adds to the weekly total.
Resets the daily accumulated and the stored date. Call this when a new work day begins. | public async bankDailyVoluntaryOT(secondRate: number): Promise<void> {
const dailyOT: number = await this.loadVoluntaryOTAccumulated()
if (dailyOT <= 0) { return }
const monday: string = this.mondayOfWeek()
const storedWeek: string = await this.loadVoluntaryOTWeekStart()
if (storedWeek !== monday... | 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 bankDailyVoluntaryOT AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left secondRate AST#identifier#Right AST#ERROR#Left AST... | public async bankDailyVoluntaryOT(secondRate: number): Promise<void> {
const dailyOT: number = await this.loadVoluntaryOTAccumulated()
if (dailyOT <= 0) { return }
const monday: string = this.mondayOfWeek()
const storedWeek: string = await this.loadVoluntaryOTWeekStart()
if (storedWeek !== monday... | https://github.com/OMGCA/sakipay | 0c19fff6a52023170ce662ae2a9e3aeefcbda2ff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | saveCurrentProfile | 保存当前配置 | private async saveCurrentProfile(): Promise<void> {
try {
if (!this.preferencesStore) return;
this.currentProfile.lastModified = Date.now();
await this.preferencesStore.put(this.CURRENT_PROFILE_KEY, JSON.stringify(this.currentProfile));
await this.preferencesStore.flush();
... | 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 saveCurrentProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async saveCurrentProfile(): Promise<void> {
try {
if (!this.preferencesStore) return;
this.currentProfile.lastModified = Date.now();
await this.preferencesStore.put(this.CURRENT_PROFILE_KEY, JSON.stringify(this.currentProfile));
await this.preferencesStore.flush();
... | https://github.com/DaLongZhuaZi/manxia | 24bc09e1833213db452850c7cfe58bd8e4548a66 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/tianjia.ets | arkts | handleShopSelect | 处理店铺选择 | handleShopSelect(shopName: string) {
this.selectedShop = shopName
this.selectedDrink = ''
if (this.onShopChanged) {
this.onShopChanged(shopName)
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleShopSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shopName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ... | handleShopSelect(shopName: string) {
this.selectedShop = shopName
this.selectedDrink = ''
if (this.onShopChanged) {
this.onShopChanged(shopName)
}
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | ec35069441f5c5d70bb138f36e70efa9478c7b04 | github |
openharmony/xts_tools | sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets | arkts | reload | 重新加载数据 | public reload(): void {
this.dataArray.splice(1, 1);
this.dataArray.splice(3, 2);
this.notifyDataReload();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat... | public reload(): void {
this.dataArray.splice(1, 1);
this.dataArray.splice(3, 2);
this.notifyDataReload();
} | https://gitee.com/openharmony/xts_tools.git | f430fc6d2052753e8edaf7626faf623f54289c41 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/ComputerViewModel.ets | arkts | loadComputers | 加载电脑列表 | async loadComputers(): Promise<void> {
if (this.isLoading) return;
this.isLoading = true;
this.errorMessage = '';
try {
const computerInfos = await this.computerManager.getComputers();
this.updateComputerList(computerInfos);
} catch (error) {
const err = error as Error;
t... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadComputers AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right... | async loadComputers(): Promise<void> {
if (this.isLoading) return;
this.isLoading = true;
this.errorMessage = '';
try {
const computerInfos = await this.computerManager.getComputers();
this.updateComputerList(computerInfos);
} catch (error) {
const err = error as Error;
t... | https://github.com/AlkaidLab/moonlight-harmony | 391a9ade519f4c8affdcbd4e373c21caa955b0a4 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/TransactionDao.ets | arkts | deleteTransactionsByAmountRange | 删除某个金额范围内的交易记录
@param minAmount 最小金额
@param maxAmount 最大金额
@param transactionType 交易类型 (0=支出, 1=收入, null=全部)
@returns 删除的记录数量 | public async deleteTransactionsByAmountRange(minAmount: number, maxAmount: number, transactionType?: number): Promise<number> {
try {
const predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(DBManager.TABLE_TRANSACTIONS);
predicates.between('amount', minAmount, maxAmount);
... | 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 deleteTransactionsByAmountRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minAmount AST#identifier#Right AST#ERRO... | public async deleteTransactionsByAmountRange(minAmount: number, maxAmount: number, transactionType?: number): Promise<number> {
try {
const predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(DBManager.TABLE_TRANSACTIONS);
predicates.between('amount', minAmount, maxAmount);
... | https://github.com/fuhhhhhhhh/openharmony | 37e78f6f29a8b1a1c3dca25ef799cb666fc0585f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/UserProfile.ets | arkts | isSaver | 判断是否为储蓄型用户 | isSaver(): boolean {
return this.spendingPersonality === SPENDING_SAVER;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSaver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isSaver(): boolean {
return this.spendingPersonality === SPENDING_SAVER;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e4bc3468a9941fdf90d80a984d20add38faa95ea | github |
openharmony/arkui_ace_engine | advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets | arkts | getBlockWidth | Obtains the width of each girdItem. | getBlockWidth(): number {
const blockWidth: number = (this.areaWidth - 32) / this.colNum;
return blockWidth;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBlockWidth 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#statemen... | getBlockWidth(): number {
const blockWidth: number = (this.areaWidth - 32) / this.colNum;
return blockWidth;
} | https://gitee.com/openharmony/arkui_ace_engine.git | 733f15e3ca08a2abe111db73274b8dc72a06ee70 | gitee |
AuspiciousSign/HarmonyOS | entry/src/main/ets/database/Rdb.ets | arkts | deleteData | 删除数据的方法,接收谓词和回调函数两个参数 | deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!');
return;
}
// 创建结... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le... | deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!');
return;
}
// 创建结... | https://github.com/AuspiciousSign/HarmonyOS | 16b46a2d4a1ba771e98a74ff86d328345275f631 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | removeMany | Removes values from Array
@param index
@param count
@returns a shallow copy of the underlying array without removed data | private removeMany(index: int, count: int): T[] {
assert count > 0;
let n = index;
let k: int;
if (n >= 0) {
k = min(this.data.length - 1, n);
} else {
k = this.data.length + n;
}
if (k < 0) {
k = 0;
}
le... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | private removeMany(index: int, count: int): T[] {
assert count > 0;
let n = index;
let k: int;
if (n >= 0) {
k = min(this.data.length - 1, n);
} else {
k = this.data.length + n;
}
if (k < 0) {
k = 0;
}
le... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 65617afa044c1a90d56ab4e15fbd9fdd3af161d5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElements | 获取元素列表(用于遍历) | getElements(ruleStr: string): string[] {
if (!ruleStr || ruleStr.trim() === '') {
return [];
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 先处理 || 操作符(或操作,第一个有结果就返回)
if (processedRule.includes('||')) {
const orParts = this.safeSplit(processedRule, '||')... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | getElements(ruleStr: string): string[] {
if (!ruleStr || ruleStr.trim() === '') {
return [];
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 先处理 || 操作符(或操作,第一个有结果就返回)
if (processedRule.includes('||')) {
const orParts = this.safeSplit(processedRule, '||')... | https://github.com/DaLongZhuaZi/manxia | 58bfd291586a5e91b488ba1af1501bdd836ce417 | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/utils/MemDBUtils.ets | arkts | insertMemory | 将数据插入到数据库,返回 Promise<rowId> | async insertMemory(tableName: string, value: relationalStore.ValuesBucket): Promise<number> {
console.log('insertMemory: waiting for DB ready...')
await this.readyPromise
console.log('insertMemory: readyPromise resolved, rdbStore is', this.rdbStore ? 'present' : 'null')
console.log('insertMemory: inse... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertMemory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#type_annotation#Left A... | async insertMemory(tableName: string, value: relationalStore.ValuesBucket): Promise<number> {
console.log('insertMemory: waiting for DB ready...')
await this.readyPromise
console.log('insertMemory: readyPromise resolved, rdbStore is', this.rdbStore ? 'present' : 'null')
console.log('insertMemory: inse... | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/MemDBUtils.ets#L122-L150 | e661f2a000114d822dc256e830e5208da7e6ce92 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | setCurrentScope | 设置当前作用域 | public setCurrentScope(scopeId?: string): void {
this.currentScope = scopeId;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCurrentScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scopeId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#stri... | public setCurrentScope(scopeId?: string): void {
this.currentScope = scopeId;
} | https://github.com/DaLongZhuaZi/manxia | dde878039e3b319e6a8a82c860a4fd8a25f30d22 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | createEmptyDateField | 创建空的日期字段 | static createEmptyDateField(): DateField {
const result: DateField = {
value: '',
rawText: '',
confidence: 0,
hasBoundingBox: false,
boundingBoxJson: '',
format: ''
};
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEmptyDateField 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 D... | static createEmptyDateField(): DateField {
const result: DateField = {
value: '',
rawText: '',
confidence: 0,
hasBoundingBox: false,
boundingBoxJson: '',
format: ''
};
return result;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 1903d5a2510fe6650186594370852b51d7f56c0a | github |
openharmony-sig/fluttertpc_flutter_qr_reader | ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets | arkts | regScanResultUpdateListener | 注册扫描结果更新回调函数
@param {Function} callback 扫描结果更新回调函数
@returns {void} | regScanResultUpdateListener(callback: Function): void {
this.scanResultUpdateCb = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left regScanResultUpdateListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#... | regScanResultUpdateListener(callback: Function): void {
this.scanResultUpdateCb = callback;
} | https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git | 0781dba988897e7b7ee06d143ce5b54babba40fe | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | destroy | 销毁初始化器 | public destroy(): void {
this.reset();
DataInitializer.instance = null;
logger.debug(TAG, '数据初始化器已销毁');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public destroy(): void {
this.reset();
DataInitializer.instance = null;
logger.debug(TAG, '数据初始化器已销毁');
} | https://github.com/DaLongZhuaZi/manxia | 425e445591aa382b8e8f4e46c229fa66af8ec05d | github |
HarmonyOS_Samples/BestPracticeSnippets | AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets | arkts | notifyDataMove | Notify the controller of the data location change | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
});
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | f3f96b726b00d3399caa3252b3c90d72ae24ea2c | gitcode |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/empty/EmptyNetwork.ets | arkts | build | 构建网络缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_network"),
actionText: this.actionText,
onAction: this.onAction
});
} | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_network"),
actionText: this.actionText,
onAction: this.onAction
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | aad1f1b93f548e40a9dec0e53474287bff07ff1c | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/ScanService.ets | arkts | parseScanContent | 解析二维码内容
@param content 二维码内容
@returns 解析结果 | public parseScanContent(content: string): ScanResult {
try {
// 检查是否是TOTP URI
if (content && content.startsWith('otpauth://totp/')) {
// 解析TOTP URI
const totpConfig = TotpService.getInstance().parseUri(content);
if (totpConfig) {
return ScanResult.success(content);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left parseScanContent 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#string#Left string AST#strin... | public parseScanContent(content: string): ScanResult {
try {
// 检查是否是TOTP URI
if (content && content.startsWith('otpauth://totp/')) {
// 解析TOTP URI
const totpConfig = TotpService.getInstance().parseUri(content);
if (totpConfig) {
return ScanResult.success(content);
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/ScanService.ets#L94-L113 | 74ea2a7ac3942f584546ba64ca5762bc75f090a5 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setWidth | 弹窗宽度,仅限于wrap=true,底部和顶部弹窗默认 100% ,中间弹窗默认90% | setWidth(width: Length): Builder {
this.popupConfig.width = width
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWidth 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#identifier#Left Length AST#identifier#Right AST#)#Left ) AST#)... | setWidth(width: Length): Builder {
this.popupConfig.width = width
return this
} | https://github.com/wuba/omni-ui | dcf30a47cdb2923f3977ce49b6526b7b937aa6f0 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | pushData | 在末尾添加单个数据项 | pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right... | pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://gitee.com/openharmony/arkui_ace_engine.git | 5f416447e5dd8bc42d14ef3c750699b090f3a122 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | setWrappedBuilder | 设置布局
@param wrappedBuilder | protected setWrappedBuilder(wrappedBuilder: WrappedBuilder<T[]>) {
this.customBuilder = wrappedBuilder
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setWrappedBuilder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wrappedBuilder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right... | protected setWrappedBuilder(wrappedBuilder: WrappedBuilder<T[]>) {
this.customBuilder = wrappedBuilder
} | https://github.com/wuba/omni-ui | 6e98b62f624cea774b3890aeb476382f31eb79cb | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | getRenderer | 获取AudioRenderer实例
@returns <audio.AudioRenderer> AudioRenderer实例 | public getRenderer(): audio.AudioRenderer | null {
return this.renderer;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRenderer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST... | public getRenderer(): audio.AudioRenderer | null {
return this.renderer;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L690-L692 | b9e7213252d1642fe69de34b7a30f3857c96830e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_than/less_than_byte.ets | arkts | main | ---
desc: check less than operation for byte
--- | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a < b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a < b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 127eea32cc87291c100af773f6654281157dcec0 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | isValidImageUrl | 验证 URL 是否为有效的图片 URL | isValidImageUrl(url: string): boolean {
if (!url) return false;
// 检查是否为 http/https URL
if (!url.startsWith('http://') && !url.startsWith('https://')) {
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValidImageUrl 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#Left string AST#identifier#Right AST#)#Left ) ... | isValidImageUrl(url: string): boolean {
if (!url) return false;
// 检查是否为 http/https URL
if (!url.startsWith('http://') && !url.startsWith('https://')) {
return false;
}
return true;
} | https://github.com/AlkaidLab/moonlight-harmony | 322e2f58a5c333bc8cd4c7490f502abcb5ffeb79 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | stopMainBGM | 停止背景音乐 | static stopMainBGM(): void {
AudioManager.getInstance().stopSound(SoundType.BGM_MAIN);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stopMainBGM AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression... | static stopMainBGM(): void {
AudioManager.getInstance().stopSound(SoundType.BGM_MAIN);
} | https://github.com/the-wwyang/kids-learning-app | a85d399cd275eb34454cc34fa7cbe989b3f869f6 | github |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | isWritable | 路径是否存在且可访问(同步)。 | static isWritable(path: string): boolean {
if (path === undefined || path === null || path.length === 0) {
return false;
}
try {
return fileIo.accessSync(path);
} catch (e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isWritable 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 strin... | static isWritable(path: string): boolean {
if (path === undefined || path === null || path.length === 0) {
return false;
}
try {
return fileIo.accessSync(path);
} catch (e) {
return false;
}
} | https://github.com/LZZLHY/hlib | 6c946320cf03c0af9a71348d14656a483211f3f8 | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | noteContact | Save the contact remarks to the database.
@param {Object} addParams Contact Information
@param {string} DAHelper Database path
@param {number} result Contact ID
@param {string} uri Database address | noteContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (addParams.remarks != undefined && addParams.remarks.length > 0) {
let noteContact: Record<string, string | number> = {
'raw_contact_id': result,
'detail_info': addParams.remarks,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left noteContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#identifi... | noteContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (addParams.remarks != undefined && addParams.remarks.length > 0) {
let noteContact: Record<string, string | number> = {
'raw_contact_id': result,
'detail_info': addParams.remarks,
... | https://gitee.com/openharmony/applications_contacts.git | 4dc9ffe502a9670f303f17a86df9f6b456a991f5 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/popup/index.ets | arkts | initSize | 初始化尺寸 | initSize(): PopupSize{
switch (this.popupAlign){
case "left":
case "right":
return {
width: this.popupWidth || (this.isLandscape ? "70%" : "60%"),
height: this.popupHeight || "100%"
}
case "top":
case "bottom":
return {
width: this.popupWidth || "100%",
height: this.popupH... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initSize 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 PopupSize AST#identifier#Right AST#ERROR#Right AST#st... | initSize(): PopupSize{
switch (this.popupAlign){
case "left":
case "right":
return {
width: this.popupWidth || (this.isLandscape ? "70%" : "60%"),
height: this.popupHeight || "100%"
}
case "top":
case "bottom":
return {
width: this.popupWidth || "100%",
height: this.popupH... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/popup/index.ets#L126-L146 | 725372c54f12e98eb157749086466b55d3bfe85c | github |
xiebyapps/ClipLink | entry/src/main/ets/utils/HashUtil.ets | arkts | bytesToHex | Convert byte array to hex string | private static bytesToHex(bytes: Uint8Array): string {
return Array.from(bytes)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left bytesToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : A... | private static bytesToHex(bytes: Uint8Array): string {
return Array.from(bytes)
.map((b: number) => b.toString(16).padStart(2, '0'))
.join('');
} | https://github.com/xiebyapps/ClipLink | 40d69f753e1f15610931b52ad92498f650850300 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/trackmanager/TrackManager.ets | arkts | startReporting | Start the report track data by time interval.
@param interval | private startReporting(interval: number): void {
this.interval = setInterval(() => {
TrackManager.trackTable.queryAll().then((res: TrackServiceData[]) => {
if (res.length !== 0) {
Logger.info(TAG, `The cachedData length is ${res.length}`);
const cachedData = res.map((item: TrackS... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startReporting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left interval AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | private startReporting(interval: number): void {
this.interval = setInterval(() => {
TrackManager.trackTable.queryAll().then((res: TrackServiceData[]) => {
if (res.length !== 0) {
Logger.info(TAG, `The cachedData length is ${res.length}`);
const cachedData = res.map((item: TrackS... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 89d89c80e5807ee6587ebfa3dd5a38fb4d0d8593 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | decompressFromBase64 | 解压 base64 字符串(带 MLC: 前缀)→ JSON 字符串 | async function decompressFromBase64(data: string): Promise<string> {
const b64 = data.substring(COMPRESSED_PREFIX.length);
const buf = buffer.from(b64, 'base64');
const sourceBuffer = buf.buffer as ArrayBuffer;
// 解压缓冲区:预估原始数据最大为压缩数据的 10 倍
const destBuffer = new ArrayBuffer(sourceBuffer.byteLength * 10);
c... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left decompressFromBase64 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AS... | async function decompressFromBase64(data: string): Promise<string> {
const b64 = data.substring(COMPRESSED_PREFIX.length);
const buf = buffer.from(b64, 'base64');
const sourceBuffer = buf.buffer as ArrayBuffer;
// 解压缓冲区:预估原始数据最大为压缩数据的 10 倍
const destBuffer = new ArrayBuffer(sourceBuffer.byteLength * 10);
c... | https://github.com/AlkaidLab/moonlight-harmony | 54ab8302eff13196d9964051a1d0b4c08277b6f3 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test19_original_index.ets | arkts | testNullishCoalescingChain | --- Nullish coalescing chains --- | function testNullishCoalescingChain(): string {
let a: string | null = null;
let b: string | undefined = undefined;
let c: string = 'fallback';
let result: string = a ?? b ?? c;
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNullishCoalescingChain 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#... | function testNullishCoalescingChain(): string {
let a: string | null = null;
let b: string | undefined = undefined;
let c: string = 'fallback';
let result: string = a ?? b ?? c;
return result;
} | https://github.com/miaochiahao/ark-ghidra | 73097824e467e01acbfa3c21261e21b9e8b3f315 | github |
din0sauria/audio-deepfake-detection | entry/src/main/ets/Audio/AudioDB.ets | arkts | updateData | 修改数据 * | updateData(newItem: IInterviewAudioItem): IInterviewAudioItem[] {
const pre = new relationalStore.RdbPredicates(this.tableName)
pre.equalTo('id', newItem.id)
const res = this.store?.updateSync(newItem, pre)
if (!res) {
AlertDialog.show({ message: '数据更新失败' })
}
return this.getAllData()
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IInterviewAudioItem AST#ide... | updateData(newItem: IInterviewAudioItem): IInterviewAudioItem[] {
const pre = new relationalStore.RdbPredicates(this.tableName)
pre.equalTo('id', newItem.id)
const res = this.store?.updateSync(newItem, pre)
if (!res) {
AlertDialog.show({ message: '数据更新失败' })
}
return this.getAllData()
... | https://github.com/din0sauria/audio-deepfake-detection | 7def93ad63ad66d69a4fe5e885212d8dfb278d7b | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/WebNode.ets | arkts | update | Update | update(pk: meowTabInfo) {
if (this.builderNode) {
try {
this.builderNode.update(pk);
} catch (e) {
console.error(`[WebNode][update] Failed: ${e}!`);
}
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pk AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left meowTabInfo AST#identifier#Right AST... | update(pk: meowTabInfo) {
if (this.builderNode) {
try {
this.builderNode.update(pk);
} catch (e) {
console.error(`[WebNode][update] Failed: ${e}!`);
}
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 676f6c9d8508ee7947314adcb2e48eac50a5aa90 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_and/bitwise_and_char.ets | arkts | main | ---
desc: check bitwise AND operation for char operands
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a & b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a & b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 03e1a5d1e479c6ff81129432b5a54bd133221940 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | charAt | Getter for char at some index
@param index index in char array inside String
@returns char value at index
@throws StringIndexOutOfBoundsException if index is negative or >= length
@remarks
Implemented as native function, @see `charAt()` intrinsic [declaration](https://gitee.com/openharmony-sig/arkcompiler_runtime_core... | public charAt(index: number): String {
let c = new char[1];
c[0] = this.charAt(index as int)
return new String(c)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left charAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | public charAt(index: number): String {
let c = new char[1];
c[0] = this.charAt(index as int)
return new String(c)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3fbc6c12ade58b90b9ae81fec4d51693ec2bfda2 | gitee |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | getModuleState | 获取模块状态
@param moduleId 模块 ID
@returns 模块状态 | getModuleState(moduleId: string): ModuleState | undefined {
return this.modules.get(moduleId)?.state;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getModuleState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | getModuleState(moduleId: string): ModuleState | undefined {
return this.modules.get(moduleId)?.state;
} | https://github.com/codelably/HCompass | a1bd6520f107df53483a42b012f093c70d380580 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | setCustomLogger | MARK: - Custom Logger
Sets a custom logger to receive log callbacks from the native engine.
@param logger Custom logger implementation conforming to IAGenUILogger | static setCustomLogger(logger: IAGenUILogger): void {
AGenUILogger.getInstance().setCustomLogger(logger);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setCustomLogger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left logger AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static setCustomLogger(logger: IAGenUILogger): void {
AGenUILogger.getInstance().setCustomLogger(logger);
} | https://github.com/AGenUI/AGenUI | c1176919fba39ae6e450ed34a4158e05fbb53054 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | setAudioVolume | 设置音频音量 (0.0 ~ 1.0) | setAudioVolume(volume: number): boolean {
return this.nativeModule.setAudioVolume(volume);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAudioVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left volume AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ... | setAudioVolume(volume: number): boolean {
return this.nativeModule.setAudioVolume(volume);
} | https://github.com/AlkaidLab/moonlight-harmony | 0a1362a55e4bd024ab56bd5046f04121355ac1f5 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/IMErrorCode.ets | arkts | isEmptyFileError | Check if error code indicates empty file
@param code Error code
@returns true if it's an empty file error | static isEmptyFileError(code: number): boolean {
return code === IMErrorCode.ERR_SDK_COMM_FILE_SIZE_EMPTY;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEmptyFileError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static isEmptyFileError(code: number): boolean {
return code === IMErrorCode.ERR_SDK_COMM_FILE_SIZE_EMPTY;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | b963a141710de189340ed21e331004d009a90e7b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | getEBookLocalPath | 获取电子书本地路径 | public getEBookLocalPath(bookId: string): string | undefined {
const task = this.getEBookTask(bookId);
if (task?.status === TaskStatus.COMPLETED) {
return task.savePath;
}
return undefined;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEBookLocalPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public getEBookLocalPath(bookId: string): string | undefined {
const task = this.getEBookTask(bookId);
if (task?.status === TaskStatus.COMPLETED) {
return task.savePath;
}
return undefined;
} | https://github.com/DaLongZhuaZi/manxia | bcf90d4d3b8f4636165b5091efbbcc3729bbfd19 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets | arkts | onPayClick | 支付按钮点击事件
@returns {void} 无返回值 | onPayClick(): void {
this.startAlipayPayment();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPayClick 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... | onPayClick(): void {
this.startAlipayPayment();
} | https://github.com/Joker-x-dev/CoolMallArkTS | de59abc35e21510fa6f2fa0ab1916fa15d5ed5ef | github |
HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | entry/src/main/ets/utils/CommonUtil.ets | arkts | setWeather | 为实况窗设置天气
@param weatherType 天气类型
@returns 对应的天气信息 | public static setWeather(weatherType?: CustomerWeatherType): liveViewManager.WeatherInfo {
if (weatherType) {
return WEATHER_SAMPLE_DATA[weatherType];
}
// 此处开发者可以根据自身业务需要编写设置逻辑,这里 默认不设置
return {};
} | 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 setWeather AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left weatherType AST#identifier#Right AST#?#Left ... | public static setWeather(weatherType?: CustomerWeatherType): liveViewManager.WeatherInfo {
if (weatherType) {
return WEATHER_SAMPLE_DATA[weatherType];
}
// 此处开发者可以根据自身业务需要编写设置逻辑,这里 默认不设置
return {};
} | https://gitcode.com/HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | 2656e940119884da5b95f6b75de87bf86a193925 | gitcode |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/PreferencesUtil.ets | arkts | getPreferences | 获取 Preferences 实例
@param context 应用上下文
@returns Preferences 实例 | private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferences> {
if (!context) {
const error = new Error('Context is null or undefined');
console.error('PreferencesUtil getPreferences: ' + error.message);
throw error;
}
try {
// 为了简单起见,每次直接获... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | private static async getPreferences(context: common.UIAbilityContext): Promise<preferences.Preferences> {
if (!context) {
const error = new Error('Context is null or undefined');
console.error('PreferencesUtil getPreferences: ' + error.message);
throw error;
}
try {
// 为了简单起见,每次直接获... | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | ac4c826eea8fd381c84423465938802b6c0c5b13 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | clamp | Clamps a given value to the current range.
@param { ScopeType } value - A ScopeType value
@returns { ScopeType } Returns a ScopeType object that a given value is clamped to the current range. | clamp(value: T): T {
if (!value.compareTo(this._lowerLimit)) {
return this._lowerLimit
} else if (value.compareTo(this._upperLimit)) {
return this._upperLimit
} else {
return value
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clamp 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 T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right A... | clamp(value: T): T {
if (!value.compareTo(this._lowerLimit)) {
return this._lowerLimit
} else if (value.compareTo(this._upperLimit)) {
return this._upperLimit
} else {
return value
}
} | https://gitcode.com/iop123123/arkts-static-skills | 64b207aef05fadbe6607f0cd93792337cec6e529 | gitcode |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/controller/AudioPlayerControllerl.ets | arkts | setEventCallBack | Registering the avplayer callback function.
@param context Context. | setEventCallBack() {
if (this.avPlayer === undefined) {
return;
}
// Callback function for state machine changes.
this.avPlayer.on('stateChange', async (state) => {
if (this.avPlayer === undefined) {
return;
}
switch (state) {
case StateEvent.IDLE: // This state... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setEventCallBack 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... | setEventCallBack() {
if (this.avPlayer === undefined) {
return;
}
// Callback function for state machine changes.
this.avPlayer.on('stateChange', async (state) => {
if (this.avPlayer === undefined) {
return;
}
switch (state) {
case StateEvent.IDLE: // This state... | https://gitee.com/openharmony/codelabs.git | 4f9ce0d38c7c9649c5b9bc072d0df356e69cb30a | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenu.ets | arkts | getMenuItems | 获取所有菜单项 | getMenuItems(): SwipeMenuItem[] {
return this.items;
} | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getMenuItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi... | getMenuItems(): SwipeMenuItem[] {
return this.items;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 1323c43202cfccf3d922f1d7f9c811b511964ed6 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.