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 |
|---|---|---|---|---|---|---|---|---|---|---|
tdcare/tdwebrtc | example/MediaStreamAdvancedExample.ets | arkts | stop | ============================================================
生命周期
============================================================
停止媒体流 | public async stop(): Promise<void> {
if (!this.mediaStream) {
return;
}
await this.mediaStream.stopAll();
console.log('[MediaStreamExample] 媒体流已停止');
} | 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 stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | public async stop(): Promise<void> {
if (!this.mediaStream) {
return;
}
await this.mediaStream.stopAll();
console.log('[MediaStreamExample] 媒体流已停止');
} | https://github.com/tdcare/tdwebrtc | 8977e6c7bafe9c90dfc1243930003bfbdd295101 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current BigInt64Array using range [begin, end)
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sliceFromTo}
@param { int } [begin] - start index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { BigInt64Array ... | public slice(begin?: int, end?: int): BigInt64Array {
return this.sliceFromTo(begin ?? 0, end ?? 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 slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): BigInt64Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | d1043e369afe5ae4d2a8529ec916c742e7a68345 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | getCurrentStrategy | 获取当前策略 | public getCurrentStrategy(): PreloadStrategy {
const strategy: PreloadStrategy = {
forwardRange: this.currentStrategy.forwardRange,
backwardRange: this.currentStrategy.backwardRange,
priority: this.currentStrategy.priority,
reason: this.currentStrategy.reason
};
return strategy;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentStrategy 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 Pre... | public getCurrentStrategy(): PreloadStrategy {
const strategy: PreloadStrategy = {
forwardRange: this.currentStrategy.forwardRange,
backwardRange: this.currentStrategy.backwardRange,
priority: this.currentStrategy.priority,
reason: this.currentStrategy.reason
};
return strategy;
... | https://github.com/DaLongZhuaZi/manxia | 553a460768a3d9634ca0aa9a6a55695ca0f55dcd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets | arkts | executeJs | 执行JavaScript | private async executeJs(js: string): Promise<WebViewResult> {
try {
const result = await this.runJavaScript(js);
return {
success: true,
body: result,
url: ''
};
} catch (error) {
return {
success: false,
body: '',
url: '',
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 executeJs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left js AST#identifier#Right AST#:#Left : AST#:#... | private async executeJs(js: string): Promise<WebViewResult> {
try {
const result = await this.runJavaScript(js);
return {
success: true,
body: result,
url: ''
};
} catch (error) {
return {
success: false,
body: '',
url: '',
error:... | https://github.com/DaLongZhuaZi/manxia | 119b29596bf62c8c597236b6bf055fd5f4953d6f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/ContextBuilder.ets | arkts | getFinancialSummary | 获取用户当月的财务状况摘要
@param userId 用户ID
@returns 带有上下文的格式化字符串 | static async getFinancialSummary(userId: number): Promise<string> {
const now = new Date();
const currentMonthStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
// 1. 获取账单统计
let billContext = "暂无本月收支数据。";
try {
const stats: MonthlyStats[] = await BillDAO.getMon... | 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 getFinancialSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Le... | static async getFinancialSummary(userId: number): Promise<string> {
const now = new Date();
const currentMonthStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
// 1. 获取账单统计
let billContext = "暂无本月收支数据。";
try {
const stats: MonthlyStats[] = await BillDAO.getMon... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9a1721bc35ecf484d0f16f3776ac4699f5f23fd7 | github |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | generateBucket | 根据账户数据生成一个关系存储的值桶
此函数用于将账户数据(AccountData类型)转换为关系存储中使用的值桶(relationalStore.ValuesBucket类型)
它主要通过将账户数据中的关键字段复制到值桶对象中,从而实现数据格式的转换
@param account AccountData类型的数据,表示账户信息,包括账户类型、类型文本和金额
@returns 返回一个relationalStore.ValuesBucket类型的对象,该对象包含了从账户数据中复制过来的关键信息 | function generateBucket(account: AccountData): relationalStore.ValuesBucket {
// 初始化一个空的值桶对象
let obj: relationalStore.ValuesBucket = {};
// 将账户的账户类型复制到值桶对象
obj.accountType = account.accountType;
// 将账户的类型文本复制到值桶对象
obj.typeText = account.typeText;
// 将账户的金额复制到值桶对象
obj.amount = account.amount;
obj.t... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateBucket AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left account AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function generateBucket(account: AccountData): relationalStore.ValuesBucket {
// 初始化一个空的值桶对象
let obj: relationalStore.ValuesBucket = {};
// 将账户的账户类型复制到值桶对象
obj.accountType = account.accountType;
// 将账户的类型文本复制到值桶对象
obj.typeText = account.typeText;
// 将账户的金额复制到值桶对象
obj.amount = account.amount;
obj.t... | https://github.com/yang-kun-long/HarmonyAccounting | fa8b198840a1bb199b735aad979be1acf77a82f3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getSFWComics | [新增] 获取SFW(非NSFW)漫画列表(本地漫画)
@returns Promise<ComicInfo[]> SFW漫画列表 | public async getSFWComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'(isNSFW = ? OR isNSFW IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条SFW本地漫画`);
r... | 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 getSFWComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async getSFWComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'(isNSFW = ? OR isNSFW IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条SFW本地漫画`);
r... | https://github.com/DaLongZhuaZi/manxia | 8bb499788ffee72ade38be7f5d4d4fb2d44e95bf | github |
cpdd5201314/harmonyOS-music-app | common/mediaCommon/src/main/ets/utils/request.ets | arkts | getPosts | 获取帖子列表 | static async getPosts(): Promise<Post[]> {
return request<Post[]>('/posts');
} | 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 getPosts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | static async getPosts(): Promise<Post[]> {
return request<Post[]>('/posts');
} | https://github.com/cpdd5201314/harmonyOS-music-app | a7bbe0ec1c2777865d03ef24b3251251cc6ccd05 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | loadRelatedArray | 延迟加载关联数组
@param propertyName 关联属性名 | async loadRelatedArray(propertyName: string): Promise<Array<EntityData>> {
const value = await this.loadRelated(propertyName)
if (value && value.isArray) {
return value.entityArray
}
return []
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadRelatedArray AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left propertyName AST#identifier#Right AST#type_annotation#Left AST... | async loadRelatedArray(propertyName: string): Promise<Array<EntityData>> {
const value = await this.loadRelated(propertyName)
if (value && value.isArray) {
return value.entityArray
}
return []
} | https://github.com/offlinecat-dev/OCNetORM | 2bf91f6e3a1a367007c2ecb27c0b821b7a88c3e5 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | setContentEventRecorder | -- Dependency injection from CountlyInstance -- | public setContentEventRecorder(fn: (key: string, seg: SegmentationMap) => Promise<void>): void {
this.contentEventRecorder = fn;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setContentEventRecorder 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... | public setContentEventRecorder(fn: (key: string, seg: SegmentationMap) => Promise<void>): void {
this.contentEventRecorder = fn;
} | https://github.com/Countly/countly-sdk-hos | be89d3e31da6c8788f61c90612b90c9dc5e6e0a8 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | closeLocalMicrophone | 关闭本地麦克风 | closeLocalMicrophone(): void {
this.microphoneStatus = DeviceStatus.off;
console.info('[DeviceStore] 关闭麦克风');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeLocalMicrophone 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#stateme... | closeLocalMicrophone(): void {
this.microphoneStatus = DeviceStatus.off;
console.info('[DeviceStore] 关闭麦克风');
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 6fd8d7674d6e5ac6e10f2563e1e79e2aa645a793 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test18_original_index.ets | arkts | fibIterative | --- Iterative fibonacci --- | function fibIterative(n: number): number {
if (n <= 1) {
return n;
}
let prev: number = 0;
let curr: number = 1;
let i: number = 2;
while (i <= n) {
let next: number = prev + curr;
prev = curr;
curr = next;
i = i + 1;
}
return curr;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fibIterative AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function fibIterative(n: number): number {
if (n <= 1) {
return n;
}
let prev: number = 0;
let curr: number = 1;
let i: number = 2;
while (i <= n) {
let next: number = prev + curr;
prev = curr;
curr = next;
i = i + 1;
}
return curr;
} | https://github.com/miaochiahao/ark-ghidra | 6d45639bf9ee4b91a3269a869c35e0fb7cfc851f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | classifyAge | --- Nested if-else with multiple returns --- | function classifyAge(age: number): string {
if (age < 13) {
return 'child';
}
if (age < 20) {
return 'teen';
}
if (age < 65) {
return 'adult';
}
return 'senior';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left classifyAge AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left age AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function classifyAge(age: number): string {
if (age < 13) {
return 'child';
}
if (age < 20) {
return 'teen';
}
if (age < 65) {
return 'adult';
}
return 'senior';
} | https://github.com/miaochiahao/ark-ghidra | 97795daad5e98e15d64094c6d8c0bd7da5a585db | github |
terryma2024/happyword | harmonyos/entry/src/test/LocalUnit.test.ets | arkts | engineWithFruit | Build a BattleEngine over the fruit repo with deterministic RNG so the
BattleEngine tests can reason about a reproducible question sequence.
Declared at module scope because ArkTS strict mode does not permit
nested function declarations inside `describe`/`it` callbacks. | function engineWithFruit(seed: number, config?: BattleConfig): BattleEngine {
const repo: WordRepository = buildFruitRepo();
const gen: QuestionGenerator = new QuestionGenerator(repo, mulberry32(seed));
const engine: BattleEngine = new BattleEngine(gen, config);
engine.start();
return engine;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left engineWithFruit AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left seed AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function engineWithFruit(seed: number, config?: BattleConfig): BattleEngine {
const repo: WordRepository = buildFruitRepo();
const gen: QuestionGenerator = new QuestionGenerator(repo, mulberry32(seed));
const engine: BattleEngine = new BattleEngine(gen, config);
engine.start();
return engine;
} | https://github.com/terryma2024/happyword | 0d5f7dc31412efbd399cfd2bc758d02d1007073b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | loadSFWModeSetting | 加载SFW模式设置 | private async loadSFWModeSetting(): Promise<void> {
try {
const enabled = await this.settingsManager.getBoolean(SettingKeys.SFW_MODE_ENABLED, false);
this.sfwModeEnabled = enabled;
// 加载NSFW作用域开关
this.nsfwScopeImageSourceEnabled = this.settingsManager.getBoolean(SettingKeys.NSFW_SCO... | 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 loadSFWModeSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async loadSFWModeSetting(): Promise<void> {
try {
const enabled = await this.settingsManager.getBoolean(SettingKeys.SFW_MODE_ENABLED, false);
this.sfwModeEnabled = enabled;
// 加载NSFW作用域开关
this.nsfwScopeImageSourceEnabled = this.settingsManager.getBoolean(SettingKeys.NSFW_SCO... | https://github.com/DaLongZhuaZi/manxia | f67d3d55ae798ad5a4ec955e53ab5bb49aba9e34 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | highlightValueForObject | Highlights the value selected by touch gesture. Unlike
highlightValues(...), this generates a callback to the
OnChartValueSelectedListener.
@param high - the highlight object
@param callListener - call the listener | public highlightValueForObject(high: Highlight | null, callListener?: boolean) {
if (callListener == null || callListener == undefined) {
callListener = false;
}
let e: EntryOhos | null = null;
if (high == null) {
this.mIndicesToHighlight = null;
} else {
if (this.mLogEnabled)... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left highlightValueForObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left high AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_e... | public highlightValueForObject(high: Highlight | null, callListener?: boolean) {
if (callListener == null || callListener == undefined) {
callListener = false;
}
let e: EntryOhos | null = null;
if (high == null) {
this.mIndicesToHighlight = null;
} else {
if (this.mLogEnabled)... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 66cf3877097c20fc52c155cf59ed073f174f27e2 | gitee |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/XiaoyiSkillManager.ets | arkts | getRegisteredSkills | 获取所有已注册的技能信息 | getRegisteredSkills(): Array<{id: string; name: string; priority: number; estimatedTime: string}> {
return Array.from(this.skills.values()).map(skill => ({
id: skill.id,
name: skill.name,
priority: skill.priority,
estimatedTime: skill.estimatedTime
}));
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getRegisteredSkills 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#:#Righ... | getRegisteredSkills(): Array<{id: string; name: string; priority: number; estimatedTime: string}> {
return Array.from(this.skills.values()).map(skill => ({
id: skill.id,
name: skill.name,
priority: skill.priority,
estimatedTime: skill.estimatedTime
}));
} | https://github.com/LJ666-ui/harmony-health-care | 2eebebeb5b8cb6ad84474f23e128485b4c67490f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setClipDataToContent | When disabled, the data and/or highlights will not be clipped to contentRect. Disabling this option can
be useful, when the data lies fully within the content rect, but is drawn in such a way (such as thick lines)
that there is unwanted clipping.
@param enabled | public setClipDataToContent(enabled: boolean): void {
this.mClipDataToContent = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setClipDataToContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public setClipDataToContent(enabled: boolean): void {
this.mClipDataToContent = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fa62c34723b8d17e5177fa34df1d5214010aa076 | gitee |
RoooyHe/toona-ohos | toona/src/main/ets/utils/AppLogger.ets | arkts | info | INFO 级别日志
支持 console.log 风格的多参数拼接 | info(msg: string, ...args: object[]): void {
this.logger.info(this.buildMsg(msg, args));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left info AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right... | info(msg: string, ...args: object[]): void {
this.logger.info(this.buildMsg(msg, args));
} | https://github.com/RoooyHe/toona-ohos | 9722c0cfb64ca08e52bf0fefd4055b848603d5db | github |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | SetDataCallBack | 设置有序公共事件的结果数据回调 | function SetDataCallBack() {
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left SetDataCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AS... | function SetDataCallBack() {
} | https://gitee.com/openharmony/codelabs.git | 498c71b983bf41e10bc2f400b0e1f6939b987459 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isGreaterEqualThan | Checks if this instance value is greater than or equal to value of provided instance
@param { Double } other Right hand side of the comparison
@returns { boolean } true if this value is greater than or equal to provided, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isGreaterEqualThan(other: Double): boolean {
return this.value >= other.toDouble();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterEqualThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public isGreaterEqualThan(other: Double): boolean {
return this.value >= other.toDouble();
} | https://gitcode.com/iop123123/arkts-static-skills | cff38d34eaa393526972a4dfea92b1981d1ba83f | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | base64ToStr | Base64字符串转字符串
@param base64Str Base64字符串
@returns | static base64ToStr(base64Str: string): string {
const uint8Array = Base64Util.decodeSync(base64Str);
const result = StrUtil.unit8ArrayToStr(uint8Array);
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left base64ToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left base64Str AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | static base64ToStr(base64Str: string): string {
const uint8Array = Base64Util.decodeSync(base64Str);
const result = StrUtil.unit8ArrayToStr(uint8Array);
return result;
} | https://github.com/tdcare/tdwebrtc | 07569b065f67db507e4bac77d88e8ef2a40bd7c1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyManager.ets | arkts | handleDPadDirectionChange | 处理十字键盘 (D-Pad) 方向变化
由 VirtualDPad 组件直接调用。
direction 为方向位掩码组合(GamepadButton.UP/DOWN/LEFT/RIGHT),0 = 松开/无方向。 | handleDPadDirectionChange(direction: number): void {
// 清除旧的 D-Pad 位,设置新方向
const dpadMask: number = GamepadButton.DPAD_MASK;
this.gamepadInputMap = (this.gamepadInputMap & (~dpadMask)) | (direction & dpadMask);
this.sendGamepadState();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleDPadDirectionChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left direction AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)... | handleDPadDirectionChange(direction: number): void {
// 清除旧的 D-Pad 位,设置新方向
const dpadMask: number = GamepadButton.DPAD_MASK;
this.gamepadInputMap = (this.gamepadInputMap & (~dpadMask)) | (direction & dpadMask);
this.sendGamepadState();
} | https://github.com/AlkaidLab/moonlight-harmony | fee1708ffaa4a93a1d4fd405877dc7940e77fa46 | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/settingsController.ets | arkts | jumpToMessageTonePage | Go to the Message Ring page. Choose Settings > Sound and Vibration > Message Ring. | jumpToMessageTonePage() {
HiLog.i(TAG, 'jumpToMessageTonePage')
}; | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToMessageTonePage 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_bl... | jumpToMessageTonePage() {
HiLog.i(TAG, 'jumpToMessageTonePage')
}; | https://gitee.com/openharmony/applications_mms.git | 9ae9ddca208213e5730cd5576f6cb919cfabfa10 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | requestVerifyPin | Request PIN verification.
Adapted from https://developer.huawei.com/consumer/cn/doc/harmonyos-references/arkts-basic-components-web-events#onverifypin22
@param event The VerifyPinEvent. | requestVerifyPin(event: VerifyPinEvent) {
// 收到PIN码认证请求事件
meow(`onVerifyPin`, 'requestVerifyPin');
// 调用证书管理,打开PIN码输入框
certificateManagerDialog.openUkeyAuthDialog(UIContext.getCallingScopeUIContext()?.getHostContext(), { keyUri: event.identity })
.then(() => {
// 通知webPIN码认证成功
me... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestVerifyPin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VerifyPinEvent AST#iden... | requestVerifyPin(event: VerifyPinEvent) {
// 收到PIN码认证请求事件
meow(`onVerifyPin`, 'requestVerifyPin');
// 调用证书管理,打开PIN码输入框
certificateManagerDialog.openUkeyAuthDialog(UIContext.getCallingScopeUIContext()?.getHostContext(), { keyUri: event.identity })
.then(() => {
// 通知webPIN码认证成功
me... | https://github.com/awaLiny2333/LinysBrowser_NEXT | f0cce5d5e711dc4ed641e08226293dfd1302e263 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/PermissionManager.ets | arkts | openPermissionSettingsPage | 打开系统设置的权限管理页(处理授权结果) | openPermissionSettingsPage() {
// 1. 获取应用上下文,并通过 as 断言收窄类型为 UIAbilityContext,否则 context 默认类型无法调用 startAbility 方法
const context = new UIContext().getHostContext() as Context
const uiAbilityContext = context as common.UIAbilityContext
// 2. 获取 bundle 包信息
const bundleInfo = bundleManager.getBundleInf... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openPermissionSettingsPage 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#stateme... | openPermissionSettingsPage() {
// 1. 获取应用上下文,并通过 as 断言收窄类型为 UIAbilityContext,否则 context 默认类型无法调用 startAbility 方法
const context = new UIContext().getHostContext() as Context
const uiAbilityContext = context as common.UIAbilityContext
// 2. 获取 bundle 包信息
const bundleInfo = bundleManager.getBundleInf... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 42a541fd4dc752f970fb3a6da733f49b096dd924 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets | arkts | clickMmsCheckbox | Click Checkbox in the MMS line. | clickMmsCheckbox(e) {
this.checkedValueOfMms = e.checked;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickMmsCheckbox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expre... | clickMmsCheckbox(e) {
this.checkedValueOfMms = e.checked;
} | https://gitee.com/openharmony/applications_mms.git | b5a7409b93f5b438778a163eef0d1fcbededcd58 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/ImageProcessing/JinmantiantangDescrambler.ets | arkts | md5LastCharCode | 计算MD5哈希的最后一个字符的字符码 | private async md5LastCharCode(input: string): Promise<number> {
try {
const md = cryptoFramework.createMd('MD5');
const inputData: cryptoFramework.DataBlob = { data: this.stringToUint8Array(input) };
await md.update(inputData);
const result = await md.digest();
// 获取最后一个字节
con... | 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 md5LastCharCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left... | private async md5LastCharCode(input: string): Promise<number> {
try {
const md = cryptoFramework.createMd('MD5');
const inputData: cryptoFramework.DataBlob = { data: this.stringToUint8Array(input) };
await md.update(inputData);
const result = await md.digest();
// 获取最后一个字节
con... | https://github.com/DaLongZhuaZi/manxia | cc1ca50ff3cea87b53dc7701cfcd403936fc989b | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | setDrawCustomLabels | 设置是否使用自定义Labels
@param flag 是否使用自定义Labels | public setDrawCustomLabels(flag: boolean): void {
this.mUseCustomLabels = flag;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawCustomLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left flag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setDrawCustomLabels(flag: boolean): void {
this.mUseCustomLabels = flag;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5338caa055b22996d3b20b67a0e7d481312b1ff2 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/dateTimePicker/index.ets | arkts | getYearsList | 获取年份列表 | getYearsList(): IBestPickerOption[] {
let yearsList: IBestPickerOption[] = []
for(let i = this.minDate.getFullYear(); i <= this.maxDate.getFullYear(); i++){
yearsList.push({
value: i + "",
text: i + (this.showUnit ? getResourceStr($r("app.string.ibest_year")) : "")
})
}
return yearsList
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getYearsList 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 IBestPickerOption AST#identifier#Right AST#[#Left... | getYearsList(): IBestPickerOption[] {
let yearsList: IBestPickerOption[] = []
for(let i = this.minDate.getFullYear(); i <= this.maxDate.getFullYear(); i++){
yearsList.push({
value: i + "",
text: i + (this.showUnit ? getResourceStr($r("app.string.ibest_year")) : "")
})
}
return yearsList
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L206-L215 | 68a488294b8b87b91b8e9c76d03943dd6d04cfbc | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | find | Finds the first element in the Int16Array that satisfies the condition
@param fn condition
@returns the first element that satisfies fn | public find(fn: (val: short) => boolean): short {
let newF: (val: short, index: int, array: Int16Array) => boolean =
(val: short, index: int, array: Int16Array): boolean => { return fn(val) }
return this.find(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find 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#Righ... | public find(fn: (val: short) => boolean): short {
let newF: (val: short, index: int, array: Int16Array) => boolean =
(val: short, index: int, array: Int16Array): boolean => { return fn(val) }
return this.find(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9c14a4a7ce3c72166b4681fdd2fa48206cfb1c3e | gitee |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t15_formatConstants | T15: Format constants | t15_formatConstants(): void {
const passed: boolean =
RFC1738 === 'RFC1738' &&
RFC3986 === 'RFC3986' &&
DEFAULT_FORMAT === 'RFC3986' &&
typeof formatters['RFC1738'] === 'function' &&
typeof formatters['RFC3986'] === 'function';
const actual: string = 'RFC1738=' + RFC1738 + ' RFC3... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t15_formatConstants 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#statemen... | t15_formatConstants(): void {
const passed: boolean =
RFC1738 === 'RFC1738' &&
RFC3986 === 'RFC3986' &&
DEFAULT_FORMAT === 'RFC3986' &&
typeof formatters['RFC1738'] === 'function' &&
typeof formatters['RFC3986'] === 'function';
const actual: string = 'RFC1738=' + RFC1738 + ' RFC3... | https://github.com/wgli-collab/qs-arkts | d86c6fe1cbf9edcf22dec75f247306aef24d0bcf | github |
gongshijier/harmonyLab | entry/src/main/ets/feed/load/net/NetLoader.ets | arkts | parse | parse | parse() {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parse 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#}#Left } AST#}#Right AST#statem... | parse() {
} | https://github.com/gongshijier/harmonyLab | 30ee0fd5dd92cbe5a93fce647c7ac21f7c551b78 | github |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/entities/SystemOptions.ets | arkts | updateFromData | 从另一个 SystemOptions 对象更新当前实例的所有属性
这种逐一赋值的方式确保触发 @Trace 装饰器的监听器,从而触发持久化存储
@param data 源 SystemOptions 对象 | updateFromData(data: SystemOptions): void {
this.firstStart = data.firstStart
this.themeIndex = data.themeIndex
this.fontThickness = data.fontThickness
this.iconThickness = data.iconThickness
this.notificationEnabled = data.notificationEnabled
this.billReminderEnabled = data.billReminderEnable... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateFromData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SystemOptions AST#identifier#Right AST#)#... | updateFromData(data: SystemOptions): void {
this.firstStart = data.firstStart
this.themeIndex = data.themeIndex
this.fontThickness = data.fontThickness
this.iconThickness = data.iconThickness
this.notificationEnabled = data.notificationEnabled
this.billReminderEnabled = data.billReminderEnable... | https://github.com/ZestBox-18/kitebook-frontend | 12903cdfc41d7256fb9666365dbd9a7717d71afb | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | getInstance | Global singleton stored on AppRuntime.mediaServiceRef. | public static getInstance(): MediaService {
const rt = getAppRuntime();
if (!rt.mediaServiceRef) {
rt.mediaServiceRef = new MediaService();
}
return rt.mediaServiceRef as MediaService;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): MediaService {
const rt = getAppRuntime();
if (!rt.mediaServiceRef) {
rt.mediaServiceRef = new MediaService();
}
return rt.mediaServiceRef as MediaService;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 9855b21ae360839d1ce7125a9ab44815fb1c8a6b | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PermissionManager.ets | arkts | getInstance | 获取权限管理器单例实例 | public static getInstance(): PermissionManager {
if (!PermissionManager.instance) {
PermissionManager.instance = new PermissionManager();
}
return PermissionManager.instance;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): PermissionManager {
if (!PermissionManager.instance) {
PermissionManager.instance = new PermissionManager();
}
return PermissionManager.instance;
} | https://github.com/LJ666-ui/harmony-health-care | 263117284073869c83b2656bb0269e022a5df457 | github |
silence17/harmonydemo | common_lib/src/main/ets/utils/axios/HttpClient.ets | arkts | get | GET请求 一个参数 url 或者 对象参数
@param {Object} param | get(getParam: RequestParam<T>) {
this._processParam(getParam);
return this._doGet(getParam);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left getParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left... | get(getParam: RequestParam<T>) {
this._processParam(getParam);
return this._doGet(getParam);
} | https://github.com/silence17/harmonydemo | 80164e4b5af775ae6aa7e34a5ad5e08169dd2e21 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/RDPDisplay.ets | arkts | connect | 连接到RDP服务器 | async connect(config: RDPConnectionConfig): Promise<void> {
try {
this.config = config
this.state = RDPConnectionState.CONNECTING
console.log(`尝试连接到RDP服务器 ${config.host}:${config.port}`)
// 模拟 RDP 连接(实际连接需要在 Native 层实现)
await new Promise<void>(resolve => setTimeout(reso... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left connect AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async connect(config: RDPConnectionConfig): Promise<void> {
try {
this.config = config
this.state = RDPConnectionState.CONNECTING
console.log(`尝试连接到RDP服务器 ${config.host}:${config.port}`)
// 模拟 RDP 连接(实际连接需要在 Native 层实现)
await new Promise<void>(resolve => setTimeout(reso... | https://github.com/AetheriumSimulator/qemu-hmos | 6db74ac6482b32e30f26000b8aa82e5318608b9f | github |
751496032/DSBridge-HarmonyOS | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | setGlobalErrorMessageListener | 设置全局错误监听
@param listener | setGlobalErrorMessageListener(listener: OnErrorMessageListener): void {
this.bridge.setGlobalErrorMessageListener(listener)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setGlobalErrorMessageListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OnErrorMessageListener... | setGlobalErrorMessageListener(listener: OnErrorMessageListener): void {
this.bridge.setGlobalErrorMessageListener(listener)
} | https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L26-L28 | cdc370e102c424fec396687179a37410c5696ede | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/GenericHidController.ets | arkts | constructor | 用于去重日志 | constructor(
device: usbManager.USBDevice,
pipe: usbManager.USBDevicePipe,
deviceId: number,
listener: UsbDriverListener
) {
super(deviceId, listener, device.vendorId, device.productId);
this.device = device;
this.pipe = pipe;
this.type = ControllerType.XBOX; // 模拟 Xbox 布局
this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left ... | constructor(
device: usbManager.USBDevice,
pipe: usbManager.USBDevicePipe,
deviceId: number,
listener: UsbDriverListener
) {
super(deviceId, listener, device.vendorId, device.productId);
this.device = device;
this.pipe = pipe;
this.type = ControllerType.XBOX; // 模拟 Xbox 布局
this.... | https://github.com/AlkaidLab/moonlight-harmony | 0fdc71390324597a9759b6e304993598f68284f0 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/KeyboardMapper.ets | arkts | isMetaPressed | Check if Meta/Windows is pressed | isMetaPressed(): boolean {
return this.metaPressed;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMetaPressed 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#state... | isMetaPressed(): boolean {
return this.metaPressed;
} | https://github.com/tangwengang-del/freerdp-harmonyos | de76ee9eba2c2071e51e9296d0f89d340d88a104 | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | groupRecordsByDifficulty | 按难度分组记录
@param records 答题记录列表
@returns 按难度分组的记录 | static groupRecordsByDifficulty(records: AnswerRecord[]): Map<Difficulty, AnswerRecord[]> {
const grouped = new Map<Difficulty, AnswerRecord[]>();
for (const record of records) {
const difficulty = record.difficulty;
if (!grouped.has(difficulty)) {
grouped.set(difficulty, []);
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left groupRecordsByDifficulty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | static groupRecordsByDifficulty(records: AnswerRecord[]): Map<Difficulty, AnswerRecord[]> {
const grouped = new Map<Difficulty, AnswerRecord[]>();
for (const record of records) {
const difficulty = record.difficulty;
if (!grouped.has(difficulty)) {
grouped.set(difficulty, []);
}
... | https://github.com/the-wwyang/kids-learning-app | de8d5a30d0eacd01a5e579068a9ead59a2e65523 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | getCategories | ============ 分类管理 ============
获取分类列表
@param parentId 父分类ID,undefined 表示根分类 | async getCategories(parentId?: string): Promise<ApiResponse<KnowledgeCategory[]>> {
return this.client.get<KnowledgeCategory[]>('/api/v1/knowledge/categories', parentId ? { parentId } : undefined)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCategories AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left parentId AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a... | async getCategories(parentId?: string): Promise<ApiResponse<KnowledgeCategory[]>> {
return this.client.get<KnowledgeCategory[]>('/api/v1/knowledge/categories', parentId ? { parentId } : undefined)
} | https://github.com/David8Idira/AI-OA | c11f2c721e64609ce9cf0ab954a0b99f25bcffa8 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/OrmContext.ets | arkts | isConfigured | 检查是否已配置
@returns 是否已配置 | isConfigured(): boolean {
return this.configured
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isConfigured 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#statem... | isConfigured(): boolean {
return this.configured
} | https://github.com/offlinecat-dev/OCNetORM | 610a3fd092089b7cb15f43d18852763fbcf0c4a4 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/FavoriteViewModel.ets | arkts | hasMore | 动态判断当前列表是否还有更多数据 | get hasMore(): boolean {
if (appSettings.novel_mode) {
if (this.mainTabIndex === 0) {
if (this.filterIndex === 0) return !!(this.nextTrendNovelUrlPublic || this.nextTrendNovelUrlPrivate);
if (this.filterIndex === 1) return !!this.nextTrendNovelUrlPublic;
if (this.filterIndex === 2) r... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left hasMore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ... | get hasMore(): boolean {
if (appSettings.novel_mode) {
if (this.mainTabIndex === 0) {
if (this.filterIndex === 0) return !!(this.nextTrendNovelUrlPublic || this.nextTrendNovelUrlPrivate);
if (this.filterIndex === 1) return !!this.nextTrendNovelUrlPublic;
if (this.filterIndex === 2) r... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L113-L136 | 8be9ceeb91b61dfe3ffa9e369e8b6085964f40c5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/NetworkBoostService.ets | arkts | subscribeQos | ───── netQosChange ───── | private subscribeQos(): void {
if (!this.supported || this.qosCallback) {
return;
}
const cb = (list: Array<netQuality.NetworkQos>): void => {
if (!list || list.length === 0) {
return;
}
// 优先取主路径(WIFI_PRIMARY=2 / CELLULAR_PRIMARY=0);否则取第一条
let primary: netQuality.Net... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left subscribeQos 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#voi... | private subscribeQos(): void {
if (!this.supported || this.qosCallback) {
return;
}
const cb = (list: Array<netQuality.NetworkQos>): void => {
if (!list || list.length === 0) {
return;
}
// 优先取主路径(WIFI_PRIMARY=2 / CELLULAR_PRIMARY=0);否则取第一条
let primary: netQuality.Net... | https://github.com/AlkaidLab/moonlight-harmony | 48213c1479d2bfde649f6568d90b5fcc25c5ba3b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | trimRight | Trims all specified characters from the end of this String.
@param remove that contains the characters to trim
@throws NullPointerException if remove param is null
@returns new right trimmed string | public trimRight(remove: char[]): String {
let lastNotSpecCharIdx: int = 0;
for (let i: int = this.length() - 1; i >= 0; i--) {
if (!String.isCharOneOf(this.charAt(i), remove)) {
lastNotSpecCharIdx = i;
break;
}
}
return new Str... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remove AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier#... | public trimRight(remove: char[]): String {
let lastNotSpecCharIdx: int = 0;
for (let i: int = this.length() - 1; i >= 0; i--) {
if (!String.isCharOneOf(this.charAt(i), remove)) {
lastNotSpecCharIdx = i;
break;
}
}
return new Str... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d8c0323881fa49dd9503bdc19d94c0c793fdae28 | gitee |
ZestBox-18/kitebook-frontend | features/reports/src/main/ets/utils/ReportDataHelper.ets | arkts | loadIncomeExpenseReport | 加载收支趋势报表数据,按所选时间维度聚合为连续时间桶。 | static async loadIncomeExpenseReport(timeDimension: TimeDimensionEnum): Promise<IncomeExpenseBean[]> {
const buckets: TimeBucket[] = ReportDataHelper.buildTrendBuckets(timeDimension);
if (buckets.length === 0) {
return [];
}
const lastBucket: TimeBucket = buckets[buckets.length - 1];
const b... | 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 loadIncomeExpenseReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeDimension AST#identifier#Rig... | static async loadIncomeExpenseReport(timeDimension: TimeDimensionEnum): Promise<IncomeExpenseBean[]> {
const buckets: TimeBucket[] = ReportDataHelper.buildTrendBuckets(timeDimension);
if (buckets.length === 0) {
return [];
}
const lastBucket: TimeBucket = buckets[buckets.length - 1];
const b... | https://github.com/ZestBox-18/kitebook-frontend | 8d431988e8fc2ee8dbdaa3059936193d056a5423 | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/Video/components/CommentKeyboard.ets | arkts | removeKeyboardHeightListener | 监听移除键盘
@param win | removeKeyboardHeightListener(win: window.Window) {
win.off('keyboardHeightChange')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeKeyboardHeightListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#id... | removeKeyboardHeightListener(win: window.Window) {
win.off('keyboardHeightChange')
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 21b3f8c64f0bf95742298ff28f1bed36d15b727f | gitcode |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | gte | 大于等于
@param field 字段
@param value 值
@returns Wrapper | gte(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} >= ?`)
this.valueList.push(value)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left gte AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ... | gte(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper {
if (condition) {
this.whereList.push(`and ${field} >= ?`)
this.valueList.push(value)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L140-L146 | 1074ed313c2625fcea809e0034302b06d0812356 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CryptoUtils.ets | arkts | stringToUint8Array | 将字符串转换为Uint8Array | function stringToUint8Array(str: string): Uint8Array {
const encoder = new util.TextEncoder();
return encoder.encodeInto(str);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stringToUint8Array AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left str AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function stringToUint8Array(str: string): Uint8Array {
const encoder = new util.TextEncoder();
return encoder.encodeInto(str);
} | https://github.com/DaLongZhuaZi/manxia | d996f08b19ee34d7eff08de193d2d7dd69f09d67 | github |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | importFromJSON | 从JSON字符串导入数据 | importFromJSON(
json: string,
currentVersion: VersionControl
): ImportResult {
const result = new SyncResult();
try {
const importData = ExportData.fromJSON(json);
// 验證數據格式
if (importData.version === '1.0') {
return this.processImportV1(importData, currentVersion, result... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importFromJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ... | importFromJSON(
json: string,
currentVersion: VersionControl
): ImportResult {
const result = new SyncResult();
try {
const importData = ExportData.fromJSON(json);
// 验證數據格式
if (importData.version === '1.0') {
return this.processImportV1(importData, currentVersion, result... | https://github.com/CLMC2025/Vignette | 1db5bbc1cfd865abd043bde08cd0df7df63df321 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/EventBus.ets | arkts | post | Post an event
@param eventName Event name
@param data Event data | post(eventName: string, data: Record<string, Object>): void {
const eventId = EventBus.getEventId(eventName);
console.log(`[EventBus] 📤 Posting event "${eventName}" (ID: ${eventId}):`, JSON.stringify(data));
emitter.emit({
eventId: eventId,
priority: emitter.EventPriority.LOW
}, {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left post AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Right A... | post(eventName: string, data: Record<string, Object>): void {
const eventId = EventBus.getEventId(eventName);
console.log(`[EventBus] 📤 Posting event "${eventName}" (ID: ${eventId}):`, JSON.stringify(data));
emitter.emit({
eventId: eventId,
priority: emitter.EventPriority.LOW
}, {
... | https://github.com/Tencent-RTC/TUIKit_Harmony | a2ac3eaf4043df36bd145cf578b84ec43834c706 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getNovelReadingStyle | 获取小说阅读文字样式参数 | public static getNovelReadingStyle(): TextStyleParams {
return {
fontFamily: FontAwareHelper.globalState.novelFontFamily,
fontSize: FontAwareHelper.globalState.novelFontSize,
lineHeight: FontAwareHelper.globalState.novelLineHeight
};
} | 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 getNovelReadingStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public static getNovelReadingStyle(): TextStyleParams {
return {
fontFamily: FontAwareHelper.globalState.novelFontFamily,
fontSize: FontAwareHelper.globalState.novelFontSize,
lineHeight: FontAwareHelper.globalState.novelLineHeight
};
} | https://github.com/DaLongZhuaZi/manxia | d5271188400410a26b6fc68b5a14843e38a8822d | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/FaceRecPage.ets | arkts | getPositionText | 获取位置提示文本 | getPositionText(): string {
switch (this.facePosition) {
case FacePosition.TOO_CLOSE:
return '请稍微远离摄像头';
case FacePosition.TOO_FAR:
return '请靠近一些';
case FacePosition.TOO_LEFT:
return '请向右移动一点';
case FacePosition.TOO_RIGHT:
return '请向左移动一点';
case FacePo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPositionText 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#statem... | getPositionText(): string {
switch (this.facePosition) {
case FacePosition.TOO_CLOSE:
return '请稍微远离摄像头';
case FacePosition.TOO_FAR:
return '请靠近一些';
case FacePosition.TOO_LEFT:
return '请向右移动一点';
case FacePosition.TOO_RIGHT:
return '请向左移动一点';
case FacePo... | https://gitcode.com/openharmony/codelabs | 2806b4f22648e10659f1a73def88e3882ab9cf8a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | matchesCustomShelfFilter | 检查内容是否匹配自定义书架筛选条件 | private matchesCustomShelfFilter(item: Manga | EBook | NovelBook, type: string): boolean {
// 标签筛选
if (this.customShelfSelectedTags.size > 0) {
let itemTags: string[] = [];
if (type === 'manga' || type === 'pdfebook') {
const manga = item as Manga;
itemTags = [...manga.metadata.gen... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchesCustomShelfFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bina... | private matchesCustomShelfFilter(item: Manga | EBook | NovelBook, type: string): boolean {
// 标签筛选
if (this.customShelfSelectedTags.size > 0) {
let itemTags: string[] = [];
if (type === 'manga' || type === 'pdfebook') {
const manga = item as Manga;
itemTags = [...manga.metadata.gen... | https://github.com/DaLongZhuaZi/manxia | 19ac62ae484424c455af339df305e9de38354c10 | github |
openharmony-sig/knowledge_demo_entainment | FA/notebook/entry/src/main/ets/common/database/LocalStorage.ets | arkts | setNoteBookName | 设置记事本名称 | public async setNoteBookName(notebookName: string) {
Logger.info(TAG, "start setNoteBookName")
let preferences = await this.getPreferences()
let result = await preferences.put(CommonConstants.KEY_NOTEBOOK_NAME, notebookName);
// 将当前Preferences实例的数据异步存储到首选项持久化文件中
preferences.flush((err) => {
... | 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 setNoteBookName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left notebookName AST#identifier#Right AST#ERROR#Left AST#:#... | public async setNoteBookName(notebookName: string) {
Logger.info(TAG, "start setNoteBookName")
let preferences = await this.getPreferences()
let result = await preferences.put(CommonConstants.KEY_NOTEBOOK_NAME, notebookName);
// 将当前Preferences实例的数据异步存储到首选项持久化文件中
preferences.flush((err) => {
... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 3722c8f34c76056271e28438943d69bb04aebe7e | gitee |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/transcoder/Transcoder.ets | arkts | getCurrentProgress | 获取当前进度 | getCurrentProgress(): number {
console.info(`getCurrentProgress = ${this.currentProgress}`);
return this.currentProgress;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#sta... | getCurrentProgress(): number {
console.info(`getCurrentProgress = ${this.currentProgress}`);
return this.currentProgress;
} | https://github.com/iHongRen/harmony-study-demo | 8fc34eca8b93e804cf03f251f987158b569d2497 | github |
openharmony-sig/knowledge_demo_entainment | FA/notebook/entry/src/main/ets/common/database/NoteInfoTable.ets | arkts | updateNote | 修改笔记信息
@param noteInfo 笔记信息
@param callback 更新成功的回调函数 | updateNote(noteInfo: NoteInfo, callback) {
try {
// 获取RdbStore
this.getRdbStore(() => {
// 数据格式转换
const valueBucket = generateBucket(noteInfo);
Logger.info(Tag, " updateNote " + JSON.stringify(valueBucket));
// 获取RdbPredicates
let predicates = new data_rdb.RdbPr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateNote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left noteInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NoteInfo AST#identifier#Ri... | updateNote(noteInfo: NoteInfo, callback) {
try {
// 获取RdbStore
this.getRdbStore(() => {
// 数据格式转换
const valueBucket = generateBucket(noteInfo);
Logger.info(Tag, " updateNote " + JSON.stringify(valueBucket));
// 获取RdbPredicates
let predicates = new data_rdb.RdbPr... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | dbc6fafcef361d496468323b44cd492332c07db0 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | detach | Detaches finalizer from `this` and returns the argument which was stored inside | private detach(): long {
// This method must be called only from boot
const callerClass = Class.ofCaller()
if (callerClass != undefined && callerClass.getLinker() != getBootRuntimeLinker()) {
throw new RuntimeError("ArrayBuffer can be detached only from boot context")
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left detach 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#:#R... | private detach(): long {
// This method must be called only from boot
const callerClass = Class.ofCaller()
if (callerClass != undefined && callerClass.getLinker() != getBootRuntimeLinker()) {
throw new RuntimeError("ArrayBuffer can be detached only from boot context")
}
... | https://gitcode.com/iop123123/arkts-static-skills | 9fb62f0d6c4511e264490330e793ad1521b98ae4 | gitcode |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets | arkts | getDate | Obtaining time.
@param {number} days Days.
@return Return the specific year, month, day, and time. | getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left days AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)... | getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
} | https://gitee.com/openharmony/codelabs.git | 6251359c9e5159b8528d2ec0e09f1df24d7eb3ed | gitee |
OHPG/FinMusic | entry/src/main/ets/prefer/AppPrefer.ets | arkts | isCacheEnabled | ─── 缓存相关 ───────────────────────────────────────────────────────────── | public isCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_CACHE_ENABLED, false) as boolean
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCacheEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AS... | public isCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_CACHE_ENABLED, false) as boolean
} | https://github.com/OHPG/FinMusic | 4819cbccb10a89d444622ba8eeaf67e7a74f4956 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/VariableReplacer.ets | arkts | replace | 替换字符串中的变量
@param template 模板字符串
@param context 变量上下文
@returns 替换后的字符串 | static replace(template: string, context: VariableContext): string {
if (!template) {
return template;
}
try {
return template.replace(/\{\{([^}]+)\}\}/g, (match: string, key: string): string => {
const trimmedKey = key.trim();
// 支持嵌套属性: settings.imageQuality
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ... | static replace(template: string, context: VariableContext): string {
if (!template) {
return template;
}
try {
return template.replace(/\{\{([^}]+)\}\}/g, (match: string, key: string): string => {
const trimmedKey = key.trim();
// 支持嵌套属性: settings.imageQuality
... | https://github.com/DaLongZhuaZi/manxia | a4047ea82a34d4dabe5cfbcf261d8ec22b85d0f5 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | fixImageMove | Image move fix.
@param rotated
@param flipImage
@returns offset. | static fixImageMove(rotated: Array<Point>, flipImage: RectF): Array<number> {
let offsetX = 0;
let offsetY = 0;
for (let point of rotated) {
if (point.x < flipImage.left) {
offsetX = Math.min(offsetX, point.x - flipImage.left);
} else if (point.x > flipImage.right) {
offsetX = ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fixImageMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left rotated AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | static fixImageMove(rotated: Array<Point>, flipImage: RectF): Array<number> {
let offsetX = 0;
let offsetY = 0;
for (let point of rotated) {
if (point.x < flipImage.left) {
offsetX = Math.min(offsetX, point.x - flipImage.left);
} else if (point.x > flipImage.right) {
offsetX = ... | https://gitee.com/openharmony/codelabs.git | 68a52409bbccefb9aa7a2ffaa8d257d08c3a4747 | gitee |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/AssetOverviewCardComponent.ets | arkts | CardHeader | 构建卡片顶部标题行。 | private CardHeader(icon: Resource, title: string) {
Row({ space: 10 }) {
SymbolGlyph(icon)
.fontSize(18)
.fontColor([this.themeState.brand as ResourceColor])
Text(title)
.fontSize(16)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeState.fontPrimary)
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left CardHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left icon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Re... | private CardHeader(icon: Resource, title: string) {
Row({ space: 10 }) {
SymbolGlyph(icon)
.fontSize(18)
.fontColor([this.themeState.brand as ResourceColor])
Text(title)
.fontSize(16)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeState.fontPrimary)
}
} | https://github.com/ZestBox-18/kitebook-frontend | b3c5fea08ff3ec4816da1136bd6adb24952ec6e2 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | preloadCache | 预加载图片, 返回文件缓存的对应文件路径
@param option 加载图片对应的参数选项
@returns 返回promise对象,加载成功时获取到正常文件路径,加载失败时获取的是空字符串 | async preloadCache(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2): Promise<string> {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc === 'string') {
imageKnifeOption = {
loadSrc: loadSrc
};
} else {
imageKnifeOption = loadSrc;
}
r... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preloadCache AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left loadSrc AST#identifier#Right AST#type_annotation#Left AST... | async preloadCache(loadSrc: string | ImageKnifeOption | ImageKnifeOptionV2): Promise<string> {
let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2;
if (typeof loadSrc === 'string') {
imageKnifeOption = {
loadSrc: loadSrc
};
} else {
imageKnifeOption = loadSrc;
}
r... | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L121-L131 | 32aaa083b432de14383fb70cf70dc0f5ca9d832d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | saveTouchStart | ################ ################ ################ ################
BELOW CODE PERFORMS THE ACTUAL TOUCH ACTIONS
Saves the current Matrix state and the touch-start point.
@param event | private saveTouchStart(isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
this.mSavedMatrix.set(this.mMatrix);
if (isTouchEvent) {
let touch = event as TouchEvent;
if (!touch.touches || touch.touches.length == 0 || !touch.touches[0]) {
return;
}
this.mTouchStartPoint.x... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveTouchStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | private saveTouchStart(isTouchEvent: boolean, event: TouchEvent | GestureEvent) {
this.mSavedMatrix.set(this.mMatrix);
if (isTouchEvent) {
let touch = event as TouchEvent;
if (!touch.touches || touch.touches.length == 0 || !touch.touches[0]) {
return;
}
this.mTouchStartPoint.x... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c06a90402b65fdf081f951d1300e1dff6c5394fd | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setNoDataTextTypeface | Sets the typeface to be used for the no data text.
@param tf | public setNoDataTextTypeface(tf: FontFamily) {
if (this.mInfoPaint) {
this.mInfoPaint.setFontFamily(tf);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNoDataTextTypeface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setNoDataTextTypeface(tf: FontFamily) {
if (this.mInfoPaint) {
this.mInfoPaint.setFontFamily(tf);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 958ab5e1d74995676ed07b7e8f99f38d01a6e879 | gitee |
YANGZX22/Voot | entry/src/main/ets/entryability/EntryAbility.ets | arkts | restoreContinuityState | 从流转恢复状态 | private restoreContinuityState(want: Want): void {
console.info('[EntryAbility] restoreContinuityState called');
try {
if (!want.parameters || !want.parameters[CONTINUITY_KEY]) {
console.info('[EntryAbility] No continuity data found; params keys: ' + Object.keys(want.parameters || {}).join(',')... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left restoreContinuityState 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#identi... | private restoreContinuityState(want: Want): void {
console.info('[EntryAbility] restoreContinuityState called');
try {
if (!want.parameters || !want.parameters[CONTINUITY_KEY]) {
console.info('[EntryAbility] No continuity data found; params keys: ' + Object.keys(want.parameters || {}).join(',')... | https://github.com/YANGZX22/Voot | caf2c4e1e91f489b929b4611ea15d0ad873ff470 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitMapInt64Int64 | 访问 map<int64, int64> 字段 | visitMapInt64Int64(value: Map<bigint, bigint>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int64(k)
entryWriter.tag(2, 0).int64(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt64Int64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifier... | visitMapInt64Int64(value: Map<bigint, bigint>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int64(k)
entryWriter.tag(2, 0).int64(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 6949a3c6708ccd886e305b7f38df7c548ff5e667 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getAllNets | 获取所有处于连接状态的网络列表
@returns | static getAllNets(): Promise<Array<connection.NetHandle>> {
return connection.getAllNets();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllNets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static getAllNets(): Promise<Array<connection.NetHandle>> {
return connection.getAllNets();
} | https://github.com/tdcare/tdwebrtc | ac762978cc2f570756ff0a7254f7903bc4c03f52 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_ushort.ets | arkts | main | ---
desc: check bitwise XOR of two unsigned short integers
--- | function main(): void {
const a: ushort = {{v.left}}
const b: ushort = {{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: ushort = {{v.left}}
const b: ushort = {{v.right}}
assert (a ^ b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 76c1e5e6291c422331e5e8b67e9429c72e511c2c | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_char.ets | arkts | main | ---
desc: check subtraction of two chars
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a - b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a - b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 68bee21117a2c34b0acf772324ef172582b05a2e | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/PronunciationService.ets | arkts | speak | Speak a word. Cancels any in-flight utterance first so rapid
taps replace, not queue. Never throws — per-call errors are
logged and swallowed. | speak(word: string): void {
if (!this.isAvailable) {
return;
}
const engine: textToSpeech.TextToSpeechEngine | undefined = this.engine;
if (engine === undefined) {
return;
}
const trimmed: string = word.trim();
if (trimmed.length === 0) {
return;
}
try {
eng... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left speak AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig... | speak(word: string): void {
if (!this.isAvailable) {
return;
}
const engine: textToSpeech.TextToSpeechEngine | undefined = this.engine;
if (engine === undefined) {
return;
}
const trimmed: string = word.trim();
if (trimmed.length === 0) {
return;
}
try {
eng... | https://github.com/terryma2024/happyword | 698cbeffda1ceab3c86fcf1c8a58024fe3e4f455 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/Semaphore.ets | arkts | release | Release a permit back to the semaphore. | release(): void {
this.count++;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left release AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | release(): void {
this.count++;
} | https://github.com/killetom/ktretrofit | 981d324eac365b2c5b8ccf2faa08b314a58c0c56 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | insertContact | 插入联系人 | public async insertContact(contactData: InsertContactData): Promise<OperationResult> {
try {
const rdbStore = await this.ensureDBInitialized();
// 生成首字母(如果未提供)
const initial = contactData.initial || this.generateInitial(contactData.name);
// 创建ValuesBucket
const valueBucket: relati... | 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 insertContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contactData AST#identifier#Right AST#:#Lef... | public async insertContact(contactData: InsertContactData): Promise<OperationResult> {
try {
const rdbStore = await this.ensureDBInitialized();
// 生成首字母(如果未提供)
const initial = contactData.initial || this.generateInitial(contactData.name);
// 创建ValuesBucket
const valueBucket: relati... | https://gitcode.com/openharmony/codelabs | a9b5ab8a9e79eeb0fe161c348e786ee136934035 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | getActiveDeviceKeys | 当前已驱动控制器的 deviceKey 集合 | getActiveDeviceKeys(): Set<string> {
const keys = new Set<string>();
for (const c of this.controllers) {
if (c.isConnected()) {
keys.add(c.getDeviceKey());
}
}
return keys;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getActiveDeviceKeys 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#i... | getActiveDeviceKeys(): Set<string> {
const keys = new Set<string>();
for (const c of this.controllers) {
if (c.isConnected()) {
keys.add(c.getDeviceKey());
}
}
return keys;
} | https://github.com/AlkaidLab/moonlight-harmony | e4030fb4bb0a38a679ea1a15e389d49c87e71333 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/OCRRecognitionService.ets | arkts | getStatistics | ==================== 统计分析 ====================
获取识别统计 | static async getStatistics(userId: number) {
try {
return await OCRRecognitionRecordDAO.getStatistics(userId);
} catch (error) {
console.error('[OCRRecognitionService] 获取识别统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A... | static async getStatistics(userId: number) {
try {
return await OCRRecognitionRecordDAO.getStatistics(userId);
} catch (error) {
console.error('[OCRRecognitionService] 获取识别统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6ef0e2bfcd03ce2bf2f72db979c3572b0a3170b2 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | writable | Is true if it is safe to call writable.write(), which means
the stream has not been destroyed or emitted 'error' or 'end'. | get writable(): boolean {
return this.writableInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right... | get writable(): boolean {
return this.writableInner;
} | https://gitcode.com/iop123123/arkts-static-skills | 553cdcfcd045a89cf8e28824eeae909f3f39295e | gitcode |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/pages/Index.ets | arkts | getVoiceInterruptionMessage | Voice interruption error messages in different languages | function getVoiceInterruptionMessage(code: LanguageCode): string {
switch (code) {
case 'en': return 'Voice input interrupted';
case 'pl': return 'Wprowadzanie głosowe przerwane';
case 'it': return 'Inserimento vocale interrotto';
case 'ar': return 'تم مقاطعة الإدخال الصوتي';
case 'fa': return 'ور... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getVoiceInterruptionMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#L... | function getVoiceInterruptionMessage(code: LanguageCode): string {
switch (code) {
case 'en': return 'Voice input interrupted';
case 'pl': return 'Wprowadzanie głosowe przerwane';
case 'it': return 'Inserimento vocale interrotto';
case 'ar': return 'تم مقاطعة الإدخال الصوتي';
case 'fa': return 'ور... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/pages/Index.ets#L62-L71 | 7575d7f9852adb63d6fe20aad2e912bca7794a4d | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderListViewModel.ets | arkts | handleOrderComment | 处理订单评价逻辑
@param {Order} order - 订单信息
@returns {void} 无返回值 | handleOrderComment(order: Order): void {
this.commentCurrentOrder = null;
this.commentCartList = [];
const cartList: Cart[] = this.convertOrderGoodsToCart(order);
if (cartList.length > 1) {
this.commentCurrentOrder = order;
this.commentCartList = cartList;
this.showCommentModal();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleOrderComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Order AST#identifier#Right AST#)#Lef... | handleOrderComment(order: Order): void {
this.commentCurrentOrder = null;
this.commentCartList = [];
const cartList: Cart[] = this.convertOrderGoodsToCart(order);
if (cartList.length > 1) {
this.commentCurrentOrder = order;
this.commentCartList = cartList;
this.showCommentModal();
... | https://github.com/Joker-x-dev/CoolMallArkTS | b1e9d4de2fe790e834faaab9509b69fdbb774376 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/ReaderKitParser.ets | arkts | getReaderKitFileType | 获取 Reader Kit 文件类型 | private getReaderKitFileType(): string {
// ReaderKit 当前按文件路径创建处理器,这里保留格式字符串用于诊断和兜底路由。
return this.format;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getReaderKitFileType 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 st... | private getReaderKitFileType(): string {
// ReaderKit 当前按文件路径创建处理器,这里保留格式字符串用于诊断和兜底路由。
return this.format;
} | https://github.com/DaLongZhuaZi/manxia | 7866a46216a76c4c971b5c32b767c09059489927 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/animation/ChartAnimator.ets | arkts | setPhaseX | Sets the X axis phase of the animation.
@param phase float value between 0 - 1 | public setPhaseX(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseX = phase;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPhaseX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | public setPhaseX(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseX = phase;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 73e1a698601afb782aefb86d6fca2a3212dcf456 | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets | arkts | desDecrypt | DES 解密 | private desDecrypt(data: Uint8Array, key: Uint8Array): Uint8Array {
try {
if (deviceInfo.sdkApiVersion < sdkApiVersion) {
const keyWords: CryptoJS.lib.WordArray = this.bytesToWordArray(key);
const dataWords: CryptoJS.lib.WordArray = this.bytesToWordArray(data);
const decrypted: Cryp... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left desDecrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ui... | private desDecrypt(data: Uint8Array, key: Uint8Array): Uint8Array {
try {
if (deviceInfo.sdkApiVersion < sdkApiVersion) {
const keyWords: CryptoJS.lib.WordArray = this.bytesToWordArray(key);
const dataWords: CryptoJS.lib.WordArray = this.bytesToWordArray(data);
const decrypted: Cryp... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 4e76dea901abffa4f316a5ee22f9b796bb612642 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | $_invoke | RegExp constructor call signature, used to create new RegExp instances.
@param { RegExp | String } pattern Regular expression pattern or another RegExp instance.
@returns { RegExp } Newly created RegExp instance.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static $_invoke(pattern: RegExp | String) : RegExp {
return new RegExp(pattern)
} | 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 $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pattern AST#identifier#Right AST#:#Left : AST#... | public static $_invoke(pattern: RegExp | String) : RegExp {
return new RegExp(pattern)
} | https://gitcode.com/iop123123/arkts-static-skills | 3ad860ee0ecb23965c8730e4f0ec3d38c761d60d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/MigrationScripts.ets | arkts | cleanDuplicateOnlineChapters | 清理online_chapter表的重复数据 | async cleanDuplicateOnlineChapters(store: any): Promise<void> {
logger.info(TAG, '开始清理online_chapter表的重复数据');
const findDuplicatesSql = `
SELECT comicId, externalId, COUNT(*) as count
FROM online_chapter
GROUP BY comicId, externalId
HAVING COUNT(*) > 1
`;
const duplic... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cleanDuplicateOnlineChapters AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left store AST#identifier#Right AST#type_annot... | async cleanDuplicateOnlineChapters(store: any): Promise<void> {
logger.info(TAG, '开始清理online_chapter表的重复数据');
const findDuplicatesSql = `
SELECT comicId, externalId, COUNT(*) as count
FROM online_chapter
GROUP BY comicId, externalId
HAVING COUNT(*) > 1
`;
const duplic... | https://github.com/DaLongZhuaZi/manxia | 57a86078c409bf900aef080ba6c673cfa983ca9f | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets | arkts | scrollToPackManagerEntry | V0.6.5.1 / V0.6.7: ConfigPage scrolls vertically and the pack-
manager entry sits below the autoSpeak row. On a narrow landscape
viewport one swipe is enough; iterate up to 5x to be defensive
across emulator skins. | async function scrollToPackManagerEntry(driver: Driver): Promise<void> {
try {
for (let attempt: number = 0; attempt < 5; attempt++) {
const btn: Component | null =
await driver.findComponent(ON.id('ConfigPackManagerEntry'));
if (btn !== null) {
return;
}
await driver.swipe... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left scrollToPackManagerEntry AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Ri... | async function scrollToPackManagerEntry(driver: Driver): Promise<void> {
try {
for (let attempt: number = 0; attempt < 5; attempt++) {
const btn: Component | null =
await driver.findComponent(ON.id('ConfigPackManagerEntry'));
if (btn !== null) {
return;
}
await driver.swipe... | https://github.com/terryma2024/happyword | a4b9ea266e403769289ad00e2f33256df413e6eb | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets | arkts | startAlipayPayment | 发起支付宝支付
@returns {void} 无返回值 | startAlipayPayment(): void {
if (!this.orderId) {
return;
}
const params: AlipayPayParams = { orderId: this.orderId };
RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params))
.execute()
.then((payInfo: string): void => {
this.startAlipaySdk(payInfo);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startAlipayPayment 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... | startAlipayPayment(): void {
if (!this.orderId) {
return;
}
const params: AlipayPayParams = { orderId: this.orderId };
RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params))
.execute()
.then((payInfo: string): void => {
this.startAlipaySdk(payInfo);
... | https://github.com/Joker-x-dev/CoolMallArkTS | 2e0d5de8eee23022a8d20c05fdc05281bbbd4976 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | getRecommendedSupportWords | 获取推荐的支持词汇 | getRecommendedSupportWords(
targetWord: string,
count: number = 3,
minStatus: WordStatus = WordStatus.LEARNING
): string[] {
const reviewWords = this.vocabularyTracker.getReviewWords();
const learningWords = this.vocabularyTracker.getLearningWords();
// 过滤满足最低状态优先级的词汇
const qualifiedWor... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRecommendedSupportWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetWord AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#... | getRecommendedSupportWords(
targetWord: string,
count: number = 3,
minStatus: WordStatus = WordStatus.LEARNING
): string[] {
const reviewWords = this.vocabularyTracker.getReviewWords();
const learningWords = this.vocabularyTracker.getLearningWords();
// 过滤满足最低状态优先级的词汇
const qualifiedWor... | https://github.com/CLMC2025/Vignette | 94dd19ebdbba1f2af69d88cd55f35d59ca4d1008 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets | arkts | panUpdate | Panning gestures.
@param event Events when panning. | panUpdate(event: GestureEvent, callBack: Function): void {
let panX = Number.parseInt(event.offsetX.toFixed(0));
let panY = Number.parseInt(event.offsetY.toFixed(0));
if ((this.panX !== panX) || (this.panY !== panY)) {
let mapPanX = panX - this.panX;
let mapPanY = panY - this.panY;
callB... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left panUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent AST#identifier#Right AST#,#Left ... | panUpdate(event: GestureEvent, callBack: Function): void {
let panX = Number.parseInt(event.offsetX.toFixed(0));
let panY = Number.parseInt(event.offsetY.toFixed(0));
if ((this.panX !== panX) || (this.panY !== panY)) {
let mapPanX = panX - this.panX;
let mapPanY = panY - this.panY;
callB... | https://gitee.com/harmonyos/codelabs.git | 5e10be33e56da0f772db05decda284ced2a71009 | gitee |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/components/LazyImage.ets | arkts | width | 基类要求的函数实现 | width(value: Length): LazyImage {
this.widthValue = value;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left width AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Length AST#identifier#Right AST#)#Left ) AST#)#Ri... | width(value: Length): LazyImage {
this.widthValue = value;
return this;
} | https://gitcode.com/openharmony/codelabs | 7229c8dc3f0c2dec8d089129dff9bcdf56d280b7 | gitcode |
bhengubv/aether-protocol | arkts/src/main/ets/vault/ReedSolomonCodec.ets | arkts | initGfTables | GF_LOG[v] = log_α(v) for v ∈ [1, 255] | function initGfTables(): void {
let x: number = 1;
for (let i = 0; i < 255; i++) {
GF_EXP[i] = x;
GF_LOG[x] = i;
x <<= 1;
if ((x & 0x100) !== 0) {
x ^= 0x11d; // reduce mod p(x) = x⁸+x⁴+x³+x²+1
}
}
for (let i = 255; i < 512; i++) {
GF_EXP[i] = GF_EXP[i - 255];
}
GF_LOG[1] = 0;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left initGfTables 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_typ... | function initGfTables(): void {
let x: number = 1;
for (let i = 0; i < 255; i++) {
GF_EXP[i] = x;
GF_LOG[x] = i;
x <<= 1;
if ((x & 0x100) !== 0) {
x ^= 0x11d; // reduce mod p(x) = x⁸+x⁴+x³+x²+1
}
}
for (let i = 255; i < 512; i++) {
GF_EXP[i] = GF_EXP[i - 255];
}
GF_LOG[1] = 0;
... | https://github.com/bhengubv/aether-protocol | a4033f9ca9d7b4f3f2c26a6600e15e31a4109ef0 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | deflateRect | 计算减少边距后的矩形 | public deflateRect(rect: Rect): Rect {
return new Rect(
rect.left + this.left,
rect.top + this.top,
rect.right - this.right,
rect.bottom - this.bottom,
);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deflateRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Rect... | public deflateRect(rect: Rect): Rect {
return new Rect(
rect.left + this.left,
rect.top + this.top,
rect.right - this.right,
rect.bottom - this.bottom,
);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L551-L558 | 8dad3da8f45ff104f3c9efcbcf813aa5942ebafd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getSourceConfigByPkg | 获取图源配置(通过 pkg) | async getSourceConfigByPkg(pkg: string): Promise<Record<string, Object> | null> {
try {
const sql = 'SELECT * FROM comic_source WHERE pkg = ?';
const result = await this.databaseManager.querySql(sql, [pkg]);
logger.debug(TAG, `查询图源配置: pkg=${pkg}, 结果数量=${result?.length || 0}`);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceConfigByPkg AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pkg AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getSourceConfigByPkg(pkg: string): Promise<Record<string, Object> | null> {
try {
const sql = 'SELECT * FROM comic_source WHERE pkg = ?';
const result = await this.databaseManager.querySql(sql, [pkg]);
logger.debug(TAG, `查询图源配置: pkg=${pkg}, 结果数量=${result?.length || 0}`);
... | https://github.com/DaLongZhuaZi/manxia | df265916db53ac8db66c1f7a8fbb0ea899064f44 | github |
openharmony-sig/fluttertpc_flutter_qr_reader | ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets | arkts | setCameraCompSize | 设置相机宽高大小
@param width
@param height
@returns {void} | setCameraCompSize(width?: number, height?: number): void {
if (width) {
this.cameraCompWidth = px2vp(width);
}
if (height) {
this.cameraCompHeight = px2vp(height);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCameraCompSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#i... | setCameraCompSize(width?: number, height?: number): void {
if (width) {
this.cameraCompWidth = px2vp(width);
}
if (height) {
this.cameraCompHeight = px2vp(height);
}
} | https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git | d3e11755c78c00588a1886b17aa928d3d84ccb10 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/IndoorLocator.ets | arkts | clearHistory | 清除定位历史 | public clearHistory(): void {
this.positionHistory = [];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearHistory 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#expressio... | public clearHistory(): void {
this.positionHistory = [];
} | https://github.com/LJ666-ui/harmony-health-care | 81bc22aa6cce14cc40c4ab27b0202468cda078ec | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets | arkts | getTrackStatusFromAniList | 从 AniList 状态获取 TrackStatus | function getTrackStatusFromAniList(anilistStatus: string): TrackStatus {
switch (anilistStatus) {
case 'CURRENT':
return TrackStatus.READING;
case 'COMPLETED':
return TrackStatus.COMPLETED;
case 'PAUSED':
return TrackStatus.ON_HOLD;
case 'DROPPED':
return TrackStatus.DROPPED;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTrackStatusFromAniList AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left anilistStatus AST#identifier#Right AST#type_annotation#Left ... | function getTrackStatusFromAniList(anilistStatus: string): TrackStatus {
switch (anilistStatus) {
case 'CURRENT':
return TrackStatus.READING;
case 'COMPLETED':
return TrackStatus.COMPLETED;
case 'PAUSED':
return TrackStatus.ON_HOLD;
case 'DROPPED':
return TrackStatus.DROPPED;
... | https://github.com/DaLongZhuaZi/manxia | 9273e088d4207dc08a046f5ec5dc6ac408e0ab63 | github |
StarHeartY/CalculatorX | entry/src/main/ets/pages/history/HistoryManager.ets | arkts | aboutToAppear | 列表刷新信号 | aboutToAppear() {
// 页面加载时,静默探测第 0 个 Tab ("全部") 的数据状态
this.checkTabHasData(0);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 页面加载时,静默探测第 0 个 Tab ("全部") 的数据状态
this.checkTabHasData(0);
} | https://github.com/StarHeartY/CalculatorX | 616fb172bb3eb183a91dbf2b97d714e49a1fcad8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | getArchiveStats | 获取归档统计信息 | public async getArchiveStats(): Promise<ArchiveStats> {
try {
const chaptersDir = this.sandboxManager.getDirectory('chapters');
const files = await this.sandboxManager.listDirectory(chaptersDir);
let totalSize = 0;
let archiveCount = 0;
for (const file of files) {
... | 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 getArchiveStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async getArchiveStats(): Promise<ArchiveStats> {
try {
const chaptersDir = this.sandboxManager.getDirectory('chapters');
const files = await this.sandboxManager.listDirectory(chaptersDir);
let totalSize = 0;
let archiveCount = 0;
for (const file of files) {
... | https://github.com/DaLongZhuaZi/manxia | 250b3bad2e6be1ad5cda300a6b1dff8e569c7998 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/HttpClient.ets | arkts | get | 执行 GET 请求
@param url 请求 URL
@param config 配置选项
@returns 响应字符串 | static async get(url: string, config?: HttpClientConfig): Promise<string> {
const response = await HttpClient.executeGet(url, config);
return response.body;
} | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AS... | static async get(url: string, config?: HttpClientConfig): Promise<string> {
const response = await HttpClient.executeGet(url, config);
return response.body;
} | https://github.com/AlkaidLab/moonlight-harmony | ff7754c97f9c959629a30c3b2a5977e681653152 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.