nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setHorizontalFlip | Set the horizontal flip status of the element.
@param isHorizontalFlip - Boolean value indicating whether to horizontally flip the element. | public setHorizontalFlip(isHorizontalFlip: boolean): void {
this.isHorizontalFlip = isHorizontalFlip;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHorizontalFlip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isHorizontalFlip AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole... | public setHorizontalFlip(isHorizontalFlip: boolean): void {
this.isHorizontalFlip = isHorizontalFlip;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ba4e2bf18b2635ce82107dbb7a87753af9834940 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DataCollector.ets | arkts | stopCollection | 停止数据采集 | public stopCollection(): void {
if (!this.isCollecting) {
return;
}
if (this.timerId !== null) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isCollecting = false;
console.log('DataCollector: Stopped collection');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopCollection 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... | public stopCollection(): void {
if (!this.isCollecting) {
return;
}
if (this.timerId !== null) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isCollecting = false;
console.log('DataCollector: Stopped collection');
} | https://github.com/LJ666-ui/harmony-health-care | ebcb2da13168287725070df31735c91e48556963 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | setMouseEmulationCallback | ==================== 鼠标模拟(委托 MouseEmulationService) ====================
设置鼠标模拟回调(由 StreamPage 调用) | setMouseEmulationCallback(callback: MouseEmulationCallback | null): void {
this.mouseEmulationService.setCallback(callback);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMouseEmulationCallback 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#binary_expression#Left AST#identifier#Left... | setMouseEmulationCallback(callback: MouseEmulationCallback | null): void {
this.mouseEmulationService.setCallback(callback);
} | https://github.com/AlkaidLab/moonlight-harmony | e92a82b1bde5e174f59374ddb6ce602dd12d5f3c | github |
openharmony/codelabs | ETSUI/ECommerce/entry/src/main/ets/utils/RdbUtil.ets | arkts | checkout | 结算:扣库存 + 生成订单 + 写入订单明细 + 删除购物车选中项
同时扣减用户代金券余额(余额不足则直接失败) | static async checkout(items: CartItem[], userId: number): Promise<boolean> {
const store = await RdbUtil.getStore();
hilog.info(
0x0000,
'RdbUtil',
'Checkout start: userId=%{public}d items=%{public}d store=%{public}s memProducts=%{public}d memCart=%{public}d',
userId,
items.lengt... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#R... | static async checkout(items: CartItem[], userId: number): Promise<boolean> {
const store = await RdbUtil.getStore();
hilog.info(
0x0000,
'RdbUtil',
'Checkout start: userId=%{public}d items=%{public}d store=%{public}s memProducts=%{public}d memCart=%{public}d',
userId,
items.lengt... | https://gitcode.com/openharmony/codelabs | 32d00b033858237f174a8ffeb5a67133d31bf642 | gitcode |
xiaofenger_705/protobuf-arkts-generator | test/Address.ets | arkts | constructor | Constructor | constructor() {
super()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
super()
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 0a51f15e97bdb0819bab1868008774112a63612d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | addDataSet | Adds a DataSet dynamically.
@param d | public addDataSet(d: T): void {
if (d == null)
return;
this.calcMinMax1(d);
if (this.mDataSets) {
this.mDataSets.add(d);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addDataSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left T AST#id... | public addDataSet(d: T): void {
if (d == null)
return;
this.calcMinMax1(d);
if (this.mDataSets) {
this.mDataSets.add(d);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bd7e0f08c19d1e111c2ffe8a7652543bbeb91f71 | gitee |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/database/RdbHelper.ets | arkts | initDefaultAchievements | 初始化默认勋章 | private async initDefaultAchievements(store: relationalStore.RdbStore): Promise<void> {
interface InitAchievement {
name: string;
icon: string;
description: string;
unlockCondition: string;
}
const achievements: InitAchievement[] = [
// --- 累计里程碑 ---
{
name: '初... | 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 initDefaultAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left store AST#identifier#Right AS... | private async initDefaultAchievements(store: relationalStore.RdbStore): Promise<void> {
interface InitAchievement {
name: string;
icon: string;
description: string;
unlockCondition: string;
}
const achievements: InitAchievement[] = [
// --- 累计里程碑 ---
{
name: '初... | https://gitcode.com/openharmony/codelabs | e518ec402627711f7c04d38fa3db698c1c26d426 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/messagebus/TopicTrackingService.ets | arkts | start | 启动 topic-tracking:
- full=false:仅订阅 /latest + /new,用于“查看 X 个新的或更新的话题”(游客态即可)
- full=true :额外加载 preloaded + 订阅 topicTrackingStateMeta,用于 new/unread 计数(登录态) | async start(full: boolean = true): Promise<void> {
if (this.started && (!full || this.fullStarted)) return;
if (this.startInFlight !== null) {
return await this.startInFlight;
}
this.startInFlight = this.startInternal(full);
try {
await this.startInFlight;
} finally {
this.st... | 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 start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left full AST#ide... | async start(full: boolean = true): Promise<void> {
if (this.started && (!full || this.fullStarted)) return;
if (this.startInFlight !== null) {
return await this.startInFlight;
}
this.startInFlight = this.startInternal(full);
try {
await this.startInFlight;
} finally {
this.st... | https://github.com/Amaz1ny/HarmonyDO-public | e49efa87919b3150568ccb08a2d87b0e86b5b83b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | constructor | ═══════════════════════════════════════════════════════════
初始化 & 单例
═══════════════════════════════════════════════════════════ | private constructor() {
// mdnsDiscovery 需要在 init 时使用 context 初始化
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
// mdnsDiscovery 需要在 init 时使用 context 初始化
} | https://github.com/AlkaidLab/moonlight-harmony | 086e69ac25510d3685b629ee28d02f9c35d7dfe7 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | parseEpisodesFromRss | 解析RSS中的单集列表 | private parseEpisodesFromRss(rssContent: string, podcastId: string): Episode[] {
const episodes: Episode[] = [];
if (!rssContent) {
return episodes;
}
// 粗略匹配 <item> ... </item>
const itemRegex = /<item[\s\S]*?<\/item>/g;
const items = rssContent.match(itemRegex);
if (!items || !Arr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseEpisodesFromRss AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rssContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | private parseEpisodesFromRss(rssContent: string, podcastId: string): Episode[] {
const episodes: Episode[] = [];
if (!rssContent) {
return episodes;
}
// 粗略匹配 <item> ... </item>
const itemRegex = /<item[\s\S]*?<\/item>/g;
const items = rssContent.match(itemRegex);
if (!items || !Arr... | https://github.com/pangpang20/antennaPodHM | d0ea67391bf7b3d7d038768a4b3fcb4cb1f5a47b | github |
banggx/account_app_harmonyos | entry/src/main/ets/service/account.ets | arkts | insert | 插入一条记录
@param info
@returns | insert(info: AccountInfo) {
const createTime = dayjs().startOf('day').toDate().getTime();
return AccountModel.insert({ ...info, createTime });
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountInfo AST#identifier#Right A... | insert(info: AccountInfo) {
const createTime = dayjs().startOf('day').toDate().getTime();
return AccountModel.insert({ ...info, createTime });
} | https://github.com/banggx/account_app_harmonyos | 9bda37dd1c0e0bdddba54f82093b1198e1aceb93 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnBadgeViewModel.ets | arkts | resetValue | 重置徽标数值 | resetValue(): void {
this.badgeValue = 5;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetValue 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... | resetValue(): void {
this.badgeValue = 5;
} | https://github.com/codelably/tuniao-ui | e3ecb49120d5fa921677f21ed4d7fcb043806203 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets | arkts | insertRecording | ==================== 录音操作 ====================
插入录音 | async insertRecording(recording: Recording): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const valuesBucket = recording.toDbObject()
await this.rdbStore.insert(AppConstants.TABLE_RECORDING, valuesBucket)
} catch (error) {
Logger.error(TAG, `Failed to insert recording:... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertRecording AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left recording AST#identifier#Righ... | async insertRecording(recording: Recording): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const valuesBucket = recording.toDbObject()
await this.rdbStore.insert(AppConstants.TABLE_RECORDING, valuesBucket)
} catch (error) {
Logger.error(TAG, `Failed to insert recording:... | https://gitcode.com/openharmony/codelabs | 4f5946fde11715932b12d23712331851d261ef7f | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/ReminderTaskDemo.ets | arkts | publishReminder | 发布一个倒计时提醒(倒计时结束后会弹出一个通知) | publishReminder() {
// 构造一个 ReminderRequestTimer 类型的倒计时提醒
let reminderRequestTimer: reminderAgentManager.ReminderRequestTimer = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, // 倒计时提醒
triggerTimeInSeconds: 10, // 倒计时的起始秒数
actionButton: [ // 通知上显示的按钮的标题和类型
{
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left publishReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | publishReminder() {
// 构造一个 ReminderRequestTimer 类型的倒计时提醒
let reminderRequestTimer: reminderAgentManager.ReminderRequestTimer = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, // 倒计时提醒
triggerTimeInSeconds: 10, // 倒计时的起始秒数
actionButton: [ // 通知上显示的按钮的标题和类型
{
... | https://github.com/webabcd/HarmonyDemo | 71be44ae9a5315067058ccaf1d55a56ce5cd6b5c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | mouseDistanceExceeds | ====== MOUSE 模式:绝对定位(对齐 Android AbsoluteTouchContext) ======
计算两点间距离是否超过阈值 | private mouseDistanceExceeds(deltaX: number, deltaY: number, limit: number): boolean {
return Math.sqrt(deltaX * deltaX + deltaY * deltaY) > limit;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mouseDistanceExceeds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private mouseDistanceExceeds(deltaX: number, deltaY: number, limit: number): boolean {
return Math.sqrt(deltaX * deltaX + deltaY * deltaY) > limit;
} | https://github.com/AlkaidLab/moonlight-harmony | 52b36f30a8d6ecb70a581e42d8af43ea592d0248 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceSelectorEngine.ets | arkts | executeXPathSelector | 执行XPath选择器 | private async executeXPathSelector(
selector: Selector,
context: SelectorContext,
executeJS: (script: string) => Promise<Object>
): Promise<SelectorResult> {
// 类型守卫:确保是XPath选择器
if (selector.type !== SelectorType.XPATH) {
return {
found: false,
count: 0,
error: 'Inv... | 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 executeXPathSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selector AST#identifier#Right AS... | private async executeXPathSelector(
selector: Selector,
context: SelectorContext,
executeJS: (script: string) => Promise<Object>
): Promise<SelectorResult> {
// 类型守卫:确保是XPath选择器
if (selector.type !== SelectorType.XPATH) {
return {
found: false,
count: 0,
error: 'Inv... | https://github.com/DaLongZhuaZi/manxia | 1f501cd89b0fdbd32bd10040c104950a67134a4b | github |
Joker-x-dev/CoolMallArkTS | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | createSearchHistoryTable | 创建搜索历史表
@returns {void} 无返回 | private createSearchHistoryTable(): void {
this.orm.executeSql(
`CREATE TABLE IF NOT EXISTS ${SearchHistoryLocalDataSourceImpl.TABLE_NAME} (keyword TEXT PRIMARY KEY, search_time INTEGER)`
);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createSearchHistoryTable 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#Righ... | private createSearchHistoryTable(): void {
this.orm.executeSql(
`CREATE TABLE IF NOT EXISTS ${SearchHistoryLocalDataSourceImpl.TABLE_NAME} (keyword TEXT PRIMARY KEY, search_time INTEGER)`
);
} | https://github.com/Joker-x-dev/CoolMallArkTS | c2479018167632d029a179ab7bba9648934dae63 | github |
silence17/harmonydemo | entry/src/main/ets/pages/RankPage.ets | arkts | onPageShow | @Entry装饰的组件才可以调用页面的生命周期。页面的生命周期
页面每次显示时触发。 | onPageShow() {
hilog.info(0x0000, 'testTag', '%{public}s', 'RankPage onPageShow');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
hilog.info(0x0000, 'testTag', '%{public}s', 'RankPage onPageShow');
} | https://github.com/silence17/harmonydemo | 039aa3dbf10753b04d679e8c4f95e92a4fa38ae5 | github |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityInteraction/entry/src/main/ets/specifiedability/HotStartAbility.ets | arkts | onCreate | [StartExclude HotAbility] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 接收调用方UIAbility传过来的参数
this.funcAbilityWant = want;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 接收调用方UIAbility传过来的参数
this.funcAbilityWant = want;
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 9f4ad62b9aadd231516c85ed09b99088278a70f4 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Creates a new Uint8ClampedArray using initializer
@param { FixedArray<number> } data - initializer
@returns { Uint8ClampedArray } - a new Uint8ClampedArray from data
@throws { Error } - function not implemented
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public of(...data: FixedArray<number>): Uint8ClampedArray {
throw new Error("Uint8ClampedArray.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left data A... | public of(...data: FixedArray<number>): Uint8ClampedArray {
throw new Error("Uint8ClampedArray.of: not implemented")
} | https://gitcode.com/iop123123/arkts-static-skills | ec1c65186ffd1eacad61483768b7c778dc1bd1d2 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | setWebColor | Sets the color for the web lines that come from the center. Don't forget
to use getResources().getColor(...) when loading a color from the
resources. Default: Color.rgb(122, 122, 122)
@param color | public setWebColor(color: number) {
this.mWebColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public setWebColor(color: number) {
this.mWebColor = color;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | af26c63331726f216a17ee793244823b0cceecfe | gitee |
midori52000/ArkPilot | Agent/entry/src/main/ets/skills/SkillsBackendService.ets | arkts | extractZip | 使用系统 ZIP 解压能力将整个压缩包解到目标目录。 | private async extractZip(zipPath: string, destDir: string): Promise<void> {
try {
await zlib.decompressFile(zipPath, destDir);
} catch (e) {
const message = e instanceof Error ? e.message : JSON.stringify(e);
throw new Error(`解压 ZIP 失败: ${message}`);
}
} | 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 extractZip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left zipPath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | private async extractZip(zipPath: string, destDir: string): Promise<void> {
try {
await zlib.decompressFile(zipPath, destDir);
} catch (e) {
const message = e instanceof Error ? e.message : JSON.stringify(e);
throw new Error(`解压 ZIP 失败: ${message}`);
}
} | https://github.com/midori52000/ArkPilot | fee82f16d4bfb36d468c8dca625fac57e1978315 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets | arkts | onUpdateViewFinished | Called after attributes and styles are updated. | onUpdateViewFinished() {
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onUpdateViewFinished 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_blo... | onUpdateViewFinished() {
} | https://github.com/AGenUI/AGenUI | 22b8d4bf69af84dc1d1e976c71571e05ffc24d66 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | map | Creates a new Int8Array using fn(arr[i]) over all elements of current Int8Array.
@param { function } fn - a function to apply for each element of current Int8Array
@returns { Int8Array } - a new Int8Array where for each element from current Int8Array fn was applied
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public map(fn: (val: number, index: int, array: Int8Array) => number): Int8Array {
let resBuf = new ArrayBuffer(this.lengthInt * Int8Array.BYTES_PER_ELEMENT)
let res = new Int8Array(resBuf, 0, (resBuf.getByteLength() / Int8Array.BYTES_PER_ELEMENT).toInt())
for (let i = 0; i < this.lengthInt;... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: number, index: int, array: Int8Array) => number): Int8Array {
let resBuf = new ArrayBuffer(this.lengthInt * Int8Array.BYTES_PER_ELEMENT)
let res = new Int8Array(resBuf, 0, (resBuf.getByteLength() / Int8Array.BYTES_PER_ELEMENT).toInt())
for (let i = 0; i < this.lengthInt;... | https://gitcode.com/iop123123/arkts-static-skills | 7334ba536b28c48b208a8dd2c7596e2d3f9e5989 | gitcode |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getLatestTopics | ==================== V1 Public API (V1) ====================
Get the latest topics from the public HTML feed to avoid legacy JSON API rate limits. | async getLatestTopics(): Promise<V2exTopic[]> {
return this.getRecentTopics(1)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLatestTopics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene... | async getLatestTopics(): Promise<V2exTopic[]> {
return this.getRecentTopics(1)
} | https://github.com/honjow/Next2V | 045ea5577564e274851b1a9ceb51307057fffd30 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/SourceDetailPage.ets | arkts | updateExistingItems | 更新已存在的项目信息(不改变位置) | updateExistingItems(updatedItems: Map<string, ComicInfo>): void {
let hasChanges = false;
this.items = this.items.map(item => {
const updated = updatedItems.get(item.id);
if (updated) {
hasChanges = true;
return updated;
}
return item;
});
if (hasChanges) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateExistingItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left updatedItems AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#id... | updateExistingItems(updatedItems: Map<string, ComicInfo>): void {
let hasChanges = false;
this.items = this.items.map(item => {
const updated = updatedItems.get(item.id);
if (updated) {
hasChanges = true;
return updated;
}
return item;
});
if (hasChanges) {
... | https://github.com/DaLongZhuaZi/manxia | 4c4e1b0722eb2da0c5abaf68425318a252e9f721 | github |
ibestservices/ibest-ui | library/src/main/ets/apis/IBestToast.ets | arkts | hide | 关闭toast | public async hide(){
if(this.toastContent === null || this.promptAction === null){
return
}
clearTimeout(this.timer)
this.timer = -1
await this.promptAction.closeCustomDialog(this.toastContent)
this.toastContent.dispose()
this.toastContent = null
this.toastOption = null
this.isLock = false
} | 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 hide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right... | public async hide(){
if(this.toastContent === null || this.promptAction === null){
return
}
clearTimeout(this.timer)
this.timer = -1
await this.promptAction.closeCustomDialog(this.toastContent)
this.toastContent.dispose()
this.toastContent = null
this.toastOption = null
this.isLock = false
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestToast.ets#L207-L218 | b8560e21dd63d0fa98b23a5c8263c0840e1c01f7 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/Logger.ets | arkts | getLogContent | 获取日志内容(包含备份和当前日志) | static async getLogContent(): Promise<string> {
if (!Logger.context) return '';
const filesDir = Logger.context.filesDir;
const logPath = `${filesDir}/${LOG_FILE_NAME}`;
const backupPath = `${filesDir}/${BACKUP_LOG_FILE_NAME}`;
let content = '';
try {
// 读取备份日志
const backupExists ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLogContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | static async getLogContent(): Promise<string> {
if (!Logger.context) return '';
const filesDir = Logger.context.filesDir;
const logPath = `${filesDir}/${LOG_FILE_NAME}`;
const backupPath = `${filesDir}/${BACKUP_LOG_FILE_NAME}`;
let content = '';
try {
// 读取备份日志
const backupExists ... | https://github.com/LambdaYH/ScrcpyForHarmonyOS | 52754b4c939a5e6520393825b4444decba95a00f | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | buildRtcDataEnvelope | 构造 rtcdata 消息外层 | private buildRtcDataEnvelope(): SignalingEnvelope {
const env: SignalingEnvelope = {
type: CmdType.TYPE_RTC_DATA,
from_mac: this.mac,
is_echo: '0',
};
return env;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildRtcDataEnvelope 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#Lef... | private buildRtcDataEnvelope(): SignalingEnvelope {
const env: SignalingEnvelope = {
type: CmdType.TYPE_RTC_DATA,
from_mac: this.mac,
is_echo: '0',
};
return env;
} | https://github.com/tdcare/tdwebrtc | 668e70e3a3d81562712112da84e173ee50861849 | github |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/core/HighLightGuideBuilder.ets | arkts | addGuidePage | 添加引导页
@param page 引导页对象
@returns 引导页组件的配置项 | public addGuidePage(page: GuidePage): HighLightGuideBuilder {
this.guidePages.push(page);
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addGuidePage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Gui... | public addGuidePage(page: GuidePage): HighLightGuideBuilder {
this.guidePages.push(page);
return this;
} | https://gitee.com/openharmony-sig/ohos_highlightguide.git | 73682b712b1e9b5e4ec1e2d30f29e5bf55d1f5e7 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnListViewModel.ets | arkts | handleItemClick | 列表项点击处理
@param title 列表项标题 | handleItemClick(title: string): void {
this.clickCount = this.clickCount + 1;
this.lastClickedItem = title;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleItemClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | handleItemClick(title: string): void {
this.clickCount = this.clickCount + 1;
this.lastClickedItem = title;
} | https://github.com/codelably/tuniao-ui | c9fceb69830197d39b8cfb97268bfb4fa615a033 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/ServerManager.ets | arkts | getVersion | 获取当前Scrcpy版本 | static getVersion(): string {
return ServerManager.SCRCPY_VERSION;
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static getVersion(): string {
return ServerManager.SCRCPY_VERSION;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | e21e14b1e5eb978c6f9ec0603d36678009051303 | github |
webabcd/HarmonyDemo | entry/src/main/ets/startup/StartupTask1.ets | arkts | onDependencyCompleted | 当前任务的某一个依赖任务执行完成后的回调 | onDependencyCompleted(dependence: string, result: Object): void {
// dependence - 执行完的依赖任务的名称
// result - 执行完的依赖任务的返回结果(即依赖任务在 init 中 return 的结果)
MyLog.d(`StartupTask1 onDependencyCompleted dependence:${dependence}, result:${JSON.stringify(result)}`)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDependencyCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dependence AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Le... | onDependencyCompleted(dependence: string, result: Object): void {
// dependence - 执行完的依赖任务的名称
// result - 执行完的依赖任务的返回结果(即依赖任务在 init 中 return 的结果)
MyLog.d(`StartupTask1 onDependencyCompleted dependence:${dependence}, result:${JSON.stringify(result)}`)
} | https://github.com/webabcd/HarmonyDemo | 96cc720646cd0f97e212c3f1e289bcff250e94fc | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | isNotNull | 判断字符串是否为非空。true为非空空,否则false
@param str
@returns | static isNotNull(str: string | number | undefined | null): boolean {
return false === StrUtil.isNull(str);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNotNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left ... | static isNotNull(str: string | number | undefined | null): boolean {
return false === StrUtil.isNull(str);
} | https://github.com/tdcare/tdwebrtc | c40776a2a55de29271aefc6d96818926aa2cee32 | github |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/database-crud-template.ets | arkts | updateUser | ==================== UPDATE ==================== | async updateUser(user: User): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let predicates = new relationalStore.RdbPredicates('users');
predicates.equalTo('id', user.id);
let rows = await this.rdbStore.update({
name: user.name,
age: user.age,
email: us... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateUser AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left user AST#identifier#Right AST#type_annotation#Lef... | async updateUser(user: User): Promise<number> {
if (!this.rdbStore) throw new Error('DB not initialized');
let predicates = new relationalStore.RdbPredicates('users');
predicates.equalTo('id', user.id);
let rows = await this.rdbStore.update({
name: user.name,
age: user.age,
email: us... | https://github.com/Goway-Hui/harmonyos-next-dev | 68c014802218c54e4dc89cc779fd957ab0f8118a | github |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/Pigeon.ets | arkts | getCodec | The codec used by CameraInterface. | static getCodec(): MessageCodec<Object> {
return CameraInterfaceCodec.INSTANCE;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCodec 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_st... | static getCodec(): MessageCodec<Object> {
return CameraInterfaceCodec.INSTANCE;
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | 379a4b74bf1ec4d988119c4122357e93031dc275 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/anchor/OmniAnchor.ets | arkts | _getScrollOption | 获取OmniAnchorMode映射的ScrollOption | _getScrollOption(): ScrollDirection {
if (this.mode == OmniAnchorMode.Scrollable) {
return ScrollDirection.Horizontal
} else {
return ScrollDirection.None
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _getScrollOption 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 ScrollDirection AST#identifier#Right AST#ERRO... | _getScrollOption(): ScrollDirection {
if (this.mode == OmniAnchorMode.Scrollable) {
return ScrollDirection.Horizontal
} else {
return ScrollDirection.None
}
} | https://github.com/wuba/omni-ui | fa77504f5f27a3b3257d24a935c729cd88fcec3b | github |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityInteraction/entry/src/main/ets/innerability/FuncAbilityA.ets | arkts | onDestroy | [StartExclude Ability_FuncAbilityA] | onDestroy(): void {
hilog.info(DOMAIN, 'FuncAbilityA', '%{public}s', 'Ability onDestroy');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le... | onDestroy(): void {
hilog.info(DOMAIN, 'FuncAbilityA', '%{public}s', 'Ability onDestroy');
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 697387d10233de9af96221a3318d2a389868d92a | gitcode |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ReplyManager.ets | arkts | wrapSelectedText | BBCode 包装辅助 (纯文本插入) | static wrapSelectedText(text: string, selStart: number, selEnd: number, tag: string): string {
const before: string = text.substring(0, selStart)
const selected: string = text.substring(selStart, selEnd)
const after: string = text.substring(selEnd)
if (selStart !== selEnd) {
return before + '[' ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left wrapSelectedText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static wrapSelectedText(text: string, selStart: number, selEnd: number, tag: string): string {
const before: string = text.substring(0, selStart)
const selected: string = text.substring(selStart, selEnd)
const after: string = text.substring(selEnd)
if (selStart !== selEnd) {
return before + '[' ... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ReplyManager.ets#L208-L216 | e39a699c2a3a92c545859f66e041d101a4189aac | github |
openharmony/codelabs | ETSUI/ContactManager/entry/src/main/ets/pages/ContactListPage.ets | arkts | handleAlphabetSelect | 处理字母索引点击 | handleAlphabetSelect(index: number): void {
const letter = this.alphabetList[index]
console.info('[ContactListPage] 选中字母:', letter)
// 计算目标位置(需要累加前面所有组的项数)
let targetIndex = 0
for (let i = 0; i < index; i++) {
targetIndex += this.contactGroups[i].contacts.length + 1 // +1是因为有分组标题
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleAlphabetSelect 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 AST#)#... | handleAlphabetSelect(index: number): void {
const letter = this.alphabetList[index]
console.info('[ContactListPage] 选中字母:', letter)
// 计算目标位置(需要累加前面所有组的项数)
let targetIndex = 0
for (let i = 0; i < index; i++) {
targetIndex += this.contactGroups[i].contacts.length + 1 // +1是因为有分组标题
}
... | https://gitcode.com/openharmony/codelabs | 4abd07508c59203020196b45cf874735ab7cbbd0 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | goBack | Go back.
@returns True if successful. | goBack() {
try {
if (this.controller?.accessBackward()) {
this.controller?.backward();
return true;
}
} catch (e) {
meow(`this.controller?.back(); failed: ${e}`, 'meowTabInfo][goBack', meowLevel.ERROR);
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left goBack 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#try_statement#Left AST#try#Lef... | goBack() {
try {
if (this.controller?.accessBackward()) {
this.controller?.backward();
return true;
}
} catch (e) {
meow(`this.controller?.back(); failed: ${e}`, 'meowTabInfo][goBack', meowLevel.ERROR);
}
return false;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 0ccc9d5a187f22408b37d9184ab56f7a812072ab | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | call | ---- 呼叫控制(对齐 Android WebRtcManager) ----
发起语音呼叫 | public call(toMacList: string[], roomId: string, msg: string): void {
LogUtil.info(`[WebRTC] call: toMacList=${JSON.stringify(toMacList)}, roomId=${roomId}, msg=${msg}`);
LogUtil.info(`[WebRTC] call: signaling=${this.signaling !== null ? 'ok' : 'null'}, isConnected=${this.signaling?.getIsConnected()}`);
t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left call AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left toMacList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST... | public call(toMacList: string[], roomId: string, msg: string): void {
LogUtil.info(`[WebRTC] call: toMacList=${JSON.stringify(toMacList)}, roomId=${roomId}, msg=${msg}`);
LogUtil.info(`[WebRTC] call: signaling=${this.signaling !== null ? 'ok' : 'null'}, isConnected=${this.signaling?.getIsConnected()}`);
t... | https://github.com/tdcare/tdwebrtc | 0af36db43978c154be25b764a7c991bbecb854cf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | saveShelves | 保存书架列表 | private async saveShelves(): Promise<void> {
try {
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存书架:SettingsManager未初始化');
return;
}
await this.settingsManager.setString(TYPE_SHELVES_KEY, JSON.stringify(this.shelves));
logger.debug(TAG, `保存了 ${this.shel... | 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 saveShelves AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | private async saveShelves(): Promise<void> {
try {
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存书架:SettingsManager未初始化');
return;
}
await this.settingsManager.setString(TYPE_SHELVES_KEY, JSON.stringify(this.shelves));
logger.debug(TAG, `保存了 ${this.shel... | https://github.com/DaLongZhuaZi/manxia | ff920ed7293e9fdfd7a833566eec4904b1af306d | github |
Tianpei-Shi/MusicDash | src/services/CloudDBService.ets | arkts | getAllUsers | 获取所有用户 | async getAllUsers(): Promise<CloudDBZoneObject[]> {
try {
// 模拟从云数据库获取所有用户
console.log('获取所有用户');
const users: CloudDBZoneObject[] = [
{
id: 1001,
username: "user1",
password: "password1",
like: "周杰伦,林俊杰",
history: "稻香,晴天,七里香",
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllUsers 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 getAllUsers(): Promise<CloudDBZoneObject[]> {
try {
// 模拟从云数据库获取所有用户
console.log('获取所有用户');
const users: CloudDBZoneObject[] = [
{
id: 1001,
username: "user1",
password: "password1",
like: "周杰伦,林俊杰",
history: "稻香,晴天,七里香",
... | https://github.com/Tianpei-Shi/MusicDash | b483c9b9c0b951ed190226c48f1d114b4b553cef | github |
openharmony/applications_mms | entry/src/main/ets/pages/transmitmsg/transmitMsgController.ets | arkts | changeValue | Include Forward Message Source Button Switch - SMS | changeValue(item, e) {
item.content = e.text;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#argument... | changeValue(item, e) {
item.content = e.text;
} | https://gitee.com/openharmony/applications_mms.git | e3db0fe340ea97186a1653c9244164d33a12bff0 | gitee |
openharmony-sig/ohos_video_trimmer | entry/src/main/ets/pages/FileUtils.ets | arkts | getFileSize | 获取path的文件大小 | getFileSize(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
console.error("FileUtils - FileUtils getFileSize e " + (e as BusinessError).message)
return -1
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | getFileSize(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
console.error("FileUtils - FileUtils getFileSize e " + (e as BusinessError).message)
return -1
}
} | https://gitee.com/openharmony-sig/ohos_video_trimmer.git | 172a107c504b1f3fe569b076b74e4023f5f9ab61 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | includes | Determines whether BigUint64Array includes a certain element, returning true or false as appropriate
@param { long } searchElement - The element to search for. The search starts at index 0.
@returns { boolean } - true if searchElement is in BigUint64Array, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStage... | public includes(searchElement: long): boolean {
if (searchElement < 0) {
return false;
}
return this.indexOf(searchElement.toInt(), 0) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident... | public includes(searchElement: long): boolean {
if (searchElement < 0) {
return false;
}
return this.indexOf(searchElement.toInt(), 0) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | b208f77aac2aca5e46a61895a7ae0f9e729e68c3 | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/GlobalContextUtil.ets | arkts | getContext | 获取GlobalContextUtil实例
@returns GlobalContextUtil | public static getContext(): GlobalContextUtil {
if (!GlobalContextUtil.instance) {
GlobalContextUtil.instance = new GlobalContextUtil()
}
return GlobalContextUtil.instance
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public static getContext(): GlobalContextUtil {
if (!GlobalContextUtil.instance) {
GlobalContextUtil.instance = new GlobalContextUtil()
}
return GlobalContextUtil.instance
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 29ef6f8e7d469e37de31e9d5640b07498c350da3 | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets | arkts | cleanupOldInstances | 清理旧的重复实例 | private async cleanupOldInstances(originalEventId: string): Promise<void> {
try {
// 删除该事件的所有旧实例
const deleted = await this.eventDao.deleteEventInstancesByOriginalId(originalEventId);
console.info(`清理了事件 ${originalEventId} 的旧实例`);
} catch (error) {
console.error('清理旧实例失败:', error);
... | 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 cleanupOldInstances AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalEventId AST#identifier#Right AST#ERROR#L... | private async cleanupOldInstances(originalEventId: string): Promise<void> {
try {
// 删除该事件的所有旧实例
const deleted = await this.eventDao.deleteEventInstancesByOriginalId(originalEventId);
console.info(`清理了事件 ${originalEventId} 的旧实例`);
} catch (error) {
console.error('清理旧实例失败:', error);
... | https://gitcode.com/openharmony/codelabs | e35b1743cd8bb52dad92a17f8d5878ca74db64db | gitcode |
dingzhilin1990/zhilinclaw | src/security/SecurityFilter.ets | arkts | detectPatterns | 检测模式匹配 | private detectPatterns(
input: string,
patterns: RegExp[],
issueType: SecurityIssueType
): SecurityIssue[] {
const issues: SecurityIssue[] = [];
for (const pattern of patterns) {
const match = input.match(pattern);
if (match) {
issues.push({
type: issueType,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectPatterns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private detectPatterns(
input: string,
patterns: RegExp[],
issueType: SecurityIssueType
): SecurityIssue[] {
const issues: SecurityIssue[] = [];
for (const pattern of patterns) {
const match = input.match(pattern);
if (match) {
issues.push({
type: issueType,
... | https://github.com/dingzhilin1990/zhilinclaw | d3c4789abcff0e59e159dab621877b60740583c7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets | arkts | getEnabledRules | 获取启用的规则 | getEnabledRules(): DictRule[] {
return this.getAllRules().filter(rule => rule.enabled);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEnabledRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Righ... | getEnabledRules(): DictRule[] {
return this.getAllRules().filter(rule => rule.enabled);
} | https://github.com/DaLongZhuaZi/manxia | 48eea997c295114a7456589d2be44f233abb1063 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getComicSourceByName | 根据名称获取图源记录 | async getComicSourceByName(sourceName: string): Promise<ComicSourceDatabaseRecord | null> {
try {
const sql: string = 'SELECT * FROM comic_source WHERE name = ?';
const result: DatabaseRecord[] = await this.databaseManager.querySql(sql, [sourceName]);
if (result && result.length > 0) {
r... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getComicSourceByName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceName AST#identifier#Right AST#type_annotation#Left A... | async getComicSourceByName(sourceName: string): Promise<ComicSourceDatabaseRecord | null> {
try {
const sql: string = 'SELECT * FROM comic_source WHERE name = ?';
const result: DatabaseRecord[] = await this.databaseManager.querySql(sql, [sourceName]);
if (result && result.length > 0) {
r... | https://github.com/DaLongZhuaZi/manxia | 05aa0aa436e313bb48d78b174f50cf49569bfb08 | github |
CsCesium/KantaiHomo | entry/src/main/ets/features/router/persist/ingest/webDump.ets | arkts | isEmptyResult | 判断 ParseResult 是否为空 | function isEmptyResult(result: ParseResult): boolean {
return result.preEvents.length === 0
&& result.mainEvents.length === 0
&& (!result.postEvents || result.postEvents.length === 0);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isEmptyResult AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left result AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function isEmptyResult(result: ParseResult): boolean {
return result.preEvents.length === 0
&& result.mainEvents.length === 0
&& (!result.postEvents || result.postEvents.length === 0);
} | https://github.com/CsCesium/KantaiHomo | bf9b25c1919804d1cbc335e6ee063f2de203c7fd | github |
2763981847/Clock-Alarm | entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets | arkts | build | 构建对话框的内容 | build() {
// 使用Flex布局
Flex() {
// 如果间隔时间或间隔次数大于0
if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) {
// 创建一个通用对话框
CommonDialog({
title: $r('app.string.ring_interval'), // 设置标题
controller: this.controller, // 设置控制器
// 确认按钮的回调函数
o... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#comment#Le... | build() {
// 使用Flex布局
Flex() {
// 如果间隔时间或间隔次数大于0
if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) {
// 创建一个通用对话框
CommonDialog({
title: $r('app.string.ring_interval'), // 设置标题
controller: this.controller, // 设置控制器
// 确认按钮的回调函数
o... | https://github.com/2763981847/Clock-Alarm | 1ff2411def7f49d7feb6c6f84c70317047cc285a | github |
Vsolon0401/MallShopping | features/home/src/main/ets/model/homeService.ets | arkts | fetchClassify | 按id取分类 | async fetchClassify(parentId: number) {
return Request.get(`/home/productCateList/${parentId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchClassify AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left parentId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async fetchClassify(parentId: number) {
return Request.get(`/home/productCateList/${parentId}`)
} | https://github.com/Vsolon0401/MallShopping | 56bec8208b6b8a6efbe81348655d2e0976720d76 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | rotateDisplay | 旋转显示器方向 (Sunshine)
@param angle 0=横屏, 90=竖屏 | async rotateDisplay(angle: number, displayName?: string): Promise<boolean> {
if (!this.nvHttp) {
console.warn('StreamingSession: rotateDisplay 失败 - nvHttp 未初始化');
return false;
}
try {
return await this.nvHttp.rotateDisplay(angle, displayName);
} catch (err) {
console.warn(`Str... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left rotateDisplay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left angle AST#identifier#Right AST#... | async rotateDisplay(angle: number, displayName?: string): Promise<boolean> {
if (!this.nvHttp) {
console.warn('StreamingSession: rotateDisplay 失败 - nvHttp 未初始化');
return false;
}
try {
return await this.nvHttp.rotateDisplay(angle, displayName);
} catch (err) {
console.warn(`Str... | https://github.com/AlkaidLab/moonlight-harmony | 617bf97ed10f47687338745bafed62a9ac612ec6 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | updateMessageContent | 更新消息内容 | async updateMessageContent(messageId: string, content: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
content: content
}
const predicates = new relationalStore.RdbPredicates(Tabl... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateMessageContent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left messageId AST#identifier#Right AST#type_annotation#Left AS... | async updateMessageContent(messageId: string, content: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
content: content
}
const predicates = new relationalStore.RdbPredicates(Tabl... | https://github.com/LongLiveY96/chatcube | 6f589257b75853db250487f0288de1aa573b0aae | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | parseGoogleResponse | 解析 Google Gemini 响应 | private parseGoogleResponse(responseData: string): AIApiResult {
const response = JSON.parse(responseData) as GoogleResponse
if (response.candidates !== undefined && response.candidates.length > 0) {
const candidate = response.candidates[0]
if (candidate.content !== undefined && candidate.content.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseGoogleResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private parseGoogleResponse(responseData: string): AIApiResult {
const response = JSON.parse(responseData) as GoogleResponse
if (response.candidates !== undefined && response.candidates.length > 0) {
const candidate = response.candidates[0]
if (candidate.content !== undefined && candidate.content.... | https://github.com/LongLiveY96/chatcube | aa57d2d125c0c1d7018e5276dc807bde75d48fd0 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveStorage.ets | arkts | init | 初始化存储配置
@param config OneDrive存储配置 | public init(config: StorageConfig): void {
this.config = this.parseConfig(config);
hilog.debug(DOMAIN, TAG, `OneDriveStorage init: accessToken length=${this.config.getAccessTokenText().length}`);
if (this.client) {
this.client.close();
}
// 创建OAuth2配置
const authConfig: OneDriveOAuth2Con... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public init(config: StorageConfig): void {
this.config = this.parseConfig(config);
hilog.debug(DOMAIN, TAG, `OneDriveStorage init: accessToken length=${this.config.getAccessTokenText().length}`);
if (this.client) {
this.client.close();
}
// 创建OAuth2配置
const authConfig: OneDriveOAuth2Con... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L54-L80 | d33109afffe9c0e099437e239aeb801721d2b351 | github |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets | arkts | isImageCached | 检查图片是否已缓存 | static async isImageCached(url: string): Promise<boolean> {
try {
const fileName = await ImageCacheUtil.generateFileName(url);
const cachePath = ImageCacheUtil.getCacheFilePath(fileName);
return fileIO.accessSync(cachePath);
} catch (error) {
console.error('ImageCacheUtil: 检查缓存失败', err... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left isImageCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#... | static async isImageCached(url: string): Promise<boolean> {
try {
const fileName = await ImageCacheUtil.generateFileName(url);
const cachePath = ImageCacheUtil.getCacheFilePath(fileName);
return fileIO.accessSync(cachePath);
} catch (error) {
console.error('ImageCacheUtil: 检查缓存失败', err... | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | ba71e1b84ff0c1b79c87353a26d84a719818c547 | github |
apap6628114/nga_oh | entry/src/main/ets/parser/nga/html-thread/AttachParser.ets | arkts | tryParseAttachLoad | 从 HTML 中解析 ubbcode.attach.load() 调用的附件数据(优先方案)。
定位 `ubbcode.attach.load('postattach${lou}', ..., 'postcontent${lou}', [...])` 调用,
扫描最后的 `[...]` 数组体,逐个提取对象中的 url/name/type/thumb/size/dscp 等字段。
@param html 源 HTML
@param lou 楼层号
@returns 附件元信息数组;无附件或解析失败时返回 null | function tryParseAttachLoad(html: string, lou: number): Record<string, Object>[] | null {
const marker: string = `ubbcode.attach.load('postattach${lou}'`;
const startIdx: number = html.indexOf(marker);
if (startIdx < 0) return null;
const afterMarker: string = html.substring(startIdx + marker.length);
const ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left tryParseAttachLoad AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function tryParseAttachLoad(html: string, lou: number): Record<string, Object>[] | null {
const marker: string = `ubbcode.attach.load('postattach${lou}'`;
const startIdx: number = html.indexOf(marker);
if (startIdx < 0) return null;
const afterMarker: string = html.substring(startIdx + marker.length);
const ... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/AttachParser.ets#L21-L96 | 38ef7fdc6c9dc9059fa4622952f5730232ff5b84 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | searchContacts | 搜索联系人(按姓名或电话) | public async searchContacts(keyword: string): Promise<ContactsItem[]> {
try {
const rdbStore = await this.ensureDBInitialized();
// 创建查询条件
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.contains('name', keyword)
.or()
.contains('phone', keywor... | 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 searchContacts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public async searchContacts(keyword: string): Promise<ContactsItem[]> {
try {
const rdbStore = await this.ensureDBInitialized();
// 创建查询条件
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.contains('name', keyword)
.or()
.contains('phone', keywor... | https://gitcode.com/openharmony/codelabs | 957fb2d838e29e243ae8e8331b45693466c30b8f | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets | arkts | drawForm | Draws the Legend-form at the given position with the color at the given
index.
@param c canvas to draw with
@param x position
@param y position
@param entry the entry to render
@param legend the legend context | protected drawForm(x : number, y : number, entry : LegendEntry, legend : Legend): Paint {
if (
entry.formColor == ColorTemplate.COLOR_SKIP ||
entry.formColor == ColorTemplate.COLOR_NONE ||
entry.formColor == 0
) {
return;
}
let... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left drawForm AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#... | protected drawForm(x : number, y : number, entry : LegendEntry, legend : Legend): Paint {
if (
entry.formColor == ColorTemplate.COLOR_SKIP ||
entry.formColor == ColorTemplate.COLOR_NONE ||
entry.formColor == 0
) {
return;
}
let... | https://gitee.com/openharmony/developtools_profiler.git | b02bf508d1474dc452033e4a97613085c6337458 | gitee |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | saveNumber | 保存数字数据
@param storeName 存储文件名
@param key 键名
@param value 值 | async saveNumber(storeName: string, key: string, value: number): Promise<void> {
try {
const prefs = await this.getPreferences(storeName);
await prefs.put(key, value);
await prefs.flush();
console.log(`[DataStorageManager] Saved number: ${storeName}/${key}`);
} catch (error) {
co... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveNumber AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async saveNumber(storeName: string, key: string, value: number): Promise<void> {
try {
const prefs = await this.getPreferences(storeName);
await prefs.put(key, value);
await prefs.flush();
console.log(`[DataStorageManager] Saved number: ${storeName}/${key}`);
} catch (error) {
co... | https://github.com/the-wwyang/kids-learning-app | a86f0f454151f7fe76a81a31f4d086f37f81e30f | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets | arkts | anticipate | 创建预期动画配置 | static anticipate(): AnimationConfig {
let config = new AnimationConfig();
config.duration = 300;
config.interpolator = InterpolatorType.ANTICIPATE;
config.anticipateTension = 2.0;
return config;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left anticipate 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 AnimationCo... | static anticipate(): AnimationConfig {
let config = new AnimationConfig();
config.duration = 300;
config.interpolator = InterpolatorType.ANTICIPATE;
config.anticipateTension = 2.0;
return config;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | ede7b79f9e14bc0d7bb3902da5388e0968e68a08 | gitcode |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | quickPlay | 快速播放
@param url 要播放的音频的url | async quickPlay(url: string | media.AVFileDescriptor | media.AVDataSrcDescriptor) {
await this.init({ immediately: true, loop: true });
if (typeof url === "string") {
await this.setUrl(url)
} else {
if (typeof (url as media.AVFileDescriptor).fd === "number") {
await this.setFdSrc(url ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left quickPlay AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async quickPlay(url: string | media.AVFileDescriptor | media.AVDataSrcDescriptor) {
await this.init({ immediately: true, loop: true });
if (typeof url === "string") {
await this.setUrl(url)
} else {
if (typeof (url as media.AVFileDescriptor).fd === "number") {
await this.setFdSrc(url ... | https://github.com/yangyongzhen/hmmovie | 505b9254a87a97cb23423f871dd1395aecf0de45 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toFixed | Return a string representing the value of this Decimal in normal (fixed-point) notation to
`decimalPlaces` fixed decimal places.
@param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
@returns { string } the string type
@throws { BusinessError } 10200001 - The value of `decimalPlaces` is ou... | public toFixed(decimalPlaces: double): string {
return this.toFixed(decimalPlaces, Decimal.rounding);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFixed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left decimalPlaces AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AST#iden... | public toFixed(decimalPlaces: double): string {
return this.toFixed(decimalPlaces, Decimal.rounding);
} | https://gitcode.com/iop123123/arkts-static-skills | 5c7397269b3b21810140f1cab841b159ef5bca5d | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/database/DatabaseHelper.ets | arkts | queryAllHealthEventsForDebug | 【诊断方法】查询所有健康事件(不带任何过滤,用于调试) | public async queryAllHealthEventsForDebug(): Promise<HealthEvent[]> {
const predicates = new relationalStore.RdbPredicates("t_health_event");
predicates.orderByDesc("event_time");
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().query(predicates, [
... | 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 queryAllHealthEventsForDebug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | public async queryAllHealthEventsForDebug(): Promise<HealthEvent[]> {
const predicates = new relationalStore.RdbPredicates("t_health_event");
predicates.orderByDesc("event_time");
let resultSet: relationalStore.ResultSet | undefined;
try {
resultSet = await this.getStore().query(predicates, [
... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L595-L634 | 90064e8a12afa13a23c3286b8c8b5b42cc2ee622 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | getLeftAndRightExp | To deal with pButton
@param { PhysicsButtonInfo } pButton
@param { Function } callBack | private getLeftAndRightExp(): string[] {
// 首先获取带逗号的表达式原型,以匹配节目传过来的带逗号之后的index
let expressionValue: string | undefined = AppStorage.get<string>('globalExpression');
if (expressionValue !== undefined) {
this.expression = DisplayUtil.formatAddSeparator(expressionValue);
}
if (this.expression =... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLeftAndRightExp 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 getLeftAndRightExp(): string[] {
// 首先获取带逗号的表达式原型,以匹配节目传过来的带逗号之后的index
let expressionValue: string | undefined = AppStorage.get<string>('globalExpression');
if (expressionValue !== undefined) {
this.expression = DisplayUtil.formatAddSeparator(expressionValue);
}
if (this.expression =... | https://gitee.com/openharmony-sig/applications_calculator.git | e155d76734c3cdecdbb9121cf6100f4683ec0d8f | gitee |
Explore-In-HMOS-Wearable/currency-converter | entry/src/main/ets/viewmodel/CurrencyViewModel.ets | arkts | initCurrencyData | Initialize currency data | public initCurrencyData(): CurrencyData[] {
return [
new CurrencyData('USD', 'US Dollar',
$r('app.media.flag_usd'), '$', 1.0),
new CurrencyData('EUR', 'Euro', $r('app.media.flag_eur'), '€',
0.92),
new CurrencyData('GBP', 'British Pound',
$r('app.media.flag_gbp'), '£', 0.7... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initCurrencyData 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 Curre... | public initCurrencyData(): CurrencyData[] {
return [
new CurrencyData('USD', 'US Dollar',
$r('app.media.flag_usd'), '$', 1.0),
new CurrencyData('EUR', 'Euro', $r('app.media.flag_eur'), '€',
0.92),
new CurrencyData('GBP', 'British Pound',
$r('app.media.flag_gbp'), '£', 0.7... | https://github.com/Explore-In-HMOS-Wearable/currency-converter | 16b92969ae19405e541fbe0bb69f7b0452b00db6 | github |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/OmniFilterComponentRegistry.ets | arkts | getRightSlideComponentBuilder | 获取右滑类型的组件构建器 | getRightSlideComponentBuilder(type: string): WrappedBuilder<[OmniFilterItemBean, OnConfirmAction, OnCloseAction]> | undefined {
return this.rightSlideTypeBuilderPool.get(type);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getRightSlideComponentBuilder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left ... | getRightSlideComponentBuilder(type: string): WrappedBuilder<[OmniFilterItemBean, OnConfirmAction, OnCloseAction]> | undefined {
return this.rightSlideTypeBuilderPool.get(type);
} | https://github.com/wuba/omni-ui | d15cca6d9fdb622a409ad43f345a3d4f3bd30bde | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | of | Returns the localized display name for the provided code
@param code The code to get the display name for
@returns The localized display name, the code itself (if fallback is 'code'), or undefined
@throws RangeError If the code is invalid for the current type | public of(code: string): string | undefined {
if (code.isEmpty()) {
throw new RangeError('Code cannot be empty');
}
try {
const result = DisplayNames.ofNative(
this.locale,
this.type,
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier... | public of(code: string): string | undefined {
if (code.isEmpty()) {
throw new RangeError('Code cannot be empty');
}
try {
const result = DisplayNames.ofNative(
this.locale,
this.type,
... | https://gitcode.com/iop123123/arkts-static-skills | a3327eac1698c6d266d5af9caa7a742f5364b606 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_or/bitwise_or_short.ets | arkts | main | ---
desc: check bitwise OR of two short integers
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{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: short = {{v.left}}
const b: short = {{v.right}}
assert (a | b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5ce0af49674a41939356fec3f92e2faafe55cd3b | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AdviceFeedbackDAO.ets | arkts | getByUserId | 获取用户的所有反馈记录 | static async getByUserId(userId: number, limit?: number): Promise<AdviceFeedback[]> {
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AdviceFeedback.tableName);
predicates.equalTo('user_id', userId);
predicates.orderByDesc('created_at... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getByUserId(userId: number, limit?: number): Promise<AdviceFeedback[]> {
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AdviceFeedback.tableName);
predicates.equalTo('user_id', userId);
predicates.orderByDesc('created_at... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2aa4cc3e850f70ec65329219ad476cea079b9d48 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | updateCachePathForOrientation | 根据当前屏幕方向更新缓存路径 | private updateCachePathForOrientation(): void {
const orientation = this.getCurrentOrientation();
if (orientation === 'portrait') {
this.localCachePath = this.portraitCachePath;
} else {
this.localCachePath = this.landscapeCachePath;
}
this.cachedOrientation = orientation;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateCachePathForOrientation 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#... | private updateCachePathForOrientation(): void {
const orientation = this.getCurrentOrientation();
if (orientation === 'portrait') {
this.localCachePath = this.portraitCachePath;
} else {
this.localCachePath = this.landscapeCachePath;
}
this.cachedOrientation = orientation;
} | https://github.com/AlkaidLab/moonlight-harmony | fc9b6f5622f9dce48872cccbdf26a4e926079d6a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | acosh | Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
value of this Decimal.
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | public acosh(): Decimal {
let x: Decimal = this;
if (x.comparedTo(1) == -1) {
return new Decimal(x.equals(1) ? 0 : NaN);
}
if (!x.isFinite()) {
return new Decimal(x);
}
let pr = Decimal.precision;
let rm = Decimal.rounding;
Dec... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left acosh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public acosh(): Decimal {
let x: Decimal = this;
if (x.comparedTo(1) == -1) {
return new Decimal(x.equals(1) ? 0 : NaN);
}
if (!x.isFinite()) {
return new Decimal(x);
}
let pr = Decimal.precision;
let rm = Decimal.rounding;
Dec... | https://gitcode.com/iop123123/arkts-static-skills | 0449ead3e3cff43b0b2d4f669ed4cc47bbbdee8f | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/auth/AuthService.ets | arkts | getCsrfToken | 获取 CSRF Token | getCsrfToken(): string {
return this.csrfToken;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCsrfToken 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... | getCsrfToken(): string {
return this.csrfToken;
} | https://github.com/Amaz1ny/HarmonyDO-public | feddc1272aa391715fcf808f0bb519bf11bb4668 | github |
openeuler-mirror/arkui-linux | samples/arkui-test/Component/08_UserDefined/entry/src/main/ets/pages/Ring.ets | arkts | filter | 填充颜色,默认白色
对非法参数进行过滤 | public static filter(ringAttribute: RingAttribute): RingAttribute {
if (null == ringAttribute || undefined == ringAttribute) {
ringAttribute = new RingAttribute();
} else {
var defaultAttribute: RingAttribute = new RingAttribute();
if (undefined == ringAttribute.color) {
ringAttribut... | 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 filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ringAttribute AST#identifier#Right AST#:#Left : ... | public static filter(ringAttribute: RingAttribute): RingAttribute {
if (null == ringAttribute || undefined == ringAttribute) {
ringAttribute = new RingAttribute();
} else {
var defaultAttribute: RingAttribute = new RingAttribute();
if (undefined == ringAttribute.color) {
ringAttribut... | https://github.com/openeuler-mirror/arkui-linux | a22cdc38ff775ed1aa9c35807628f4f805dacbbe | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/allowPass.ets | arkts | fn1 | Works because Foo is allowed | function fn1(arg: Foo) {} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#typ... | function fn1(arg: Foo) {} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 9cc2374c4649c2600d637c746b221224dbaf03ee | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/SizeViewModel.ets | arkts | getFunctionHeightItems | 获取函数高度示例列表
@returns {FunctionSizeItem[]} 函数高度示例数组 | getFunctionHeightItems(): FunctionSizeItem[] {
return [
new FunctionSizeItem("tn_h(1, 2)", 1, 2),
new FunctionSizeItem("tn_h(1, 3)", 1, 3),
new FunctionSizeItem("tn_h(2, 3)", 2, 3),
new FunctionSizeItem("tn_h(1, 4)", 1, 4),
new FunctionSizeItem("tn_h(3, 4)", 3, 4),
new Function... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFunctionHeightItems 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#identifier#Left FunctionSizeItem AST#ide... | getFunctionHeightItems(): FunctionSizeItem[] {
return [
new FunctionSizeItem("tn_h(1, 2)", 1, 2),
new FunctionSizeItem("tn_h(1, 3)", 1, 3),
new FunctionSizeItem("tn_h(2, 3)", 2, 3),
new FunctionSizeItem("tn_h(1, 4)", 1, 4),
new FunctionSizeItem("tn_h(3, 4)", 3, 4),
new Function... | https://github.com/codelably/tuniao-ui | 00c6db26be2e47f5dad6393027436c9c4a1854c7 | github |
dingzhilin1990/zhilinclaw | src/security/SandboxedExecutor.ets | arkts | createSandboxEnvironment | 创建沙箱环境 | private async createSandboxEnvironment(context?: Record<string, any>): Promise<any> {
// 创建受限的全局对象
const sandbox = {
// 只暴露安全的 API
console: {
log: (...args: any[]) => console.log('[Sandbox]', ...args),
warn: (...args: any[]) => console.warn('[Sandbox]', ...args),
error: (..... | 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 createSandboxEnvironment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right... | private async createSandboxEnvironment(context?: Record<string, any>): Promise<any> {
// 创建受限的全局对象
const sandbox = {
// 只暴露安全的 API
console: {
log: (...args: any[]) => console.log('[Sandbox]', ...args),
warn: (...args: any[]) => console.warn('[Sandbox]', ...args),
error: (..... | https://github.com/dingzhilin1990/zhilinclaw | 827b5f96cfd42c5a0bf35f024d38ca98d1475241 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | buildContinuousDailyTrend | 把 (dayKey -> 值) 的 Map 整理成最近 dayCount 天的连续序列(本地时区,缺失天补 0) | private buildContinuousDailyTrend(valueByDay: Map<string, number>, dayCount: number): DailyUsagePoint[] {
const points: DailyUsagePoint[] = []
const now = new Date()
// 以本地零点为基准向前回溯,保证桶键与 buildLocalDayKey 一致
const baseMs = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime()
const ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildContinuousDailyTrend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left valueByDay AST#identifier#Right AST#ERROR#Left AST#:#Le... | private buildContinuousDailyTrend(valueByDay: Map<string, number>, dayCount: number): DailyUsagePoint[] {
const points: DailyUsagePoint[] = []
const now = new Date()
// 以本地零点为基准向前回溯,保证桶键与 buildLocalDayKey 一致
const baseMs = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime()
const ... | https://github.com/LongLiveY96/chatcube | 71d46df945a36b301b9b027ba20a1a6a4c350fdc | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getHoverScale | 获取悬停缩放比例 | static getHoverScale(): number {
return 1.02;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHoverScale 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... | static getHoverScale(): number {
return 1.02;
} | https://github.com/chendi126/harmonyOS-TCP | e572142899bdde0242916c02cb61ab9e51124781 | github |
dingzhilin1990/zhilinclaw | src/agents/AgentBase.ets | arkts | setAIModelAdapter | 设置 AI 模型适配器 | public setAIModelAdapter(adapter: AIModelAdapter): void {
this.aiModelAdapter = adapter;
this.log('AI 模型适配器已设置');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAIModelAdapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left adapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public setAIModelAdapter(adapter: AIModelAdapter): void {
this.aiModelAdapter = adapter;
this.log('AI 模型适配器已设置');
} | https://github.com/dingzhilin1990/zhilinclaw | fd2e86cd9f1cf0ea6d6414dcab1b3eb9ff676c7f | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/Video/components/CommentKeyboard.ets | arkts | getFrequentEmojiIcons | 表情集合遍历的函数 | getFrequentEmojiIcons(): Resource[] {
const getRandomNum = () => Math.floor(Math.random() * 2) + 3
return Array(10).fill(1).map(() => $r(`app.media.emoji_${getRandomNum()}`))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFrequentEmojiIcons 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#identifier#Left Resource AST#identifier#R... | getFrequentEmojiIcons(): Resource[] {
const getRandomNum = () => Math.floor(Math.random() * 2) + 3
return Array(10).fill(1).map(() => $r(`app.media.emoji_${getRandomNum()}`))
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | e19a6e33f85a411b4c3a68110050138a9b7e9fac | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | convertObject | Converts object to this lambda type
@param {Any} obj Object to convert
@returns {Any} Converted object
@throws {Error} If conversion is invalid
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override convertObject(obj: Any): Any {
const objType = Type.of(obj)
if (this.equals(objType)) {
return obj
}
if (this.assignableFrom(objType)) {
return obj
}
throw new Error("invalid conversion")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A... | public override convertObject(obj: Any): Any {
const objType = Type.of(obj)
if (this.equals(objType)) {
return obj
}
if (this.assignableFrom(objType)) {
return obj
}
throw new Error("invalid conversion")
} | https://gitcode.com/iop123123/arkts-static-skills | f35612bd6014d7202dee1f5472425f4118872715 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | undo | 撤销:恢复到上一个快照 | undo(): boolean {
if (this.undoStack.length === 0) return false;
// 保存当前状态到 redo 栈
const current: EditSnapshot = {
textA: this.textA,
textB: this.textB,
description: '恢复到此状态'
};
this.redoStack.push(current);
// 恢复上一个快照
const snapshot = this.undoStack.pop()!;
this.te... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left undo 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_bloc... | undo(): boolean {
if (this.undoStack.length === 0) return false;
// 保存当前状态到 redo 栈
const current: EditSnapshot = {
textA: this.textA,
textB: this.textB,
description: '恢复到此状态'
};
this.redoStack.push(current);
// 恢复上一个快照
const snapshot = this.undoStack.pop()!;
this.te... | https://github.com/XJTUWYD/ArkDiff | 973735f586dafa740ee838657bca2d2b6e7f3fc2 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | search | ============ 搜索 ============
搜索文档
@param keyword 关键词
@param params 其他搜索参数 | async search(keyword: string, params?: { parentId?: string; tags?: string[]; type?: DocumentType; page?: number; pageSize?: number }): Promise<ApiResponse<KnowledgeSearchResult>> {
return this.client.get<KnowledgeSearchResult>('/api/v1/knowledge/search', { keyword, ...params } as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left search AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async search(keyword: string, params?: { parentId?: string; tags?: string[]; type?: DocumentType; page?: number; pageSize?: number }): Promise<ApiResponse<KnowledgeSearchResult>> {
return this.client.get<KnowledgeSearchResult>('/api/v1/knowledge/search', { keyword, ...params } as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | 0cfdf97421a89ed7d5688ca7227a6f99fafb578b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | constructor | @param m lambda to call
@example new CallableBodyFunction((self: Object, i: int): void {} as Object)
@note in case of instance methods zero argument is a reciever | public constructor(m: Object) throws {
super()
if (!(Type.of(m) instanceof LambdaType)) {
throw new TypeAPICreateException("can't encapsulate non-functional type")
}
this.body = m
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left m AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object ... | public constructor(m: Object) throws {
super()
if (!(Type.of(m) instanceof LambdaType)) {
throw new TypeAPICreateException("can't encapsulate non-functional type")
}
this.body = m
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1c24db3015d63f4fa67b0d73268b79b4c87b9614 | gitee |
openharmony-sig/arkcompiler_ets_frontend | arkoala-arkts/shopping/user/src/ets/pages/collect/collected.ets | arkts | build | async onPortrait(mediaQueryResult : mediaquery.MediaQueryResult) {
let result = mediaQueryResult.matches
if (result) {
this.width1 = 45
} else {
this.width1 = 100
}
} | build() {
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image('/resources/icon/arrow_left.png')
.width(30 * this.ratio)
.aspectRatio(1)
.onClick((e?: ClickEvent) => {
router.back()
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image('/resources/icon/arrow_left.png')
.width(30 * this.ratio)
.aspectRatio(1)
.onClick((e?: ClickEvent) => {
router.back()
... | https://gitee.com/openharmony-sig/arkcompiler_ets_frontend.git | 9b3eae671a9309013dda902ac3f31a59f8c2ed89 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | cleanupTempDirectory | 清理临时目录 | private async cleanupTempDirectory(tempDir: string): Promise<void> {
try {
if (await this.sandboxManager.exists(tempDir)) {
await this.sandboxManager.deleteDirectory(tempDir, true);
logger.debug(TAG, `清理临时目录: ${tempDir}`);
}
} catch (error) {
logger.error(TAG, '清理临时目录失败', err... | 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 cleanupTempDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tempDir AST#identifier#Right AST#ERROR#Left AST... | private async cleanupTempDirectory(tempDir: string): Promise<void> {
try {
if (await this.sandboxManager.exists(tempDir)) {
await this.sandboxManager.deleteDirectory(tempDir, true);
logger.debug(TAG, `清理临时目录: ${tempDir}`);
}
} catch (error) {
logger.error(TAG, '清理临时目录失败', err... | https://github.com/DaLongZhuaZi/manxia | 3c952dc24e0a8effef4ce38c9a9817d985c53408 | github |
SuppliedGoat435/NumberSlidingPuzzle | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | tileFontSize | 根据尺寸自动调整字体 | get tileFontSize(): number {
if (this.size === 3) return 28
if (this.size === 4) return 22
return 16
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left tileFontSize 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#Righ... | get tileFontSize(): number {
if (this.size === 3) return 28
if (this.size === 4) return 22
return 16
} | https://github.com/SuppliedGoat435/NumberSlidingPuzzle | 3c5bbb599cac7686f6724ace6cab4fe84aec49cc | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | comparePinnedAndTime | 比较两个条目/分组的置顶状态和时间
用于排序:置顶的在前,同是置顶的按修改时间排序
@param a 条目A
@param b 条目B
@returns 排序结果 | public static comparePinnedAndTime(a: KdbxEntry | KdbxGroup, b: KdbxEntry | KdbxGroup): number {
const aPinned = KdbxUtils.isPinned(a);
const bPinned = KdbxUtils.isPinned(b);
// 如果置顶状态不同,置顶的排在前面
if (aPinned && !bPinned) {
return -1;
}
if (!aPinned && bPinned) {
return 1;
}
... | 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 comparePinnedAndTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left ... | public static comparePinnedAndTime(a: KdbxEntry | KdbxGroup, b: KdbxEntry | KdbxGroup): number {
const aPinned = KdbxUtils.isPinned(a);
const bPinned = KdbxUtils.isPinned(b);
// 如果置顶状态不同,置顶的排在前面
if (aPinned && !bPinned) {
return -1;
}
if (!aPinned && bPinned) {
return 1;
}
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L512-L530 | e7cdf5400e0bd26e2997d4964d253b80eab158de | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets | arkts | constructor | Creates a WeakMapEntry
@param { int } keyHash - Hash of the key
@param { V } value - The value
@syscap SystemCapability.Utils.Lang | constructor(keyHash: int, value: V) {
this._keyHash = keyHash
this._value = value
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyHash AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right A... | constructor(keyHash: int, value: V) {
this._keyHash = keyHash
this._value = value
} | https://gitcode.com/iop123123/arkts-static-skills | 9e71eae85c5698ebf5c791027cdb19605efd9500 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | getAxisRight | Returns the right y-axis object. In the horizontal bar-chart, this is the
bottom axis.
@return | public getAxisRight(): YAxis | null {
return this.mAxisRight;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAxisRight 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 AS... | public getAxisRight(): YAxis | null {
return this.mAxisRight;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 00c4d361c0bed7f90cb89650c9e67ac7d5895e2e | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Float32Array that satisfies the condition
@param { function } fn - condition
@returns { int } - the index of the last element that satisfies fn, -1 otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLastIndex(fn: (val: number, index: int, array: Float32Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: number, index: int, array: Float32Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return i
}
}
return -1
} | https://gitcode.com/iop123123/arkts-static-skills | 1d56e1e1fe2750ddace07b9da0c4edc06a791359 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets | arkts | isCharType | Checks if the given Class object represents a char type (including boxed and primitive types).
@static
@param { Class } type The Class object to be checked.
@returns { boolean } Returns true if it's a char type; otherwise returns false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isCharType(type: Class): boolean {
return type === Types.BOXED_CHAR || type === Class.PRIMITIVE_CHAR
} | 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 isCharType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:... | public static isCharType(type: Class): boolean {
return type === Types.BOXED_CHAR || type === Class.PRIMITIVE_CHAR
} | https://gitcode.com/iop123123/arkts-static-skills | 1a8f75a0228907cb6b03a5f4a12bdb53087b61db | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnRatePage.ets | arkts | build | 构建评分展示页面 | build() {
AppNavDestination({
title: "评分",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | 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,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | 3676a9612a7d8839c22865b17a098c3b781d24f4 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Queue.ets | arkts | forEach | Executes a provided function once for each array element.
@param callbackfn - The function to execute on each element, taking the value, index, and Queue as arguments. | public forEach(callbackfn: QueueForEachCb<T>): void {
this.buffer.forEach(((val: T, idx) => callbackfn(val, idx.toInt(), this)));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr... | public forEach(callbackfn: QueueForEachCb<T>): void {
this.buffer.forEach(((val: T, idx) => callbackfn(val, idx.toInt(), this)));
} | https://gitcode.com/iop123123/arkts-static-skills | ccf5fe329cacd7e6afe951dfb2c92b6403cd3e77 | gitcode |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets | arkts | clearAllHistory | 清空所有观看历史 | async clearAllHistory(): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
prefs.putSync(WatchHistoryManager.HISTORY_KEY, '[]')
await prefs.flush()
console.log('观看历史已清空')
} catch (error) {
console.error('清空历史记录失败:', error)
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAllHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene... | async clearAllHistory(): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
prefs.putSync(WatchHistoryManager.HISTORY_KEY, '[]')
await prefs.flush()
console.log('观看历史已清空')
} catch (error) {
console.error('清空历史记录失败:', error)
}
} | https://github.com/SMAT-Lab/PhantomRendering | bc5be90dd922a3741a45c00bce0abf38c04d121f | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.