nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | constructor | `Date` constructor.
@param year
@param month
@param day
@param hours
@param minutes
@param seconds
@see ECMA-262, 21.4.2.1
@description Initialize `Date` instance with year, month, day, hours, minutes and seconds given. | constructor(year: long, month: long, day: long, hours: long, minutes: long, seconds: long) {
this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0 as long))
this.TZOffset = Date.getLocalTimezoneOffset()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#identifier#Right AST... | constructor(year: long, month: long, day: long, hours: long, minutes: long, seconds: long) {
this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0 as long))
this.TZOffset = Date.getLocalTimezoneOffset()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 60da2ae6158815aca1e5118ff9dbefb83bfb2331 | gitee |
codelably/HCompass | core/navigation/src/main/ets/NavigationService.ets | arkts | navigateTo | 路由跳转(入栈)
@param name 路由名称
@param params 跳转参数
@param options 导航选项
@returns 是否导航成功 | async navigateTo(name: string, params?: Unknown, options?: NavigateOptions): Promise<boolean> {
if (!this.stack) {
this.logError('Navigation stack is not initialized');
return false;
}
// 构建路由上下文
const context: RouteContext = {
targetRoute: name,
params,
fromRoute: this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left navigateTo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type... | async navigateTo(name: string, params?: Unknown, options?: NavigateOptions): Promise<boolean> {
if (!this.stack) {
this.logError('Navigation stack is not initialized');
return false;
}
// 构建路由上下文
const context: RouteContext = {
targetRoute: name,
params,
fromRoute: this.... | https://github.com/codelably/HCompass | fdf3027d28ede72986ec12d5e7641b73e4d557f8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/ComicInfoParser.ets | arkts | handleAttributeValue | 处理XML属性和属性值
@param name 属性名
@param value 属性值
@returns 是否继续解析 | private handleAttributeValue(name: string, value: string): boolean {
try {
// ComicInfo.xml通常不使用属性,但为了完整性保留此方法
logger.debug(TAG, `XML属性: ${name} = ${value}`);
return true;
} catch (error) {
logger.error(TAG, '处理XML属性值时出错' + error);
return true;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleAttributeValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private handleAttributeValue(name: string, value: string): boolean {
try {
// ComicInfo.xml通常不使用属性,但为了完整性保留此方法
logger.debug(TAG, `XML属性: ${name} = ${value}`);
return true;
} catch (error) {
logger.error(TAG, '处理XML属性值时出错' + error);
return true;
}
} | https://github.com/DaLongZhuaZi/manxia | 4cc38bd7e23462a32f7e7191050e0b5349a5a18c | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/components/TKPaperItem.ets | arkts | getButtonTitle | 提交试卷状态:0 未提交(未答题) 开始答题 ,1 已提交 重新答题,2 保存未提交 继续答题 | getButtonTitle(status:number){
switch (status) {
case 0:
return '开始答题'
break;
case 1:
return '重新答题'
break;
default:
return '继续答题'
break;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getButtonTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left status AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#... | getButtonTitle(status:number){
switch (status) {
case 0:
return '开始答题'
break;
case 1:
return '重新答题'
break;
default:
return '继续答题'
break;
}
} | https://github.com/wanrenhuifu/JLU | 7f656cd417a71af7e73c7498b974c055d1c18881 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/model/TaskModel.ets | arkts | initDDLState | Initialization method, executed immediately after loading | initDDLState() {
let ddl_arr = this.ddl_detail.split('-');
if (ddl_arr.length >= 3) {
this.ddl_state.critical = Number(ddl_arr[0]);
this.ddl_state.hard = Number(ddl_arr[1]);
this.ddl_state.medium = Number(ddl_arr[2]);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initDDLState 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 ... | initDDLState() {
let ddl_arr = this.ddl_detail.split('-');
if (ddl_arr.length >= 3) {
this.ddl_state.critical = Number(ddl_arr[0]);
this.ddl_state.hard = Number(ddl_arr[1]);
this.ddl_state.medium = Number(ddl_arr[2]);
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | ac476fa1c2739ee5f7f2b8ed2f48cd35f234c8ad | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getMonthDataFromDb | 异步获取历史店铺前三名数据(与周数据方法结构完全一致) | async function getMonthDataFromDb(context: Context): Promise<Record<string, string>> {
const resultData: Record<string, string> = {
'shop1': '', 'count1': '0',
'shop2': '', 'count2': '0',
'shop3': '', 'count3': '0'
};
try {
const rdbStore = await relationalStore.getRdbStore(context, {
name:... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getMonthDataFromDb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right A... | async function getMonthDataFromDb(context: Context): Promise<Record<string, string>> {
const resultData: Record<string, string> = {
'shop1': '', 'count1': '0',
'shop2': '', 'count2': '0',
'shop3': '', 'count3': '0'
};
try {
const rdbStore = await relationalStore.getRdbStore(context, {
name:... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 825acfb3b8d9e42db13af48b3f564da0fd48f6fd | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendTypeParameters | VCARD_PARAM_SEPARATOR must be appended before this method being called. | private appendTypeParameters(types: Array<string>): void {
// We may have to make this comma separated form like "TYPE=DOM,WORK" in the future,
// which would be recommended way in vcard 3.0 though not valid in vCard 2.1.
let first = true;
for (let typeValue of types) {
i... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendTypeParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left types AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant... | private appendTypeParameters(types: Array<string>): void {
// We may have to make this comma separated form like "TYPE=DOM,WORK" in the future,
// which would be recommended way in vcard 3.0 though not valid in vCard 2.1.
let first = true;
for (let typeValue of types) {
i... | https://gitee.com/openharmony-tpc/VCard.git | 27391d14e1403a182396227f9d6dac8a9579cb4a | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getByBillId | 根据账单ID查询识别记录 | static async getByBillId(billId: number): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.tableName}
WHERE bill_id = ? AND is_deleted = 0
ORDER BY created_at DESC
`;
cons... | 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 getByBillId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left : AST... | static async getByBillId(billId: number): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.tableName}
WHERE bill_id = ? AND is_deleted = 0
ORDER BY created_at DESC
`;
cons... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5080d05ec42aafd5dbea30f8ea60e5952efe84dd | github |
HarmonyOS_Samples/BestPracticeSnippets | FramedRendering/entry/src/main/ets/view/DateItemView.ets | arkts | aboutToReuse | Only five-day data is updated for one frame
[Start Case4] | aboutToReuse(params: Record<string, Object>): void {
hiTraceMeter.startTrace('reuse_' + (params.monthItem as Month).month, 1);
this.temp.push(params.monthItem as Month);
hiTraceMeter.finishTrace('reuse_' + (params.monthItem as Month).month, 1);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ... | aboutToReuse(params: Record<string, Object>): void {
hiTraceMeter.startTrace('reuse_' + (params.monthItem as Month).month, 1);
this.temp.push(params.monthItem as Month);
hiTraceMeter.finishTrace('reuse_' + (params.monthItem as Month).month, 1);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 21c7307dda83b9e1a7b3a064448834f9292ae597 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | getWorkflow | 获取工作流 | getWorkflow(config: MangaSourceConfig, workflowName: string): Action[] | undefined {
const workflow = config.workflows;
switch (workflowName) {
case 'search':
return this.getWorkflowByType(workflow, WorkflowType.SEARCH);
case 'searchById':
return this.getWorkflowByType(workflow, Wo... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getWorkflow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | getWorkflow(config: MangaSourceConfig, workflowName: string): Action[] | undefined {
const workflow = config.workflows;
switch (workflowName) {
case 'search':
return this.getWorkflowByType(workflow, WorkflowType.SEARCH);
case 'searchById':
return this.getWorkflowByType(workflow, Wo... | https://github.com/DaLongZhuaZi/manxia | 7254f1cc43c9224aa7da9b4764eb16aa2e2bf37d | github |
tdcare/tdwebrtc | example/SignalingClientExample.ets | arkts | makeVoiceCall | ============================================================
呼叫控制
============================================================
发起语音呼叫 | public makeVoiceCall(toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendCall(toMac, this.currentRoomId, '');
console.log(`[SignalingExample] 发起语音呼叫 to ${toMac}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left makeVoiceCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | public makeVoiceCall(toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendCall(toMac, this.currentRoomId, '');
console.log(`[SignalingExample] 发起语音呼叫 to ${toMac}`);
} | https://github.com/tdcare/tdwebrtc | 7483a579f75d7887ae0baa10685b236ffc4e1786 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/HttpUtil.ets | arkts | clearFamilyToken | 清除家属Token | static async clearFamilyToken(): Promise<void> {
try {
AppStorage.setOrCreate<string>('familyToken', '');
const settings: SettingsUtil = SettingsUtil.getInstance();
await settings.clearFamilyAuth();
} catch (error) {
console.error('[HttpUtil] 清除家属Token失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left clearFamilyToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | static async clearFamilyToken(): Promise<void> {
try {
AppStorage.setOrCreate<string>('familyToken', '');
const settings: SettingsUtil = SettingsUtil.getInstance();
await settings.clearFamilyAuth();
} catch (error) {
console.error('[HttpUtil] 清除家属Token失败:', error);
}
} | https://github.com/LJ666-ui/harmony-health-care | 1c753d9271bf8f387efb5d1877bbda9c1762612c | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets | arkts | getGoodsDetail | 获取商品详情页数据
@param {number} goodsId - 商品 ID
@returns {Promise<NetworkResponse<GoodsDetail>>} 商品详情 | async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> {
const resp: AxiosResponse<NetworkResponse<GoodsDetail>> =
await NetworkClient.http.get("page/goodsDetail", { params: { goodsId } });
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goodsId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> {
const resp: AxiosResponse<NetworkResponse<GoodsDetail>> =
await NetworkClient.http.get("page/goodsDetail", { params: { goodsId } });
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ddc1d3d80ca1f835a287b9c9a25bc29b432ef3a8 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/ObservedMaskVisibleState.ets | arkts | setShowGuideMask | 设置引导页蒙版显示状态
@param show 是否显示引导页蒙版 | setShowGuideMask(show: boolean): void {
this.globalShowGuideMask = show;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShowGuideMask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left... | setShowGuideMask(show: boolean): void {
this.globalShowGuideMask = show;
} | https://github.com/wuba/omni-ui | 7f2aab837e587eac64c64eff61370c838aa881c2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelTxtTocRuleManager.ets | arkts | getMatchingPattern | 获取匹配的正则表达式
用于TXT文件章节解析 | getMatchingPattern(sampleText: string): RegExp | null {
for (const rule of this.getEnabledRules()) {
const pattern = this.compiledPatterns.get(rule.id);
if (pattern && pattern.test(sampleText)) {
logger.info(TAG, `匹配到TXT目录规则: ${rule.name}`);
return pattern;
}
}
return nul... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMatchingPattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sampleText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | getMatchingPattern(sampleText: string): RegExp | null {
for (const rule of this.getEnabledRules()) {
const pattern = this.compiledPatterns.get(rule.id);
if (pattern && pattern.test(sampleText)) {
logger.info(TAG, `匹配到TXT目录规则: ${rule.name}`);
return pattern;
}
}
return nul... | https://github.com/DaLongZhuaZi/manxia | d6c8a3d1344036fa9c1040c3195dbe26c1f74de5 | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/WebDownloadFileImpl.ets | arkts | cancelDownload | 停止当前下载 | static cancelDownload() {
if (WebDownloadFileHelper._webDownloadItem) {
WebDownloadFileHelper._webDownloadItem.cancel()
WebDownloadFileHelper.instance.cleanupDownloadSession()
WebDownloadFileHelper.closeDownloadPopUpWindow()
promptAction.showToast({ message: '下载已取消' })
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cancelDownload 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 ... | static cancelDownload() {
if (WebDownloadFileHelper._webDownloadItem) {
WebDownloadFileHelper._webDownloadItem.cancel()
WebDownloadFileHelper.instance.cleanupDownloadSession()
WebDownloadFileHelper.closeDownloadPopUpWindow()
promptAction.showToast({ message: '下载已取消' })
}
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 866ef2bb3873c0621a4d5b885f417ebfac7cb3a9 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | canStartReview | 检查是否可以开始复习 | canStartReview(word: WordItem): boolean {
const wordKey = `${word.id}_${word.word}`;
const now = Date.now();
// 检查是否有活动的复习记录
if (this.activeReviews.has(wordKey)) {
const existingRecord = this.activeReviews.get(wordKey)!;
if (existingRecord.status === 'active') {
return false;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left canStartReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WordItem AST#identifier#Right AST#)#Left ... | canStartReview(word: WordItem): boolean {
const wordKey = `${word.id}_${word.word}`;
const now = Date.now();
// 检查是否有活动的复习记录
if (this.activeReviews.has(wordKey)) {
const existingRecord = this.activeReviews.get(wordKey)!;
if (existingRecord.status === 'active') {
return false;
... | https://github.com/CLMC2025/Vignette | 9fe727dbada2964b469749670521d0f74d99dd6c | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/GuidePage.ets | arkts | isEmpty | 获取当前引导页是否有高亮区域
@returns 当前引导页是否有高亮区域 | public isEmpty(): boolean {
return (this.highLights.length === 0);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEmpty 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#boole... | public isEmpty(): boolean {
return (this.highLights.length === 0);
} | https://github.com/wuba/omni-ui | 0534e3b88bb863ddb394938e5e3c851c00c88e1d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets | arkts | getCurrentStatus | 获取当前详情页设置状态 | getCurrentStatus(): DetailPageStatus {
const emptyStatus: DetailPageStatus = {
manga: '',
ebook: '',
novel: '',
forceEnabled: 'false',
lastEnforcement: ''
};
if (!this.settingsManager) {
return emptyStatus;
}
const status: DetailPageStatus = {
manga:... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentStatus 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 DetailPageStatus AST#identifier#Right AST#ERR... | getCurrentStatus(): DetailPageStatus {
const emptyStatus: DetailPageStatus = {
manga: '',
ebook: '',
novel: '',
forceEnabled: 'false',
lastEnforcement: ''
};
if (!this.settingsManager) {
return emptyStatus;
}
const status: DetailPageStatus = {
manga:... | https://github.com/DaLongZhuaZi/manxia | e8188b50d99e47d1cfbac7cce8bfe5024fb1d18c | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets | arkts | initLocationFlag | 初始化位置权限组授权信息
@param callerAppInfo 调用方信息
return flag: 0:不授权,1:只申请模糊权限,2:模糊升级为精确,3:模糊+精确,开启精确,4:模糊+精确,关闭精确 | public initLocationFlag(callerAppInfo: CallerAppInfo): number {
let locationFlag: number = Constants.LOCATION_NONE;
let hasFuzz: boolean = callerAppInfo.reqPerms.includes(Permission.APPROXIMATELY_LOCATION);
let hasPrecise: boolean = callerAppInfo.reqPerms.includes(Permission.LOCATION);
if (hasFuzz) {... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initLocationFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callerAppInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public initLocationFlag(callerAppInfo: CallerAppInfo): number {
let locationFlag: number = Constants.LOCATION_NONE;
let hasFuzz: boolean = callerAppInfo.reqPerms.includes(Permission.APPROXIMATELY_LOCATION);
let hasPrecise: boolean = callerAppInfo.reqPerms.includes(Permission.LOCATION);
if (hasFuzz) {... | https://gitee.com/openharmony/applications_permission_manager.git | beb1daad4b51f6ec10331cec6eca565968d8ccc3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | onLoadComplete | 加载完成回调 | onLoadComplete(request: ImageRequestInfo, result: WebViewLoadingResult): void {
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadComplete(request, result);
} catch (error) {
logger.error(TAG, `通知加载完成失败: ${error instanceof Error ? error.message : String(erro... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onLoadComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageRequestInfo AST#identifier#Right ... | onLoadComplete(request: ImageRequestInfo, result: WebViewLoadingResult): void {
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadComplete(request, result);
} catch (error) {
logger.error(TAG, `通知加载完成失败: ${error instanceof Error ? error.message : String(erro... | https://github.com/DaLongZhuaZi/manxia | 8aa08e3b2ec637dfbbafb63079a22ca0850650d0 | github |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | startTimeUpdate | 开始时间更新 | startTimeUpdate() {
setInterval(() => {
if (this.playerStatus === VideoPlayerStatus.PLAYING) {
this.currentTime += 1000; // 每秒增加1秒
this.callback?.onTimeUpdate?.(this.currentTime, this.totalTime);
}
}, 1000);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startTimeUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | startTimeUpdate() {
setInterval(() => {
if (this.playerStatus === VideoPlayerStatus.PLAYING) {
this.currentTime += 1000; // 每秒增加1秒
this.callback?.onTimeUpdate?.(this.currentTime, this.totalTime);
}
}, 1000);
} | https://github.com/fbinba3955/Flymby | 330925094b8f07204433b33441c287cb53117e9f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test3_original_index.ets | arkts | testBooleanLogic | === Boolean logic === | function testBooleanLogic(a: boolean, b: boolean): string {
if (a && b) {
return 'both true';
}
if (a || b) {
return 'at least one true';
}
return 'both false';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testBooleanLogic AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function testBooleanLogic(a: boolean, b: boolean): string {
if (a && b) {
return 'both true';
}
if (a || b) {
return 'at least one true';
}
return 'both false';
} | https://github.com/miaochiahao/ark-ghidra | e6abae8dc1e38bd6d5e23d106464a8a8a3bed41a | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets | arkts | getWonderfulReview | Get great review data.
@returns Comment array. | getWonderfulReview(): Comment[] {
let commentList: Comment[] = [];
commentList.push(
new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar1')));
commentList.push(new Comment('ke歌可Qi', '单曲循环到天明', '2021年9月4日', $r('app.media.ic_avatar2')));
commentList.push(
new... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWonderfulReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Comment AST#i... | getWonderfulReview(): Comment[] {
let commentList: Comment[] = [];
commentList.push(
new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar1')));
commentList.push(new Comment('ke歌可Qi', '单曲循环到天明', '2021年9月4日', $r('app.media.ic_avatar2')));
commentList.push(
new... | https://gitee.com/harmonyos/codelabs.git | 1fa0eeab8d5198d76c2406c7aa26ec4be269af83 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | getApprovalDetail | 获取审批详情
@param approvalId 审批ID | async getApprovalDetail(approvalId: string): Promise<ApiResponse<Approval>> {
return this.client.get<Approval>(`/api/v1/approval/approvals/${approvalId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovalDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#... | async getApprovalDetail(approvalId: string): Promise<ApiResponse<Approval>> {
return this.client.get<Approval>(`/api/v1/approval/approvals/${approvalId}`)
} | https://github.com/David8Idira/AI-OA | b883df105623a1d84ae97aac23425613cd8fbdfb | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryCache.ets | arkts | invalidate | 使指定实体的单条记录缓存失效
@param entityName 实体名称
@param id 实体主键值 | invalidate(entityName: string, id: ValueType): void {
const key = this.generateKey(entityName, id)
this.cache.delete(key)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left invalidate 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 , AST#,#... | invalidate(entityName: string, id: ValueType): void {
const key = this.generateKey(entityName, id)
this.cache.delete(key)
} | https://github.com/offlinecat-dev/OCNetORM | fa51837182324af04053ca6c1f3ae8cf4a14a739 | github |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/OmniFilterComponentRegistry.ets | arkts | hasDropSlideType | 检查是否存在某个下拉类型的组件 | hasDropSlideType(type: string): boolean {
return this.dropSlideTypeBuilderPool.has(type);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasDropSlideType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | hasDropSlideType(type: string): boolean {
return this.dropSlideTypeBuilderPool.has(type);
} | https://github.com/wuba/omni-ui | f62ea8ae3364b6cfc2519c5195618b4ce7b5246e | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppNav.ets | arkts | openDetailCard | 打开 DetailCard 覆盖页。 | openDetailCard(contentBuilder: () => void = () => {}, height: string = AppNav.DEFAULT_DETAIL_CARD_HEIGHT): void {
this.detailCardContentBuilder = contentBuilder;
this.detailCardHeight = this.resolveOverlayHeight(height, AppNav.DEFAULT_DETAIL_CARD_HEIGHT);
this.pushOverlayRoute(AppOverlayRoute.DETAIL_CARD,... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openDetailCard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left contentBuilder AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right... | openDetailCard(contentBuilder: () => void = () => {}, height: string = AppNav.DEFAULT_DETAIL_CARD_HEIGHT): void {
this.detailCardContentBuilder = contentBuilder;
this.detailCardHeight = this.resolveOverlayHeight(height, AppNav.DEFAULT_DETAIL_CARD_HEIGHT);
this.pushOverlayRoute(AppOverlayRoute.DETAIL_CARD,... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L83-L87 | 00b5b3dea5c121b84d6a5992c1bff8841ebc5c4e | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | getSeasons | 获取剧集的分季列表
@param seriesId 剧集id
@returns | public getSeasons(seriesId: string): Promise<Array<FinItem>> {
return this.requireApi().getSeasons(seriesId)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSeasons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seriesId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public getSeasons(seriesId: string): Promise<Array<FinItem>> {
return this.requireApi().getSeasons(seriesId)
} | https://github.com/OHPG/FinVideo | 0a2251b0ed3c487be6660467566e9d54c09f1e9f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/Highlight.ets | arkts | getStackIndex | Only needed if a stacked-barchart entry was highlighted. References the
selected value within the stacked-entry.
@return | public getStackIndex(): number {
return this.mStackIndex;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStackIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#n... | public getStackIndex(): number {
return this.mStackIndex;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7f05cf9ca30931296fd5a99a35d49303060f3dc8 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | updateSessionTimestamps | 更新会话时间戳(用于导入时恢复原始时间) | async updateSessionTimestamps(sessionId: string, createdAt: number, updatedAt: number): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
created_at: createdAt,
updated_at: updatedAt
}
... | 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 updateSessionTimestamps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier... | async updateSessionTimestamps(sessionId: string, createdAt: number, updatedAt: number): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const valueBucket: relationalStore.ValuesBucket = {
created_at: createdAt,
updated_at: updatedAt
}
... | https://github.com/LongLiveY96/chatcube | b2e0770dbe183d3900975dc2160744d036f08b33 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | addGlobalLifecycleObserver | 添加全局的NavDestination页面的生命周期观察者
@param observer
@returns | public static addGlobalLifecycleObserver<IL extends ILifecycleObserver>(observer: IL): LifecycleMgr {
return ZRouter.getRouterMgr().lifecycleMgr.addGlobalObserver(observer)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left addGlobalLifecycleObserver AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left IL AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#... | public static addGlobalLifecycleObserver<IL extends ILifecycleObserver>(observer: IL): LifecycleMgr {
return ZRouter.getRouterMgr().lifecycleMgr.addGlobalObserver(observer)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L310-L312 | 26439ae1782dd9cfc8caac581720833157daeac2 | github |
openharmony/app_samples | Telephony/Message/entry/src/main/ets/MainAbility/model/DateTimeUtil.ets | arkts | concatTime | 时分格式修饰
@param hours
@param minutes
@param seconds | concatTime(hours, minutes) {
return `${this.fill(hours)}:${this.fill(minutes)}`
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left concatTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hours AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left minutes AST#identifier#Right AST#)#Left ) AST#)#Right AST#ar... | concatTime(hours, minutes) {
return `${this.fill(hours)}:${this.fill(minutes)}`
} | https://gitee.com/openharmony/app_samples.git | 87d197bf19e70107c5e7ef01355e1289f6f0915d | gitee |
erosTeam/NextE | shared/src/main/ets/settings/CustomProfilesSettings.ets | arkts | setDisplayMode | Pin a per-tab display mode ('global' = follow the shared ListModeState). Does NOT bump lastEditTime
so the retained page only re-renders with the new renderer — it must not refetch. | static async setDisplayMode(
context: common.UIAbilityContext,
uuid: string,
mode: string,
): Promise<void> {
const state: CustomProfilesState = connectCustomProfiles()
const next: CustomProfile[] = []
state.profiles.forEach((p: CustomProfile) => {
if (p.uuid === uuid && p.displayMode ... | 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 setDisplayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | static async setDisplayMode(
context: common.UIAbilityContext,
uuid: string,
mode: string,
): Promise<void> {
const state: CustomProfilesState = connectCustomProfiles()
const next: CustomProfile[] = []
state.profiles.forEach((p: CustomProfile) => {
if (p.uuid === uuid && p.displayMode ... | https://github.com/erosTeam/NextE | 021246005f0068e7f6b278e37a5bd031369d2476 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Math.ets | arkts | min | Smallest value of `u` and `v`
@param u arbitrary number
@param v arbitrary number
@returns Smallest value of `u` and `v` | public static min(u: number, v: number): number {
return min(u, v);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left min AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left u AST#identi... | public static min(u: number, v: number): number {
return min(u, v);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c6bda91019d4d8372e7f69aeb8931f38035d01a0 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/NamingConventions.ets | arkts | generateInterfaceName | 生成标准化的接口名
@param words - 单词数组
@returns 标准化的接口名 | static generateInterfaceName(words: string[]): string {
if (words.length === 0) return '';
const pascalCaseWords = words.map(word => {
const cleanWord = word.toLowerCase().replace(/[^a-z0-9]/g, '');
return cleanWord.charAt(0).toUpperCase() + cleanWord.slice(1);
});
return pascalC... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateInterfaceName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left words AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | static generateInterfaceName(words: string[]): string {
if (words.length === 0) return '';
const pascalCaseWords = words.map(word => {
const cleanWord = word.toLowerCase().replace(/[^a-z0-9]/g, '');
return cleanWord.charAt(0).toUpperCase() + cleanWord.slice(1);
});
return pascalC... | https://github.com/DaLongZhuaZi/manxia | e4f0e32ea5700def9fc12f3e4614a7dab0586149 | github |
arkui-x/samples | CodeLab/Cases/feature/editaddress/src/main/ets/view/EditAddressView.ets | arkts | label | 地址信息模块每条输入框的标签名
格式:收件人*,手机号* | @Builder
function label(params: Label) {
Text() {
Span(params.labelName)
.fontColor(Color.Black)
.fontSize(CommonConstants.LABEL_NAME_FONTSIZE)
.fontWeight(CommonConstants.LABEL_FONT_WEIGHT)
Span("*")
.fontColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.fontSize(Co... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left label AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_pa... | @Builder
function label(params: Label) {
Text() {
Span(params.labelName)
.fontColor(Color.Black)
.fontSize(CommonConstants.LABEL_NAME_FONTSIZE)
.fontWeight(CommonConstants.LABEL_FONT_WEIGHT)
Span("*")
.fontColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.fontSize(Co... | https://gitcode.com/arkui-x/samples | a1d4248f1d37c131356754031af1da0eb6fd062a | gitcode |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/toast/index.ets | arkts | closeToast | 关闭提示效果 | closeToast() {
if (this.contentNode) {
this.ctx?.getPromptAction().closeCustomDialog(this.contentNode).then(() => {
this.onClose?.()
})
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left closeToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | closeToast() {
if (this.contentNode) {
this.ctx?.getPromptAction().closeCustomDialog(this.contentNode).then(() => {
this.onClose?.()
})
}
} | https://github.com/itrainhub/wu-ui | 802de81015ed348eacb4bce1ecc05f53fef06018 | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | listenSnoozeInput | Initiate the snooze input listening. | listenSnoozeInput(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left listenSnoozeInput 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_expressi... | listenSnoozeInput(): void {
} | https://gitee.com/openharmony-sig/applications_clock.git | e3eecbea721c21fa6a5643a71501d7ab1c7f241a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | isChapterCached | 检查章节是否已缓存(检查txt文件是否存在) | async isChapterCached(bookId: string, chapterIndex: number): Promise<boolean> {
try {
const filePath = this.getChapterFilePath(bookId, chapterIndex);
if (await this.sandboxManager.exists(filePath)) {
return true;
}
return await this.isAudioChapterCached(bookId, chapterIndex);
}... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isChapterCached AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async isChapterCached(bookId: string, chapterIndex: number): Promise<boolean> {
try {
const filePath = this.getChapterFilePath(bookId, chapterIndex);
if (await this.sandboxManager.exists(filePath)) {
return true;
}
return await this.isAudioChapterCached(bookId, chapterIndex);
}... | https://github.com/DaLongZhuaZi/manxia | 6f0099de8700355bd168c6e3b8b865b5005f39aa | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/SpacingViewModel.ets | arkts | getSpacingItems | 获取间距列表
@returns {SpacingItem[]} 间距项数组 | getSpacingItems(): SpacingItem[] {
const baseStyle = TnUIGetUIBaseStyle();
return [
new SpacingItem("space-xs", "超小间距", baseStyle.spaceXs),
new SpacingItem("space-sm", "小间距", baseStyle.spaceSm),
new SpacingItem("space", "默认间距", baseStyle.space),
new SpacingItem("space-lg", "大间距", base... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSpacingItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left SpacingItem AST#... | getSpacingItems(): SpacingItem[] {
const baseStyle = TnUIGetUIBaseStyle();
return [
new SpacingItem("space-xs", "超小间距", baseStyle.spaceXs),
new SpacingItem("space-sm", "小间距", baseStyle.spaceSm),
new SpacingItem("space", "默认间距", baseStyle.space),
new SpacingItem("space-lg", "大间距", base... | https://github.com/codelably/tuniao-ui | 74311e326218cf5328690df7b5b7c417b055b9bd | github |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets | arkts | setQRCodeScanAnimation | 扫描扫描动画 | setQRCodeScanAnimation() {
setInterval(() => {
animateTo({
duration: 1000, // 动画时间
tempo: 0.5, // 动画速率
curve: Curve.EaseInOut,
delay: 200, // 动画延迟时间
iterations: -1, // 动画是否重复播放
playMode: PlayMode.Normal,
}, () => {
this.animationOrdinate = 390 //... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setQRCodeScanAnimation 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_b... | setQRCodeScanAnimation() {
setInterval(() => {
animateTo({
duration: 1000, // 动画时间
tempo: 0.5, // 动画速率
curve: Curve.EaseInOut,
delay: 200, // 动画延迟时间
iterations: -1, // 动画是否重复播放
playMode: PlayMode.Normal,
}, () => {
this.animationOrdinate = 390 //... | https://github.com/openharmony/applications_app_samples | 01cf46d2c0c9710f9984480cf32aecee7af2a325 | github |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets | arkts | putCacheMap | 缓存数据map集合
@param key 键值
@param size 缓存文件大小 | putCacheMap(key: string, size: number = 0) {
this.cacheMap.set(key, new DiskCacheEntry(key, size));
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left putCacheMap 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 AS... | putCacheMap(key: string, size: number = 0) {
this.cacheMap.set(key, new DiskCacheEntry(key, size));
} | https://gitcode.com/arkui-x/samples | a6e88c77134fc793cd7481d79cc932e406fef2f1 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | handleOffsetPagination | 处理offset分页 | handleOffsetPagination(
sourceId: string,
config: PaginationConfig,
itemsReceived?: number
): PaginationResult {
const state = this.paginationStates.get(sourceId);
if (!state) {
logger.warn(TAG, `分页状态未初始化: ${sourceId}`);
return {
hasMore: false,
nextOffset: 0,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleOffsetPagination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Lef... | handleOffsetPagination(
sourceId: string,
config: PaginationConfig,
itemsReceived?: number
): PaginationResult {
const state = this.paginationStates.get(sourceId);
if (!state) {
logger.warn(TAG, `分页状态未初始化: ${sourceId}`);
return {
hasMore: false,
nextOffset: 0,
... | https://github.com/DaLongZhuaZi/manxia | 3c919dadd2e6adffb1405b75ab314e7630f0f12c | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AccountService.ets | arkts | initialize | 从 Preferences 读取登录态到内存,同步一份到 AppStorage。
在 EntryAbility.initializeServices 的 PreferencesService 初始化之后调用。 | async initialize(_context: Context): Promise<void> {
if (this.isInitialized) {
return
}
try {
const preferences: PreferencesService = getPreferencesService()
const loggedIn: boolean = await preferences.getBoolean(PreferenceKeys.HW_ACCOUNT_LOGGED_IN, false)
const openId: string = aw... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left _context AST#identifier#Right AST#... | async initialize(_context: Context): Promise<void> {
if (this.isInitialized) {
return
}
try {
const preferences: PreferencesService = getPreferencesService()
const loggedIn: boolean = await preferences.getBoolean(PreferenceKeys.HW_ACCOUNT_LOGGED_IN, false)
const openId: string = aw... | https://github.com/LongLiveY96/chatcube | 6d052c01eb16c827c971f11b81fe72ebb3e6163d | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | tick | 核心计时逻辑(每秒被调用一次) | private tick(): void {
const now = Date.now();
let isComplete = false;
// 基于时间戳差值计算剩余时间,避免 JS 定时器休眠导致的不准
if (this.expectedEndTime > 0) {
const remainingMs = Math.max(0, this.expectedEndTime - now);
this.remainingSeconds = Math.ceil(remainingMs / 1000);
isComplete = remainingMs <... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left tick 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... | private tick(): void {
const now = Date.now();
let isComplete = false;
// 基于时间戳差值计算剩余时间,避免 JS 定时器休眠导致的不准
if (this.expectedEndTime > 0) {
const remainingMs = Math.max(0, this.expectedEndTime - now);
this.remainingSeconds = Math.ceil(remainingMs / 1000);
isComplete = remainingMs <... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L171-L189 | 73caf9e045a44a4be324e58a26a0ef3f60c6bff7 | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | initCircleRadius | 设置悬浮球半径 -- 比正常半径要小一圈 | initCircleRadius(): void {
// 半径
this.circleRadius = this.getMinWidth() / 2 - SURPLUSRADIUS;
// 直径
this.circleDiameter = this.circleRadius * 2;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initCircleRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | initCircleRadius(): void {
// 半径
this.circleRadius = this.getMinWidth() / 2 - SURPLUSRADIUS;
// 直径
this.circleDiameter = this.circleRadius * 2;
} | https://gitcode.com/arkui-x/samples | 256b2b7096da346030a222fec0682323778fb5d1 | gitcode |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/common/utils/ResourceUtils.ets | arkts | getString | 获取字符串资源
@param resId 资源 ID ($r('app.string.xxx'))
@returns Promise<string> | public static async getString(resId: Resource): Promise<string> {
// Fix: this.context -> ResourceUtils.context
if (!ResourceUtils.context) {
ResourceUtils.logger.error('Context not initialized');
return '';
}
try {
const manager = ResourceUtils.context.resourceManager;
const ... | 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 getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resId AS... | public static async getString(resId: Resource): Promise<string> {
// Fix: this.context -> ResourceUtils.context
if (!ResourceUtils.context) {
ResourceUtils.logger.error('Context not initialized');
return '';
}
try {
const manager = ResourceUtils.context.resourceManager;
const ... | https://gitcode.com/openharmony/codelabs | 89a4e7aaf6e1280839533773db97a6b7b8d0495d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | getNumber | 获取数字设置 | getNumber(key: string, defaultValue: number = 0): number {
const value = this.settingsCache.get(key);
if (value === undefined) {
return defaultValue;
}
const num = Number(value);
return isNaN(num) ? defaultValue : num;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNumber 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#,#... | getNumber(key: string, defaultValue: number = 0): number {
const value = this.settingsCache.get(key);
if (value === undefined) {
return defaultValue;
}
const num = Number(value);
return isNaN(num) ? defaultValue : num;
} | https://github.com/DaLongZhuaZi/manxia | 40605d663e2506be7f974480209ca2cc87f0c23c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | getDeviceId | 获取设备 ID | getDeviceId(): number {
return this.deviceId;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getDeviceId(): number {
return this.deviceId;
} | https://github.com/AlkaidLab/moonlight-harmony | b6c9efb3904fb888f4c65ca0b9dacc4e4505c50b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | setupVideoSurface | ---------------------------------------------------------------------------
内部 — 视频 Surface
--------------------------------------------------------------------------- | private async setupVideoSurface(): Promise<void> {
console.info(`设置视频 Surface: ${this.surfaceId}`);
if (!this.nativeModule.setVideoSurface(this.surfaceId)) {
throw new Error('设置视频 Surface 失败');
}
} | 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 setupVideoSurface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async setupVideoSurface(): Promise<void> {
console.info(`设置视频 Surface: ${this.surfaceId}`);
if (!this.nativeModule.setVideoSurface(this.surfaceId)) {
throw new Error('设置视频 Surface 失败');
}
} | https://github.com/AlkaidLab/moonlight-harmony | dbe527d5b8531f2bff9cbf4e43d1ddb3f3ac851e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | start | ---------------------------------------------------------------------------
生命周期 — 启动 / 停止 / 恢复
---------------------------------------------------------------------------
开始串流会话 | async start(
computerId: string,
appId: number,
config: StreamConfig,
surfaceId: string,
context?: common.UIAbilityContext,
displayGuid?: string,
useVdd?: boolean
): Promise<void> {
this.computerId = computerId;
this.appId = appId;
this.config = config;
this.surfaceId = s... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left comput... | async start(
computerId: string,
appId: number,
config: StreamConfig,
surfaceId: string,
context?: common.UIAbilityContext,
displayGuid?: string,
useVdd?: boolean
): Promise<void> {
this.computerId = computerId;
this.appId = appId;
this.config = config;
this.surfaceId = s... | https://github.com/AlkaidLab/moonlight-harmony | d9618e07135703102e88fee3bda988ffabfcfb30 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/TrendsPage.ets | arkts | getSelectedRecord | 获取选中日期的记录(辅助方法) | getSelectedRecord(): HealthRecord | null {
if (this.selectedDateIndex >= 0 && this.selectedDateIndex < this.recentDates.length) {
return this.getRecordForDate(this.recentDates[this.selectedDateIndex]);
}
return null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSelectedRecord 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#ide... | getSelectedRecord(): HealthRecord | null {
if (this.selectedDateIndex >= 0 && this.selectedDateIndex < this.recentDates.length) {
return this.getRecordForDate(this.recentDates[this.selectedDateIndex]);
}
return null;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 290238ee6a9dfd36a2e591271496041c9dc67039 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets | arkts | pushRecentCustomColor | 将自定义颜色提交进最近列表;同色去重并迁移到最前,最多保留 N 项。 | pushRecentCustomColor(color: AnnotationColor): void {
if (color.id !== CustomAnnotationColorId) {
return;
}
const filtered: AnnotationColor[] = [];
for (const existing of this.recentCustomColors) {
if (existing.pdfColor !== color.pdfColor) {
filtered.push(existing);
}
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushRecentCustomColor 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 AnnotationColor AST#identifier#Ri... | pushRecentCustomColor(color: AnnotationColor): void {
if (color.id !== CustomAnnotationColorId) {
return;
}
const filtered: AnnotationColor[] = [];
for (const existing of this.recentCustomColors) {
if (existing.pdfColor !== color.pdfColor) {
filtered.push(existing);
}
}
... | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets#L218-L235 | c2afb5f5555372162b9d4891dd638bed655fd977 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | endImageDrag | End drag image. | private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left endImageDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#voi... | private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this... | https://gitee.com/openharmony/codelabs.git | 827c4fa18342cdb51d691d36166322a372b8b480 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | switchTo | Switch to a tab. Auto calls the tab to restore web state if it is not active.
@param target The tab index or the meowTabInfo itself. | async switchTo(target: number | meowTabInfo) {
if (this.currentNode) {
this.currentNode.detachWeb();
this.currentNode.rebuild();
}
if (typeof target == 'number') {
this.currentTab = this.tabs[Math.min(target, this.tabs.length - 1)];
} else {
this.currentTab = target;
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left switchTo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left target AST#identifier#Right AST#type... | async switchTo(target: number | meowTabInfo) {
if (this.currentNode) {
this.currentNode.detachWeb();
this.currentNode.rebuild();
}
if (typeof target == 'number') {
this.currentTab = this.tabs[Math.min(target, this.tabs.length - 1)];
} else {
this.currentTab = target;
}
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 1f2a41e178747c01244131fc3dbd45e4b7d5a3c8 | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets | arkts | aboutToAppear | 生命周期: aboutToAppear
描述: 组件即将挂载显示时触发。
职责: 解析路由参数,初始化 authType。 | aboutToAppear() {
// 从路由参数获取认证类型
// router.getParams() 返回路由跳转时携带的参数对象
const params = router.getParams() as Record<string, string>;
// 参数校验,防止空指针
if (params && params.authType) {
this.authType = params.authType as PassType;
}
} | 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() {
// 从路由参数获取认证类型
// router.getParams() 返回路由跳转时携带的参数对象
const params = router.getParams() as Record<string, string>;
// 参数校验,防止空指针
if (params && params.authType) {
this.authType = params.authType as PassType;
}
} | https://gitcode.com/openharmony/codelabs | 01d96adbb110efd8a81129ae83501a7a9fcc100e | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int8Array using range [begin, end)
@param begin start index to be taken into slice
@param end last index to be taken into slice
@returns a new Int8Array with elements of current Int8Array[begin;end) where end index is excluded
@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... | public slice(begin: number, end: number): Int8Array {
return this.slice(begin as int, end as int)
} | 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#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number, end: number): Int8Array {
return this.slice(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1683f5e790459b6ae440144986e5b62c37f9d5ba | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpSessionManager.ets | arkts | getCurrentInstance | Get current instance | static getCurrentInstance(): number {
return currentInstance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentInstance 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 ... | static getCurrentInstance(): number {
return currentInstance;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 4999d7c7ffae37e1a38839020fd8ad45c22db876 | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showLoading | 显示加载中提示
@returns {void} 无返回值 | static showLoading(): void {
IBestToast.showLoading();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression... | static showLoading(): void {
IBestToast.showLoading();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 27de74d08f5c5df24162641a2adde3bcde3081c7 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | isDrawTopYLabelEntryEnabled | returns true if drawing the top y-axis label entry is enabled
@return | public isDrawTopYLabelEntryEnabled(): boolean {
return this.mDrawTopYLabelEntry;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawTopYLabelEntryEnabled 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#Le... | public isDrawTopYLabelEntryEnabled(): boolean {
return this.mDrawTopYLabelEntry;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0bc487069e9431c4e3a0349257d6572213e9a421 | gitee |
chendi126/harmonyOS-TCP | entry/src/main/ets/pages/ProtocolConfig.ets | arkts | onProtocolChange | 协议切换处理 | onProtocolChange(protocol: ProtocolType) {
this.selectedProtocol = protocol;
this.config.protocol = protocol;
// 根据协议设置默认端口
switch (protocol) {
case ProtocolType.TCP:
this.config.port = 8888;
break;
case ProtocolType.UDP:
this.config.port = 8889;
break;... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onProtocolChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left protocol AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ProtocolType AST#ide... | onProtocolChange(protocol: ProtocolType) {
this.selectedProtocol = protocol;
this.config.protocol = protocol;
// 根据协议设置默认端口
switch (protocol) {
case ProtocolType.TCP:
this.config.port = 8888;
break;
case ProtocolType.UDP:
this.config.port = 8889;
break;... | https://github.com/chendi126/harmonyOS-TCP | 0785e72564f289ffa480daf39a58313e83f48fd7 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test40_original_index.ets | arkts | testNestedMap | --- Nested Map (Map of Maps) --- | function testNestedMap(): string {
let outer: Map<string, Map<string, number>> = new Map();
let inner1: Map<string, number> = new Map();
inner1.set('x', 10);
inner1.set('y', 20);
let inner2: Map<string, number> = new Map();
inner2.set('x', 30);
inner2.set('y', 40);
outer.set('first', inner1);
outer.se... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedMap 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_ty... | function testNestedMap(): string {
let outer: Map<string, Map<string, number>> = new Map();
let inner1: Map<string, number> = new Map();
inner1.set('x', 10);
inner1.set('y', 20);
let inner2: Map<string, number> = new Map();
inner2.set('x', 30);
inner2.set('y', 40);
outer.set('first', inner1);
outer.se... | https://github.com/miaochiahao/ark-ghidra | a658a23b3683aa53cd760df01777f28e50767feb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | isHighlightPerTapEnabled | Returns true if values can be highlighted via tap gesture, false if not.
@return | public isHighlightPerTapEnabled(): boolean {
return this.mHighLightPerTapEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isHighlightPerTapEnabled 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 ... | public isHighlightPerTapEnabled(): boolean {
return this.mHighLightPerTapEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 812ff6eec353a079d4541902459c4c746f9d1d96 | gitee |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | getLastReviewForWord | 获取单词的最后一次复习记录 | private getLastReviewForWord(word: string): ReviewTimeRecord | null {
// 从历史记录中倒序查找
for (let i = this.reviewHistory.length - 1; i >= 0; i--) {
const record = this.reviewHistory[i];
if (record.word === word && record.status === 'completed') {
return record;
}
}
return null;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLastReviewForWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private getLastReviewForWord(word: string): ReviewTimeRecord | null {
// 从历史记录中倒序查找
for (let i = this.reviewHistory.length - 1; i >= 0; i--) {
const record = this.reviewHistory[i];
if (record.word === word && record.status === 'completed') {
return record;
}
}
return null;
... | https://github.com/CLMC2025/Vignette | e5c071af5c8899914e635f2e1a3dd39d467cd260 | github |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/common/utils/CommonUtil.ets | arkts | getRandomNumber | Obtain n non-repetitive random numbers between min and max.
@param n Number of random.
@returns | public static getRandomNumber(n: number) {
// Generates an array from 0 to n-1.
let arr: number[] = Array.from(Array(n), (v: number, k: number) => k);
// Randomly disrupted.
for (let i = 0; i < n; i++) {
let j = Math.floor(Math.random() * (arr.length - i) + i);
let tmp = arr[i];
arr[... | 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 getRandomNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST... | public static getRandomNumber(n: number) {
// Generates an array from 0 to n-1.
let arr: number[] = Array.from(Array(n), (v: number, k: number) => k);
// Randomly disrupted.
for (let i = 0; i < n; i++) {
let j = Math.floor(Math.random() * (arr.length - i) + i);
let tmp = arr[i];
arr[... | https://gitee.com/openharmony/codelabs.git | 58f5ecc4f0a79a7b04eeb038e8a76d021ac83c27 | gitee |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/SettingsService.ets | arkts | save | 写入并落盘。 | static async save(cfg: AppConfig): Promise<void> {
const pref = SettingsService.ensure();
pref.putSync(KEY, JSON.stringify(cfg.toData()));
await pref.flush();
} | 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 save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cfg AST#identifier#Right AST#:#Left : AST#:#Right A... | static async save(cfg: AppConfig): Promise<void> {
const pref = SettingsService.ensure();
pref.putSync(KEY, JSON.stringify(cfg.toData()));
await pref.flush();
} | https://github.com/picklerick422/zju-learning-assistant-OH | adff94aae0c0774d50acca14faeab787d46882c7 | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets | arkts | stopAndReleaseCamera | 关闭摄像头输入流 | private stopAndReleaseCamera() {
if (this.cameraInput != null) {
try {
this.photoSession?.removeInput(this.cameraInput);
} catch (e) {
}
try {
this.videoSession?.removeInput(this.cameraInput);
} catch (e) {
}
this.cameraInput.close();
this.cameraInp... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopAndReleaseCamera 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 AS... | private stopAndReleaseCamera() {
if (this.cameraInput != null) {
try {
this.photoSession?.removeInput(this.cameraInput);
} catch (e) {
}
try {
this.videoSession?.removeInput(this.cameraInput);
} catch (e) {
}
this.cameraInput.close();
this.cameraInp... | https://gitee.com/openharmony-sig/flutter_packages.git | a8576140e96afe2055d24719f678f010b0e8934d | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/pages/StatisticsPage.ets | arkts | roundDownToNiceNumber | 将数值向下取整到合适的刻度值(用于负数最小值) | roundDownToNiceNumber(value: number): number {
if (value >= 0) return 0;
if (value > -10) {
// 大于-10的值,向下取整到整数
return Math.floor(value);
}
// 找到合适的刻度单位
const magnitude = Math.pow(10, Math.floor(Math.log10(Math.abs(value))));
c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left roundDownToNiceNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)... | roundDownToNiceNumber(value: number): number {
if (value >= 0) return 0;
if (value > -10) {
// 大于-10的值,向下取整到整数
return Math.floor(value);
}
// 找到合适的刻度单位
const magnitude = Math.pow(10, Math.floor(Math.log10(Math.abs(value))));
c... | https://github.com/qiuhaotc/HarmonyOSPlayground | b76a1587b21f124db256ab6d0f550785af22d587 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/dialer/DialerPresenter.ets | arkts | ifNeedSpace | Add a space when entering a number. | ifNeedSpace() {
let needNumber: string | undefined = AppStorage.Get('tele_number');
switch (needNumber?.length) {
case 3:
if (this.checkNeedNumberSpace(needNumber)) {
AppStorage.SetOrCreate('tele_number', needNumber + ' ');
}
break;
case 8:
AppStorage.SetO... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ifNeedSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | ifNeedSpace() {
let needNumber: string | undefined = AppStorage.Get('tele_number');
switch (needNumber?.length) {
case 3:
if (this.checkNeedNumberSpace(needNumber)) {
AppStorage.SetOrCreate('tele_number', needNumber + ' ');
}
break;
case 8:
AppStorage.SetO... | https://gitee.com/openharmony/applications_contacts.git | 84a0d0f64bcc6016a685ce6e8bc57cafb657a7b6 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an Uint8ClampedArray with respect to buf.
@param buf data initializer | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint8ClampedArray.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#R... | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint8ClampedArray.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | aab47629bd3a3b89f88fa45abd6a3c2a35805c66 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setVerticalAlignment | sets the vertical alignment of the legend
@param value | public setVerticalAlignment(value: LegendVerticalAlignment): void {
this.mVerticalAlignment = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVerticalAlignment 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... | public setVerticalAlignment(value: LegendVerticalAlignment): void {
this.mVerticalAlignment = value;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 27e9e3da3bfe892cf638ee3a474a8a75b6c9e640 | gitee |
jiwangyihao/FlameChase | entry/src/main/ets/utils/DesignSystem.ets | arkts | resourceToRgb | Converts a color resource to an RGB object.
Note: This is a simplified implementation for demonstration. | private static resourceToRgb(resource: number): ColorRGB | null {
// In a real application, you would need a more robust way to get the hex value.
const hex = resource.toString(16);
if (hex.length !== 8) {
console.error("Failed to parse color resource string:", resource);
return null;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left resourceToRgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resource AST#identifier#Right AST#ERROR#Left AST#:#Le... | private static resourceToRgb(resource: number): ColorRGB | null {
// In a real application, you would need a more robust way to get the hex value.
const hex = resource.toString(16);
if (hex.length !== 8) {
console.error("Failed to parse color resource string:", resource);
return null;
}
... | https://github.com/jiwangyihao/FlameChase | 3c093a26f4d2d1adfe81763f8d9e832febb554d3 | github |
2763981847/Accounting-app | entry/src/main/ets/common/database/Rdb.ets | arkts | getRdbStore | 获取关系型数据库存储对象
@param callback - 获取成功后的回调函数 | getRdbStore(callback: Function = () => {
}): void {
// 如果回调函数未提供,记录警告信息
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!');
return;
}
// 如果 rdbStore 已存在,直接调用回调函数并返回
if (this.rdbStore !=... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left Function ... | getRdbStore(callback: Function = () => {
}): void {
// 如果回调函数未提供,记录警告信息
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!');
return;
}
// 如果 rdbStore 已存在,直接调用回调函数并返回
if (this.rdbStore !=... | https://github.com/2763981847/Accounting-app | 9990e3f5fdc545c393448703917041e3af88a9e8 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistoryChunk.ets | arkts | lookUpHistoryEntriesBruteForce | Looks up history entries for a given query using BRUTE FORCE. Would load index and entries from disk.
@param query Any query word(s) / string.
@param minHitRate The minimum hit rate (a number between 0 and 1).
@param maxResults The maximum number of results to return.
@returns A promise that resolves to an array of meo... | async lookUpHistoryEntriesBruteForce(query: string, minHitRate: number = 0.8, maxResults: number = 20) {
// Get history entries.
await this.loadEntriesFromDisk();
if (!this.entries) {
meow(`this.getEntries() failed to do its mission! Query of key ${query} @ ${this.indexPath}`, 'meowHistoryChunk][loo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left lookUpHistoryEntriesBruteForce AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#L... | async lookUpHistoryEntriesBruteForce(query: string, minHitRate: number = 0.8, maxResults: number = 20) {
// Get history entries.
await this.loadEntriesFromDisk();
if (!this.entries) {
meow(`this.getEntries() failed to do its mission! Query of key ${query} @ ${this.indexPath}`, 'meowHistoryChunk][loo... | https://github.com/awaLiny2333/LinysBrowser_NEXT | a39b8dee0ad35b5852fe515167aa1e57374be7a2 | github |
openharmony/applications_call | mobiledatasettings/src/main/ets/pages/index.ets | arkts | initAirPlaneMode | init AirPlane Mode | initAirPlaneMode() {
LogUtils.i(TAG, 'initAirPlaneMode');
try {
addAirPlaneModeListener((data) => {
LogUtils.i(TAG, 'initAirPlaneMode callback');
this.isAirPlaneMode = data == 1 ? true : false;
});
} catch (err) {
LogUtils.e(TAG, `initAirPlaneMode err = ${JSON.stringify(e... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initAirPlaneMode 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... | initAirPlaneMode() {
LogUtils.i(TAG, 'initAirPlaneMode');
try {
addAirPlaneModeListener((data) => {
LogUtils.i(TAG, 'initAirPlaneMode callback');
this.isAirPlaneMode = data == 1 ? true : false;
});
} catch (err) {
LogUtils.e(TAG, `initAirPlaneMode err = ${JSON.stringify(e... | https://gitee.com/openharmony/applications_call.git | 7356a867543df610969090c60b1b6b224dd07fa7 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/config/RouteConfigManager.ets | arkts | getRouteCount | 获取路由数量
@returns number | public getRouteCount(): number {
return this.routes.size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRouteCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#n... | public getRouteCount(): number {
return this.routes.size;
} | https://github.com/LJ666-ui/harmony-health-care | 9f0b3bd7aa342ea6d78db96f8c0081399c093e96 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toDouble | Returns value of this instance
@returns { double }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toDouble(): double {
return this.value.toDouble();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toDouble(): double {
return this.value.toDouble();
} | https://gitcode.com/iop123123/arkts-static-skills | 4e312bdb222639457a29886120be36f74549bf05 | gitcode |
2763981847/Accounting-app | entry/src/main/ets/pages/MainPage.ets | arkts | aboutToAppear | 生命周期钩子,在页面即将显示时触发 | aboutToAppear() {
this.filterAccounts();
} | 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() {
this.filterAccounts();
} | https://github.com/2763981847/Accounting-app | 091a894ba6dda37460fa155c96896f25c346f6a4 | github |
HarmonyOS_Codelabs/readerkit_codelab_arkts | entry/src/main/ets/utils/BookUtils.ets | arkts | convertSuffixToSourceType | Convert book types based on suffix
@param suffixName - Book file name extension
@returns {BOOK_FILE_TYPE} | public static convertSuffixToSourceType(suffixName: string): number {
switch (suffixName) {
case EXTENSION_FILE_TXT:
return BOOK_FILE_TYPE.TXT;
case EXTENSION_FILE_EPUB:
return BOOK_FILE_TYPE.EPUB;
case EXTENSION_FILE_MOBI:
return BOOK_FILE_TYPE.MOBI;
case EXTENSION... | 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 convertSuffixToSourceType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left suffixName AST#identifier#Right AST#ERROR#Le... | public static convertSuffixToSourceType(suffixName: string): number {
switch (suffixName) {
case EXTENSION_FILE_TXT:
return BOOK_FILE_TYPE.TXT;
case EXTENSION_FILE_EPUB:
return BOOK_FILE_TYPE.EPUB;
case EXTENSION_FILE_MOBI:
return BOOK_FILE_TYPE.MOBI;
case EXTENSION... | https://gitcode.com/HarmonyOS_Codelabs/readerkit_codelab_arkts | 2913289e21d77ed99337496ca343989494de4693 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | equal | 判断两个传入的数值或者是字符串是否相等
@param source
@param target
@returns | static equal(source: string | number, target: string | number): boolean {
return source === target;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left equal AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static equal(source: string | number, target: string | number): boolean {
return source === target;
} | https://github.com/tdcare/tdwebrtc | 802bd28e050b75bbc1000d45bd22c3ea3591a3a9 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/MetadataStorage.ets | arkts | getEntityMetadata | 获取实体元数据
@param entityName 实体类名
@returns 实体元数据,如果不存在返回 null | getEntityMetadata(entityName: string): EntityMetadata | null {
const metadata = this.entities.get(entityName)
if (metadata) {
return metadata
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getEntityMetadata 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... | getEntityMetadata(entityName: string): EntityMetadata | null {
const metadata = this.entities.get(entityName)
if (metadata) {
return metadata
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | 583c621c6392b90b74ef06bc9573b31a5b1aa1da | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | getHeicOptimizeDecoding | 获取默认解码是否开启了heic解码优化
@returns 返回true表示开启了优化解码,返回false表示没有开启 | getHeicOptimizeDecoding(): boolean {
return nativeNode.getHeicOptimizeDecoding();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHeicOptimizeDecoding 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... | getHeicOptimizeDecoding(): boolean {
return nativeNode.getHeicOptimizeDecoding();
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L414-L416 | 49d5a6e07613a6110c99c003952d7e6abc52ca13 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/less_or_equal/less_or_equal_float.ets | arkts | main | ---
desc: check less or equal operation for two floats
--- | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
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: float = {{v.left}} as float
const b: float = {{v.right}} as float
assert (a <= b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 00943dcd3f47aa437e70c6ff09d0b2e82211fe9a | gitee |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | getUpdateValue | 获取更新的占位符参数 | getUpdateValue() {
return this.updateValueList
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getUpdateValue 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#Lef... | getUpdateValue() {
return this.updateValueList
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/MyWrapper.ets#L81-L83 | 459d09ac237e4e1721b6168b87133173916402d2 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | importSettings | 从文件导入设置
Requirements: 1.13, 1.14
@param fileUri 导入文件的 URI
@returns 操作结果,包含导入的设置数量 | public async importSettings(fileUri: string): Promise<SettingsResult<number>> {
try {
// 读取文件内容
const file = fileIo.openSync(fileUri, fileIo.OpenMode.READ_ONLY);
let jsonContent: string;
try {
const stat = fileIo.statSync(file.fd);
const buffer = new ArrayBuffer(stat.size);... | 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 importSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileUri AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public async importSettings(fileUri: string): Promise<SettingsResult<number>> {
try {
// 读取文件内容
const file = fileIo.openSync(fileUri, fileIo.OpenMode.READ_ONLY);
let jsonContent: string;
try {
const stat = fileIo.statSync(file.fd);
const buffer = new ArrayBuffer(stat.size);... | https://github.com/richshaw2015/nds | c098737a9c1bd9050f66756cb5142db117b9a511 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | every | Tests whether all elements in the array pass the test
implemented by the provided function. It returns a Boolean value.
@param fn function to execute for each element in the array.
It should return a `true` to indicate the element passes the test, and a `false` value otherwise.
@returns `true` if `fn` returns a `true` ... | public every(fn: (v: T, k: number) => boolean): boolean {
for (let i = 0; i < this.data.length; i++) {
if (!fn(this.data[i], i)) {
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: (v: T, k: number) => boolean): boolean {
for (let i = 0; i < this.data.length; i++) {
if (!fn(this.data[i], i)) {
return false
}
}
return true;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c7f850dd4fe2f3ae1eb067a92aa3834e321bf222 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartBudgetService.ets | arkts | calculateAccuracy | 计算预测准确度 | private static calculateAccuracy(
historicalData: CategoryHistoricalData[],
forecasts: ForecastResult[]
): number {
// 简化实现:基于置信度的平均值
if (forecasts.length === 0) {
return 0;
}
const avgConfidence = forecasts.reduce((sum: number, f: ForecastResult) => sum + f.confidence, 0) / forecasts... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateAccuracy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left historicalData AST#identifier#Righ... | private static calculateAccuracy(
historicalData: CategoryHistoricalData[],
forecasts: ForecastResult[]
): number {
// 简化实现:基于置信度的平均值
if (forecasts.length === 0) {
return 0;
}
const avgConfidence = forecasts.reduce((sum: number, f: ForecastResult) => sum + f.confidence, 0) / forecasts... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | eeab75b0e169bea07c9c0faba58df450c901f570 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/data/DnsStats.ets | arkts | seedFrom | One-time migration: adopt the totals computed from the pre-existing table so
upgrading users keep their history, then switch to incremental updates. | seedFrom(summary: DnsLogSummary): void {
this.total = summary.total;
this.blocked = summary.blocked;
this.requestBytes = summary.requestBytes;
this.responseBytes = summary.responseBytes;
if (summary.lastDomain.length > 0) {
this.lastDomain = summary.lastDomain;
this.lastRule = summary.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left seedFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left summary AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DnsLogSummary AST#identifier#Right AST#)#Lef... | seedFrom(summary: DnsLogSummary): void {
this.total = summary.total;
this.blocked = summary.blocked;
this.requestBytes = summary.requestBytes;
this.responseBytes = summary.responseBytes;
if (summary.lastDomain.length > 0) {
this.lastDomain = summary.lastDomain;
this.lastRule = summary.... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/data/DnsStats.ets#L63-L74 | 55863b09192ef1f24494cb1df8168fcdcae46fd7 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getAllWords | Get all words | async getAllWords(): Promise<WordItem[]> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.orderByAsc(WordColumns.WORD);
const resultSet = await this.store!.query(predicates);
const words: WordItem[] = [];
try {
while (resultSet.... | 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 getAllWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right A... | async getAllWords(): Promise<WordItem[]> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.orderByAsc(WordColumns.WORD);
const resultSet = await this.store!.query(predicates);
const words: WordItem[] = [];
try {
while (resultSet.... | https://github.com/CLMC2025/Vignette | 88128aeb36387bb62de29f8601973c13227656e4 | github |
Octo-o-o-o/harmonyos-ai-workspace | tools/hooks/test-fixtures/BadSecurityKit.ets | arkts | decodeImage | KIT-002: ImageSource 不 release | async decodeImage(buf: ArrayBuffer): Promise<void> {
const imageSource = image.createImageSource(buf);
const px = await imageSource.createPixelMap();
// 漏了 imageSource.release()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left decodeImage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buf AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | async decodeImage(buf: ArrayBuffer): Promise<void> {
const imageSource = image.createImageSource(buf);
const px = await imageSource.createPixelMap();
// 漏了 imageSource.release()
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | e9f22b7b7b61e49b213f16b686fdab8230590c53 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setColorValueWhiteList | ����ɫ�ʹ��˵�Ļ������
@param colors
@return | public setColorValueWhiteList(colors: number[]): DanmakuContext {
this.mColorValueWhiteList.splice(0, this.mColorValueWhiteList.length);
if (colors == null || colors.length == 0) {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_TEXT_COLOR_DANMAKU_FILTER });
} else {
this.mColo... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorValueWhiteList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | public setColorValueWhiteList(colors: number[]): DanmakuContext {
this.mColorValueWhiteList.splice(0, this.mColorValueWhiteList.length);
if (colors == null || colors.length == 0) {
this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_TEXT_COLOR_DANMAKU_FILTER });
} else {
this.mColo... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 5aed02ad4378dda37e53b721a91b57ef12dd8798 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets | arkts | clearKomgaCache | 清除Komga缓存 | async clearKomgaCache(): Promise<void> {
try {
this.komgaCache = null;
const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME);
await dataPreferences.delete(this.KOMGA_KEY);
await dataPreferences.flush();
logger.info(TAG, 'Komga Tab缓存已清除');
} catch ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearKomgaCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene... | async clearKomgaCache(): Promise<void> {
try {
this.komgaCache = null;
const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME);
await dataPreferences.delete(this.KOMGA_KEY);
await dataPreferences.flush();
logger.info(TAG, 'Komga Tab缓存已清除');
} catch ... | https://github.com/DaLongZhuaZi/manxia | 9d7a404b0abf743774f1b49cddc81699136c5a37 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_byte.ets | arkts | main | ---
desc: check subtraction of two bytes
--- | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a - b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a - b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ca519ce71c3ae0faa69a3c86d246b3b95222e90c | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | sticky | Gets the sticky flag, indicating whether to perform sticky matching.
@return { boolean } `true` if sticky matching is enabled, `false` otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get sticky(): boolean {
return this.isSticky
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left sticky 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 A... | get sticky(): boolean {
return this.isSticky
} | https://gitcode.com/iop123123/arkts-static-skills | 29ab4e594bfcd475cc3db4717dd278a5009b25a6 | gitcode |
fbinba3955/Flymby | main/src/main/ets/utils/StringUtil.ets | arkts | formatSize | 计算影片文件大小 | static formatSize(size: number): string {
if (size < 1024) {
return size + 'B'
} else if (size < 1024 * 1024) {
return (size / 1024).toFixed(2) + 'KB'
} else if (size < 1024 * 1024 * 1024) {
return (size / 1024 / 1024).toFixed(2) + 'MB'
} else {
return (size / 1024 / 1024 / 102... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | static formatSize(size: number): string {
if (size < 1024) {
return size + 'B'
} else if (size < 1024 * 1024) {
return (size / 1024).toFixed(2) + 'KB'
} else if (size < 1024 * 1024 * 1024) {
return (size / 1024 / 1024).toFixed(2) + 'MB'
} else {
return (size / 1024 / 1024 / 102... | https://github.com/fbinba3955/Flymby | 4c00f71c5b7fbb7dde8a0d509feaa998030589aa | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | setConnectionInfo | Set connection info from bookmark settings | static setConnectionInfo(inst: number, bookmark: BookmarkSettings, clientName: string = ''): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
const args: string[] = [];
args.push('FreeRDP');
args.push('/gdi:sw');
if (clientName) {
args.push(`/client-hostna... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setConnectionInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static setConnectionInfo(inst: number, bookmark: BookmarkSettings, clientName: string = ''): boolean {
if (!LibFreeRDP.ensureNativeReady()) {
return false;
}
const args: string[] = [];
args.push('FreeRDP');
args.push('/gdi:sw');
if (clientName) {
args.push(`/client-hostna... | https://github.com/tangwengang-del/freerdp-harmonyos | f831655d0db00bc3885f19b38d383b07709f0386 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | toSorted | Copying version of the sort() method.
It returns a new array with the elements sorted in ascending order.
@returns sorted copy of hte current instance using default comparator | public toSorted(): Array<T> {
let arr = new Array<T>(this.data)
arr.doSort(this.data, 0, this.data.length, Array.defaultComparator)
return arr
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#id... | public toSorted(): Array<T> {
let arr = new Array<T>(this.data)
arr.doSort(this.data, 0, this.data.length, Array.defaultComparator)
return arr
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ec5138556069396b65f6b680c55b851cb7d00edb | gitee |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets | arkts | goBack | 方法: goBack
描述: 返回上一页。
返回上一页 | goBack() {
this.uiContext.getRouter().back();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left goBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#... | goBack() {
this.uiContext.getRouter().back();
} | https://gitcode.com/openharmony/codelabs | 895faa05560b8ec2620a70337a789f32b4c576d5 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/utils/BreakpointUtil.ets | arkts | register | 注册断点监听(幂等:重复调用会先解除旧监听,避免泄漏) | register(): void {
if (this.smListener !== null || this.mdListener !== null || this.lgListener !== null) {
this.unregister();
}
this.smListener = this.uiContext.getMediaQuery()
.matchMediaSync('(320vp<=width<600vp)');
this.mdListener = this.uiContext.getMediaQuery()
.matchMediaSync('... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left A... | register(): void {
if (this.smListener !== null || this.mdListener !== null || this.lgListener !== null) {
this.unregister();
}
this.smListener = this.uiContext.getMediaQuery()
.matchMediaSync('(320vp<=width<600vp)');
this.mdListener = this.uiContext.getMediaQuery()
.matchMediaSync('... | https://github.com/XJTUWYD/ArkDiff | f94a319c403b9d7ce1776e4456d267cfc3a8cb96 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.