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 |
|---|---|---|---|---|---|---|---|---|---|---|
harmonyos/codelabs | HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets | arkts | queryCommodityList | Query commodity list.
@returns Commodity[] | queryCommodityList() {
return commodityData;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryCommodityList 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... | queryCommodityList() {
return commodityData;
} | https://gitee.com/harmonyos/codelabs.git | a3c60adf5bb364bb99a00c00a2ba9adefc5ac7a3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/SafeUtils.ets | arkts | parseOptional | 当确定无法提供合适的 fallback 时,可以使用这个变体,它允许返回 undefined | static parseOptional<T>(jsonStr: string | undefined | null): T | undefined {
if (!jsonStr || jsonStr.trim() === '') {
return undefined;
}
try {
return JSON.parse(jsonStr) as T;
} catch (error) {
logger.error(TAG, `JSON parse error (Optional): ${String(error)}, prefix: ${jsonStr.subst... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left parseOptional AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(... | static parseOptional<T>(jsonStr: string | undefined | null): T | undefined {
if (!jsonStr || jsonStr.trim() === '') {
return undefined;
}
try {
return JSON.parse(jsonStr) as T;
} catch (error) {
logger.error(TAG, `JSON parse error (Optional): ${String(error)}, prefix: ${jsonStr.subst... | https://github.com/DaLongZhuaZi/manxia | 8d77f3c3c6210ff2c34bac5e8a0e9cf5b1d66f72 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | sort | Sorts the elements of an ArrayList in place and returns the sorted ArrayList.
@param comparator - Optional. A function that defines the sort order. | public sort(comparator?: ArrayListComparatorFn<T>): void {
if (comparator == undefined) {
this.buffer.sort(comparator);
} else {
let fn = (firstValue: T, secondValue: T): int => {
return comparator!(firstValue, secondValue).toInt()
}
th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comparator AST#identifier#Right AST#?#Left ? AST#?#Right AS... | public sort(comparator?: ArrayListComparatorFn<T>): void {
if (comparator == undefined) {
this.buffer.sort(comparator);
} else {
let fn = (firstValue: T, secondValue: T): int => {
return comparator!(firstValue, secondValue).toInt()
}
th... | https://gitcode.com/iop123123/arkts-static-skills | 1d5ba228388e4ee2ebe2ebdd7ca57df9d961465c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an BigInt64Array with respect to length.
@param { number } length - Number of elements
@throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / BigInt64Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / BigInt64Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = ... | https://gitcode.com/iop123123/arkts-static-skills | e675287e39cbf8ec29eac7f2ec41bf4b1d40b9c3 | gitcode |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/pages/Setting/SettingPage.ets | arkts | aboutToAppear | 默认1x对应索引2 | aboutToAppear() {
// 延迟初始化主题,确保Context准备就绪
setTimeout(() => {
themeManager.initTheme()
this.isDarkMode = this.currentTheme === ThemeMode.DARK
// 初始化播放速度
playSpeedManager.initPlaySpeed()
this.updateSpeedIndex()
}, 50)
} | 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() {
// 延迟初始化主题,确保Context准备就绪
setTimeout(() => {
themeManager.initTheme()
this.isDarkMode = this.currentTheme === ThemeMode.DARK
// 初始化播放速度
playSpeedManager.initPlaySpeed()
this.updateSpeedIndex()
}, 50)
} | https://github.com/SMAT-Lab/PhantomRendering | 0f162fb08fd9bba4ad96c96438ae3a302a4f4314 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | downloadMangaChapter | ==================== 漫画下载 ====================
下载漫画章节
@param params 下载参数
@returns 任务ID | public async downloadMangaChapter(params: MangaChapterDownloadParams): Promise<string> {
const startedAt: number = Date.now();
const flowId: string = this.ensureDownloadCacheFlow(
params.downloadCacheFlowId || '',
DownloadCacheEntrySource.UNIFIED_DOWNLOAD_MANAGER,
DownloadCacheContentType.MA... | 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 downloadMangaChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#L... | public async downloadMangaChapter(params: MangaChapterDownloadParams): Promise<string> {
const startedAt: number = Date.now();
const flowId: string = this.ensureDownloadCacheFlow(
params.downloadCacheFlowId || '',
DownloadCacheEntrySource.UNIFIED_DOWNLOAD_MANAGER,
DownloadCacheContentType.MA... | https://github.com/DaLongZhuaZi/manxia | 31faba4cd26fefd115e82293610846fb8a5fa0b6 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DefaultModelService.ets | arkts | getModel | ============================================================================
Model(委托 Store)
============================================================================ | getModel(role: ModelRole): DefaultModelConfig {
return this.store.getDefaultModel(role)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ModelRole AST#identifier#Right AST#)#Left ) AST... | getModel(role: ModelRole): DefaultModelConfig {
return this.store.getDefaultModel(role)
} | https://github.com/LongLiveY96/chatcube | d9b0469a2cdc7741b98f310181c6a42c1ead17b1 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/arkts/concurrent/TaskPoolDemo.ets | arkts | fun3 | 一个 catch 到任务异常的示例 | @Concurrent
async function fun3(a: number, b: number): Promise<number> {
return await new Promise((resolve, reject) => {
setTimeout(()=>{
reject("error message");
}, 1000)
});
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left fun3 AST#identifier#Right AST#formal_parameters#Left A... | @Concurrent
async function fun3(a: number, b: number): Promise<number> {
return await new Promise((resolve, reject) => {
setTimeout(()=>{
reject("error message");
}, 1000)
});
} | https://github.com/webabcd/HarmonyDemo | c24fbe0c96f834bc5c0be8da199ee50466c9f9bb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | keys | Returns an list of keys in BigUint64Array
@returns { IterableIterator<int> } - iterator over keys
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public keys(): IterableIterator<int> {
return new BigUint64ArrayIteratorKeys(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public keys(): IterableIterator<int> {
return new BigUint64ArrayIteratorKeys(this)
} | https://gitcode.com/iop123123/arkts-static-skills | f0354a50301dca3744e8a62416a6207666dcf522 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | replaceVariables | 替换操作中的变量 | private replaceVariables(action: Action, variables: Record<string, Object | undefined>): Action {
const actionStr = JSON.stringify(action).replace(/\{\{([a-zA-Z0-9_.]+)\}\}/g, (match: string, varName: string): string => {
const value: Object | undefined = variables[varName];
if (value === undefined) r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private replaceVariables(action: Action, variables: Record<string, Object | undefined>): Action {
const actionStr = JSON.stringify(action).replace(/\{\{([a-zA-Z0-9_.]+)\}\}/g, (match: string, varName: string): string => {
const value: Object | undefined = variables[varName];
if (value === undefined) r... | https://github.com/DaLongZhuaZi/manxia | b7b80cc33a518246e27bee73f803f3c482fabf62 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | isDdkPolling | 是否使用 DDK 高速轮询 | isDdkPolling(): boolean {
return this.ddkActive;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDdkPolling 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... | isDdkPolling(): boolean {
return this.ddkActive;
} | https://github.com/AlkaidLab/moonlight-harmony | 8df627151bc2dddc341583ba7e6cb6739a187fbe | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/setting.ets | arkts | getTikTokConnect | 获取抖音联系人 | getTikTokConnect() {
const Store = this.getStore()
return JSON.parse(Store.getSync(TIKTOK_CONNECT, JSON.stringify(defaultUserInfo)) as string) as UserInfoModel[]
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTikTokConnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | getTikTokConnect() {
const Store = this.getStore()
return JSON.parse(Store.getSync(TIKTOK_CONNECT, JSON.stringify(defaultUserInfo)) as string) as UserInfoModel[]
} | https://github.com/SMAT-Lab/PhantomRendering | a510a5667626ea2bae878e00f22f0c1e1df193f3 | github |
harmonyos/codelabs | CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | fillArc | Method of drawing arcs.
@param fillArcData fillArcData.
@param fillColor fillColor. | fillArc(fillArcData: FillArcData, fillColor: string) {
if (CheckEmptyUtils.isEmptyObj(fillArcData) || CheckEmptyUtils.isEmptyStr(fillColor)) {
Logger.error('[DrawModel][fillArc] fillArcData or fillColor is empty.');
return;
}
if (this.canvasContext !== undefined) {
this.canvasContext.beg... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fillArc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fillArcData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FillArcData AST#identifier... | fillArc(fillArcData: FillArcData, fillColor: string) {
if (CheckEmptyUtils.isEmptyObj(fillArcData) || CheckEmptyUtils.isEmptyStr(fillColor)) {
Logger.error('[DrawModel][fillArc] fillArcData or fillColor is empty.');
return;
}
if (this.canvasContext !== undefined) {
this.canvasContext.beg... | https://gitee.com/harmonyos/codelabs.git | c9fa42bf076f713ffb6f4fcd45e5a129384dfb73 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test17_original_index.ets | arkts | mergeConfigs | --- Object merge pattern (manual copy) --- | function mergeConfigs(base: Record<string, number>, override: Record<string, number>): Record<string, number> {
let result: Record<string, number> = {};
let baseKeys: string[] = Object.keys(base);
for (let i: number = 0; i < baseKeys.length; i++) {
let key: string = baseKeys[i];
result[key] = base[key];
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeConfigs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left base AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function mergeConfigs(base: Record<string, number>, override: Record<string, number>): Record<string, number> {
let result: Record<string, number> = {};
let baseKeys: string[] = Object.keys(base);
for (let i: number = 0; i < baseKeys.length; i++) {
let key: string = baseKeys[i];
result[key] = base[key];
... | https://github.com/miaochiahao/ark-ghidra | 0ea23e975f37494de05cf37c83851b183cc7c143 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/CommandLine.ets | arkts | getOptionValue | Retrieve the first argument, if any, of an option.
@param opt name of the option.
@param defaultValue is the default value to be returned if the option is not specified.
@return Value of the argument if option is set, and has an argument, otherwise {@code defaultValue}. | public getOptionValue(opt: string, defaultValue?: string): string | null {
let option = this.resolveOption(opt);
if (option == null) {
return null;
}
let values = this.getOptionValues(option);
let answer = values == null ? null : values[0];
if (defaultValue) {
return answer != null... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOptionValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left opt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public getOptionValue(opt: string, defaultValue?: string): string | null {
let option = this.resolveOption(opt);
if (option == null) {
return null;
}
let values = this.getOptionValues(option);
let answer = values == null ? null : values[0];
if (defaultValue) {
return answer != null... | https://gitee.com/openharmony-sig/commons-cli.git | 23567b2f3faf18a6a58fbe3924a35c7936853bf2 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getAllPOIs | 获取所有POI列表 | public getAllPOIs(): NavigationDestination[] {
return this.buildingData?.pois ?? [];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllPOIs 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_... | public getAllPOIs(): NavigationDestination[] {
return this.buildingData?.pois ?? [];
} | https://github.com/LJ666-ui/harmony-health-care | be15ebaf1409a744a7347c42bc63b26dc1bd1302 | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeGetIsRenderOutsizeSafeArea | Whether to render outside the safe area. | public static nativeGetIsRenderOutsizeSafeArea(): boolean {
return tuanjie.nativeGetIsRenderOutsizeSafeArea();
} | 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 nativeGetIsRenderOutsizeSafeArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_exp... | public static nativeGetIsRenderOutsizeSafeArea(): boolean {
return tuanjie.nativeGetIsRenderOutsizeSafeArea();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | 9d72343a5aac68c898413294defb57fafe0ea847 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | updateMessageAttachments | 更新消息附件 | async updateMessageAttachments(messageId: string, attachments: MessageAttachment[]): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
try {
// 1. 先删除该消息的所有附件
const deletePredicates = new relationalStore.RdbPredicates(TableNames.ATTACHMENTS)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateMessageAttachments AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifie... | async updateMessageAttachments(messageId: string, attachments: MessageAttachment[]): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
try {
// 1. 先删除该消息的所有附件
const deletePredicates = new relationalStore.RdbPredicates(TableNames.ATTACHMENTS)
... | https://github.com/LongLiveY96/chatcube | 2d38f1bf512cab930eb3adc7fa45febb743b2f82 | github |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/Pigeon.ets | arkts | getCodec | The codec used by AnalysisImageUtils. | static getCodec(): MessageCodec<Object> {
return AnalysisImageUtilsCodec.INSTANCE;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_st... | static getCodec(): MessageCodec<Object> {
return AnalysisImageUtilsCodec.INSTANCE;
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | c4c263ff526d48bf14e5ddc67f8461cff0170a4a | gitee |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | setZeroLineWidth | Sets the width of the zero line in dp
@param width | public setZeroLineWidth(width: number): void {
this.mZeroLineWidth = Utils.convertDpToPixel(width);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setZeroLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setZeroLineWidth(width: number): void {
this.mZeroLineWidth = Utils.convertDpToPixel(width);
} | https://gitee.com/openharmony/developtools_profiler.git | d349c5e93e3157bb369c3593b06f5dbf2eaf75ee | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | getDefaultFilterConfig | 获取默认筛选配置 | getDefaultFilterConfig(): SearchFilterConfig {
return {
contentType: SearchContentType.ALL,
sourceType: SearchSourceType.LOCAL,
selectedMangaSources: [],
selectedNovelSources: [],
enableSuwayomi: false,
maxConcurrent: 5
};
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDefaultFilterConfig 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 SearchFilterConfig AST#identifier#Right... | getDefaultFilterConfig(): SearchFilterConfig {
return {
contentType: SearchContentType.ALL,
sourceType: SearchSourceType.LOCAL,
selectedMangaSources: [],
selectedNovelSources: [],
enableSuwayomi: false,
maxConcurrent: 5
};
} | https://github.com/DaLongZhuaZi/manxia | e03726528bafb6dd056495db3950b3d2a701d2cd | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/alerts/AlertsProcessor.ets | arkts | alarmExists | 查看alarm是否已经存在
@param calendarAlerts 携带参数的calendarAlerts
@return 存在则返回true | async function alarmExists(rdbStore: data_rdb.RdbStore, calendarAlerts: CalendarAlerts): Promise<boolean> {
let isExistAlarm = false;
const columns = [CalendarAlertsColumns.ALARM_TIME];
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(InstancesColumns.EVENT_ID, calendarAlerts.e... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left alarmExists AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#typ... | async function alarmExists(rdbStore: data_rdb.RdbStore, calendarAlerts: CalendarAlerts): Promise<boolean> {
let isExistAlarm = false;
const columns = [CalendarAlertsColumns.ALARM_TIME];
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo(InstancesColumns.EVENT_ID, calendarAlerts.e... | https://gitee.com/openharmony/applications_calendar_data.git | b20493ce58fbaab4a514b12f0d24ce2b7ca753bd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | detectAnimationType | 自动检测动画类型 | private detectAnimationType(): AnimationType {
const prevCount = this.previousItems.length;
const currCount = this.currentItems.length;
if (prevCount === 0) {
// 初始加载,不需要动画
return AnimationType.REFRESH;
}
if (currCount > prevCount) {
// 有新增条目
return AnimationType.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectAnimationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left... | private detectAnimationType(): AnimationType {
const prevCount = this.previousItems.length;
const currCount = this.currentItems.length;
if (prevCount === 0) {
// 初始加载,不需要动画
return AnimationType.REFRESH;
}
if (currCount > prevCount) {
// 有新增条目
return AnimationType.... | https://github.com/DaLongZhuaZi/manxia | 856281ad48f0e2c9d49481127b5f658e7e1468f1 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/RequireAwait/ets/requireAwaitNoReport.ets | arkts | delay | Non-async function that returns a promise | function delay() {
return Promise.resolve();
}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left delay 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#return_statement#Left... | function delay() {
return Promise.resolve();
}; | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 4e4068179b8803af9817cb9ea2aaa4eac80ee69c | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/pages/Index.ets | arkts | aboutToDisappear | 组件销毁时移除主题监听器 | aboutToDisappear(): void {
// 注意:在实际应用中,应该保存监听器的引用以便移除
// 这里为了简化,暂时不实现移除逻辑
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio... | aboutToDisappear(): void {
// 注意:在实际应用中,应该保存监听器的引用以便移除
// 这里为了简化,暂时不实现移除逻辑
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 2fe66f4dcf3dddfb0566c21e0e5c703be21562d8 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/ApiClient.ets | arkts | getFilteredTopics | 获取话题列表(支持分类/标签/排序/period)
支持分类、标签、排序和 period 组合查询 | async getFilteredTopics(
filter: string,
page: number = 0,
period: string | null = null,
order: string | null = null,
ascending: boolean | null = null,
categorySlug: string | null = null,
categoryId: number | null = null,
parentCategorySlug: string | null = null,
tags: string[] | n... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFilteredTopics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filter AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getFilteredTopics(
filter: string,
page: number = 0,
period: string | null = null,
order: string | null = null,
ascending: boolean | null = null,
categorySlug: string | null = null,
categoryId: number | null = null,
parentCategorySlug: string | null = null,
tags: string[] | n... | https://github.com/Amaz1ny/HarmonyDO-public | 6aefac05d606da147f6483eaa32b5e2e803924ea | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test38_original_index.ets | arkts | testMapIteration | === Round 38: Map forEach iteration, switch with break,
object property enumeration, Promise chain (.then/.catch),
string encoding patterns, nested function references ===
--- Map forEach iteration --- | function testMapIteration(): string {
let m: Map<string, number> = new Map();
m.set('x', 10);
m.set('y', 20);
m.set('z', 30);
let total: number = 0;
let keys: string[] = ['x', 'y', 'z'];
for (let i: number = 0; i < keys.length; i++) {
let val: number | undefined = m.get(keys[i]);
if (val !== undef... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapIteration 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... | function testMapIteration(): string {
let m: Map<string, number> = new Map();
m.set('x', 10);
m.set('y', 20);
m.set('z', 30);
let total: number = 0;
let keys: string[] = ['x', 'y', 'z'];
for (let i: number = 0; i < keys.length; i++) {
let val: number | undefined = m.get(keys[i]);
if (val !== undef... | https://github.com/miaochiahao/ark-ghidra | 00ab1b4bf0efb1f800a8fc214b13deaac2736553 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11CompatibilityTester.ets | arkts | getDetails | 获取详细信息 | private getDetails(
cpuSupported: boolean,
memoryAdequate: boolean,
tpmSupported: boolean,
secureBootEnabled: boolean
): Windows11Details {
const cpuArch = this.getCpuArch();
const deviceType = deviceInfo.deviceType || 'tablet';
// 估算内存(基于设备类型)
let estimatedMemoryGB = 4;
if ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDetails AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cpuSupported AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b... | private getDetails(
cpuSupported: boolean,
memoryAdequate: boolean,
tpmSupported: boolean,
secureBootEnabled: boolean
): Windows11Details {
const cpuArch = this.getCpuArch();
const deviceType = deviceInfo.deviceType || 'tablet';
// 估算内存(基于设备类型)
let estimatedMemoryGB = 4;
if ... | https://github.com/AetheriumSimulator/qemu-hmos | 2f14ea2fc79fd0506fa1129f533ba9c4654add1b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | isNsfwScopeImageSourceEnabled | ==================== NSFW作用域开关 ====================
图源NSFW作用域是否启用 | public isNsfwScopeImageSourceEnabled(): boolean {
return this.nsfwScopeImageSourceEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isNsfwScopeImageSourceEnabled 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#... | public isNsfwScopeImageSourceEnabled(): boolean {
return this.nsfwScopeImageSourceEnabled;
} | https://github.com/DaLongZhuaZi/manxia | baf5039b1d7209a832984d91920ad2ca32df0b71 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array from FixedArray<number>
@param { FixedArray<number> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Uint32Array.doubleToInt(numbers[i]))
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<number>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, Uint32Array.doubleToInt(numbers[i]))
}
} | https://gitcode.com/iop123123/arkts-static-skills | c74fdb69215b065ebbc7c28e86d9ec5bdfd0edc4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | getColumnSetterMap | [性能优化] 懒初始化列名→setter函数的映射表
将130+ if-else字符串比较替换为 O(1) Map查找 | private getColumnSetterMap(): Map<string, (record: GenericQueryRecord, value: DatabaseValue) => void> {
if (this.columnSetterMap) {
return this.columnSetterMap;
}
const m = new Map<string, (record: GenericQueryRecord, value: DatabaseValue) => void>();
// 通用字段
m.set('id', (r: GenericQueryReco... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getColumnSetterMap 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#instantiation_ex... | private getColumnSetterMap(): Map<string, (record: GenericQueryRecord, value: DatabaseValue) => void> {
if (this.columnSetterMap) {
return this.columnSetterMap;
}
const m = new Map<string, (record: GenericQueryRecord, value: DatabaseValue) => void>();
// 通用字段
m.set('id', (r: GenericQueryReco... | https://github.com/DaLongZhuaZi/manxia | 6bf0264b8dea57132528187bdb4908209a4b7ab0 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/KeyboardMapper.ets | arkts | processKeyEvent | Process a key event from HarmonyOS | processKeyEvent(keyCode: number, isDown: boolean): boolean {
// Update modifier states
switch (keyCode) {
case 59: // Shift
this.shiftPressed = isDown;
break;
case 113: // Ctrl
this.ctrlPressed = isDown;
break;
case 57: // Alt
this.altPressed = isDown;... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | processKeyEvent(keyCode: number, isDown: boolean): boolean {
// Update modifier states
switch (keyCode) {
case 59: // Shift
this.shiftPressed = isDown;
break;
case 113: // Ctrl
this.ctrlPressed = isDown;
break;
case 57: // Alt
this.altPressed = isDown;... | https://github.com/tangwengang-del/freerdp-harmonyos | 878050fa069260d64d2f72c2868826d9d4d7f1ef | github |
LZZLHY/hlib | entry/src/main/ets/api/HttpClient.ets | arkts | setFailover | 注入域名漂移策略(EntryAbility 启动时调一次)。 | setFailover(failover: DomainFailover): void {
this.failover = failover;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFailover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left failover AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DomainFailover AST#identifier#Right AST#... | setFailover(failover: DomainFailover): void {
this.failover = failover;
} | https://github.com/LZZLHY/hlib | e7fb782f2742cdc3b6eb900558383b901566f764 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets | arkts | increaseCapacityTo | Increases the capacity of the LightWeightMap to the specified minimum capacity
@param minimumCapacity the minimum capacity to increase to | increaseCapacityTo(minimumCapacity: int): void {
if (minimumCapacity > Int.MAX_VALUE) {
return;
}
this.buckets.increaseCapacityTo(minimumCapacity);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increaseCapacityTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minimumCapacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right A... | increaseCapacityTo(minimumCapacity: int): void {
if (minimumCapacity > Int.MAX_VALUE) {
return;
}
this.buckets.increaseCapacityTo(minimumCapacity);
} | https://gitcode.com/iop123123/arkts-static-skills | 182cb761902e9416fa78d5431b38d6f10e76e8a6 | gitcode |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_namespace/user/main.ets | arkts | primitives_noreturn | namespace2 | function primitives_noreturn() {
namespace2Test.inner.Primitives_noreturn(
(1).toInt(), (2).toDouble(), true, "hello", (3).toByte())
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left primitives_noreturn 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#express... | function primitives_noreturn() {
namespace2Test.inner.Primitives_noreturn(
(1).toInt(), (2).toDouble(), true, "hello", (3).toByte())
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | e0961ed21ad8045f3c4c2ca2d3b90d98f51beca3 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/I18nManager.ets | arkts | tf2 | 模板格式化(2个参数):替换翻译字符串中的 ${k1} 和 ${k2} 占位符。 | tf2(key: string, k1: string, v1: string | number, k2: string, v2: string | number): string {
let result = this.t(key);
result = result.replace(`\${${k1}}`, String(v1));
result = result.replace(`\${${k2}}`, String(v2));
return result;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left tf2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ... | tf2(key: string, k1: string, v1: string | number, k2: string, v2: string | number): string {
let result = this.t(key);
result = result.replace(`\${${k1}}`, String(v1));
result = result.replace(`\${${k2}}`, String(v2));
return result;
} | https://github.com/richshaw2015/nds | 35955b65e9129d5e49148c2b1fee9e075893c0b0 | github |
xufei5789651/HmWan | commons/utils/src/main/ets/manager/PreferenceManager.ets | arkts | hasValue | 是否包含名为给定Key的存储键值对
@param key
@returns | async hasValue(context: Context, key: string): Promise<boolean> {
this.initPreference(context, PREFERENCES_NAME);
return this.preferences!.has(key);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left hasValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context A... | async hasValue(context: Context, key: string): Promise<boolean> {
this.initPreference(context, PREFERENCES_NAME);
return this.preferences!.has(key);
} | https://github.com/xufei5789651/HmWan | 5f176df0e17b473377d3833d7fa77d6287154fbb | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test16_original_index.ets | arkts | bubbleSort | --- Bubble sort (nested loops with swap) --- | function bubbleSort(arr: number[]): number[] {
let n: number = arr.length;
for (let i: number = 0; i < n - 1; i++) {
for (let j: number = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
let temp: number = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
retur... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left bubbleSort AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function bubbleSort(arr: number[]): number[] {
let n: number = arr.length;
for (let i: number = 0; i < n - 1; i++) {
for (let j: number = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
let temp: number = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
retur... | https://github.com/miaochiahao/ark-ghidra | 4e7dbb2e442b5fa73da05369694952467747ff14 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | every | Checks that all elements of Uint8Array satisfy the passed function
@param fn check function
@returns true if all elements satisfy fn | public every(fn: (element: number, index: int, array: Uint8Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every 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#Rig... | public every(fn: (element: number, index: int, array: Uint8Array) => boolean): boolean {
for (let i = 0; i < this.length; ++i) {
if (!fn(this.at(i), i, this)) {
return false
}
}
return true
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 94eea4ae20fc2d2201a0966381fe12f0232d1f43 | gitee |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/WYCrypto.ets | arkts | linuxapi | linuxapi 加密(AES-128-ECB)
@param obj 要加密的对象
@returns 加密后的 eparams 字符串(大写HEX) | public static async linuxapi(obj: ESObject): Promise<string> {
try {
// 1. 将对象转为 JSON 字符串
const text = JSON.stringify(obj);
const textData = WYCrypto.stringToUint8Array(text);
// 2. 创建对称密钥生成器
const symKeyGenerator = cryptoFramework.createSymKeyGenerator('AES128');
// 3. 生成密钥(... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left linuxapi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#i... | public static async linuxapi(obj: ESObject): Promise<string> {
try {
// 1. 将对象转为 JSON 字符串
const text = JSON.stringify(obj);
const textData = WYCrypto.stringToUint8Array(text);
// 2. 创建对称密钥生成器
const symKeyGenerator = cryptoFramework.createSymKeyGenerator('AES128');
// 3. 生成密钥(... | https://github.com/cpdd5201314/harmonyOS-music-app | b332ee9d8551801ad53faa8973ad45c2d4ed2189 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | setChatFontSize | 设置聊天字体大小 | async setChatFontSize(size: number): Promise<void> {
await this.setNumber(PreferenceKeys.CHAT_FONT_SIZE, size)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setChatFontSize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left size AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async setChatFontSize(size: number): Promise<void> {
await this.setNumber(PreferenceKeys.CHAT_FONT_SIZE, size)
} | https://github.com/LongLiveY96/chatcube | 5cdc021257e1701e4dcefe99aa7ec03f6fa97e37 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets | arkts | getSettings | 获取当前动画设置 | public getSettings(): AnimationSettings {
return this.copySettings(this.currentSettings);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSettings 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 AnimationS... | public getSettings(): AnimationSettings {
return this.copySettings(this.currentSettings);
} | https://github.com/DaLongZhuaZi/manxia | d7631053dcb569ce839537f192d218eded82bbaf | github |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets | arkts | setNeutralColor | TODO
It is necessary to implement ColorsList class that will encapsulate
colors list functionality, because It's wrong to copy paste setColor,
addColor, ... resetColors for each time when we want to add a coloring
options for one of objects
@author Mesrop
BELOW THIS COLOR HANDLING
Sets the one and ONLY color that shoul... | public setNeutralColor(color: number): void {
this.mNeutralColor = color;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNeutralColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setNeutralColor(color: number): void {
this.mNeutralColor = color;
} | https://gitee.com/openharmony-sig/smartperf.git | 956cf7cc58f38629c3c25690b3f6eba3c87639e3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/components/backup/BackupOptionsDialog.ets | arkts | toggleSelectAll | 切换全选状态 | toggleSelectAll(): void {
this.isAllSelected = !this.isAllSelected;
// 更新所有选项
this.backupOptions.includeBasicData = this.isAllSelected;
this.backupOptions.includeMangaLibrary = this.isAllSelected;
this.backupOptions.includeNovelLibrary = this.isAllSelected;
this.backupOptions.includeEBook... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSelectAll 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_bl... | toggleSelectAll(): void {
this.isAllSelected = !this.isAllSelected;
// 更新所有选项
this.backupOptions.includeBasicData = this.isAllSelected;
this.backupOptions.includeMangaLibrary = this.isAllSelected;
this.backupOptions.includeNovelLibrary = this.isAllSelected;
this.backupOptions.includeEBook... | https://github.com/DaLongZhuaZi/manxia | 5784912b6ac9a96b9c0929bc5de9743da449bafa | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/manager/ComponentDetailManager.ets | arkts | updateDetailViewModelMap | 更新详情视图模型
@param key string
@param value CardComponentDetailViewModel | public updateDetailViewModelMap(key: string, value: CardComponentDetailViewModel) {
this.detailViewModelMap.set(key, value)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateDetailViewModelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public updateDetailViewModelMap(key: string, value: CardComponentDetailViewModel) {
this.detailViewModelMap.set(key, value)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 917842601c6c27e1b0dbc551f537b8309fa92f39 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_short.ets | arkts | main | ---
desc: check addition of two short integers
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a + b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a + b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fbe2e3b9272dfb924696630e92dd288c513edef7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | getCacheData | 获取缓存数据(测试用) | public async getCacheData(key: string): Promise<Record<string, string | number | boolean | string[] | number[]> | null> {
try {
if (!this.testCache) {
return null;
}
const data = this.testCache.get(key) || null;
logger.debug(TAG, `获取缓存数据: ${key}, 存在: ${data !== null}`);
retur... | 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 getCacheData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:... | public async getCacheData(key: string): Promise<Record<string, string | number | boolean | string[] | number[]> | null> {
try {
if (!this.testCache) {
return null;
}
const data = this.testCache.get(key) || null;
logger.debug(TAG, `获取缓存数据: ${key}, 存在: ${data !== null}`);
retur... | https://github.com/DaLongZhuaZi/manxia | 6963658c0d97493ce5dd16190c60c199a7128f63 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/MainViewMdoel.ets | arkts | onSuccess | 成功回调函数 | onSuccess(viewModel, result) {
console.info('Http result:' + result)
//改写myProfile数据,使用重新赋值的方法,以刷新页面
let user: User = new User()
user.fromJSON(result)
viewModel.myProfile = user
viewModel.isProfileInit = true
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewModel AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left result AST#identifier#Right AST#)#Left ) AST#)#Right AST#... | onSuccess(viewModel, result) {
console.info('Http result:' + result)
//改写myProfile数据,使用重新赋值的方法,以刷新页面
let user: User = new User()
user.fromJSON(result)
viewModel.myProfile = user
viewModel.isProfileInit = true
} | https://gitee.com/openharmony-sig/online_event.git | 0bebaf9e16060a3d8218bbc52672fde777a0c7d2 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | showDialog | 显示弹框
@param showDialogOptions
@returns | public static showDialog(showDialogOptions: promptAction.ShowDialogOptions): Promise<ShowDialogSuccessResponse> {
if (CommonUtils.uiContext) {
return CommonUtils.uiContext.getPromptAction().showDialog(showDialogOptions).catch((error: Error) => {
hilog.error(DOMAIN, TAG, `uiContext showDialog error: ... | 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 showDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left showDialogOptions AST#identifier... | public static showDialog(showDialogOptions: promptAction.ShowDialogOptions): Promise<ShowDialogSuccessResponse> {
if (CommonUtils.uiContext) {
return CommonUtils.uiContext.getPromptAction().showDialog(showDialogOptions).catch((error: Error) => {
hilog.error(DOMAIN, TAG, `uiContext showDialog error: ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L105-L117 | eb5a54da7c1d69b522d09be757247ce431d56968 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | getDisplays | 获取服务器可用的显示器列表 (Sunshine 专用功能)
@returns 显示器信息列表 | async getDisplays(): Promise<DisplayInfo[]> {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'displays');
// 使用客户端证书
const response = await this.doRequest(url, {
transferTimeout: NvHttp.LONG_CONNECTION_TIMEOUT,
useClientCert: true
});
// 解析 JSON 响应
const json = JSON.p... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDisplays AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getDisplays(): Promise<DisplayInfo[]> {
const url = this.buildUrl(await this.getHttpsBaseUrl(), 'displays');
// 使用客户端证书
const response = await this.doRequest(url, {
transferTimeout: NvHttp.LONG_CONNECTION_TIMEOUT,
useClientCert: true
});
// 解析 JSON 响应
const json = JSON.p... | https://github.com/AlkaidLab/moonlight-harmony | 0fe1cfd32d38a4af33a1227e6abe127f469c1d54 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | includes | Checks if specified argument is in Int16Array
@param e search element
@returns true if e is in Int16Array, false otherwise | public includes(e: number): boolean {
return this.includes(e as double as int as short, 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number): boolean {
return this.includes(e as double as int as short, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fdafcbf5e9cd160c6bc908a426db2cd3dfd599f6 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | registerColumn | 注册列元数据
@param entityName 实体类名
@param column 列元数据
@throws EntityNotRegisteredError 如果实体未注册 | registerColumn(entityName: string, column: ColumnMetadata): void {
const metadata = this.getEntityOrThrow(entityName)
metadata.addColumn(column)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AS... | registerColumn(entityName: string, column: ColumnMetadata): void {
const metadata = this.getEntityOrThrow(entityName)
metadata.addColumn(column)
} | https://github.com/offlinecat-dev/OCNetORM | 2818c7fe08f4783c9167963f021a59404c0e17a1 | github |
silence17/harmonydemo | common_lib/src/main/ets/utils/axios/HttpClient.ets | arkts | _processParam | @param {Object} param 接口调用方传递的参数 | private _processParam(args: RequestParam<T>, method = "get") {
if (!args.url) throw new Error("API 请求缺少url参数");
switch (method) {
case "get":
let paramStr = ""
for (let key in args.params.keys()) {
paramStr = paramStr + key + "=" + args.params[key] + "&"
}
if (... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _processParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_e... | private _processParam(args: RequestParam<T>, method = "get") {
if (!args.url) throw new Error("API 请求缺少url参数");
switch (method) {
case "get":
let paramStr = ""
for (let key in args.params.keys()) {
paramStr = paramStr + key + "=" + args.params[key] + "&"
}
if (... | https://github.com/silence17/harmonydemo | 63d867e7e95535a15b1248efa730930cc8962564 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | fetchAndAddSize | Atomically increments the queue size and returns the previous value.
Uses the internal atomic counter shared by producers and consumers.
@returns { int } The previous queue size before the increment is applied,
and before the new element count becomes visible.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private fetchAndAddSize(): int {
return this.actualSize.fetchAdd(1);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fetchAndAddSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int... | private fetchAndAddSize(): int {
return this.actualSize.fetchAdd(1);
} | https://gitcode.com/iop123123/arkts-static-skills | 4aa70bf072f2ed15d2382c5eb2b0d4d21e6db4cc | gitcode |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets | arkts | queryOrientationByDisplay | 通过资源管理器查询显示方向 | queryOrientationByDisplay(): void {
try {
let displayClass: display.Display | null = display.getDefaultDisplaySync();
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testLog', `Failed to query display orientation. Code: ${err.code}, message: ${err.message}`);
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left queryOrientationByDisplay 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#st... | queryOrientationByDisplay(): void {
try {
let displayClass: display.Display | null = display.getDefaultDisplaySync();
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testLog', `Failed to query display orientation. Code: ${err.code}, message: ${err.message}`);
}
... | https://github.com/ZestBox-18/kitebook-frontend | 5d03ed3e3c852a8666cd7845ed619e072c51e4f2 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/DownloadsViewModel.ets | arkts | saveImageToGallery | 将沙箱文件保存到系统相册 | private async saveImageToGallery(localPath: string, title: string) {
if (!localPath || !this.context) return;
try {
// 文件存在性校验
logger.info(`[SaveDebug] 准备保存. 路径: ${localPath}`);
const isExist = fs.accessSync(localPath);
logger.info(`[SaveDebug] 文件是否存在: ${isExist}`);
if (!isExist... | 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 saveImageToGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localPath AST#identifier#Right AST#ERROR#Left AST... | private async saveImageToGallery(localPath: string, title: string) {
if (!localPath || !this.context) return;
try {
// 文件存在性校验
logger.info(`[SaveDebug] 准备保存. 路径: ${localPath}`);
const isExist = fs.accessSync(localPath);
logger.info(`[SaveDebug] 文件是否存在: ${isExist}`);
if (!isExist... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L493-L541 | b4586c6f8e38690e8986a054da427dcde66e02b2 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/notification/NotificationDemo.ets | arkts | startAbility_appSettings_withDialog | 打开当前 app 的设置页(先弹出提示用的对话框) | startAbility_appSettings_withDialog() {
promptAction.showDialog({
title: '提示',
message: '需要在设置页中允许通知',
buttons: [
{ text: '好的', color: '#ff0000' },
],
}, (err, data) => {
if (err) {
return;
}
this.startAbility_appSettings()
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAbility_appSettings_withDialog 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 AS... | startAbility_appSettings_withDialog() {
promptAction.showDialog({
title: '提示',
message: '需要在设置页中允许通知',
buttons: [
{ text: '好的', color: '#ff0000' },
],
}, (err, data) => {
if (err) {
return;
}
this.startAbility_appSettings()
});
} | https://github.com/webabcd/HarmonyDemo | 07911f9cd2666fb3d65272b7fc3420e317b0411e | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | skipRest | 跳过休息阶段,直接进入下一轮专注 | skipRest(): void {
if (this.state !== FocusState.RESTING) return;
this.cleanupTimer();
this.start(this.currentWorkDuration, this.currentRestDuration, this.todoId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left skipRest 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#Lef... | skipRest(): void {
if (this.state !== FocusState.RESTING) return;
this.cleanupTimer();
this.start(this.currentWorkDuration, this.currentRestDuration, this.todoId);
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L94-L98 | ffd01ee8f7018680bbbda118b140ebb39b8c2983 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentSourceViewModel.ets | arkts | unregisterDataChangeListener | 销毁数据变化监听器
@param dataChangeListeners DataChangeListener | public unregisterDataChangeListener(dataChangeListeners: DataChangeListener): void {
const pos: number = this.dataChangeListeners.indexOf(dataChangeListeners)
if (pos >= 0) {
this.dataChangeListeners.splice(pos, 1)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataChangeListeners AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | public unregisterDataChangeListener(dataChangeListeners: DataChangeListener): void {
const pos: number = this.dataChangeListeners.indexOf(dataChangeListeners)
if (pos >= 0) {
this.dataChangeListeners.splice(pos, 1)
}
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 82121ac3e190508ea98d4e095c2cf03276861c9c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | byteLength | Read-only property for the byte length of the ArrayBuffer.
@returns { int } The byte length.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get byteLength(): int {
return this._byteLength
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left byteLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | get byteLength(): int {
return this._byteLength
} | https://gitcode.com/iop123123/arkts-static-skills | 0f496608813890c1d3161fd873e63d932e64510e | gitcode |
bhengubv/aether-protocol | arkts/src/main/ets/incentive/TipPacketPayload.ets | arkts | toJsonString | Serialises the payload to its snake_case UTF-8 JSON wire form. Keys are emitted
in a fixed order matching the C# serializer; `reference_id` and `signature` are
omitted when absent. | toJsonString(): string {
let json: string = '{';
json += `"tipper_uhid":${jsonString(this.tipperUhid)},`;
json += `"recipient_uhid":${jsonString(this.recipientUhid)},`;
json += `"amount":${jsonString(this.amount)},`;
json += `"traffic_type":${jsonString(this.trafficType)},`;
json += `"timestam... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJsonString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | toJsonString(): string {
let json: string = '{';
json += `"tipper_uhid":${jsonString(this.tipperUhid)},`;
json += `"recipient_uhid":${jsonString(this.recipientUhid)},`;
json += `"amount":${jsonString(this.amount)},`;
json += `"traffic_type":${jsonString(this.trafficType)},`;
json += `"timestam... | https://github.com/bhengubv/aether-protocol | e4db404b11eedb71a2226671e91864507ab157d9 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/SmartCurtainController.ets | arkts | getDeviceStatus | 获取窗帘设备状态 | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
properties.set('openLevel', {
key: 'openLevel',
value: 0,
u... | 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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left... | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
properties.set('openLevel', {
key: 'openLevel',
value: 0,
u... | https://github.com/LJ666-ui/harmony-health-care | 892ca497e7eb117f1f453e512e69675d2779799a | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/models/user/UserModel.ets | arkts | fromJSON | 从JSON格式的string获取内容
@param json json格式的string | public fromJSON(json: string) {
let rootObj = JSON.parse(json)
this._path = rootObj.login
this._name = rootObj.name
this._remark = rootObj.remark
this._avatar = rootObj.avatar_url
this._blog = rootObj.blog
this._weibo = rootObj.weibo
this._bio = rootObj.bio
this._email = rootObj.e... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fromJSON 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 ... | public fromJSON(json: string) {
let rootObj = JSON.parse(json)
this._path = rootObj.login
this._name = rootObj.name
this._remark = rootObj.remark
this._avatar = rootObj.avatar_url
this._blog = rootObj.blog
this._weibo = rootObj.weibo
this._bio = rootObj.bio
this._email = rootObj.e... | https://gitee.com/openharmony-sig/online_event.git | c437757042be07dbce98c71a198eef5c2cf72f76 | gitee |
openharmony/arkui_ace_engine | examples/ImageAnimator/entry/src/main/ets/pages/example/ImageAnimatorTest011.ets | arkts | getActualIterations | 获取实际生效的 iterations 值 | getActualIterations(): number | string {
if (this.testIterations === -1) {
return -1; // 无限循环
}
if (this.testIterations < -1) {
return 1; // 小于 -1 取默认值
}
if (this.testIterations === 0) {
return 0; // 0 次
}
if (this.testIterations > 0 && this.testIterations < 1) {
re... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getActualIterations 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#n... | getActualIterations(): number | string {
if (this.testIterations === -1) {
return -1; // 无限循环
}
if (this.testIterations < -1) {
return 1; // 小于 -1 取默认值
}
if (this.testIterations === 0) {
return 0; // 0 次
}
if (this.testIterations > 0 && this.testIterations < 1) {
re... | https://gitcode.com/openharmony/arkui_ace_engine | e96b601016b7dad88902fcdeb5ef1177691f0f84 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/InteractionManager.ets | arkts | getIntensityDisplayName | 获取强度显示名称 | public static getIntensityDisplayName(intensity: VibrationIntensity): string {
const names: Record<VibrationIntensity, string> = {
[VibrationIntensity.LEVEL_1]: '1档',
[VibrationIntensity.LEVEL_2]: '2档',
[VibrationIntensity.LEVEL_3]: '3档',
[VibrationIntensity.LEVEL_4]: '4档',
[Vibratio... | 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 getIntensityDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intensity AST#identifier#Right ... | public static getIntensityDisplayName(intensity: VibrationIntensity): string {
const names: Record<VibrationIntensity, string> = {
[VibrationIntensity.LEVEL_1]: '1档',
[VibrationIntensity.LEVEL_2]: '2档',
[VibrationIntensity.LEVEL_3]: '3档',
[VibrationIntensity.LEVEL_4]: '4档',
[Vibratio... | https://github.com/DaLongZhuaZi/manxia | 60e4124f33ac38198b46420d754153bc484e03fd | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | postForm | POST 表单(用于 MessageBus 长轮询) | async postForm(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000
): Promise<Record<string, Object>> {
await this.cookieStore.init();
const url: string = `${this.baseUrl}${path}`;
const body: string = this.encod... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left postForm AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async postForm(
path: string,
form: Record<string, Object>,
extraHeaders: Record<string, string> | null = null,
readTimeoutMs: number = 60000
): Promise<Record<string, Object>> {
await this.cookieStore.init();
const url: string = `${this.baseUrl}${path}`;
const body: string = this.encod... | https://github.com/Amaz1ny/HarmonyDO-public | a1c61c0e9fdc81e589fa2ad83eff4f0c47bcfe28 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test53_original_index.ets | arkts | factTail | --- Factorial tail recursion --- | function factTail(n: number, acc: number): number {
if (n <= 1) {
return acc;
}
return factTail(n - 1, acc * n);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left factTail 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 AST#... | function factTail(n: number, acc: number): number {
if (n <= 1) {
return acc;
}
return factTail(n - 1, acc * n);
} | https://github.com/miaochiahao/ark-ghidra | 33cb0314c3509d966175425a5215691fb58cc83c | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AnimationUtils.ets | arkts | withDelay | 获取延迟动画配置
@param baseConfig 基础配置
@param delay 延迟时间(毫秒)
@returns 带延迟的动画配置 | static withDelay(baseConfig: AnimationConfig, delay: number): AnimationConfig {
return {
...baseConfig,
delay
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left withDelay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left baseConfig AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static withDelay(baseConfig: AnimationConfig, delay: number): AnimationConfig {
return {
...baseConfig,
delay
};
} | https://github.com/the-wwyang/kids-learning-app | 89d5c4ab9ed026c3446f96a483ff7bca767d6e22 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/BillDAO.ets | arkts | getByPage | 分页查询账单
@param userId 用户 ID
@param page 页码(从 1 开始)
@param pageSize 每页大小(默认 20)
@param dateRange 可选的日期范围过滤
@param categoryId 可选的分类 ID 过滤
@returns 分页结果
@throws
性能优化:
- 使用 idx_bills_date 索引优化排序
- 使用 LIMIT + OFFSET 实现分页
- 单次查询同时获取总数和数据 | static async getByPage(
userId: number,
page: number = 1,
pageSize: number = 20,
dateRange?: DateRangeFilter,
categoryId?: number
): Promise<PaginatedResult<Bill>> {
console.log(`[BillDAO] 分页查询账单 - 用户: ${userId}, 页码: ${page}, 每页: ${pageSize}`);
try {
const store = DatabaseManager.... | 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 getByPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:... | static async getByPage(
userId: number,
page: number = 1,
pageSize: number = 20,
dateRange?: DateRangeFilter,
categoryId?: number
): Promise<PaginatedResult<Bill>> {
console.log(`[BillDAO] 分页查询账单 - 用户: ${userId}, 页码: ${page}, 每页: ${pageSize}`);
try {
const store = DatabaseManager.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b7da5352d77176713d41259338de9d57f8e7825c | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/ParentApiClient.ets | arkts | setHttpRequester | Override the binary http path; tests inject a stub. | setHttpRequester(r: IHttpRequester): void {
this.httpRequester = r;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHttpRequester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left r AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IHttpRequester AST#identifier#Right AST#)#... | setHttpRequester(r: IHttpRequester): void {
this.httpRequester = r;
} | https://github.com/terryma2024/happyword | 7ef67a7ff351f988eeaec0f74b93626ee054a9e8 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V30.ets | arkts | handleType | vCard 3.0 defines
param = param-name "=" param-value *("," param-value)
param-name = iana-token / x-name
param-value = ptext / quoted-string
quoted-string = DQUOTE QSAFE-CHAR DQUOTE
QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-ASCII
; Any character except CTLs, DQUOTE
QSAFE-CHAR must not contain DQUOTE, incl... | protected handleType(property:VCardProperty , paramValue:string):void {
this.splitAndPutParam(property, VCardConstants.PARAM_TYPE, paramValue);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left property AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | protected handleType(property:VCardProperty , paramValue:string):void {
this.splitAndPutParam(property, VCardConstants.PARAM_TYPE, paramValue);
} | https://gitee.com/openharmony-tpc/VCard.git | 69d3b19bdd8ccf7db84843353272a2a95850c88b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceField.ets | arkts | constructor | Private constructor, direct calls are prohibited.
@throws { Error } Direct calls to the InstanceField constructor are prohibited. | private constructor() { throw new Error("InstanceField constructor called") } | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() { throw new Error("InstanceField constructor called") } | https://gitcode.com/iop123123/arkts-static-skills | 103824cd38180029911bcef715f9745f9bc3347d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getHighlightForX | Returns the corresponding Highlight for a given xVal and x- and y-touch position in pixels.
@param xVal
@param x
@param y
@return | protected getHighlightForX(xVal: number, x: number, y: number): Highlight | null {
let closestValues: JArrayList<Highlight> | null = this.getHighlightsAtXValue(xVal, x, y);
if (!closestValues || closestValues.isEmpty()) {
return null;
}
let leftAxisMinDist: number = this.getMinimumDistance(cl... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getHighlightForX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xVal AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | protected getHighlightForX(xVal: number, x: number, y: number): Highlight | null {
let closestValues: JArrayList<Highlight> | null = this.getHighlightsAtXValue(xVal, x, y);
if (!closestValues || closestValues.isEmpty()) {
return null;
}
let leftAxisMinDist: number = this.getMinimumDistance(cl... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6b529582e3d32766707b6e93b48f275b969df457 | gitee |
richshaw2015/nds | ohos/entry/src/test/SyncToNativeProperty.test.ets | arkts | generateValueForKey | Generate a value matching the type of a given setting key | function generateValueForKey(rng: PRNG, key: string): SettingValue {
const def = SETTINGS_DEFINITIONS[key];
if (!def) {
return 'fallback';
}
switch (def.type) {
case SettingType.BOOLEAN:
return rng.next() > 0.5;
case SettingType.NUMBER:
return rng.nextInt(-100, 1000);
case SettingTyp... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateValueForKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function generateValueForKey(rng: PRNG, key: string): SettingValue {
const def = SETTINGS_DEFINITIONS[key];
if (!def) {
return 'fallback';
}
switch (def.type) {
case SettingType.BOOLEAN:
return rng.next() > 0.5;
case SettingType.NUMBER:
return rng.nextInt(-100, 1000);
case SettingTyp... | https://github.com/richshaw2015/nds | a8aec4ccc5a18323648f58490e77e3ef27f6725f | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningService.ets | arkts | calculateAccuracy | 计算正确率 | public calculateAccuracy(correctCount: number, totalCount: number): number {
if (totalCount === 0) return 0;
return Math.round((correctCount / totalCount) * 100);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculateAccuracy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left correctCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | public calculateAccuracy(correctCount: number, totalCount: number): number {
if (totalCount === 0) return 0;
return Math.round((correctCount / totalCount) * 100);
} | https://github.com/the-wwyang/kids-learning-app | 580bb2f0346da7274d0981555302d58a6c7d8d39 | github |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/converter/OmniFilterConverter.ets | arkts | getCurrentSelectedFilterParams | 获取当前选中项的筛选数据 | function getCurrentSelectedFilterParams(filterItem: OmniFilterItemBean): Map<string, string> {
const params = new Map<string, string>();
const parentKey = filterItem.key;
const selectedEntities = filterItem.children
.filter(child => child.isSelected && !TextUtils.isBlank(child.value))
.map(child => child... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getCurrentSelectedFilterParams AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filterItem AST#identifier#Right AST#type_annotation#Lef... | function getCurrentSelectedFilterParams(filterItem: OmniFilterItemBean): Map<string, string> {
const params = new Map<string, string>();
const parentKey = filterItem.key;
const selectedEntities = filterItem.children
.filter(child => child.isSelected && !TextUtils.isBlank(child.value))
.map(child => child... | https://github.com/wuba/omni-ui | 5e7fe67e9915b9ba4175d3ee1060e12c40247d1b | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | limitRectInRotatedBasedOnPoint | Based on point rotating, limit rect.
@param baseIndex
@param rect
@param rotatedLines | static limitRectInRotatedBasedOnPoint(baseIndex: number, rect: RectF, rotatedLines: Array<LineSegment>): void {
let points = MathUtils.rectToPoints(rect);
let base = points[baseIndex];
points.splice(baseIndex, 1);
let scale = 1;
for (let point of points) {
let line = new LineSegment(base, po... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left limitRectInRotatedBasedOnPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ... | static limitRectInRotatedBasedOnPoint(baseIndex: number, rect: RectF, rotatedLines: Array<LineSegment>): void {
let points = MathUtils.rectToPoints(rect);
let base = points[baseIndex];
points.splice(baseIndex, 1);
let scale = 1;
for (let point of points) {
let line = new LineSegment(base, po... | https://gitee.com/openharmony/codelabs.git | d0bfd6842d3e6abdcb88e0e8914441985275e30e | gitee |
genjishare/snake-game | entry/src/main/ets/common/service/GameStateManager.ets | arkts | isGameStateInitialized | 检查游戏状态是否已初始化 | public isGameStateInitialized(): boolean {
return this.isInitialized;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGameStateInitialized 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 bo... | public isGameStateInitialized(): boolean {
return this.isInitialized;
} | https://github.com/genjishare/snake-game | eeb4358740e7b321519ff1753594619918a746cc | github |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/ShouYe/HomeTab.ets | arkts | build | 新增搜索关键字状态 | build() {
Scroll() {
Column() {
HomeHeaderComponent({
onSearch: (keyword: string) => {
this.searchKeyword = keyword; // 更新搜索关键字
}
})
DepartmentGridComponent({
selectedDepartment: this.selectedDept,
onSelect: (name: string) => {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Scroll() {
Column() {
HomeHeaderComponent({
onSearch: (keyword: string) => {
this.searchKeyword = keyword; // 更新搜索关键字
}
})
DepartmentGridComponent({
selectedDepartment: this.selectedDept,
onSelect: (name: string) => {
... | https://github.com/luojiang001/Pulse | 1071d9f7d9c5938d4a12527c583670681ecc27cf | github |
openharmony/applications_app_samples | code/BasicFeature/Ability/AbilityRuntime/entry/src/main/ets/abilitylifecyclecallback/AbilityLifecycleCallback.ets | arkts | onAbilitySaveState | 注册监听应用上下文的生命周期后,在UIAbility的[onSaveState]触发后回调。 | onAbilitySaveState(ability: UIAbility) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onAbilitySaveState.');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAbilitySaveState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ability AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIAbility AST#ident... | onAbilitySaveState(ability: UIAbility) {
hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onAbilitySaveState.');
} | https://github.com/openharmony/applications_app_samples | 5ae32980dc588891b5265c72001fcdea4398d00e | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | getPlaybackSpeed | 获取当前播放速度 | getPlaybackSpeed(): number {
return this.playbackSpeed;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPlaybackSpeed 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#state... | getPlaybackSpeed(): number {
return this.playbackSpeed;
} | https://github.com/pangpang20/antennaPodHM | 7a051a0eb067a0b859d675fe834b4ab6536a7c71 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/accountants/AccountantsPresenter.ets | arkts | hideKeyboard | Hide the Keyboard to prevent occlusion dialogs. | hideKeyboard() {
inputMethod.getController().hideSoftKeyboard((err) => {
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left hideKeyboard 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 ... | hideKeyboard() {
inputMethod.getController().hideSoftKeyboard((err) => {
})
} | https://gitee.com/openharmony/applications_contacts.git | 18def74a4994c9e4fab25f367ac38bef1f9730e0 | gitee |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | 应用销毁时调用
释放应用上下文、注销路由
@returns {void} 无返回值 | onDestroy(): void {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le... | onDestroy(): void {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
} | https://github.com/Joker-x-dev/CoolMallArkTS | 1b79628f9229c2521e5aa67785927852a20b0198 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/WindowModel.ets | arkts | updateMainWinPreferredOrientation | 根据折叠屏的折叠状态,更新主窗口显示方向属性
@param curFoldStatus 当前折叠屏折叠状态
@returns {void} | updateMainWinPreferredOrientation(curFoldStatus: display.FoldStatus = display.getFoldStatus()): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow(async (err: BusinessError, mainWindow: window.Window) => {
let... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateMainWinPreferredOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left curFoldStatus AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | updateMainWinPreferredOrientation(curFoldStatus: display.FoldStatus = display.getFoldStatus()): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow(async (err: BusinessError, mainWindow: window.Window) => {
let... | https://gitcode.com/arkui-x/samples | 8a911717f1e8931aee55a140562037271d9d7e15 | gitcode |
openharmony/vendor_unionman | unionpi_tiger/sample_api10/app/dlna_app/DlnaPlayer/entry/src/main/ets/videomanager/AvPlayManager.ets | arkts | setUrl | 设置播放的URL | setUrl(url: string): void {
this.avPlayer!.url = url;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig... | setUrl(url: string): void {
this.avPlayer!.url = url;
} | https://gitee.com/openharmony/vendor_unionman.git | 1f2d54c5402e91a63e951b32ef31ef9c78dbf5b8 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/pages/CategoryManagement.ets | arkts | getParentDisplayName | 获取父分类显示名称 | getParentDisplayName(): string {
if (!this.editingCategory || this.editingCategory.parentCategoryId === 0) {
return '无(顶级分类)'
}
const parent = this.availableParents.find((cat: Category) =>
cat.categoryId === this.editingCategory!.parentCategoryId
)
return parent ? `${parent.icon} ${pa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getParentDisplayName 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#s... | getParentDisplayName(): string {
if (!this.editingCategory || this.editingCategory.parentCategoryId === 0) {
return '无(顶级分类)'
}
const parent = this.availableParents.find((cat: Category) =>
cat.categoryId === this.editingCategory!.parentCategoryId
)
return parent ? `${parent.icon} ${pa... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a00c32d111df76512e6c95c558b17cc82d640dee | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int16 with all elements.
@returns a new Int16Array with elements of current Int16Array | public slice(): Int16Array {
return new Int16Array(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public slice(): Int16Array {
return new Int16Array(this)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | db76fef64caee5919bc76622a65462f791e9a24b | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test42_original_index.ets | arkts | testObjectKeys | --- Object.keys iteration --- | function testObjectKeys(): string {
let data: Record<string, number> = {};
data['x'] = 10;
data['y'] = 20;
data['z'] = 30;
let keys: string[] = Object.keys(data);
let total: number = 0;
for (let i: number = 0; i < keys.length; i++) {
let k: string = keys[i];
total = total + data[k];
}
return S... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectKeys AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testObjectKeys(): string {
let data: Record<string, number> = {};
data['x'] = 10;
data['y'] = 20;
data['z'] = 30;
let keys: string[] = Object.keys(data);
let total: number = 0;
for (let i: number = 0; i < keys.length; i++) {
let k: string = keys[i];
total = total + data[k];
}
return S... | https://github.com/miaochiahao/ark-ghidra | 2f547f2169daed40461e0d374926ff565626ab8f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Queue.ets | arkts | constructor | Creates a new instance of Queue. | public constructor() {
this.buffer = new Deque<T>();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.buffer = new Deque<T>();
} | https://gitcode.com/iop123123/arkts-static-skills | 9c6d2cc4098daf923602260e9421dfd3f8c1d64e | gitcode |
XHXYT/Pixark | entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets | arkts | deleteById | 根据ID删除历史记录
用于精确删除某条记录
@param id 记录ID
@returns 删除的记录数量 | async deleteById(id: number): Promise<number> {
logger.debug('deleteById id = ' + id)
return this.deleteItem(this.getPredicates().equalTo('id', id))
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async deleteById(id: number): Promise<number> {
logger.debug('deleteById id = ' + id)
return this.deleteItem(this.getPredicates().equalTo('id', id))
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L176-L179 | 25dd2c5d202bc329ef4d4256833cb01e4707f683 | github |
zcg741/chengyu-game | entry/src/main/ets/pages/CollectionPage.ets | arkts | getPinyinInitials | 获取拼音首字母(如:Y X Y Y) | getPinyinInitials(pinyin: string): string {
if (!pinyin) return '';
return getInitialLettersFromPinyin(pinyin).join(' ');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPinyinInitials AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pinyin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le... | getPinyinInitials(pinyin: string): string {
if (!pinyin) return '';
return getInitialLettersFromPinyin(pinyin).join(' ');
} | https://github.com/zcg741/chengyu-game | 51fc63ea2578c6e7e5d689dd62db46b302c22616 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets | arkts | checkAllClickButtonStyle | Verify the display style of the Select All button. | checkAllClickButtonStyle() {
HiLog.i(TAG, 'checkAllClickButtonStyle start , and tabIndex is ' + this.tabInfo.tabIndex);
switch (this.tabInfo.tabIndex) {
case 0:
if (this.tabInfo.recentCount === this.tabInfo.recentTotal) {
HiLog.i(TAG, 'checkAllClickButtonStyle recent select all ');
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkAllClickButtonStyle 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... | checkAllClickButtonStyle() {
HiLog.i(TAG, 'checkAllClickButtonStyle start , and tabIndex is ' + this.tabInfo.tabIndex);
switch (this.tabInfo.tabIndex) {
case 0:
if (this.tabInfo.recentCount === this.tabInfo.recentTotal) {
HiLog.i(TAG, 'checkAllClickButtonStyle recent select all ');
... | https://gitee.com/openharmony/applications_contacts.git | a9a700598e21d1459a927e60002d2c0415c089d9 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | link | The link() method creates a string that embeds a string in an <a> element (<a href="...">str</a>), to be used as a hypertext link to another URL. | public link(link: String): String{
return this.CreateHTMLString("a", " href=\"" + link + "\"")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left link AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left link AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public link(link: String): String{
return this.CreateHTMLString("a", " href=\"" + link + "\"")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fb852e3305183e7e5b66957c1c1a29c5b54e231c | gitee |
LZZLHY/hlib | entry/src/main/ets/utils/SecretStore.ets | arkts | init | 读取 / 生成 master key。EntryAbility.onCreate 必须最早调一次。 | static async init(): Promise<void> {
if (SecretStore.initialized) {
return;
}
SecretStore.initialized = true;
try {
const exists: boolean = await SecretStore.hasKey();
if (!exists) {
await SecretStore.generateKey();
Logger.i(TAG, 'master key generated in HUKS');
... | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | static async init(): Promise<void> {
if (SecretStore.initialized) {
return;
}
SecretStore.initialized = true;
try {
const exists: boolean = await SecretStore.hasKey();
if (!exists) {
await SecretStore.generateKey();
Logger.i(TAG, 'master key generated in HUKS');
... | https://github.com/LZZLHY/hlib | a9e5dadb864a13a0528063aa61bd7e69a331cb0e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets | arkts | generateSafeFileName | 生成安全的文件名 | private generateSafeFileName(bookId: string): string {
// 简单hash函数
let hash = 0;
for (let i = 0; i < bookId.length; i++) {
const char = bookId.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return `novel_cover_${Math.abs(hash).toString(16)}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateSafeFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private generateSafeFileName(bookId: string): string {
// 简单hash函数
let hash = 0;
for (let i = 0; i < bookId.length; i++) {
const char = bookId.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return `novel_cover_${Math.abs(hash).toString(16)}`;
} | https://github.com/DaLongZhuaZi/manxia | d7666b5863488741170a043f1a298061cf3b6567 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | mergeServerInfo | ═══════════════════════════════════════════════════════════
合并入口(mergeServerInfo)
═══════════════════════════════════════════════════════════
把 ServerInfo 合并到一个已存在的 ComputerInfo 中。
这是**唯一**的服务器信息合并入口,对齐 Android `ComputerDetails.update()`:
- mDNS 发现已存在 PC(addComputerInternal 已有分支)
- mDNS 快速验证(verifyOrPollComputer)
- 周期性... | private mergeServerInfo(
target: ComputerInfo,
info: ServerInfo,
address: string,
httpPort?: number,
discoveredIpv6?: string
): void {
// 名称:仅在新值非空时覆盖
if (info.hostname) {
target.name = info.hostname;
}
// 当前活动地址:始终更新为本次成功连接的地址
target.address = address;
// 本地地址:过滤... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeServerInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private mergeServerInfo(
target: ComputerInfo,
info: ServerInfo,
address: string,
httpPort?: number,
discoveredIpv6?: string
): void {
// 名称:仅在新值非空时覆盖
if (info.hostname) {
target.name = info.hostname;
}
// 当前活动地址:始终更新为本次成功连接的地址
target.address = address;
// 本地地址:过滤... | https://github.com/AlkaidLab/moonlight-harmony | c5ec800f7d1a02e08fff03c3def4cb88de5c4981 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getHighlighted | Returns the array of currently highlighted values. This might a null or
empty array if nothing is highlighted.
@return | public getHighlighted(): Highlight[] | null {
return this.mIndicesToHighlight;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlighted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ... | public getHighlighted(): Highlight[] | null {
return this.mIndicesToHighlight;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 35facf9edb4468533d1279f400cf203b206c4aad | gitee |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/feature/charge/src/main/ets/view/ChargeItemDialogView.ets | arkts | pileStateTextColor | 区分不同状态的文本颜色 | pileStateTextColor(state: number) {
switch (state) {
case 0:
return $r('app.color.color_009688')
case 1:
return $r('app.color.color_d68751')
case 2:
return $r('app.color.color_F44336')
default:
return $r('app.color.color_009688')
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pileStateTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier... | pileStateTextColor(state: number) {
switch (state) {
case 0:
return $r('app.color.color_009688')
case 1:
return $r('app.color.color_d68751')
case 2:
return $r('app.color.color_F44336')
default:
return $r('app.color.color_009688')
}
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 48906a0f762683a3f829e377b843d8150e490e95 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | ensurePoolSize | 确保池子中有足够的题目 | private ensurePoolSize(poolKey: string, type: QuestionType, difficulty: Difficulty): void {
const pool = this.questionPools.get(poolKey) || [];
const currentSize = pool.length;
if (currentSize < this.poolConfig.minSize) {
// 补充题目到最大容量
const needCount = this.poolConfig.maxSize - currentSize;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensurePoolSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left poolKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private ensurePoolSize(poolKey: string, type: QuestionType, difficulty: Difficulty): void {
const pool = this.questionPools.get(poolKey) || [];
const currentSize = pool.length;
if (currentSize < this.poolConfig.minSize) {
// 补充题目到最大容量
const needCount = this.poolConfig.maxSize - currentSize;
... | https://github.com/the-wwyang/kids-learning-app | c6d6e2b7c22c7fbc5fce1f8fe726789b512dcca1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | valueToString | 将值转换为字符串,对象转为JSON字符串 | private valueToString(value: ESObject): string {
if (value === null || value === undefined) {
return '';
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
return String(value);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left valueToString 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#Lef... | private valueToString(value: ESObject): string {
if (value === null || value === undefined) {
return '';
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
return String(value);
} | https://github.com/DaLongZhuaZi/manxia | 019caddc7a16ad725a6a103997ea5e8cfbe97a97 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.