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
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getLastDayOfMonth
给定年份和月份的最后一天是几号 @param year 年 @param month 月 @returns
static getLastDayOfMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLastDayOfMonth 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#Lef...
static getLastDayOfMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
https://gitcode.com/arkui-x/samples
dae1fe2a020f7d29a4afc4c53b43c45d5ae164c5
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/EventSourcingDAO.ets
arkts
getLatest
获取最新快照
static async getLatest(aggregateType: string, aggregateId: number): Promise<AggregateSnapshot | null> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(AggregateSnapshot.tableName); ...
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 getLatest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggregateType AST#identifier#Right AST#ERROR#Left AST#:#Left ...
static async getLatest(aggregateType: string, aggregateId: number): Promise<AggregateSnapshot | null> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(AggregateSnapshot.tableName); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c66cf7ce15985d0b79bd1f7536bad796c98bfbcb
github
LJ666-ui/harmony-health-care
entry/src/main/ets/deepseek/DeepSeekChatManager.ets
arkts
generateRehabPlan
生成康复方案
async generateRehabPlan( condition: string, surgeryOrDisease: string, daysAfterSurgery?: number, currentStatus?: string ): Promise<string> { const prompt = `请为以下患者制定康复方案: 【疾病/手术】 ${surgeryOrDisease} 【当前状况】 - ${condition} - 术后/发病时间:${daysAfterSurgery ? `${daysAfterSurgery}天` : '未知'} - 当前状态:${cu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left generateRehabPlan AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left condition AST#identifier#Right AST#type_annotation#Left AST#:...
async generateRehabPlan( condition: string, surgeryOrDisease: string, daysAfterSurgery?: number, currentStatus?: string ): Promise<string> { const prompt = `请为以下患者制定康复方案: 【疾病/手术】 ${surgeryOrDisease} 【当前状况】 - ${condition} - 术后/发病时间:${daysAfterSurgery ? `${daysAfterSurgery}天` : '未知'} - 当前状态:${cu...
https://github.com/LJ666-ui/harmony-health-care
0fe8a21fd9d4ebfa2678ba2912bf2f779d54fba9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtParser.ets
arkts
createChapter
创建章节对象
private createChapter( bookTitle: string, chapterNumber: number, title: string, content: string, startPosition: number, endPosition: number ): EBookChapter { return { id: `${bookTitle}_chapter_${chapterNumber}`, bookId: '', // 将在EBook构造函数中设置 chapterNumber: chapterNumbe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bookTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private createChapter( bookTitle: string, chapterNumber: number, title: string, content: string, startPosition: number, endPosition: number ): EBookChapter { return { id: `${bookTitle}_chapter_${chapterNumber}`, bookId: '', // 将在EBook构造函数中设置 chapterNumber: chapterNumbe...
https://github.com/DaLongZhuaZi/manxia
0d06dddb5d6a66367327e0f9082b3f9a9ff72442
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsObserver.ets
arkts
constructor
初始化变量
private constructor() { this.isAlertTimerBeingCreated = false; this.mLastUpdateAlertTime = 0; this.mAlertTimerId = 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private constructor() { this.isAlertTimerBeingCreated = false; this.mLastUpdateAlertTime = 0; this.mAlertTimerId = 0; }
https://gitee.com/openharmony/applications_calendar_data.git
9e93a1ffe190802838e368de43992b4586daba38
gitee
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
addRecordToSession
添加答题记录到会话 @param session 学习会话 @param record 答题记录 @returns 更新后的会话
static addRecordToSession( session: LearningSession, record: AnswerRecord ): LearningSession { const newRecords: AnswerRecord[] = []; for (let i = 0; i < session.records.length; i++) { newRecords.push(session.records[i]); } newRecords.push(record); return { id: session.id, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left addRecordToSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left session AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
static addRecordToSession( session: LearningSession, record: AnswerRecord ): LearningSession { const newRecords: AnswerRecord[] = []; for (let i = 0; i < session.records.length; i++) { newRecords.push(session.records[i]); } newRecords.push(record); return { id: session.id, ...
https://github.com/the-wwyang/kids-learning-app
70c7a0b5841e76e325f9f77184d54649d71ad6d1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets
arkts
setGuideStep
设置引导步骤 用于测试特定步骤的引导
public static async setGuideStep(step: GuideStep): Promise<void> { try { await this.guideManager.initialize(); await this.guideManager.setCurrentStep(step); logger.info(TAG, `✅ 引导步骤已设置为: ${step}`); return Promise.resolve(); } catch (error) { logger.error(TAG, '设置引导步骤失败', String(e...
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 setGuideStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step ...
public static async setGuideStep(step: GuideStep): Promise<void> { try { await this.guideManager.initialize(); await this.guideManager.setCurrentStep(step); logger.info(TAG, `✅ 引导步骤已设置为: ${step}`); return Promise.resolve(); } catch (error) { logger.error(TAG, '设置引导步骤失败', String(e...
https://github.com/DaLongZhuaZi/manxia
9130df9f7d90ed011a0318987a08f596edc15c67
github
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
drawCanvas
-- Public instance methods -- Draws this QR Code, with the given module scale and border modules, onto the given HTML canvas element. The canvas's width and height is resized to (this.size + border * 2) * scale. The drawn image is be purely black and white, and fully opaque. The scale must be a positive integer and the...
public drawCanvas(scale: int, border: int, canvas: CanvasRenderingContext2D): void { if (scale <= 0 || border < 0) throw new Error("Value out of range"); let x1:number = 0; let y1:number = 0; let codeScale: int = (this.size + border * 2) * scale; let canvasMinEdge = Math.min(can...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left drawCanvas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scale AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
public drawCanvas(scale: int, border: int, canvas: CanvasRenderingContext2D): void { if (scale <= 0 || border < 0) throw new Error("Value out of range"); let x1:number = 0; let y1:number = 0; let codeScale: int = (this.size + border * 2) * scale; let canvasMinEdge = Math.min(can...
https://gitee.com/openharmony-sig/qr-code-generator.git
784c47c7e507f5a8efb117189b71bfb3a795e7e4
gitee
ZestBox-18/kitebook-frontend
features/home/src/main/ets/utils/HomeIndexCalculator.ets
arkts
buildHeaderState
根据当前卡片索引和排序模式生成列表区头部文案。
static buildHeaderState(swiperIndex: number, billSortType: BillSortTypeEnum): HomeHeaderState { const headerState: HomeHeaderState = new HomeHeaderState(); headerState.title = swiperIndex === 2 ? '资产账户' : '本周账单'; if (swiperIndex === 2) { headerState.action = '管理资产'; return headerState; } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildHeaderState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left swiperIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n...
static buildHeaderState(swiperIndex: number, billSortType: BillSortTypeEnum): HomeHeaderState { const headerState: HomeHeaderState = new HomeHeaderState(); headerState.title = swiperIndex === 2 ? '资产账户' : '本周账单'; if (swiperIndex === 2) { headerState.action = '管理资产'; return headerState; } ...
https://github.com/ZestBox-18/kitebook-frontend
b9d079b778ca724b880cf1cdea48536b0b5f9b55
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
getLengthMetricsByResourceOrNumber
get LengthMetrics @param Resource | number type @returns LengthMetrics
function getLengthMetricsByResourceOrNumber(resourceOrNumber: Resource | number): LengthMetrics { if (!resourceOrNumber) { return LengthMetrics.vp(0); } else if (typeof resourceOrNumber === 'number') { return LengthMetrics.vp(resourceOrNumber as Double); } else { return LengthMetrics.resource(resource...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getLengthMetricsByResourceOrNumber AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resourceOrNumber AST#identifier#Right AST#type_anno...
function getLengthMetricsByResourceOrNumber(resourceOrNumber: Resource | number): LengthMetrics { if (!resourceOrNumber) { return LengthMetrics.vp(0); } else if (typeof resourceOrNumber === 'number') { return LengthMetrics.vp(resourceOrNumber as Double); } else { return LengthMetrics.resource(resource...
https://gitcode.com/openharmony/arkui_ace_engine
c88dd57e4ad0a53cd8a04451f8b45ec7937e8ed0
gitcode
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
getStatusName
获取状态名称
getStatusName(): string { switch (this.status) { case WordStatus.NEW: return '新词'; case WordStatus.LEARNING: return '学习中'; case WordStatus.REVIEW: return '复习'; case WordStatus.RELEARNING: return '重学'; default: return '未知'; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen...
getStatusName(): string { switch (this.status) { case WordStatus.NEW: return '新词'; case WordStatus.LEARNING: return '学习中'; case WordStatus.REVIEW: return '复习'; case WordStatus.RELEARNING: return '重学'; default: return '未知'; } }
https://github.com/CLMC2025/Vignette
b4dec210422f1f0d45fcb370c829fcfe40096cb5
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets
arkts
getBaseLowFPS
获得低帧率的计算标准
private static getBaseLowFPS(gameFPS: number): number { if (gameFPS >= 60) { return 45; } else if (gameFPS == 40) { return 30; } else if (gameFPS == 30) { return 25; } return 20; // 25时候返回20 }
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 getBaseLowFPS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameFPS AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private static getBaseLowFPS(gameFPS: number): number { if (gameFPS >= 60) { return 45; } else if (gameFPS == 40) { return 30; } else if (gameFPS == 30) { return 25; } return 20; // 25时候返回20 }
https://gitee.com/openharmony/developtools_profiler.git
4f4ee9a1901c856ad6ed83122383e2abfba693f4
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
cleanupAll
Clean up all sessions
static cleanupAll(): void { console.info('GlobalSessionManager: Cleaning up all sessions'); GlobalSessionManager.sessions.forEach((session: SessionState) => { session.cleanup(); }); GlobalSessionManager.sessions.clear(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cleanupAll 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 cleanupAll(): void { console.info('GlobalSessionManager: Cleaning up all sessions'); GlobalSessionManager.sessions.forEach((session: SessionState) => { session.cleanup(); }); GlobalSessionManager.sessions.clear(); }
https://github.com/tangwengang-del/freerdp-harmonyos
89369a941bb7bdb106c384113a2a9d785edbdde3
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/common/utils/DateUtil.ets
arkts
getStartOfWeek
获取本周开始的时间戳
static getStartOfWeek(): number { const now = new Date(); const day = now.getDay() || 7; now.setDate(now.getDate() - day + 1); now.setHours(0, 0, 0, 0); return now.getTime(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStartOfWeek 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#...
static getStartOfWeek(): number { const now = new Date(); const day = now.getDay() || 7; now.setDate(now.getDate() - day + 1); now.setHours(0, 0, 0, 0); return now.getTime(); }
https://gitcode.com/openharmony/codelabs
a81cee42ae75057d53dbc71dcad688cf63d1a38c
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/WaterfallDataSet.ets
arkts
getDotsColors
获取所有高亮点的颜色。 @returns 包含所有高亮点颜色的数组,元素可以是字符串或数字。
public getDotsColors(): Array<string | number> { const colors: Array<number | string> = []; this.mEntries?.dataSource.forEach((value: BarEntry) => { const entry = value as WaterfallEntry; entry.getHighlights().forEach((highlight: WaterfallHighlight) => { colors.push(highlight.getColor()); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDotsColors 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#expressi...
public getDotsColors(): Array<string | number> { const colors: Array<number | string> = []; this.mEntries?.dataSource.forEach((value: BarEntry) => { const entry = value as WaterfallEntry; entry.getHighlights().forEach((highlight: WaterfallHighlight) => { colors.push(highlight.getColor()); ...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
689f58ab5afb3476c3fedbd02c4b433cdc957555
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/DemoDataService.ets
arkts
seedTags
---------------- 标签数据填充 ----------------
private static async seedTags(userId: number) { try { const existingTags = await TagDAO.getAll(userId); if (existingTags.length > 0) { console.info('[DemoDataService] 标签数据已存在,跳过生成'); return; } const tagNames: string[] = ['日常', '工作', '娱乐', '紧急', '报销', '固定支出']; const t...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left seedTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId...
private static async seedTags(userId: number) { try { const existingTags = await TagDAO.getAll(userId); if (existingTags.length > 0) { console.info('[DemoDataService] 标签数据已存在,跳过生成'); return; } const tagNames: string[] = ['日常', '工作', '娱乐', '紧急', '报销', '固定支出']; const t...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f53499abd22bbe67078923c8465eeb3180504fc9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
analyzeSuwayomiSourceIcons
分析Suwayomi图源图标缓存 路径: /Download/com.dlzz.manxia/suwayomi/source_icons/
private async analyzeSuwayomiSourceIcons(): Promise<StorageItem> { try { const dirInfo = await this.getDownloadSubdirInfo('suwayomi/source_icons'); const basePath = DownloadDirManager.isReady() ? `${DownloadDirManager.getPath()}/suwayomi/source_icons` : ''; return { type: StorageT...
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 analyzeSuwayomiSourceIcons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
private async analyzeSuwayomiSourceIcons(): Promise<StorageItem> { try { const dirInfo = await this.getDownloadSubdirInfo('suwayomi/source_icons'); const basePath = DownloadDirManager.isReady() ? `${DownloadDirManager.getPath()}/suwayomi/source_icons` : ''; return { type: StorageT...
https://github.com/DaLongZhuaZi/manxia
ba6c31890db223774f9251ebe0fa2173451772e8
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets
arkts
workWindowMinutes
Total clock minutes in the work window (before subtracting breaks).
public get workWindowMinutes(): number { const ws: number = this.workStartMinutes const we: number = this.workEndMinutes return this.isCrossMidnight ? (1440 - ws) + we : we - ws }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left workWindowMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public get workWindowMinutes(): number { const ws: number = this.workStartMinutes const we: number = this.workEndMinutes return this.isCrossMidnight ? (1440 - ws) + we : we - ws }
https://github.com/OMGCA/sakipay
db18f7140464a1ba86ebe1caa2d1af28fdc2273c
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/BillItemComponent.ets
arkts
build
构建单个账单列表项,展示分类、备注、金额和时间。
build() { Row() { SymbolGlyph(this.bill.getCategoryIcon()) .fontSize(20) .fontColor([this.getBillTintColor()]) .width(36) .height(36) .borderRadius(8) .backgroundColor(this.getBillBgColor()) .padding(8) Column() { Text(this.bill.category...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { SymbolGlyph(this.bill.getCategoryIcon()) .fontSize(20) .fontColor([this.getBillTintColor()]) .width(36) .height(36) .borderRadius(8) .backgroundColor(this.getBillBgColor()) .padding(8) Column() { Text(this.bill.category...
https://github.com/ZestBox-18/kitebook-frontend
e3dfbe013e9beb7811b4ea534179f1c6202a62bc
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Either.ets
arkts
right
Checks if Either is Right and returns R data @returns { R } Right data of Either @throws { Error } If Either is not Right @syscap SystemCapability.Utils.Lang @final @FaAndStageModel
public final get right(): R { if (this.isRight()) { return this.Rdata } throw new Error("Cannot read Right value from Left!") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left final AST#identifier#Right AST#get#Left get AST#get#Right AST#identifier#Left right AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AS...
public final get right(): R { if (this.isRight()) { return this.Rdata } throw new Error("Cannot read Right value from Left!") }
https://gitcode.com/iop123123/arkts-static-skills
95c19934b7ef645dd38ff57d0f7281dacbfcdc02
gitcode
somnio-software/my-bot-pal
entry/src/main/ets/utils/LocationService.ets
arkts
getLastKnownLocation
Gets the last known location from the cache This is useful for low-power scenarios where approximate location is enough @returns Promise with the location data or null if not available
public async getLastKnownLocation(): Promise<LocationData | null> { try { const location = geoLocationManager.getLastLocation(); return this.formatLocationData(location); } catch (err) { const error = err as BusinessError; hilog.error(0x0000, 'LocationService', `Failed to get last loca...
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 getLastKnownLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
public async getLastKnownLocation(): Promise<LocationData | null> { try { const location = geoLocationManager.getLastLocation(); return this.formatLocationData(location); } catch (err) { const error = err as BusinessError; hilog.error(0x0000, 'LocationService', `Failed to get last loca...
https://github.com/somnio-software/my-bot-pal
53e599c03fff1b796b4e4cb8fb3b34f583dc7616
github
HarmonyOS_Samples/BestPracticeSnippets
AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets
arkts
computeTask
[EndExclude cold_start_speed_optimization]
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left computeTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#...
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
61f1b78f35bc2224ec94a1c6ffb3167400edaddb
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets
arkts
insertEnd
Inserts an element at the end of the deque. @param element - The element to insert.
public insertEnd(element: T): void { if (this.isFull()) { this.increaseCapacity(); } this.buffer[this.rear] = element; this.rear = (this.rear + 1) % this.capacity; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Ri...
public insertEnd(element: T): void { if (this.isFull()) { this.increaseCapacity(); } this.buffer[this.rear] = element; this.rear = (this.rear + 1) % this.capacity; }
https://gitcode.com/iop123123/arkts-static-skills
77e260fb92858e36d15f21cf1f57a81d51c1ff0d
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/MessageManager.ets
arkts
clearAllMessages
Clear all messages (for testing/debugging).
static async clearAllMessages(): Promise<boolean> { if (!MessageManager.dataPreferences) { Logger.warn('MessageManager', 'Preferences not initialized'); return false; } try { await MessageManager.dataPreferences.clear(); await MessageManager.dataPreferences.flush(); Logger.i...
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 clearAllMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
static async clearAllMessages(): Promise<boolean> { if (!MessageManager.dataPreferences) { Logger.warn('MessageManager', 'Preferences not initialized'); return false; } try { await MessageManager.dataPreferences.clear(); await MessageManager.dataPreferences.flush(); Logger.i...
https://github.com/Harrisonls2004/WaterFlow
4f6c9a3f6d4e0fb57b5a5560d70fdd528e739e04
github
openharmony-tpc/openharmony_tpc_samples
SmartRefreshLayout/library/src/main/ets/components/topRefresh/SmartRefreshForFlyRefresh.ets
arkts
getDownYOffset
和scrollerEndYOffset结合使用
getDownYOffset() : number { return this.downYOffset }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDownYOffset 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#stateme...
getDownYOffset() : number { return this.downYOffset }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
f002ab7003438d4615e3b0d6cca9ba7c64a0b942
gitee
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/assertDeepEquals.ets
arkts
logMsg
获取失败显示日志 @param actualValue 实际对象 @param expected 期待比较对象
function logMsg(actualValue: AnyType, expected: AnyType): string { const actualMsg = getObjectDesc(actualValue); const expectMsg = getObjectDesc(expected); return actualMsg + ' is not deep equal ' + expectMsg; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left logMsg AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left actualValue AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function logMsg(actualValue: AnyType, expected: AnyType): string { const actualMsg = getObjectDesc(actualValue); const expectMsg = getObjectDesc(expected); return actualMsg + ' is not deep equal ' + expectMsg; }
https://gitee.com/openharmony/testfwk_arkxtest.git
0a43c062ae7d4bfab330af64f614927d6db139a4
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
getUserInvitations
获取用户的待处理邀请
static async getUserInvitations(userId: number): Promise<LedgerInvitation[]> { try { return await LedgerInvitationDAO.getByInviteeUserId(userId); } catch (error) { console.error('[SharedLedgerService] 获取用户邀请失败:', error); return []; } }
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 getUserInvitations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef...
static async getUserInvitations(userId: number): Promise<LedgerInvitation[]> { try { return await LedgerInvitationDAO.getByInviteeUserId(userId); } catch (error) { console.error('[SharedLedgerService] 获取用户邀请失败:', error); return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f7dada99a5060ba59acaa2d8734b4df38ea78c3d
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/GuidePage.ets
arkts
getEnterAnimation
获取引导页进入动画 @returns 引导页进入动画
public getEnterAnimation(): AnimatorOptions | null { return this.enterAnimation; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnterAnimation 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#Le...
public getEnterAnimation(): AnimatorOptions | null { return this.enterAnimation; }
https://github.com/wuba/omni-ui
970c5db2c52641f7a6162fea50f01389e5d8028d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets
arkts
updateStats
更新统计信息
private updateStats(): void { const pages: IPageManager[] = []; this.pageManagers.forEach((value: IPageManager) => { pages.push(value); }); let totalTimers = 0; let totalPromises = 0; let totalResources = 0; let totalListeners = 0; this.pageManagers.forEach((manager: IPageMa...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateStats 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#express...
private updateStats(): void { const pages: IPageManager[] = []; this.pageManagers.forEach((value: IPageManager) => { pages.push(value); }); let totalTimers = 0; let totalPromises = 0; let totalResources = 0; let totalListeners = 0; this.pageManagers.forEach((manager: IPageMa...
https://github.com/DaLongZhuaZi/manxia
a7ecac9bb0745a3d6a14b566364e08bd8669ace2
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/components/TouchPointerView.ets
arkts
moveTo
Move pointer to position (desktop coordinates)
moveTo(x: number, y: number): void { this.pointerX = Math.max(0, Math.min(x, this.desktopWidth - 1)); this.pointerY = Math.max(0, Math.min(y, this.desktopHeight - 1)); // Send mouse move event if (this.instance !== 0) { LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left moveTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Right...
moveTo(x: number, y: number): void { this.pointerX = Math.max(0, Math.min(x, this.desktopWidth - 1)); this.pointerY = Math.max(0, Math.min(y, this.desktopHeight - 1)); // Send mouse move event if (this.instance !== 0) { LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,...
https://github.com/tangwengang-del/freerdp-harmonyos
8a3b77b257cd9f777005e1797b7d1cc046f24fdc
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets
arkts
getY
Returns the center value of the candle. (Middle value between high and low)
public getY(): number { return super.getY(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getY AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public getY(): number { return super.getY(); }
https://gitee.com/openharmony/developtools_profiler.git
94714fd0f490beb2a2fcf31ad1921cd520208142
gitee
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets
arkts
handleNumberClick
事件处理: handleNumberClick 描述: 处理数字键盘点击事件。 逻辑: 1. 检查长度是否未满 6 位。 2. 追加数字到 password 字符串。 3. 如果长度达到 6 位,自动触发验证。 @param num - 点击的数字字符 ('0'-'9') 数字按钮点击处理
handleNumberClick(num: string) { // 长度限制检查 if (this.password.length < 6) { // 字符串拼接 this.password += num; // 输入满6位后自动验证 if (this.password.length === 6) { this.verifyPassword(); } } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleNumberClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri...
handleNumberClick(num: string) { // 长度限制检查 if (this.password.length < 6) { // 字符串拼接 this.password += num; // 输入满6位后自动验证 if (this.password.length === 6) { this.verifyPassword(); } } }
https://gitcode.com/openharmony/codelabs
59ff7c4b95fd23198ae1c077c04a6b016c47a23e
gitcode
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/Consent.test.ets
arkts
<arrow>
ConsentModule (test-accessible per project_facade_api_surface)
async (): Promise<void> => { h.instance.consentModule.giveConsent(['events']); },
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Left AST#type_identifier#Left Promise AST#type_identifi...
async (): Promise<void> => { h.instance.consentModule.giveConsent(['events']); },
https://github.com/Countly/countly-sdk-hos
7d807fe7261a1bc1c3b635f110d0db778880f3a6
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GameControllerService.ets
arkts
heartbeatCheck
心跳检测 - 检查设备是否仍然连接 对于某些设备(如雷蛇手柄),电源管理不透明, 系统可能不会及时发送断开事件。 此函数通过重新查询设备列表来检测设备断开。 @returns 断开的设备数量
heartbeatCheck(): number { if (!native || !this.initialized || !this.monitoring) { return 0; } return native.heartbeatCheck(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left heartbeatCheck 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#stateme...
heartbeatCheck(): number { if (!native || !this.initialized || !this.monitoring) { return 0; } return native.heartbeatCheck(); }
https://github.com/AlkaidLab/moonlight-harmony
34ba53c983ba992d7a2ff9ebaad3c7454d50da47
github
Lycorius03/studyos
apps/harmonyos/entry/src/main/ets/bridge/StudyOsBridge.ets
arkts
startSession
---- Quiz session ----
startSession(topicId: string, mode: string): Session { this.ensureInit(); const json: string = nativeModule.studyosStartSession(this.handle, topicId, mode); const parsed: Session = JSON.parse(json) as Session; return parsed; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left topicId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R...
startSession(topicId: string, mode: string): Session { this.ensureInit(); const json: string = nativeModule.studyosStartSession(this.handle, topicId, mode); const parsed: Session = JSON.parse(json) as Session; return parsed; }
https://github.com/Lycorius03/studyos
d9e88a7279c23f6194dbf5dc306156743c3c792b
github
apap6628114/nga_oh
entry/src/main/ets/store/AuthStore.ets
arkts
loadSessions
============== Session ==============
private async loadSessions(): Promise<void> { const saved = await this.store.getJSON<Array<Array<Object>>>(SESSION_KEY) if (!saved) return for (let i = 0; i < saved.length; i++) { const entry = saved[i] const token = String(entry[0]) const sessionObj = entry[1] as Record<string, Object> ...
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 loadSessions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async loadSessions(): Promise<void> { const saved = await this.store.getJSON<Array<Array<Object>>>(SESSION_KEY) if (!saved) return for (let i = 0; i < saved.length; i++) { const entry = saved[i] const token = String(entry[0]) const sessionObj = entry[1] as Record<string, Object> ...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AuthStore.ets#L130-L148
90913ea13400c7ed4d24823db476d6b369c970c0
github
openharmony/developtools_ace_ets2bundle
compiler/sample/pages/testcases/showcaseCovid19.ets
arkts
build
do not put curley brackets around the item gen function below, compiler will not generate needed return
build() { Column() { ForEach(this.countriesVM(), (country) => CountryStatsView({ monthsPresentation: $monthsPresentation, countryData: country}), (country) => country.data.alpha2 ).setUniqueKey("ForEach") }.wrapContent().setUniqueKey("ForEach_Col") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { ForEach(this.countriesVM(), (country) => CountryStatsView({ monthsPresentation: $monthsPresentation, countryData: country}), (country) => country.data.alpha2 ).setUniqueKey("ForEach") }.wrapContent().setUniqueKey("ForEach_Col") }
https://gitee.com/openharmony/developtools_ace_ets2bundle.git
718b57a3acc8463170a8fd173588f47c60051431
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/NativeModuleManager.ets
arkts
initializeGlobalObject
初始化全局对象访问
private initializeGlobalObject(): void { try { // 使用间接方式获取全局对象,避免直接使用globalThis const getGlobal = new Function('return this') as () => Record<string, Function>; const globalObj: Record<string, Function> = getGlobal(); if (globalObj && typeof globalObj === 'object') { this.gl...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeGlobalObject 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 vo...
private initializeGlobalObject(): void { try { // 使用间接方式获取全局对象,避免直接使用globalThis const getGlobal = new Function('return this') as () => Record<string, Function>; const globalObj: Record<string, Function> = getGlobal(); if (globalObj && typeof globalObj === 'object') { this.gl...
https://github.com/DaLongZhuaZi/manxia
53dc8a2149c8a8f46c129990deba2d944a52d5d2
github
fbinba3955/Flymby
common/src/main/ets/utils/StringUtil.ets
arkts
number2time
将毫秒数转换为时间格式字符串 @param milliseconds 毫秒数 @returns 格式化的时间字符串 (HH:MM:SS 或 MM:SS)
static number2time(milliseconds: number): string { if (!milliseconds || milliseconds < 0) { return '00:00'; } const totalSeconds = Math.floor(milliseconds / 1000); const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((totalSeconds % 3600) / 60); const seconds = tota...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left number2time AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left milliseconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static number2time(milliseconds: number): string { if (!milliseconds || milliseconds < 0) { return '00:00'; } const totalSeconds = Math.floor(milliseconds / 1000); const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((totalSeconds % 3600) / 60); const seconds = tota...
https://github.com/fbinba3955/Flymby
88431d46314dc133fdcab7c0400309e9db880b40
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets
arkts
getComponentDetailDataByLocal
获取本地组件详情数据 @returns Promise<ComponentDetailModel[]>
public getComponentDetailDataByLocal(): Promise<ComponentDetailModel[]> { return new Promise((resolve: (value: ComponentDetailModel[]) => void, reject: (reason?: Object) => void) => { LocalRequestManager.get<ComponentDetailModel[]>(LocalFileNameEnum.COMPONENT_DETAIL_DATA) .then((result: Compon...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentDetailDataByLocal 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#instanti...
public getComponentDetailDataByLocal(): Promise<ComponentDetailModel[]> { return new Promise((resolve: (value: ComponentDetailModel[]) => void, reject: (reason?: Object) => void) => { LocalRequestManager.get<ComponentDetailModel[]>(LocalFileNameEnum.COMPONENT_DETAIL_DATA) .then((result: Compon...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
e57e22f1a55211691f2e3a4b01e98a221fbb01c1
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
isPositive
Return true if the value of this Decimal is positive, otherwise return false. @returns { boolean } the boolean type
public isPositive(): boolean { return this.sign > 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPositive 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#bo...
public isPositive(): boolean { return this.sign > 0; }
https://gitcode.com/iop123123/arkts-static-skills
63b2614e2ab6e226d7db4604d80d16e26946113a
gitcode
fuhhhhhhhh/openharmony
entry/src/main/ets/data/DatabaseHelper.ets
arkts
deleteTransactionsByCategory
删除某个分类下的所有交易记录 @param categoryId 分类ID @returns 删除的记录数量
public static async deleteTransactionsByCategory(categoryId: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.transactionDao.deleteTransactionsByCategory(catego...
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 deleteTransactionsByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cate...
public static async deleteTransactionsByCategory(categoryId: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.transactionDao.deleteTransactionsByCategory(catego...
https://github.com/fuhhhhhhhh/openharmony
4e1371d13c2f2b6df370f76713fb619c8af45624
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
clearFailedTasks
清理失败的任务
public clearFailedTasks(): number { const failedIds: string[] = []; const failedTaskIds = this.taskIdsByStatus.get(UnifiedTaskStatus.FAILED); if (failedTaskIds) { for (const taskId of failedTaskIds) { failedIds.push(taskId); } } failedIds.forEach(id => { this.unregis...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearFailedTasks 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 AS...
public clearFailedTasks(): number { const failedIds: string[] = []; const failedTaskIds = this.taskIdsByStatus.get(UnifiedTaskStatus.FAILED); if (failedTaskIds) { for (const taskId of failedTaskIds) { failedIds.push(taskId); } } failedIds.forEach(id => { this.unregis...
https://github.com/DaLongZhuaZi/manxia
561e447f776ca124433bc41e3e12b6c1ae017bb8
github
openharmony/applications_mms
entry/src/main/ets/views/receive/receiveController.ets
arkts
filterContacts
Filter search terms to match contacts
filterContacts(textValue) { try { this.contacts = this.contactsTemp.filter((contact) => { if (contact.contactName && contact.contactName.toLowerCase().search(textValue) != -1) { HiLog.i(TAG, 'filterContacts, contactName'); return true; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left filterContacts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left textValue AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST...
filterContacts(textValue) { try { this.contacts = this.contactsTemp.filter((contact) => { if (contact.contactName && contact.contactName.toLowerCase().search(textValue) != -1) { HiLog.i(TAG, 'filterContacts, contactName'); return true; ...
https://gitee.com/openharmony/applications_mms.git
253d89f2898342ea02bce4291163863352422b0a
gitee
the-wwyang/kids-learning-app
src/main/ets/common/ErrorHandler.ets
arkts
handleAsync
处理异步操作的错误
public static async handleAsync<T>( promise: Promise<T>, context: string, type: ErrorType = ErrorType.UNKNOWN, showToUser: boolean = true ): Promise<ErrorResult<T>> { try { const data = await promise; return { success: true, data: data }; } catch (error) { ...
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#binary_expression#Left AST#identifier#Left handleAsync AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expr...
public static async handleAsync<T>( promise: Promise<T>, context: string, type: ErrorType = ErrorType.UNKNOWN, showToUser: boolean = true ): Promise<ErrorResult<T>> { try { const data = await promise; return { success: true, data: data }; } catch (error) { ...
https://github.com/the-wwyang/kids-learning-app
21a5f951501cba69026c9375784dd17d44c69f12
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test40_original_index.ets
arkts
testPipeline
--- Chained pipeline ---
function testPipeline(): string { let nums: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let result: number = nums .filter((n: number): boolean => { return n % 2 === 0; }) .map((n: number): number => { return n * n; }) .reduce((sum: number, n: number): number => { return sum + n; }, 0); return String(r...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testPipeline AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_typ...
function testPipeline(): string { let nums: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let result: number = nums .filter((n: number): boolean => { return n % 2 === 0; }) .map((n: number): number => { return n * n; }) .reduce((sum: number, n: number): number => { return sum + n; }, 0); return String(r...
https://github.com/miaochiahao/ark-ghidra
afc4036f64ab1f1cc76bb33b7a6d0c69bf92b38f
github
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
save
保存实体(插入或更新) 根据主键值判断是 INSERT 还是 UPDATE 在数据库操作前执行 beforeSave 钩子 @param entityData 实体数据 @returns Promise<SaveResult>
async save(entityData: EntityData): Promise<SaveResult> { this.ensureWritePathAllowed('SAVE') return await this.withSessionStore(async (repo) => { const result = await repo.crudOperations.save(entityData) return repo.ensureSaveResultSuccess(result, 'SAVE') }) }
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 save AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityData AS...
async save(entityData: EntityData): Promise<SaveResult> { this.ensureWritePathAllowed('SAVE') return await this.withSessionStore(async (repo) => { const result = await repo.crudOperations.save(entityData) return repo.ensureSaveResultSuccess(result, 'SAVE') }) }
https://github.com/offlinecat-dev/OCNetORM
c0ae8e1d3c5868f4a57f078795df3b779fa727d9
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets
arkts
evaluateBMI
评估BMI风险
private static evaluateBMI(weightKg: number, heightCm: number): RiskFactor { const heightM = heightCm / 100; const bmi = weightKg / (heightM * heightM); let score = 0; let level: 'low' | 'medium' | 'high' | 'very_high' = 'low'; if (bmi >= 32) { score = 85; level = 'very_high'; } else...
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 evaluateBMI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left weightKg AST#identifier#Right AST#ERROR#Left AST#:#Left...
private static evaluateBMI(weightKg: number, heightCm: number): RiskFactor { const heightM = heightCm / 100; const bmi = weightKg / (heightM * heightM); let score = 0; let level: 'low' | 'medium' | 'high' | 'very_high' = 'low'; if (bmi >= 32) { score = 85; level = 'very_high'; } else...
https://github.com/LJ666-ui/harmony-health-care
fe0ce20156542c6aed9b192e7ac5ba920fe96a4a
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
getUserId
获取当前用户id return 用户id
private async getUserId(): Promise<number> { let userId: number = 0; try { const accountManager: osAccount.AccountManager = osAccount.getAccountManager(); userId = await accountManager.getForegroundOsAccountLocalId(); } catch (error) { Log.error(`getForegroundOsAccountLocalId faild, code...
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 getUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
private async getUserId(): Promise<number> { let userId: number = 0; try { const accountManager: osAccount.AccountManager = osAccount.getAccountManager(); userId = await accountManager.getForegroundOsAccountLocalId(); } catch (error) { Log.error(`getForegroundOsAccountLocalId faild, code...
https://gitee.com/openharmony/applications_permission_manager.git
e3be02ebbc63c1f57820114846c223d915fc9b12
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/LegendRenderer.ets
arkts
getFormPaint
Returns the Paint object used for drawing the Legend forms. @return
public getFormPaint(): Paint { return this.mLegendFormPaint; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFormPaint 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 Paint AST...
public getFormPaint(): Paint { return this.mLegendFormPaint; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
396661382eefc036af07917a2676b2176ab8a478
gitee
ChangJing01/HarmonyOS-FinalProject
entry/src/main/ets/pages/CategoryPage.ets
arkts
getCurrentCategory
获取当前选中分类对应的GoodsCategory
getCurrentCategory(): GoodsCategory | null { const categoryMap = [ null, // 0: 精选 - 显示全部 GoodsCategory.PHONE, // 1: 手机 GoodsCategory.CLOTHES, // 2: 服饰 GoodsCategory.WEAR, // 3: 穿搭 GoodsCategory.FURNITURE // 4: 家具 ]; return categoryMap[...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCategory 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#id...
getCurrentCategory(): GoodsCategory | null { const categoryMap = [ null, // 0: 精选 - 显示全部 GoodsCategory.PHONE, // 1: 手机 GoodsCategory.CLOTHES, // 2: 服饰 GoodsCategory.WEAR, // 3: 穿搭 GoodsCategory.FURNITURE // 4: 家具 ]; return categoryMap[...
https://github.com/ChangJing01/HarmonyOS-FinalProject
24b6598a72df62d5674c01b8ce9184a2368db8f0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Makes a copy of internal elements to insertPos from startPos to endPos. @param insertPos insert index to place copied elements @param startPos start index to begin copy from @param endPos last index to end copy from, excluded See rules of parameters normalization on {@link https://developer.mozilla.org/en-US/docs/Web/J...
/* public */ internal copyWithin(insertPos: int, startPos: int, endPos: int): void { if (insertPos < -this.length) { insertPos = 0 } if (insertPos >= this.length) { return } if (insertPos < 0) { insertPos = this.length + insertPos ...
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST...
/* public */ internal copyWithin(insertPos: int, startPos: int, endPos: int): void { if (insertPos < -this.length) { insertPos = 0 } if (insertPos >= this.length) { return } if (insertPos < 0) { insertPos = this.length + insertPos ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bfd9dc4320583bd9adfdbfc10b35930b3d32c356
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarDataSet.ets
arkts
calcEntryCountIncludingStacks
Calculates the total number of entries this DataSet represents, including stacks. All values belonging to a stack are calculated separately.
private calcEntryCountIncludingStacks(yVals: JList<BarEntry>): void { this.mEntryCountStacks = 0; for (let i = 0; i < yVals.length(); i++) { let vals: number[] | null = yVals.get(i).getYVals(); if (!vals) this.mEntryCountStacks++; else this.mEntryCountStacks += vals.lengt...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcEntryCountIncludingStacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left yVals AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private calcEntryCountIncludingStacks(yVals: JList<BarEntry>): void { this.mEntryCountStacks = 0; for (let i = 0; i < yVals.length(); i++) { let vals: number[] | null = yVals.get(i).getYVals(); if (!vals) this.mEntryCountStacks++; else this.mEntryCountStacks += vals.lengt...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
50d89ec7a43f410904ae8f1d6a4cc9598efcadd0
gitee
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar_forpc.ets
arkts
onCloseButtonClick
点击关闭按钮
onCloseButtonClick(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCloseButtonClick 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_express...
onCloseButtonClick(): void { }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
aab6aaa6e9416061c2f227f1257eaf3d325342d1
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/LimitLine.ets
arkts
setLineWidth
set the line width of the chart (min = 0.2f, max = 12f); default 2f NOTE: thinner line == better performance, thicker line == worse performance @param width
public setLineWidth(width: number) { if (width < 0.2) width = 0.2; if (width > 12.0) width = 12.0; this.mLineWidth = width; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public setLineWidth(width: number) { if (width < 0.2) width = 0.2; if (width > 12.0) width = 12.0; this.mLineWidth = width; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5e86e75219c8769aa0d090c877274f4fb18d1a3a
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint16Array with the same ArrayBuffer @returns new Uint16Array with the same ArrayBuffer
public subarray(): Uint16Array { return this.subarray(0, this.length) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray 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 Uint16Array A...
public subarray(): Uint16Array { return this.subarray(0, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
90bca8312a0feb5de46c6a5f6390805296eda112
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Function.ets
arkts
__lambdaUnsafeCallStub
Implementation body for the Runtime.lambdaUnsafeCallStub
function __lambdaUnsafeCallStub(fn: Function, r: FixedArray<Any>): Any { let arity: int = r.length if (arity > 16) { throw new Error("Internal arity exceeds threshold") } switch (arity) { case 0: if (!(fn instanceof FunctionR0)) { break } return (fn as FunctionR0<Any, Any>) ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left __lambdaUnsafeCallStub AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fn AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function __lambdaUnsafeCallStub(fn: Function, r: FixedArray<Any>): Any { let arity: int = r.length if (arity > 16) { throw new Error("Internal arity exceeds threshold") } switch (arity) { case 0: if (!(fn instanceof FunctionR0)) { break } return (fn as FunctionR0<Any, Any>) ...
https://gitcode.com/iop123123/arkts-static-skills
866824cdc70f9892ba9a881c23b708178d605ff5
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
valueOf
Returns the object itself @returns { Int32Array } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): Int32Array { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf 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 Int32Array AST...
public valueOf(): Int32Array { return this }
https://gitcode.com/iop123123/arkts-static-skills
07946e879f54ebeab2215e4003f5ffeaca011e96
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_error/user/main.ets
arkts
testSayHello
==================== 全局函数测试 ====================
function testSayHello() { let errorMsg: string = ""; try { hello.sayHello(); } catch (error) { errorMsg = error.toString(); } arktest.assertEQ("Error: System initialization failed", errorMsg); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSayHello AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declar...
function testSayHello() { let errorMsg: string = ""; try { hello.sayHello(); } catch (error) { errorMsg = error.toString(); } arktest.assertEQ("Error: System initialization failed", errorMsg); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
92072a8e87e0fbe1b45ee68f8d0c86974f22a991
gitcode
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/component/VerificationCodeField.ets
arkts
build
构建验证码输入组件 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.verificationCode, type: "number", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: th...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.verificationCode, type: "number", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: th...
https://github.com/Joker-x-dev/CoolMallArkTS
c52d5d65a781f22c5fb81b1991f1079e3a671dd9
github
dingzhilin1990/zhilinclaw
src/agents/HanwudiWorkflow.ets
arkts
step6_FixIssues
步骤 6: 问题修复
private async step6_FixIssues(qualityResult: QualityReport): Promise<any> { this.addLog(6, 'Fixer', '开始问题修复', 'started'); const issues = qualityResult.issues; const fixResults = []; for (const issue of issues) { const fixResult = await this.fixer.process(JSON.stringify(issue)); f...
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 step6_FixIssues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left qualityResult AST#identifier#Right AS...
private async step6_FixIssues(qualityResult: QualityReport): Promise<any> { this.addLog(6, 'Fixer', '开始问题修复', 'started'); const issues = qualityResult.issues; const fixResults = []; for (const issue of issues) { const fixResult = await this.fixer.process(JSON.stringify(issue)); f...
https://github.com/dingzhilin1990/zhilinclaw
8eaefd3c6f37f8381d11da5a62349ee784482429
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StorageUtil.ets
arkts
saveToken
保存Token @param token 认证令牌
static async saveToken(token: string): Promise<void> { try { const prefs: preferences.Preferences = await StorageUtil.getPreferences(); await prefs.put(StorageUtil.TOKEN_KEY, token); await prefs.flush(); } catch (error) { console.error('保存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 saveToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#...
static async saveToken(token: string): Promise<void> { try { const prefs: preferences.Preferences = await StorageUtil.getPreferences(); await prefs.put(StorageUtil.TOKEN_KEY, token); await prefs.flush(); } catch (error) { console.error('保存Token失败:', error); } }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
fa752878d0d1190c100f44f10ede8be03ae49f90
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebSearchService.ets
arkts
buildContentForAI
构建给 AI 的内容(限制总长度,避免上下文过大)
private buildContentForAI(results: SearchResultItem[]): string { // 引用格式指引贴在搜索结果旁边,比塞进 system 更精准、不调用搜索时 0 token 占用。 // 与 BuiltinTools.ets 的工具 description 一致,避免两边出现冲突的指令。 let content = '以下是搜索结果。引用搜索结果时请使用标准 Markdown 链接格式 [title](url),不要写成 [1]、[2] 这类编号。\n\n' const maxChars = 3800 for (let i = 0; i...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildContentForAI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip...
private buildContentForAI(results: SearchResultItem[]): string { // 引用格式指引贴在搜索结果旁边,比塞进 system 更精准、不调用搜索时 0 token 占用。 // 与 BuiltinTools.ets 的工具 description 一致,避免两边出现冲突的指令。 let content = '以下是搜索结果。引用搜索结果时请使用标准 Markdown 链接格式 [title](url),不要写成 [1]、[2] 这类编号。\n\n' const maxChars = 3800 for (let i = 0; i...
https://github.com/LongLiveY96/chatcube
2a037eeabb374d9cc2ddab3417630f1bdc865a43
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/services/EventHubManager.ets
arkts
init
初始化,在主页面的 aboutToAppear 调用
public async init(context: common.Context): Promise<void> { EventHubManager.ctx = context; }
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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
public async init(context: common.Context): Promise<void> { EventHubManager.ctx = context; }
https://gitcode.com/openharmony/codelabs
78a7b1d148450d236409083b93a83cde522cb65e
gitcode
silence17/harmonydemo
common_lib/src/main/ets/utils/JumpAbility.ets
arkts
jumpToLoginAbility
跳转登陆页面
static jumpToLoginAbility() { let wantInfo = { //可跨设备调用, '':当前设备 deviceId: '', bundleName: 'com.example.rankdemo', //待启动的UIAbility abilityName: 'LoginAbility', //moduleName在待启动的UIAbility属于不同的Module时添加 parameters: { info: '来自EntryAbility Index页面' }, } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left jumpToLoginAbility 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#{#L...
static jumpToLoginAbility() { let wantInfo = { //可跨设备调用, '':当前设备 deviceId: '', bundleName: 'com.example.rankdemo', //待启动的UIAbility abilityName: 'LoginAbility', //moduleName在待启动的UIAbility属于不同的Module时添加 parameters: { info: '来自EntryAbility Index页面' }, } ...
https://github.com/silence17/harmonydemo
7b847dbf5726fa55460a285dd3c9a535670627ac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ChineseConverter.ets
arkts
getMappingSize
获取映射表大小
getMappingSize(): { s2t: number; t2s: number } { return { s2t: ChineseConverter.s2tMap.size, t2s: ChineseConverter.t2sMap.size }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMappingSize 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#statement_block#Left AST#{#Left { AST#{#Right A...
getMappingSize(): { s2t: number; t2s: number } { return { s2t: ChineseConverter.s2tMap.size, t2s: ChineseConverter.t2sMap.size }; }
https://github.com/DaLongZhuaZi/manxia
787db88892e3d81932ca8f0eade12e3ca26da634
github
PollenWang6/HiXD
entry/src/main/ets/services/ExperimentService.ets
arkts
followRedirects
===== 工具方法 =====
private async followRedirects(startUrl: string, maxSteps: number = 10): Promise<HttpResponse> { let currentUrl = startUrl; for (let i = 0; i < maxSteps; i++) { const resp = await this.http.getNoRedirect(currentUrl); if (!resp.isRedirect || !resp.location) { return resp; } let l...
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 followRedirects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startUrl AST#identifier#Right AST#ERROR#Left AST#:#L...
private async followRedirects(startUrl: string, maxSteps: number = 10): Promise<HttpResponse> { let currentUrl = startUrl; for (let i = 0; i < maxSteps; i++) { const resp = await this.http.getNoRedirect(currentUrl); if (!resp.isRedirect || !resp.location) { return resp; } let l...
https://github.com/PollenWang6/HiXD
5adcff93cc3c67f5f790f8f2157ffa9525f54c2f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
hashData
确定使用的哈希算法 Gen 7+ 使用 SHA-256,之前使用 SHA-1
private async hashData(data: Uint8Array, useSha256: boolean): Promise<Uint8Array> { if (useSha256) { return await CryptoUtil.sha256(data); } else { return await CryptoUtil.sha1(data); } }
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 hashData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:...
private async hashData(data: Uint8Array, useSha256: boolean): Promise<Uint8Array> { if (useSha256) { return await CryptoUtil.sha256(data); } else { return await CryptoUtil.sha1(data); } }
https://github.com/AlkaidLab/moonlight-harmony
285bed647775412a097a1f6bb7d4236dd1604a62
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets
arkts
constructor
构造函数:显式赋值
constructor(context: common.Context) { this.context = context; // 显式赋值 this.eventDao = new EventDao(context); }
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 context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
constructor(context: common.Context) { this.context = context; // 显式赋值 this.eventDao = new EventDao(context); }
https://gitcode.com/openharmony/codelabs
565caec19a9bafc93cc8ed3b69359f513b1e569c
gitcode
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ColorUtil.ets
arkts
getDeepenImmersionColor
Generates an immersive background color by adjusting saturation and brightness @param rRGB Red component (0-255) @param gRGB Green component (0-255) @param bRGB Blue component (0-255) @returns Adjusted RGB values as [r, g, b]
public static getDeepenImmersionColor(rRGB: number, gRGB: number, bRGB: number): number[] { const r: number = Math.max(0, Math.min(rRGB, 255)); const g: number = Math.max(0, Math.min(gRGB, 255)); const b: number = Math.max(0, Math.min(bRGB, 255)); const hsb = ColorUtil.rgbToHsb(r, g, b); let satur...
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 getDeepenImmersionColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rRGB AST#identifier#Right AST#:...
public static getDeepenImmersionColor(rRGB: number, gRGB: number, bRGB: number): number[] { const r: number = Math.max(0, Math.min(rRGB, 255)); const g: number = Math.max(0, Math.min(gRGB, 255)); const b: number = Math.max(0, Math.min(bRGB, 255)); const hsb = ColorUtil.rgbToHsb(r, g, b); let satur...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
e67e8394531a88a9666ab9b23745da32d97dc0ce
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/RecurringBillService.ets
arkts
generateRecurringBills
生成定期账单(在APP启动时调用) @returns 生成的账单总数
async generateRecurringBills(): Promise<number> { try { console.info('RecurringBillService: 开始生成定期账单'); // 获取所有活跃的定期配置 const configs = await this.recurringDb.queryActiveConfigs(); if (configs.length === 0) { console.info('RecurringBillService: 没有活跃的定期配置'); ret...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left generateRecurringBills 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#...
async generateRecurringBills(): Promise<number> { try { console.info('RecurringBillService: 开始生成定期账单'); // 获取所有活跃的定期配置 const configs = await this.recurringDb.queryActiveConfigs(); if (configs.length === 0) { console.info('RecurringBillService: 没有活跃的定期配置'); ret...
https://github.com/qiuhaotc/HarmonyOSPlayground
dc35d5897d005ed10c33d8be79a25eb4dc24a473
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
set
Sets the char value wrapped in this CharBox. @param { char } value - The new char value to set @returns { char } The newly set char value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set(value: char): char { return (this.value = value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public set(value: char): char { return (this.value = value); }
https://gitcode.com/iop123123/arkts-static-skills
02323781b76f7caf32ed2478e386c3df8d871f09
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets
arkts
isPhoneExist
检查电话号码是否已存在
public async isPhoneExist(phone: string, excludeId?: number): Promise<boolean> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.equalTo('phone', phone); if (excludeId !== undefined) { ...
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 isPhoneExist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST...
public async isPhoneExist(phone: string, excludeId?: number): Promise<boolean> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.equalTo('phone', phone); if (excludeId !== undefined) { ...
https://gitcode.com/openharmony/codelabs
fb595b48a56d41cc55a635bca9d18fd8883f3a50
gitcode
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
popNavWithResult
携带结果返回到指定的页面(可以跨多级页面),可在onPopListener回调函数内监听 @param name 路由名称 @param result 返回携带的数据 @param animated 是否执行动画 @deprecated 建议使用popToNameWithResult()方法,该方法已经被弃用
public popNavWithResult<T>(name: string, result: T, animated: boolean = true) { this.updateCurrentStackName() this.routerMgr.popNavWithResult<T>(name, result, animated) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left popNavWithResult AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#...
public popNavWithResult<T>(name: string, result: T, animated: boolean = true) { this.updateCurrentStackName() this.routerMgr.popNavWithResult<T>(name, result, animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L318-L321
12032a5eed0c7be75aada6d7ea135ae0d11cd534
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
delay
延迟函数 @param ms 延迟毫秒数
private static delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left delay AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#R...
private static delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
b99dbf696caf9dc025776c08836705ee2435a44c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findLast
Finds the last element in the Uint16Array that satisfies the condition @param { function } fn - condition @returns { number } - the last element that satisfies fn @throws { Error } - If the element cannot be found, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLast(fn: (val: number, index: int, array: Uint16Array) => boolean): number { for (let i = this.lengthInt - 1; i >= 0; i--) { let val = this.getUnsafe(i).toDouble() if (fn(val, i, this)) { return val } } throw new Error("Uint16Arr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: number, index: int, array: Uint16Array) => boolean): number { for (let i = this.lengthInt - 1; i >= 0; i--) { let val = this.getUnsafe(i).toDouble() if (fn(val, i, this)) { return val } } throw new Error("Uint16Arr...
https://gitcode.com/iop123123/arkts-static-skills
816159dd36be9e20c33891f32b639df49be372d8
gitcode
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets
arkts
padZero
Pad number with leading zeros
private padZero(num: number, length: number): string { let str = num.toString(); while (str.length < length) { str = '0' + str; } return str; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left padZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
private padZero(num: number, length: number): string { let str = num.toString(); while (str.length < length) { str = '0' + str; } return str; }
https://github.com/AGenUI/AGenUI
d2f5b3dbf4c146afad97d855e142e543d899775f
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CartManager.ets
arkts
setSelection
Set selection status directly (not toggle).
static async setSelection(cartId: number, isSelected: boolean): Promise<void> { let newCartList: ICartItemData[] = []; let changed = false; for (let i = 0; i < cachedCartList.length; i++) { if (cachedCartList[i].cartId === cartId) { if (cachedCartList[i].isSelected !== isSelected) { ...
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 setSelection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cartId AST#identifier#Right AST#:#Left : AS...
static async setSelection(cartId: number, isSelected: boolean): Promise<void> { let newCartList: ICartItemData[] = []; let changed = false; for (let i = 0; i < cachedCartList.length; i++) { if (cachedCartList[i].cartId === cartId) { if (cachedCartList[i].isSelected !== isSelected) { ...
https://github.com/Harrisonls2004/WaterFlow
d1edb7115a14362c8b55cfcea8e68651973734e2
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/MessageManager.ets
arkts
deleteConversation
Delete a conversation (all messages in it). @param conversationId 本地会话ID(用于删除本地缓存) @param otherUserId 对方用户ID(用于服务器删除)
static async deleteConversation(conversationId: string, otherUserId?: number): Promise<boolean> { try { // 尝试调用服务器API删除会话 if (SERVER_ENABLED && otherUserId !== undefined && otherUserId > 0) { const response = await MessageApi.deleteConversation(otherUserId); if (response.code === 200) ...
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 deleteConversation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left conversationId AST#identifier#Right AST#ERROR#Left A...
static async deleteConversation(conversationId: string, otherUserId?: number): Promise<boolean> { try { // 尝试调用服务器API删除会话 if (SERVER_ENABLED && otherUserId !== undefined && otherUserId > 0) { const response = await MessageApi.deleteConversation(otherUserId); if (response.code === 200) ...
https://github.com/Harrisonls2004/WaterFlow
ba7ff683a2a5160823ea007c272779db8ff9937e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
syncCookieChanges
同步Cookie变化到持久化存储 @param changes Cookie变化列表
private async syncCookieChanges(changes: CookieChange[]): Promise<void> { const cookieStore = getCookieStore(); for (const change of changes) { try { if (change.action === 'set' && change.value) { await cookieStore.setCookie(change.url, change.value); logger.debug(TAG, `...
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 syncCookieChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left changes AST#identifier#Right AST#:#...
private async syncCookieChanges(changes: CookieChange[]): Promise<void> { const cookieStore = getCookieStore(); for (const change of changes) { try { if (change.action === 'set' && change.value) { await cookieStore.setCookie(change.url, change.value); logger.debug(TAG, `...
https://github.com/DaLongZhuaZi/manxia
f3812169970be708d37e5f85d4aefc389b836dd9
github
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/_AudioPlayer.ets
arkts
destroy
销毁(目前不需要销毁,不调用release)
async destroy() { await this.stopAndReset(); // 重置 this.eventListener = new Map(); this.waitingToPlay = false; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left destroy AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right ...
async destroy() { await this.stopAndReset(); // 重置 this.eventListener = new Map(); this.waitingToPlay = false; }
https://github.com/mybricks/comlib-harmony-normal
12ae7338377d4100f77f790dfb560a8cdd2827cb
github
richshaw2015/nds
ohos/entry/src/test/ThemeManager.test.ets
arkts
getAllThemeIds
============================================================================ 测试辅助函数 ============================================================================ 获取所有有效的主题 ID 数组 @returns NDSThemeId 枚举值数组
function getAllThemeIds(): NDSThemeId[] { return [ NDSThemeId.PLATINUM_SILVER, NDSThemeId.GRAPHITE_BLACK, NDSThemeId.TURQUOISE_BLUE, NDSThemeId.CANDY_PINK, NDSThemeId.RED ]; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getAllThemeIds 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#array_type#L...
function getAllThemeIds(): NDSThemeId[] { return [ NDSThemeId.PLATINUM_SILVER, NDSThemeId.GRAPHITE_BLACK, NDSThemeId.TURQUOISE_BLUE, NDSThemeId.CANDY_PINK, NDSThemeId.RED ]; }
https://github.com/richshaw2015/nds
982920230de004c1f0e12e4220ae48c787f4da53
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/select/picker/components/BasicStylePicker.ets
arkts
ListItem
TimePicker list item
ListItem() { PickerItemRow({ label: $r('app.string.timepicker_en_label'), value: format12HourTime(this.ctx, this.selectedTime), onClickAction: () => { this.openTimePicker(); } }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ListItem 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 AS...
ListItem() { PickerItemRow({ label: $r('app.string.timepicker_en_label'), value: format12HourTime(this.ctx, this.selectedTime), onClickAction: () => { this.openTimePicker(); } }) }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
2a3bf52e40b50ebe05c860d4102d92fb276be69c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
fatal
💀 致命级别的日志 @param tag - 日志分类标签 @param message - 要输出的日志信息 @param args - 其他可选参数
public fatal(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.FATAL) { const formattedMessage = this.formatMessageWithArgs(LogLevel.FATAL, tag, message, args); // 仅当hilog输出级别允许时才输出到hilog if (this.shouldOutputToHilog(LogLevel.FATAL)) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fatal AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public fatal(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.FATAL) { const formattedMessage = this.formatMessageWithArgs(LogLevel.FATAL, tag, message, args); // 仅当hilog输出级别允许时才输出到hilog if (this.shouldOutputToHilog(LogLevel.FATAL)) ...
https://github.com/DaLongZhuaZi/manxia
f1a902d44f84919aa4cf057518739d48a6536114
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateWarning
警告反馈 — 强振动
static vibrateWarning(): void { VibratorManager.logExecution('vibrateWarning'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 100, VibrationUsage.ALARM); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateWarning 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#express...
static vibrateWarning(): void { VibratorManager.logExecution('vibrateWarning'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 100, VibrationUsage.ALARM); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
dd0c72b47c454e899b60c07ef0f00d2502a89b91
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ImageRestorationEngine.ets
arkts
executeDetailEnhancement
执行细节增强
private async executeDetailEnhancement( imageData: AncientImageData, params?: ProcessingParams ): Promise<ProcessResult> { const startTime = Date.now(); const inputQuality = (await this.preprocessor.assessQuality(imageData)).overall; // 简化实现:返回原图 const enhancedData = imageData; const o...
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 executeDetailEnhancement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imageData AST#identifier#Rig...
private async executeDetailEnhancement( imageData: AncientImageData, params?: ProcessingParams ): Promise<ProcessResult> { const startTime = Date.now(); const inputQuality = (await this.preprocessor.assessQuality(imageData)).overall; // 简化实现:返回原图 const enhancedData = imageData; const o...
https://github.com/LJ666-ui/harmony-health-care
d0084fe5c8fba6667687c182a994fbfc4a0c8df9
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsObserver.ets
arkts
stopLastTimerAndStartThisTimer
停止上一个定时器并重置该定时器,该定时器会在5s后到期 @Param alertsObserver 表示 AlertsObserver 的实例
function stopLastTimerAndStartThisTimer(alertsObserver: AlertsObserver) { let alertTimerId = alertsObserver.getAlertTimerId(); Log.debug(TAG, `Clear Last AlertTimer, and AlertTimerId is` + JSON.stringify(alertTimerId)); stopTimer(alertTimerId, (err) => { if (err?.message !== undefined) { Log.error(TAG, ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stopLastTimerAndStartThisTimer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alertsObserver AST#identifier#Right AST#type_annotation...
function stopLastTimerAndStartThisTimer(alertsObserver: AlertsObserver) { let alertTimerId = alertsObserver.getAlertTimerId(); Log.debug(TAG, `Clear Last AlertTimer, and AlertTimerId is` + JSON.stringify(alertTimerId)); stopTimer(alertTimerId, (err) => { if (err?.message !== undefined) { Log.error(TAG, ...
https://gitee.com/openharmony/applications_calendar_data.git
d93c2aaa5af921f0927954fe9ca55069182c18a8
gitee
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
getAlignmentPatternPositions
-- Private helper functions -- Returns an ascending list of positions of alignment patterns for this version number. Each position is in the range [0,177), and are used on both the x and y axes. This could be implemented as lookup table of 40 variable-length lists of integers.
private getAlignmentPatternPositions(): Array<int> { if (this.version == 1) return []; else { const numAlign: int = Math.floor(this.version / 7) + 2; const step: int = (this.version == 32) ? 26 : Math.ceil((this.size - 13) / (numAlign * 2 - 2)) * 2; let result: Ar...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getAlignmentPatternPositions 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...
private getAlignmentPatternPositions(): Array<int> { if (this.version == 1) return []; else { const numAlign: int = Math.floor(this.version / 7) + 2; const step: int = (this.version == 32) ? 26 : Math.ceil((this.size - 13) / (numAlign * 2 - 2)) * 2; let result: Ar...
https://gitee.com/openharmony-sig/qr-code-generator.git
b0f7dc3df759da3f1a0bce11e936ea61783faa5f
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
stopDurationTimer
停止时长计时器
private stopDurationTimer(): void { if (this.durationTimer !== -1) { clearInterval(this.durationTimer) this.durationTimer = -1 } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopDurationTimer 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#e...
private stopDurationTimer(): void { if (this.durationTimer !== -1) { clearInterval(this.durationTimer) this.durationTimer = -1 } }
https://gitcode.com/openharmony/codelabs
8eaabfe57cc6c45ed26a366f2b5f09d977b0843c
gitcode
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/OrderCount.ets
arkts
readNumber
读取数值字段 @param {Object} source - 原始对象 @param {string} key - 字段名 @returns {number | null} 数值或空
private static readNumber(source: Object, key: string): number | null { const value: string | number | undefined = Reflect.get(source, key) as string | number | undefined; if (typeof value === "number") { return value; } if (typeof value === "string") { const parsed: number = Number(value)...
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 readNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : ...
private static readNumber(source: Object, key: string): number | null { const value: string | number | undefined = Reflect.get(source, key) as string | number | undefined; if (typeof value === "number") { return value; } if (typeof value === "string") { const parsed: number = Number(value)...
https://github.com/Joker-x-dev/CoolMallArkTS
b4504bf16b3b88eaa45403ad540e98b43b3d87d0
github
HarmonyOS_Samples/MultiPictureBeautification
features/multipictureediting/src/main/ets/viewmodel/EditingViewModel.ets
arkts
handleWindowSizeChange
Handle window size change: update layout direction Called by View when window size changes
handleWindowSizeChange(windowSize: window.Size, uiContext: UIContext): void { let curWidthVp = uiContext.px2vp(windowSize.width); let ratio: number = windowSize.width > 0 ? windowSize.height / windowSize.width : CommonConstants.SCREEN_RATIO_DEFAULT; this.updateLayoutDirection(curWidthVp, ratio); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleWindowSizeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#ident...
handleWindowSizeChange(windowSize: window.Size, uiContext: UIContext): void { let curWidthVp = uiContext.px2vp(windowSize.width); let ratio: number = windowSize.width > 0 ? windowSize.height / windowSize.width : CommonConstants.SCREEN_RATIO_DEFAULT; this.updateLayoutDirection(curWidthVp, ratio); }
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
a0fcf06064c6b3c10ce43c825609ab161f91edb9
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuList.ets
arkts
getCloseInterpolator
获取菜单关闭时的插值器
getCloseInterpolator(): InterpolatorType { return this.closeAnimationConfig.interpolator; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCloseInterpolator 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 InterpolatorType AST#identifier#Right AST...
getCloseInterpolator(): InterpolatorType { return this.closeAnimationConfig.interpolator; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
2254c8ecfe1e05f6739ef1897187bf200fc617f9
gitcode
codelably/HCompass
core/network/src/main/ets/NetworkResult.ets
arkts
failure
创建失败响应 @param code 错误码 @param message 错误消息 @returns NetworkResult 实例
static failure<T>(code: number, message: string): NetworkResult<T> { return new NetworkResult<T>({ code, data: null, message } as StandardResponse<T>); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left failure AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right...
static failure<T>(code: number, message: string): NetworkResult<T> { return new NetworkResult<T>({ code, data: null, message } as StandardResponse<T>); }
https://github.com/codelably/HCompass
9c2841750fa7ef720439cc0d49cf5e92e1a7f987
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
start_timing
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 定时功能 // /////////// 设置定时 //
start_timing(hours: number, minutes: number, waitEnd: boolean) { // 先清除旧定时器 this.clear_timer_interval() const now = Date.now() this.timed = now + (hours * 60 + minutes) * 60 * 1000 this.wait_end = waitEnd this.is_timed = true const totalSeconds = hours * 3600 + minutes * 60 if (totalSe...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left start_timing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hours AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right...
start_timing(hours: number, minutes: number, waitEnd: boolean) { // 先清除旧定时器 this.clear_timer_interval() const now = Date.now() this.timed = now + (hours * 60 + minutes) * 60 * 1000 this.wait_end = waitEnd this.is_timed = true const totalSeconds = hours * 3600 + minutes * 60 if (totalSe...
https://github.com/Nekofox-POT/LinMusic
4d3e1966fd3365478d892a1be4efb0b95a506a17
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
positive
Returns whether the BigInt is positive. @returns { boolean } True if positive (including zero), false otherwise. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public positive(): boolean { return this.sign >= 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left positive 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#bool...
public positive(): boolean { return this.sign >= 0 }
https://gitcode.com/iop123123/arkts-static-skills
5cd3883f50b29ac2fbcf6e53aee58eab8407fbf7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
getZipByteArrayContent
获取zip文件中指定文件的内容(字节数组)
async getZipByteArrayContent(url: string, path: string): Promise<Uint8Array | null> { try { // 下载或获取zip文件 let zipPath: string; if (url.startsWith('http://') || url.startsWith('https://')) { zipPath = await this.downloadFile(url); } else { // 假设是hex字符串 const bytes = ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getZipByteArrayContent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#...
async getZipByteArrayContent(url: string, path: string): Promise<Uint8Array | null> { try { // 下载或获取zip文件 let zipPath: string; if (url.startsWith('http://') || url.startsWith('https://')) { zipPath = await this.downloadFile(url); } else { // 假设是hex字符串 const bytes = ...
https://github.com/DaLongZhuaZi/manxia
3a00c2fc281d14685c443f454d4785115865d83c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets
arkts
removeMessages
Remove messages with a specific identifier and object @param { int } what The message identifier to remove @param { Any } obj The object to match @returns { boolean } True if messages were successfully removed, false otherwise
public removeMessages(what: int, obj: Any): boolean { if (this.workerIsMain()) { return false; } if (what == this.defaultMessagewhat) { return false; } return this.removeMessages((value: MessageStatus, key: Message) => {...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left what AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public removeMessages(what: int, obj: Any): boolean { if (this.workerIsMain()) { return false; } if (what == this.defaultMessagewhat) { return false; } return this.removeMessages((value: MessageStatus, key: Message) => {...
https://gitcode.com/iop123123/arkts-static-skills
502e8111a1ace2812c31e286f505fc26374d3f87
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
fixed
The fixed() method creates a string that embeds a string in a <tt> element (<tt>str</tt>), which causes a string to be displayed in a big font.
public fixed(): String{ return this.CreateHTMLString("tt", "") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fixed AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public fixed(): String{ return this.CreateHTMLString("tt", "") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eb0c02fb13d5bc188b89caadc1ba1f0c8dda358d
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Parameter.ets
arkts
isOptional
Determines whether this parameter is an optional parameter. @returns { boolean } Returns true if it is an optional parameter, otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isOptional(): boolean { return (this.attributes & Attributes.OPTIONAL) != 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isOptional 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#bo...
public isOptional(): boolean { return (this.attributes & Attributes.OPTIONAL) != 0 }
https://gitcode.com/iop123123/arkts-static-skills
d2e72cdeca1da51364d60ecdfc3b662d057c1b2a
gitcode
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/common/BioAuthConfig.ets
arkts
checkFingerprintSupport
检查设备是否支持指纹识别
static async checkFingerprintSupport(): Promise<boolean> { try { userAuth.getAvailableStatus( userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL3 ); return true; } catch (error) { console.error('设备不支持指纹认证或权限不足', error); return false; } }
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 checkFingerprintSupport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
static async checkFingerprintSupport(): Promise<boolean> { try { userAuth.getAvailableStatus( userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL3 ); return true; } catch (error) { console.error('设备不支持指纹认证或权限不足', error); return false; } }
https://gitcode.com/openharmony/codelabs
10f30dac754740b176a6788518d8855a12b67d87
gitcode