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
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
deleteSharedBill
删除共享账单
static async deleteSharedBill(billId: number, operatorId: number): Promise<boolean> { try { const bill = await SharedBillDAO.getById(billId); if (!bill) { throw new Error('账单不存在'); } // 检查权限 const canDelete = await SharedLedgerService.checkPermission(bill.ledgerId, operatorI...
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 deleteSharedBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left ...
static async deleteSharedBill(billId: number, operatorId: number): Promise<boolean> { try { const bill = await SharedBillDAO.getById(billId); if (!bill) { throw new Error('账单不存在'); } // 检查权限 const canDelete = await SharedLedgerService.checkPermission(bill.ledgerId, operatorI...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
dc72614ff2cdfef55c55b0554b901276d425e9b7
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
getRecommendedDestinations
获取智能推荐目的地 基于当前位置和用户偏好进行推荐 @currentPos 当前位置 @userPreferences 用户偏好(可选)
public getRecommendedDestinations( currentPos?: Position3D, userPreferences?: UserPreferences ): NavigationDestination[] { if (!this.buildingData) return []; let candidates = this.buildingData.pois.slice(); const scoredCandidates: ScoredCandidate[] = []; for (const poi of candidates) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRecommendedDestinations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left currentPos AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#...
public getRecommendedDestinations( currentPos?: Position3D, userPreferences?: UserPreferences ): NavigationDestination[] { if (!this.buildingData) return []; let candidates = this.buildingData.pois.slice(); const scoredCandidates: ScoredCandidate[] = []; for (const poi of candidates) { ...
https://github.com/LJ666-ui/harmony-health-care
0cc12f9c8b5afbbf8e6208b30d61d70f8bcabb49
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets
arkts
constructor
Constructs new UndefinableStringArray with required capacity @param { int } capacity - The initial capacity of the array @syscap SystemCapability.Utils.Lang
constructor(capacity: int) { this.data = new FixedArray<UndefinableString>(capacity) this.curSize = 0 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ...
constructor(capacity: int) { this.data = new FixedArray<UndefinableString>(capacity) this.curSize = 0 }
https://gitcode.com/iop123123/arkts-static-skills
17163f046987814eabdfa755232828a12c2ae98a
gitcode
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
onBrightActionStart
Bright gesture method onActionStart. @param event Gesture event.
onBrightActionStart(event?: GestureEvent) { if (!event) { return; } this.positionY = event.offsetY; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBrightActionStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
onBrightActionStart(event?: GestureEvent) { if (!event) { return; } this.positionY = event.offsetY; }
https://gitee.com/openharmony/codelabs.git
bf1f8f7d966067949dc91472ac8a9736f2a3ef1b
gitee
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
loadOrderCache
从缓存加载订单数据 @returns {Promise<void>} Promise<void>
async loadOrderCache(): Promise<void> { // 1. 读取购物车缓存(仅购物车页面会存储) this.cachedCarts = await this.orderCacheStoreRepository.loadCarts(); // 2. 读取已选商品列表 this.selectedGoodsList = await this.orderCacheStoreRepository.loadSelectedGoodsList() ?? []; // 3. 购物车列表:优先从 cachedCarts 获取,没有则从 selectedGoodsList ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadOrderCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async loadOrderCache(): Promise<void> { // 1. 读取购物车缓存(仅购物车页面会存储) this.cachedCarts = await this.orderCacheStoreRepository.loadCarts(); // 2. 读取已选商品列表 this.selectedGoodsList = await this.orderCacheStoreRepository.loadSelectedGoodsList() ?? []; // 3. 购物车列表:优先从 cachedCarts 获取,没有则从 selectedGoodsList ...
https://github.com/Joker-x-dev/CoolMallArkTS
0f56b2c0ccbaded1c25feed54991aacc3d4d837c
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/DateUtils.ets
arkts
getStartOfDay
获取今天的开始时间戳 (00:00:00)
public static getStartOfDay(timestamp: number = Date.now()): number { const date = new Date(timestamp); date.setHours(0, 0, 0, 0); return date.getTime(); }
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 getStartOfDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timestamp AST#identifier#Right AST#:#Left...
public static getStartOfDay(timestamp: number = Date.now()): number { const date = new Date(timestamp); date.setHours(0, 0, 0, 0); return date.getTime(); }
https://gitcode.com/openharmony/codelabs
ad6dc159141cf524c3ae57c09af21976071ca1df
gitcode
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
isAlphanumeric
Tests whether the given string can be encoded as a segment in alphanumeric mode. A string is encodable iff each character is in the following set: 0 to 9, A to Z (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
public static isAlphanumeric(text: string): boolean { return QrSegment.ALPHANUMERIC_REGEX.test(text); }
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 isAlphanumeric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : A...
public static isAlphanumeric(text: string): boolean { return QrSegment.ALPHANUMERIC_REGEX.test(text); }
https://gitee.com/openharmony/arkui_ace_engine.git
61c2590e462d30bdb7ed1b7fe9fd1e331e465c83
gitee
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/Logger.ets
arkts
initWorker
初始化worker线程
private initWorker() { // 注册onmessage回调,当宿主线程接收到来自其创建的Worker通过workerPort.postMessage接口发送的消息时被调用,在宿主线程执行 this.workerInstance.onmessage = (_e: MessageEvents) => { //let data: string = e.data } // 注册onerror回调,当Worker在执行过程中发生异常时被调用,在宿主线程执行 this.workerInstance.onerror = (err: ErrorEvent) => { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initWorker 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 initWorker() { // 注册onmessage回调,当宿主线程接收到来自其创建的Worker通过workerPort.postMessage接口发送的消息时被调用,在宿主线程执行 this.workerInstance.onmessage = (_e: MessageEvents) => { //let data: string = e.data } // 注册onerror回调,当Worker在执行过程中发生异常时被调用,在宿主线程执行 this.workerInstance.onerror = (err: ErrorEvent) => { ...
https://github.com/chenchl/GMLogger-HarmonyOS
dab2eb1997b19ba96b8c575ddb3d9d299debd2b7
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/popup/index.ets
arkts
calcCornerRadius
根据是否圆角与定位位置,计算各方向圆角大小
calcCornerRadius() { const set = (topLeft: number, topRight: number, bottomLeft: number, bottomRight: number) => { this.connerRadius = { topLeft, topRight, bottomLeft, bottomRight, } } if (this.round) { if (this.placement === 'top') { set(0, 0, 8,...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calcCornerRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
calcCornerRadius() { const set = (topLeft: number, topRight: number, bottomLeft: number, bottomRight: number) => { this.connerRadius = { topLeft, topRight, bottomLeft, bottomRight, } } if (this.round) { if (this.placement === 'top') { set(0, 0, 8,...
https://github.com/itrainhub/wu-ui
73baad123dbc372159a2f9e3ea8a7db1b0f48111
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/base/BaseViewModel.ets
arkts
processIntentSync
同步的方式执行intention @param intention view的意图 return 执行结果
public processIntentSync(intention: BaseIntent): ProcessResult { Log.info(`start processIntent: ${intention.getIntentTag()}.`); if (this._model === null || this._model === undefined) { this._model = this.initModel(); } if (this._viewState === null || this._viewState === undefined) { this._...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left processIntentSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intention AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public processIntentSync(intention: BaseIntent): ProcessResult { Log.info(`start processIntent: ${intention.getIntentTag()}.`); if (this._model === null || this._model === undefined) { this._model = this.initModel(); } if (this._viewState === null || this._viewState === undefined) { this._...
https://gitee.com/openharmony/applications_permission_manager.git
e191c6245127b5fc8e6c9d0436212823037ab150
gitee
zhangmeng1847/RDB
entry/src/main/ets/viewmodels/TaskHandle.ets
arkts
getTaskList
查询任务列表
async getTaskList(){ // 1.构建查询条件 let predicates = new relationalStore.RdbPredicates(this.tableName) // 2.查询 let result = await this.rdbStore.query(predicates, ['ID', 'NAME', 'FINISHED']) // 3.解析查询结果 // 3.1.定义一个数组,组装最终的查询结果 let tasks: TaskDataModel[] = [] // 3.2.遍历封装 while(!result.i...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getTaskList AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#comment#...
async getTaskList(){ // 1.构建查询条件 let predicates = new relationalStore.RdbPredicates(this.tableName) // 2.查询 let result = await this.rdbStore.query(predicates, ['ID', 'NAME', 'FINISHED']) // 3.解析查询结果 // 3.1.定义一个数组,组装最终的查询结果 let tasks: TaskDataModel[] = [] // 3.2.遍历封装 while(!result.i...
https://github.com/zhangmeng1847/RDB
07fe43a48b32552ddbb4f1129149bd46cab95aa2
github
HarmonyOS_Samples/BestPracticeSnippets
AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets
arkts
aboutToAppear
[StartExclude positive_of_lazy_for_each]
aboutToAppear(): void { for (let i = 1; i < 1000; i++) { this.data.pushData(i); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { for (let i = 1; i < 1000; i++) { this.data.pushData(i); } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
89ceebf0b75adb250d8d0da0feb8d4a3c2063a36
gitcode
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/Logger.ets
arkts
getMessage
获取格式化后的日志消息。 该函数用于生成带有标签和消息内容的格式化日志字符串。支持展示日志位置信息,并处理不同类型的消息内容。 @param tag 日志标签,用于标识日志的来源或类别,默认为空字符串。 @param message 日志消息内容,可以是字符串或对象。 @returns 返回格式化后的日志字符串。
private getMessage(tag: string = "", message: string | object): string { // 初始化日志字符串,包含标签和分隔线 let log = "┌───────" + tag + "────────────────────────────────────────────────────────────────────────────────" log = log.substring(0, log.length - tag.length) + "\n" //添加当前日期和时间 精确到毫秒格式为xxxx年xx月xx日 xx时xx分xx秒...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi...
private getMessage(tag: string = "", message: string | object): string { // 初始化日志字符串,包含标签和分隔线 let log = "┌───────" + tag + "────────────────────────────────────────────────────────────────────────────────" log = log.substring(0, log.length - tag.length) + "\n" //添加当前日期和时间 精确到毫秒格式为xxxx年xx月xx日 xx时xx分xx秒...
https://github.com/chenchl/GMLogger-HarmonyOS
b8eaf583ded6161d33580e23500752bbd34b47a7
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getVisibleTabConfigs
获取可见的标签配置(根据用户自定义配置和高级模式过滤)
private getVisibleTabConfigs(): TabConfig[] { return this.tabConfigs.filter((cfg: TabConfig) => { // 必须显示的标签(书库、管理)始终显示 if (cfg.required) { return true; } if (!this.shouldDisplayTabConfig(cfg)) { return false; } // 检查是否在用户自定义的可见列表中 return thi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getVisibleTabConfigs 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 AS...
private getVisibleTabConfigs(): TabConfig[] { return this.tabConfigs.filter((cfg: TabConfig) => { // 必须显示的标签(书库、管理)始终显示 if (cfg.required) { return true; } if (!this.shouldDisplayTabConfig(cfg)) { return false; } // 检查是否在用户自定义的可见列表中 return thi...
https://github.com/DaLongZhuaZi/manxia
ef0fcc24b6bc5f545b9c766c59f5c4a221c56a6b
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
saveWidgetDataToPrefs
保存卡片数据到Preferences
async function saveWidgetDataToPrefs(context: Context, formId: string, data: Record<string, string>): Promise<void> { try { const prefs = await preferences.getPreferences(context, PREFERENCES_NAME); const key = WIDGET_DATA_PREFIX + formId; const jsonData = JSON.stringify(data); prefs.putSync(key, json...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left saveWidgetDataToPrefs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Righ...
async function saveWidgetDataToPrefs(context: Context, formId: string, data: Record<string, string>): Promise<void> { try { const prefs = await preferences.getPreferences(context, PREFERENCES_NAME); const key = WIDGET_DATA_PREFIX + formId; const jsonData = JSON.stringify(data); prefs.putSync(key, json...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
699d0800ef988bfc96e2aca4e00b06052efef104
github
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
primitiveTypes
类型 基本类型
function primitiveTypes() { let a: number = 10; let b: number = a; b = 20; console.log(`a: ${a}`); console.log(`b: ${b}`); // number类型 let age: number = 20; let score: number = 90.5; console.log(`age: ${age}`); console.log(`score: ${score}`); // string类型 let s1: string = 'Hello!'; // 单引号字符串 ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left primitiveTypes 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_decl...
function primitiveTypes() { let a: number = 10; let b: number = a; b = 20; console.log(`a: ${a}`); console.log(`b: ${b}`); // number类型 let age: number = 20; let score: number = 90.5; console.log(`age: ${age}`); console.log(`score: ${score}`); // string类型 let s1: string = 'Hello!'; // 单引号字符串 ...
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
a99f8570a9528f16c19750e40570a87216530799
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
of
Creates a new Uint8Array using initializer @param data initializer @returns a new Uint8Array from data
public of(data: Object[]): Uint8Array { throw new Error("Uint8Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public of(data: Object[]): Uint8Array { throw new Error("Uint8Array.of: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3c26cd3e231a87161a46e8a9e58caa1e260d6a3f
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/services/NotificationService.ets
arkts
loadNotifications
加载通知列表
private async loadNotifications(): Promise<void> { try { const response = await HttpUtil.get<Notification[]>('/notifications', { userId: this.currentUserId, limit: 100 }); if (response.success && response.data) { response.data.forEach((notification: Notification) =...
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 loadNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async loadNotifications(): Promise<void> { try { const response = await HttpUtil.get<Notification[]>('/notifications', { userId: this.currentUserId, limit: 100 }); if (response.success && response.data) { response.data.forEach((notification: Notification) =...
https://github.com/LJ666-ui/harmony-health-care
3aeccace2d01f94706b1df5b8bb56c7f0059d00a
github
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar.ets
arkts
closeContainerAnimation
元服务关闭动效,包含嵌入式组件关闭动效
closeContainerAnimation(): void { if (this.isHalfScreen) { this.closeHalfContainerAnimation(); return; } if (this.isHalfToFullScreen) { // 关闭弹框 animateTo({ duration: 250, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { NativeEve...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeContainerAnimation 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#{#Left { AST#{#Right...
closeContainerAnimation(): void { if (this.isHalfScreen) { this.closeHalfContainerAnimation(); return; } if (this.isHalfToFullScreen) { // 关闭弹框 animateTo({ duration: 250, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { NativeEve...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
55367378975e3888295335146397edf322b02a17
gitee
bhengubv/aether-protocol
arkts/src/main/ets/vault/ReedSolomonCodec.ets
arkts
shardCount
Total shard count (K + M).
get shardCount(): number { return this.n; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left shardCount 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 ...
get shardCount(): number { return this.n; }
https://github.com/bhengubv/aether-protocol
ee3deb79774c9b63b2e69a29aafb8b61d5c7bdcb
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
copyFrom
从现有条目复制属性
copyFrom(source: KdbxEntry, options?: TemplateApplyOptions): TemplateBuilder { const opts: TemplateApplyOptions = { overwriteExisting: options?.overwriteExisting ?? this.options.overwriteExisting, copyTags: options?.copyTags ?? this.options.copyTags, copyIcon: options?.copyIcon ?? this.options.c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left copyFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KdbxEntry AST#identifier#Right AST#,#Left , A...
copyFrom(source: KdbxEntry, options?: TemplateApplyOptions): TemplateBuilder { const opts: TemplateApplyOptions = { overwriteExisting: options?.overwriteExisting ?? this.options.overwriteExisting, copyTags: options?.copyTags ?? this.options.copyTags, copyIcon: options?.copyIcon ?? this.options.c...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L206-L273
013d58661f864fa8ddea1a8df57286958087efb0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/29.conditional_expressions/02.numeric_conditional_expressions/numeric_condition_expression_type.ets
arkts
main
--- desc: Type of a numeric conditional expression ---
function main(): void { let x{{operand.type}} = {{operand.first}} ? {{operand.second}} : {{operand.third}}; assert {{operand.check}}; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let x{{operand.type}} = {{operand.first}} ? {{operand.second}} : {{operand.third}}; assert {{operand.check}}; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
90b4328c88fccde40598c881f7c1cab0b435fb50
gitee
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/DataInitializer.ets
arkts
initializeTrendData
生成趋势数据(模拟体重下降或上升) @param trend 'increase' | 'decrease' | 'stable'
async initializeTrendData(trend: 'increase' | 'decrease' | 'stable' = 'stable'): Promise<void> { console.info(`生成${trend}趋势的数据...`); const baseWeight: number = 70; const baseHeight: number = 175; const baseBloodPressureHigh: number = 120; const baseBloodPressureLow: number = 80; const baseHea...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initializeTrendData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left trend AST#identifier#Right AST#type_annotation#Lef...
async initializeTrendData(trend: 'increase' | 'decrease' | 'stable' = 'stable'): Promise<void> { console.info(`生成${trend}趋势的数据...`); const baseWeight: number = 70; const baseHeight: number = 175; const baseBloodPressureHigh: number = 120; const baseBloodPressureLow: number = 80; const baseHea...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
049f1eb4d9520e3209d44152fd21db51308e75f7
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/models/RecurringBillModel.ets
arkts
getEndConditionText
获取结束条件描述
getEndConditionText(): string { if (this.endDate) { return `截止到${this.endDate}`; } if (this.repeatCount) { return `重复${this.repeatCount}次`; } return '永久'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEndConditionText 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#st...
getEndConditionText(): string { if (this.endDate) { return `截止到${this.endDate}`; } if (this.repeatCount) { return `重复${this.repeatCount}次`; } return '永久'; }
https://github.com/qiuhaotc/HarmonyOSPlayground
1be42b794ea50789d720dd234199b01b85673b05
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
onWindowStageCreate 生命周期 窗口创建时调用,用于加载首页 @param windowStage 窗口阶段对象
onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); /** * 加载设置页面 */ windowStage.loadContent('pages/MainPage', (err: BusinessError) => { if (er...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif...
onWindowStageCreate(windowStage: window.WindowStage): void { // Main window is created, set main page for this ability hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); /** * 加载设置页面 */ windowStage.loadContent('pages/MainPage', (err: BusinessError) => { if (er...
https://gitcode.com/openharmony/codelabs
acadcb2acebaf9440f6b8e26133765612429a9e4
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets
arkts
getLinker
Get the runtime linker associated with this class. @returns { RuntimeLinker } the runtime linker for this class @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getLinker(): RuntimeLinker { if (this.linker == undefined) { const linker = this.getLinkerInternal() this.linker = linker ?? getBootRuntimeLinker() } return this.linker! }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLinker 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 RuntimeLinke...
public getLinker(): RuntimeLinker { if (this.linker == undefined) { const linker = this.getLinkerInternal() this.linker = linker ?? getBootRuntimeLinker() } return this.linker! }
https://gitcode.com/iop123123/arkts-static-skills
90e82600e0a3c6c2cb8da08ae868127c6d89dae5
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testStartsEndsWith
--- String.endsWith and startsWith combined ---
function testStartsEndsWith(): string { let s: string = 'Hello, World!'; let starts: boolean = s.startsWith('Hello'); let ends: boolean = s.endsWith('!'); return String(starts) + ',' + String(ends); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStartsEndsWith 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#predefin...
function testStartsEndsWith(): string { let s: string = 'Hello, World!'; let starts: boolean = s.startsWith('Hello'); let ends: boolean = s.endsWith('!'); return String(starts) + ',' + String(ends); }
https://github.com/miaochiahao/ark-ghidra
7c2fc54b30edbcf6176715be1d271823590c7695
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleEngine.ets
arkts
start
Enter Playing status and spawn the first question. Safe to call once per engine; calling again while already Playing is a no-op so BattlePage's `aboutToAppear` can run defensively. Throws if the engine has already finished (Won/Lost) because that would silently reset the score.
start(): void { if (this.state_.status === BattleStatus.Playing) { return; } if (this.state_.status === BattleStatus.Won || this.state_.status === BattleStatus.Lost) { throw new Error('BattleEngine: cannot start() after battle has ended'); } this.state_.status = BattleStatus.Playing; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start 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#{#Left { AST#{#Right AST#method_defini...
start(): void { if (this.state_.status === BattleStatus.Playing) { return; } if (this.state_.status === BattleStatus.Won || this.state_.status === BattleStatus.Lost) { throw new Error('BattleEngine: cannot start() after battle has ended'); } this.state_.status = BattleStatus.Playing; ...
https://github.com/terryma2024/happyword
6955c7bcca2d6e0fc861ed63e6d052b45fb678dd
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
getPageConfig
获取页面配置 @returns
public getPageConfig(): PageConfig { return LocalFilePageConfig; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPageConfig 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 PageConf...
public getPageConfig(): PageConfig { return LocalFilePageConfig; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L23-L25
ca5f1ef293a4e18eaef0d9ee851831ad71a805a3
github
webabcd/HarmonyDemo
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
onAddForm
卡片创建时的回调
onAddForm(want: Want) { // 通过 want.parameters 可以获取卡片的规格,以及宽和高等 MyLog.d(`onAddForm ${JSON.stringify(want.parameters)}`) // FormExtensionContext - FormExtensionAbility 的上下文(在 FormExtensionAbility 内,可以通过 this.context 获取 FormExtensionContext 对象) let context = this.context let abilityName = context.e...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAddForm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#)...
onAddForm(want: Want) { // 通过 want.parameters 可以获取卡片的规格,以及宽和高等 MyLog.d(`onAddForm ${JSON.stringify(want.parameters)}`) // FormExtensionContext - FormExtensionAbility 的上下文(在 FormExtensionAbility 内,可以通过 this.context 获取 FormExtensionContext 对象) let context = this.context let abilityName = context.e...
https://github.com/webabcd/HarmonyDemo
435cf90b2b8c005fbcb9bfcb30276f981eef71b1
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/downloads/classes/meowDawnloada.ets
arkts
confirmDownload
Confirm the download of a webview.WebDownloadItem, and "start" the download. @param item The webview.WebDownloadItem.
confirmDownload(item: webview.WebDownloadItem, filename: string = item.getSuggestedFileName()) { // Get download directory. const context = UIContext.getCallingScopeUIContext()?.getHostContext(); if (!context) { meow(`Fetch UIContext failed for download item: [${item.getGuid()}][${item.getUrl()}]`, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left confirmDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Lef...
confirmDownload(item: webview.WebDownloadItem, filename: string = item.getSuggestedFileName()) { // Get download directory. const context = UIContext.getCallingScopeUIContext()?.getHostContext(); if (!context) { meow(`Fetch UIContext failed for download item: [${item.getGuid()}][${item.getUrl()}]`, ...
https://github.com/awaLiny2333/LinysBrowser_NEXT
2234dafdb00b76d490be0dd866e72e5f140a92f6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ConsolePanel.ets
arkts
copyErrorLogs
一键复制WARN/ERROR日志到剪贴板
copyErrorLogs(): void { const errorLogs = this.logs.filter(log => log.level === LogLevel.WARN || log.level === LogLevel.ERROR); if (errorLogs.length === 0) { logger.warn('ConsolePanel', '没有找到警告或错误日志'); return; } const content = errorLogs.map(log => `[${new Date(log.timestamp).toLocale...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left copyErrorLogs 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_bloc...
copyErrorLogs(): void { const errorLogs = this.logs.filter(log => log.level === LogLevel.WARN || log.level === LogLevel.ERROR); if (errorLogs.length === 0) { logger.warn('ConsolePanel', '没有找到警告或错误日志'); return; } const content = errorLogs.map(log => `[${new Date(log.timestamp).toLocale...
https://github.com/DaLongZhuaZi/manxia
136571b81ba961809c744879477ab6ed2f21af16
github
OHPG/FinSdk
jellyfin/src/main/ets/api/TvShowsApi.ets
arkts
getEpisodes
getEpisodes @summary Gets episodes for a tv season. @param {TvShowsApiGetEpisodesRequest} requestParameters Request parameters. @throws {RequiredError} @memberof TvShowsApi
public async getEpisodes(requestParameters: TvShowsApiGetEpisodesRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.seriesId) return this.apiClient.get({path: `/Shows/${requestParameters.seriesId}/Episodes`, parameters: requestParameters, excludeParams: ['seriesId']}) }
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 getEpisodes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:...
public async getEpisodes(requestParameters: TvShowsApiGetEpisodesRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.seriesId) return this.apiClient.get({path: `/Shows/${requestParameters.seriesId}/Episodes`, parameters: requestParameters, excludeParams: ['seriesId']}) }
https://github.com/OHPG/FinSdk
be0b7c44fff2e0a21182c3b24fb650b354dec532
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets
arkts
delete
Removes an Entry with specified key from the ConcurrentHashMap @param { K } key the key to remove @returns { boolean } true if the delete Operation is success, otherwise false.
public delete(key: K): boolean { if (this.deleteImpl(key) === undefined) { return false; } if (this.sizeVal.get() == 0) { this.headNode = undefined; } return true; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left K AST#ty...
public delete(key: K): boolean { if (this.deleteImpl(key) === undefined) { return false; } if (this.sizeVal.get() == 0) { this.headNode = undefined; } return true; }
https://gitcode.com/iop123123/arkts-static-skills
9900a4efce17ca77b2862feb8f4baf48e4fe9293
gitcode
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
updateSpecCount
更新商品规格数量 @param {number} goodsId 商品ID @param {number} specId 规格ID @param {number} count 新数量 @returns {Promise<void>} Promise<void>
async updateSpecCount(goodsId: number, specId: number, count: number): Promise<void> { await this.cartRepository.updateCartSpecCount(goodsId, specId, count); // 更新本地数据 for (const cart of this.cartList) { if (cart.goodsId === goodsId) { for (const spec of cart.spec) { if (spec.id ==...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSpecCount AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goodsId AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async updateSpecCount(goodsId: number, specId: number, count: number): Promise<void> { await this.cartRepository.updateCartSpecCount(goodsId, specId, count); // 更新本地数据 for (const cart of this.cartList) { if (cart.goodsId === goodsId) { for (const spec of cart.spec) { if (spec.id ==...
https://github.com/Joker-x-dev/CoolMallArkTS
fd257b9fbdc717a9cb0502295d057f401fc7d24b
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
clear
Clears all entries in the LightWeightSet
clear(): void { this.buckets.clear(); this.capacity = LightWeightSet.MIN_BUCKETS_COUNT; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.buckets.clear(); this.capacity = LightWeightSet.MIN_BUCKETS_COUNT; }
https://gitcode.com/iop123123/arkts-static-skills
4caa35991064e29e6309517827a34ce90db505bb
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
setWindowStage
Caches the window stage and resolves the main window synchronously. @param windowStage The ability's window stage.
setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; try { this.mainWindow = this.windowStage.getMainWindowSync(); } catch (error) { let err = error as BusinessError; Logger.error(`getMainWindowSync failed. Code: ${err.code}, message: ${err.message}`); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowStage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identifier#R...
setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; try { this.mainWindow = this.windowStage.getMainWindowSync(); } catch (error) { let err = error as BusinessError; Logger.error(`getMainWindowSync failed. Code: ${err.code}, message: ${err.message}`); ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
f159d5faa5221c8e7be0e978c0ca6ab4bc10e2da
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewContainerPage.ets
arkts
getWebViewCount
获取WebView数量
getWebViewCount(): number { return this.webViewItems.length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWebViewCount 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#statem...
getWebViewCount(): number { return this.webViewItems.length; }
https://github.com/DaLongZhuaZi/manxia
5b7e42a43b332ff8f6303715b04e15d4045afb9b
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
getIndexesExceptBottom
获取除栈底外的所有元素索引 @returns
private getIndexesExceptBottom(): number[] { const indexes: number[] = [] this.getAllPathName().forEach((name, index) => { if (index > 0) { indexes.push(index) } }) return indexes }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getIndexesExceptBottom 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#L...
private getIndexesExceptBottom(): number[] { const indexes: number[] = [] this.getAllPathName().forEach((name, index) => { if (index > 0) { indexes.push(index) } }) return indexes }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L623-L631
8b95a94dfc9706b777f9a4c8de513572a0742b51
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets
arkts
callDeepSeekAnalysis
调用DeepSeek进行症状分析
private static async callDeepSeekAnalysis(symptomInfo: SymptomInfo): Promise<any> { const prompt = symptomAnalysisPrompt .replace('{SYMPTOM}', symptomInfo.mainSymptom) .replace('{DURATION}', symptomInfo.duration || '未知') .replace('{SEVERITY}', symptomInfo.severity) .replace('{ACCOMPANYING}...
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 callDeepSeekAnalysis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier...
private static async callDeepSeekAnalysis(symptomInfo: SymptomInfo): Promise<any> { const prompt = symptomAnalysisPrompt .replace('{SYMPTOM}', symptomInfo.mainSymptom) .replace('{DURATION}', symptomInfo.duration || '未知') .replace('{SEVERITY}', symptomInfo.severity) .replace('{ACCOMPANYING}...
https://github.com/LJ666-ui/harmony-health-care
c6f822aaf1791224f4f60b45354688debacbd0ac
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/entry/src/main/ets/scan/ScanPage.ets
arkts
onLightingFlash
订阅闪光灯状态监听事件
onLightingFlash() { try { customScan.on('lightingFlash', (e, isLightingFlash) => { if (e) { console.error(`lucy== 监听弱光环境失败, code:${e.code}, message:${e.message}`) return } if (!this.isFlashlightOn) { console.log('lucy== isLightingFlash', isLightingFlash)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onLightingFlash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
onLightingFlash() { try { customScan.on('lightingFlash', (e, isLightingFlash) => { if (e) { console.error(`lucy== 监听弱光环境失败, code:${e.code}, message:${e.message}`) return } if (!this.isFlashlightOn) { console.log('lucy== isLightingFlash', isLightingFlash)...
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
ffe340045660840700e844ea598e1ee34bdf6931
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
getDueReminders
查询到期的提醒(需要触发的)
static async getDueReminders(userId: number, currentDate: string): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND is_active = 1 AND is_deleted = 0 AND next_reminder_date <= ? ...
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 getDueReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left :...
static async getDueReminders(userId: number, currentDate: string): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND is_active = 1 AND is_deleted = 0 AND next_reminder_date <= ? ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3f94322f0b49b30f29700ad6ab8e6d270a53348e
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets
arkts
calculateElapsedMonthEarnings
Sums the earnings for every elapsed working day in the month (including today if working).
private calculateElapsedMonthEarnings(date: Date): number { const year: number = date.getFullYear() const month: number = date.getMonth() const today: number = date.getDate() let total: number = 0 for (let d: number = 1; d <= today; d++) { const check: Date = new Date(year, month, d) t...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateElapsedMonthEarnings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
private calculateElapsedMonthEarnings(date: Date): number { const year: number = date.getFullYear() const month: number = date.getMonth() const today: number = date.getDate() let total: number = 0 for (let d: number = 1; d <= today; d++) { const check: Date = new Date(year, month, d) t...
https://github.com/OMGCA/sakipay
49b58fa095d11cf486ddf1eca6675dd52049304f
github
jm1121985/harmony-OS-screen-mirror
entry/src/main/ets/pages/ScreenMirror.ets
arkts
sendSignaling
通过 WebSocket 发送信令消息
sendSignaling(msg: IceCandidateMsg | OfferMsg): void { if (this.ws) { this.ws.send(JSON.stringify(msg), (err: BusinessError) => { if (err) { console.error(TAG, '发送失败:', err.message) } }) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendSignaling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left IceCandidateMsg ...
sendSignaling(msg: IceCandidateMsg | OfferMsg): void { if (this.ws) { this.ws.send(JSON.stringify(msg), (err: BusinessError) => { if (err) { console.error(TAG, '发送失败:', err.message) } }) } }
https://github.com/jm1121985/harmony-OS-screen-mirror
8b09f4ca1d6d0e2ca4942aa78d3ed13d637f2657
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
prepareBufferForNewItem
Prepares the buffer for adding a new item by handling namespace line break and indentation. @param {StringBuilder} stringBuilder - The StringBuilder instance to append content to.
private prepareBufferForNewItem(name: string): StringBuilder { this.checkEmptyParameter(name); let stringBuilder = new StringBuilder(); if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) { this.spliceNamespace(stringBuilder); stringBuilder....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left prepareBufferForNewItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private prepareBufferForNewItem(name: string): StringBuilder { this.checkEmptyParameter(name); let stringBuilder = new StringBuilder(); if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) { this.spliceNamespace(stringBuilder); stringBuilder....
https://gitcode.com/iop123123/arkts-static-skills
93edd0f39ad3afe8cbd165da05af98e240982848
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/AdbKeyManager.ets
arkts
regenerateCommonKey
重新生成公共密钥
async regenerateCommonKey(): Promise<void> { try { LoggerAdbKeyManager.info(`ADB: Regenerating common key...`); // 生成新密钥 const rsaGenerator = cryptoFramework.createAsyKeyGenerator('RSA2048'); const keyPair = await rsaGenerator.generateKeyPair(); this.cachedKeyPair = key...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left regenerateCommonKey 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#:#R...
async regenerateCommonKey(): Promise<void> { try { LoggerAdbKeyManager.info(`ADB: Regenerating common key...`); // 生成新密钥 const rsaGenerator = cryptoFramework.createAsyKeyGenerator('RSA2048'); const keyPair = await rsaGenerator.generateKeyPair(); this.cachedKeyPair = key...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
adc56b86df96262c609ffd9c4bd8616b1e1e22f1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
savePartialDownload
手动保存部分下载为归档 允许用户将未达80%阈值的失败任务也保存为部分归档
public async savePartialDownload(taskId: string): Promise<boolean> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return false; } if (task.status !== TaskStatus.FAILED) { logger.warn(TAG, `任务状态不允许保存: ${task.status}`); return false; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left savePartialDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Le...
public async savePartialDownload(taskId: string): Promise<boolean> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return false; } if (task.status !== TaskStatus.FAILED) { logger.warn(TAG, `任务状态不允许保存: ${task.status}`); return false; ...
https://github.com/DaLongZhuaZi/manxia
2bba90a4dbfce6c4f3937954025659032c85382d
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/common/VNCConnection.ets
arkts
disconnect
断开VNC连接
async disconnect(): Promise<void> { if (this.tcpSocket) { try { await this.tcpSocket.close(); } catch (error) { console.error('Error closing socket:', error); } // 移除事件监听 this.removeSocketEvents(); this.tcpSocket = null; } this.setState(VNCCo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left disconnect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async disconnect(): Promise<void> { if (this.tcpSocket) { try { await this.tcpSocket.close(); } catch (error) { console.error('Error closing socket:', error); } // 移除事件监听 this.removeSocketEvents(); this.tcpSocket = null; } this.setState(VNCCo...
https://github.com/AetheriumSimulator/qemu-hmos
c51c05047e16768fc3840b621f2ae00cdba60281
github
harmonyos/codelabs
HarmonyOS_NEXT/SimpleCalculator/entry/src/main/ets/pages/HomePage.ets
arkts
inputNumber
Enter numbers. @param value Enter numbers.
inputNumber(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return; } let len = this.expressions.length; let last = len > 0 ? this.expressions[len - 1] : ''; let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined; if (!this.validateEnter(last, value)) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left inputNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
inputNumber(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return; } let len = this.expressions.length; let last = len > 0 ? this.expressions[len - 1] : ''; let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined; if (!this.validateEnter(last, value)) { ...
https://gitee.com/harmonyos/codelabs.git
0b2dae913834477f800be7d5e091d366181e1577
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
setToken
设置认证Token @param token 认证令牌
static setToken(token: string): void { HttpUtil.token = token; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static setToken(token: string): void { HttpUtil.token = token; }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
6c40784dfe1c6baec0327368f86a7f290cf9b745
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/DSiWareManager.ets
arkts
hasBannerSavFile
判断标题是否有 banner.sav - 对齐 Android DSiWareTitle.hasBannerSavFile()
function hasBannerSavFile(title: DSiWareTitleNative): boolean { return ((title.appFlags ?? 0) & 0x04) !== 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasBannerSavFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function hasBannerSavFile(title: DSiWareTitleNative): boolean { return ((title.appFlags ?? 0) & 0x04) !== 0; }
https://github.com/richshaw2015/nds
b8bf4617f772efb46abad74da8b312558dada17c
github
apap6628114/nga_oh
entry/src/main/ets/common/utils/LinkUtils.ets
arkts
extractHostname
从 URL 中提取主机名。 例:'https://nga.178.com/read.php?tid=1' → 'nga.178.com'
function extractHostname(url: string): string { const start: number = url.indexOf('://') + 3 const end: number = url.indexOf('/', start) return end >= 0 ? url.substring(start, end) : url.substring(start) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractHostname AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function extractHostname(url: string): string { const start: number = url.indexOf('://') + 3 const end: number = url.indexOf('/', start) return end >= 0 ? url.substring(start, end) : url.substring(start) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/LinkUtils.ets#L16-L20
5a5582b73d874e6cb134901d45b7768da1d92589
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
rsaVerify
RSA SHA256 验签
static async rsaVerify(data: Uint8Array, signature: Uint8Array, publicKey: cryptoFramework.PubKey): Promise<boolean> { const verifier = cryptoFramework.createVerify('RSA2048|PKCS1|SHA256'); await verifier.init(publicKey); const dataBlob = CryptoUtil.createDataBlob(data); await verifier.update(dataBlob...
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 rsaVerify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#R...
static async rsaVerify(data: Uint8Array, signature: Uint8Array, publicKey: cryptoFramework.PubKey): Promise<boolean> { const verifier = cryptoFramework.createVerify('RSA2048|PKCS1|SHA256'); await verifier.init(publicKey); const dataBlob = CryptoUtil.createDataBlob(data); await verifier.update(dataBlob...
https://github.com/AlkaidLab/moonlight-harmony
f62fbbb16e7c63a98541108036b09cc966d9043a
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
playPrevious
播放前一首(根据当前循环模式)
async playPrevious() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + this.musicModelArr.length - 1) % this.musicM...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left playPrevious 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#{#R...
async playPrevious() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + this.musicModelArr.length - 1) % this.musicM...
https://gitcode.com/arkui-x/samples
925f07c44315d2b31330b7af77ceee9417c3a1f5
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/DeviceManager.ets
arkts
registerDevice
注册设备 @param deviceInfo 设备信息
public registerDevice(deviceInfo: DeviceInfo): void { this.devices.set(deviceInfo.deviceId, deviceInfo); // 更新房间到设备的映射 const deviceIds = this.roomToDeviceMap.get(deviceInfo.roomId) || []; if (!deviceIds.includes(deviceInfo.deviceId)) { deviceIds.push(deviceInfo.deviceId); this.roomToDevic...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deviceInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public registerDevice(deviceInfo: DeviceInfo): void { this.devices.set(deviceInfo.deviceId, deviceInfo); // 更新房间到设备的映射 const deviceIds = this.roomToDeviceMap.get(deviceInfo.roomId) || []; if (!deviceIds.includes(deviceInfo.deviceId)) { deviceIds.push(deviceInfo.deviceId); this.roomToDevic...
https://github.com/LJ666-ui/harmony-health-care
7bcceec92611f5921037f037c6dc1d4cb468fb07
github
openharmony/arkui_ace_engine
examples/Image/entry/src/main/ets/pages/example/ImageExample018.ets
arkts
aboutToAppear
默认亮度为0
aboutToAppear(): void { // 获取资源管理器中的媒体资源 let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl); // 创建图片源并获取图片信息 let imageSource = image.createImageSource(img?.buffer.slice(0)); let imageInfo = imageSource.getImageInfoSync(); // 检查图片信息是否获取成功 if (ima...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 获取资源管理器中的媒体资源 let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl); // 创建图片源并获取图片信息 let imageSource = image.createImageSource(img?.buffer.slice(0)); let imageInfo = imageSource.getImageInfoSync(); // 检查图片信息是否获取成功 if (ima...
https://gitee.com/openharmony/arkui_ace_engine.git
88e7bc5575a79f6fba84c176114ff70849e8e415
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
getForecasts
获取预测结果
getForecasts(): ForecastResult[] { try { const parsed = JSON.parse(this.forecastsJson) as ForecastResult[]; return parsed; } catch (e) { return []; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getForecasts 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 ForecastResult AST#identifier#Right AST#[#Left [ ...
getForecasts(): ForecastResult[] { try { const parsed = JSON.parse(this.forecastsJson) as ForecastResult[]; return parsed; } catch (e) { return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ad85495aa25b80ec0f35c69a6aefe92f9f000ccd
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/utils/HomeIndexCalculator.ets
arkts
buildWeeklyDisplayState
生成周账单列表的排序结果与排序说明。
static buildWeeklyDisplayState(weekBillGroups: BillGroup[], billSortType: BillSortTypeEnum): HomeWeeklyDisplayState { const displayState: HomeWeeklyDisplayState = new HomeWeeklyDisplayState(); displayState.sortedWeekBills = HomeIndexCalculator.buildSortedWeekBills(weekBillGroups, billSortType); displaySta...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildWeeklyDisplayState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left weekBillGroups AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Lef...
static buildWeeklyDisplayState(weekBillGroups: BillGroup[], billSortType: BillSortTypeEnum): HomeWeeklyDisplayState { const displayState: HomeWeeklyDisplayState = new HomeWeeklyDisplayState(); displayState.sortedWeekBills = HomeIndexCalculator.buildSortedWeekBills(weekBillGroups, billSortType); displaySta...
https://github.com/ZestBox-18/kitebook-frontend
6115a6c8829e6b68233572ae335df00ffe985d30
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
mapRowToReminder
将 ResultSet 的一行数据映射为 Reminder 对象
private static mapRowToReminder(resultSet: relationalStore.ResultSet): Reminder { try { const row: ReminderJSON = { reminderId: DAOHelper.getLong(resultSet, 'reminder_id'), userId: DAOHelper.getLong(resultSet, 'user_id'), type: DAOHelper.getString(resultSet, 'type') as 'bill' | 'budg...
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 mapRowToReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#...
private static mapRowToReminder(resultSet: relationalStore.ResultSet): Reminder { try { const row: ReminderJSON = { reminderId: DAOHelper.getLong(resultSet, 'reminder_id'), userId: DAOHelper.getLong(resultSet, 'user_id'), type: DAOHelper.getString(resultSet, 'type') as 'bill' | 'budg...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ae697029fed73d64634af838d3f315cabc40faf1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
initialize
初始化缓存
initialize(): void { if (this.isInitialized) { return; } try { logger.info(TAG, '开始初始化WebView图片缓存'); // 清理过期缓存 this.cleanupExpiredItems(); this.isInitialized = true; logger.info(TAG, 'WebView图片缓存初始化完成'); } catch (error) { logger.error(TAG...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize 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#{#Left { AST#{#Right AST#method_d...
initialize(): void { if (this.isInitialized) { return; } try { logger.info(TAG, '开始初始化WebView图片缓存'); // 清理过期缓存 this.cleanupExpiredItems(); this.isInitialized = true; logger.info(TAG, 'WebView图片缓存初始化完成'); } catch (error) { logger.error(TAG...
https://github.com/DaLongZhuaZi/manxia
14ca931687975b037351169adbc8c8ee672bd99b
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/util/OmniFilterUtil.ets
arkts
processBrotherItemSelectStatus
处理兄弟节点的选中状态,将当前节点置为选中状态
static processBrotherItemSelectStatus(filterItem: OmniFilterItemBean): void { let hasSelected = false if (filterItem.type === OmniFilterType.checkbox) { filterItem.isSelected = !filterItem.isSelected; if (filterItem.isSelected) { hasSelected = true } const allBrothers = filterI...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left processBrotherItemSelectStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left filterItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right...
static processBrotherItemSelectStatus(filterItem: OmniFilterItemBean): void { let hasSelected = false if (filterItem.type === OmniFilterType.checkbox) { filterItem.isSelected = !filterItem.isSelected; if (filterItem.isSelected) { hasSelected = true } const allBrothers = filterI...
https://github.com/wuba/omni-ui
33adc84cf9627bcffbfa502a21f0269e361cc593
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
fill
Fills the Uint8Array with specified value @param value new valuy @returns modified Uint8Array
public fill(value: number, start: number): Uint8Array { return this.fill(value as number, start as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start: number): Uint8Array { return this.fill(value as number, start as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f577ed00eb30a84b51e9ed94629d5edb752724c8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
startReadingSession
==================== 阅读服务 ==================== 开始阅读会话
public async startReadingSession(comicId: string, chapterId: string): Promise<ReadingSession> { try { const comic = await this.dataManager.getComicInfo(comicId); if (!comic) { throw new Error('漫画不存在'); } const chapters = await this.dataManager.getComicChapters(comicId); ...
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 startReadingSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#L...
public async startReadingSession(comicId: string, chapterId: string): Promise<ReadingSession> { try { const comic = await this.dataManager.getComicInfo(comicId); if (!comic) { throw new Error('漫画不存在'); } const chapters = await this.dataManager.getComicChapters(comicId); ...
https://github.com/DaLongZhuaZi/manxia
6d13c009ecd45eb84d412784f7a65ed06fca932e
github
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawImage
Draw the picture corresponding to the prize in the internal fan area.
drawImage() { let beginAngle = this.startAngle; let imageSrc = [ CommonConstants.WATERMELON_IMAGE_URL, CommonConstants.BEER_IMAGE_URL, CommonConstants.SMILE_IMAGE_URL, CommonConstants.CAKE_IMAGE_URL, CommonConstants.HAMBURG_IMAGE_URL, CommonConstants.SMILE_IMAGE_URL ]; for (let i = 0...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
drawImage() { let beginAngle = this.startAngle; let imageSrc = [ CommonConstants.WATERMELON_IMAGE_URL, CommonConstants.BEER_IMAGE_URL, CommonConstants.SMILE_IMAGE_URL, CommonConstants.CAKE_IMAGE_URL, CommonConstants.HAMBURG_IMAGE_URL, CommonConstants.SMILE_IMAGE_URL ]; for (let i = 0...
https://gitee.com/harmonyos/codelabs.git
6b75a978570fb8b508906187bfde9b15250eb301
gitee
JackJiang2011/harmonychat
entry/src/main/ets/pages/LoginPage.ets
arkts
doContactAuthor
联系作者。
doContactAuthor() { try { let want: Want = { action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: 'http://www.52im.net/' } let context = getContext(this) as common.UIAbilityContext; context.startAbility(want) console.info(`explicit ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doContactAuthor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
doContactAuthor() { try { let want: Want = { action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: 'http://www.52im.net/' } let context = getContext(this) as common.UIAbilityContext; context.startAbility(want) console.info(`explicit ...
https://github.com/JackJiang2011/harmonychat
45ee5d338d090075cb2ef02b86290a38803be3a8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
importFromLargeFile
==================== 大文件流式导入 ==================== 从大文件流式导入书源 适用于50M~100M+的大型书源JSON文件 @param filePath 文件路径 @param progress 进度回调 @returns 导入结果
async importFromLargeFile( filePath: string, progress?: LargeFileImportProgress ): Promise<LargeFileImportResult> { const startTime = Date.now(); const result: LargeFileImportResult = { success: false, totalParsed: 0, successCount: 0, failedCount: 0, skippedCount: 0, ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importFromLargeFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#...
async importFromLargeFile( filePath: string, progress?: LargeFileImportProgress ): Promise<LargeFileImportResult> { const startTime = Date.now(); const result: LargeFileImportResult = { success: false, totalParsed: 0, successCount: 0, failedCount: 0, skippedCount: 0, ...
https://github.com/DaLongZhuaZi/manxia
656c9dcff7de35eae0f5f9687490a7c18d047e05
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/NSFWHelper.ets
arkts
isNSFWByCategories
从分类判断是否为NSFW内容
public static isNSFWByCategories(categories: string[]): boolean { if (!categories || categories.length === 0) { return false; } const categoriesLower = categories.map(c => c.toLowerCase()).join(','); return NSFW_KEYWORDS.some(keyword => categoriesLower.includes(keyword)); }
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 isNSFWByCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AST#...
public static isNSFWByCategories(categories: string[]): boolean { if (!categories || categories.length === 0) { return false; } const categoriesLower = categories.map(c => c.toLowerCase()).join(','); return NSFW_KEYWORDS.some(keyword => categoriesLower.includes(keyword)); }
https://github.com/DaLongZhuaZi/manxia
baef8eb8ba5f5b71002261bd27eeba92ce1620a1
github
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets
arkts
getSupportedCamerasFn
Gets the camera device object that supports the specified
getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> { let supportedCameras: Array<camera.CameraDevice> = []; try { supportedCameras = cameraManager.getSupportedCameras(); Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSupportedCamerasFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#E...
getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> { let supportedCameras: Array<camera.CameraDevice> = []; try { supportedCameras = cameraManager.getSupportedCameras(); Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
96a48d2f8ce895f3dfd8ce75074ce76dae86e8d5
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/common/VNCConnection.ets
arkts
setupSocketEvents
设置Socket事件监听
private setupSocketEvents(): void { if (!this.tcpSocket) return; // 连接成功事件 this.tcpSocket.on('connect', () => { console.log('VNC Socket connected'); this.setState(VNCConnectionState.CONNECTED); }); // 接收数据事件 this.tcpSocket.on('message', (value) => { console.log('VNC data re...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupSocketEvents 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 AS...
private setupSocketEvents(): void { if (!this.tcpSocket) return; // 连接成功事件 this.tcpSocket.on('connect', () => { console.log('VNC Socket connected'); this.setState(VNCConnectionState.CONNECTED); }); // 接收数据事件 this.tcpSocket.on('message', (value) => { console.log('VNC data re...
https://github.com/AetheriumSimulator/qemu-hmos
8e505bb8feb32e12629796387667521ff228039a
github
the-wwyang/kids-learning-app
src/main/ets/services/AchievementService.ets
arkts
checkTotalQuestionsAchievements
检查累计答题成就 @param totalQuestions 累计答题数 @returns 新解锁的成就列表
static checkTotalQuestionsAchievements(totalQuestions: number): string[] { const unlockedIds: string[] = []; const totalAchievements = AchievementService.getAchievementsByType( AchievementType.TOTAL_QUESTIONS ); for (const config of totalAchievements) { if (AchievementService.shouldUnlock...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkTotalQuestionsAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left totalQuestions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number...
static checkTotalQuestionsAchievements(totalQuestions: number): string[] { const unlockedIds: string[] = []; const totalAchievements = AchievementService.getAchievementsByType( AchievementType.TOTAL_QUESTIONS ); for (const config of totalAchievements) { if (AchievementService.shouldUnlock...
https://github.com/the-wwyang/kids-learning-app
bc7b2b6b202914ad28d635b85de44070c2c20d2c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupController.ets
arkts
executePhase
执行启动阶段
async executePhase<T>(phase: StartupPhase, executor: () => Promise<T>): Promise<T> { const config = this.phaseConfigs.get(phase); if (!config) { throw new Error(`未知的启动阶段: ${phase}`); } this.currentPhase = phase; const phaseStartTime = Date.now(); logger.info('StartupController', `📋 开始...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executePhase AST#identifier#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > A...
async executePhase<T>(phase: StartupPhase, executor: () => Promise<T>): Promise<T> { const config = this.phaseConfigs.get(phase); if (!config) { throw new Error(`未知的启动阶段: ${phase}`); } this.currentPhase = phase; const phaseStartTime = Date.now(); logger.info('StartupController', `📋 开始...
https://github.com/DaLongZhuaZi/manxia
bd2e88ef22f29b1d94b45046741c3c1ddcd237e0
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
ensureSsotDir
确保 SSOT 目录存在
ensureSsotDir(): string { const ssotDir = this.getSsotDir(); try { fileIo.mkdirSync(ssotDir, true); } catch (_) { // 目录已存在 } return ssotDir; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ensureSsotDir 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...
ensureSsotDir(): string { const ssotDir = this.getSsotDir(); try { fileIo.mkdirSync(ssotDir, true); } catch (_) { // 目录已存在 } return ssotDir; }
https://github.com/midori52000/ArkPilot
143646c25c06ca7539a9a210488fb81cf5f85964
github
arkui-x/samples
CodeLab/Cases/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
modifyAllData
改变数组数据 @param data:新数组
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left modifyAllData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressi...
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
https://gitcode.com/arkui-x/samples
4ae82e944c10f5c973f91add1bf4bd140e5097a1
gitcode
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGPath.ets
arkts
addPointsWithoutOrder
添加不带命令的坐标点 @param x 要运动到的点的x 坐标 @param y 要运动到的点的y 坐标
public addPointsWithoutOrder(x: number, y: number): void{ if (x === undefined) { x = 0; } if (y === undefined) { y = 0; } this._d.push(x + ',' + y); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addPointsWithoutOrder 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#Le...
public addPointsWithoutOrder(x: number, y: number): void{ if (x === undefined) { x = 0; } if (y === undefined) { y = 0; } this._d.push(x + ',' + y); }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
44943521794eaaac225df341b7161955c0a29c4c
gitee
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
getColumnType
获取列表类型
getColumnType(): ColumnType{ return Array.isArray(this.options[0]) ? "multiple" : "cascade" }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getColumnType 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 ColumnType AST#identifier#Right AST#ERROR#Right ...
getColumnType(): ColumnType{ return Array.isArray(this.options[0]) ? "multiple" : "cascade" }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L366-L368
36869d13131634fd48375d4358add641333ee79f
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
readUint32
Reads the next unsigned integer. @param littleEndian If the value is little endian. @returns The value.
readUint32(littleEndian?: boolean): number { const value = this.getUint32(this.mByteOffset, littleEndian) this.mByteOffset += 4 return value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#E...
readUint32(littleEndian?: boolean): number { const value = this.getUint32(this.mByteOffset, littleEndian) this.mByteOffset += 4 return value }
https://gitee.com/openharmony-sig/flutter_engine.git
b05d331cc37206b9e0c1cdee121d80e8ad3bb339
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/AssistantService.ets
arkts
getRuntimeConfig
============================================================================ 派生配置 ============================================================================
async getRuntimeConfig(assistantId: string): Promise<AssistantRuntimeConfig> { await this.store.ensureAssistantsInitialized() const config = new AssistantRuntimeConfig() const id = assistantId.trim() !== '' ? assistantId.trim() : DEFAULT_ASSISTANT_ID let assistant = this.store.getAssistantById(id) ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRuntimeConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistantId AST#identifier#Right AST#type_annotation#Left AST#...
async getRuntimeConfig(assistantId: string): Promise<AssistantRuntimeConfig> { await this.store.ensureAssistantsInitialized() const config = new AssistantRuntimeConfig() const id = assistantId.trim() !== '' ? assistantId.trim() : DEFAULT_ASSISTANT_ID let assistant = this.store.getAssistantById(id) ...
https://github.com/LongLiveY96/chatcube
d062d4403f367d97c1acb6fc52be78f7aa8c0ec6
github
iHongRen/harmony-study-demo
entry/src/main/ets/pages/Index.ets
arkts
CountDownDemoBuilder
Global @Builder functions for routerMap - each wraps component in NavDestination
@Builder function CountDownDemoBuilder() { NavDestination() { Navbar({ title: '倒计时按钮' }) CountDownDemo() } .hideTitleBar(true) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left CountDownDemoBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right ...
@Builder function CountDownDemoBuilder() { NavDestination() { Navbar({ title: '倒计时按钮' }) CountDownDemo() } .hideTitleBar(true) }
https://github.com/iHongRen/harmony-study-demo
a1d14d9b9a4fb2faf2ed853f1ecbe17f94adacfa
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets
arkts
getTemplateName
获取模板名称
getTemplateName(template: ITemplate): string { if (this.supports(template)) { return ResourceManager.getString((template as IPresetTemplate).name); } return ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTemplateName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ITemplate AST#identifier#Right AST#)...
getTemplateName(template: ITemplate): string { if (this.supports(template)) { return ResourceManager.getString((template as IPresetTemplate).name); } return ''; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/PresetTemplateStrategy.ets#L131-L136
466eefa722c75a5e4a56b7e206525af52ad63575
github
azhu0001/localsend-harmony
serve/src/main/ets/http/ServerResponse.ets
arkts
printfHeader
向outHeader中追加header信息 @param originHeader起源标头 @param header中key值 @param header中value值 @return 响应头字符串输出
private printfHeader(originHeader: string, name: string, value: string | number | boolean): string { let tempOriginHeader: string = originHeader const key = name.replaceAll(/[^a-zA-Z-]/g, '').toLowerCase() tempOriginHeader += `${key}: ${value}\r\n` if (!['set-cookie'].includes(key)) { this.setHe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left printfHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originHeader AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private printfHeader(originHeader: string, name: string, value: string | number | boolean): string { let tempOriginHeader: string = originHeader const key = name.replaceAll(/[^a-zA-Z-]/g, '').toLowerCase() tempOriginHeader += `${key}: ${value}\r\n` if (!['set-cookie'].includes(key)) { this.setHe...
https://gitcode.com/azhu0001/localsend-harmony
4c86dd4e1d8de0d0c3c7ed34bedcb6c59c51dec9
gitcode
openharmony/applications_app_samples
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
getNetworkStatus
获取网络状态,查询手机卡注册网络的运营商名称、是否处于漫游状态、设备的网络注册状态等信息
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } // regState字段表示设备的网络注册状态 // (REG_STATE_POWER_OFF,值为3)蜂窝无线电已关闭,modem下电,无法和网侧进行通信 logger.in...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNetworkStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } // regState字段表示设备的网络注册状态 // (REG_STATE_POWER_OFF,值为3)蜂窝无线电已关闭,modem下电,无法和网侧进行通信 logger.in...
https://github.com/openharmony/applications_app_samples
9e009f70eff9dc50fa3c811119b7d07ad79cc11c
github
huaiminqin/TankWar-Master-with-Many-Tasks
util/src/main/ets/services/GameService.ets
arkts
generateMissions
生成任务列表
static generateMissions(level: number): Mission[] { const missions: Mission[] = []; // 根据关卡生成不同任务组合 if (level === 1) { missions.push({ id: 'm1', type: MissionType.ESCORT, title: '护送补给车', description: '保护补给车安全抵达基地', status: MissionStatus.IN_PROGRESS, p...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateMissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static generateMissions(level: number): Mission[] { const missions: Mission[] = []; // 根据关卡生成不同任务组合 if (level === 1) { missions.push({ id: 'm1', type: MissionType.ESCORT, title: '护送补给车', description: '保护补给车安全抵达基地', status: MissionStatus.IN_PROGRESS, p...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
51af05022ff3a337fdfe05e8b4abe7c698b3f12b
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
buyNow
立即购买 @param {SelectedGoods} selectedGoods - 已选商品信息 @returns {Promise<void>} Promise<void>
async buyNow(selectedGoods: SelectedGoods): Promise<void> { // 保存已选商品列表到本地存储(存储为数组格式) await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); // 关闭规格选择弹窗 this.dismissSpecModal(); // 跳转到订单确认页面 OrderNavigator.toConfirm(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left buyNow AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left selectedGoods AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async buyNow(selectedGoods: SelectedGoods): Promise<void> { // 保存已选商品列表到本地存储(存储为数组格式) await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); // 关闭规格选择弹窗 this.dismissSpecModal(); // 跳转到订单确认页面 OrderNavigator.toConfirm(); }
https://github.com/Joker-x-dev/CoolMallArkTS
ed923366518b22a221949e2786b6852d29081aee
github
luojiang001/Pulse
Pulse/oh_modules/collect_personal_info/src/main/ets/common/GridRowColSetting.ets
arkts
getPageMargin
获取页面margin @param bp @returns
public static getPageMargin(bp: string): number { return Reflect.get(GridRowColSetting.GRID_ROW_OPTIONS_MARGIN, bp); }
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 getPageMargin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#...
public static getPageMargin(bp: string): number { return Reflect.get(GridRowColSetting.GRID_ROW_OPTIONS_MARGIN, bp); }
https://github.com/luojiang001/Pulse
70d8fb06d632b84cc1a28a67c368eddee8944f72
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
post
发送POST请求
async post(url: string, body: string, headers?: Record<string, string>): Promise<JsResponse> { try { const httpRequest = http.createHttp(); const requestHeaders: Record<string, string> = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90....
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left post AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
async post(url: string, body: string, headers?: Record<string, string>): Promise<JsResponse> { try { const httpRequest = http.createHttp(); const requestHeaders: Record<string, string> = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90....
https://github.com/DaLongZhuaZi/manxia
7f8ff71571aa7c0680877650ec7f76ed8c4abfbd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
error
==================== 状态色系 ====================
static get error(): string { return getColorForCurrentTheme(ColorRole.ERROR); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST...
static get error(): string { return getColorForCurrentTheme(ColorRole.ERROR); }
https://github.com/DaLongZhuaZi/manxia
887bc0e253c6c3545a77d34a64b68ff1fc1bda77
github
apap6628114/nga_oh
entry/src/main/ets/common/concurrency/RequestQueue.ets
arkts
constructor
构造并发队列。 @param maxConcurrent - 允许的最大并发任务数
constructor(maxConcurrent: number) { this.maxConcurrent = maxConcurrent; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxConcurrent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ...
constructor(maxConcurrent: number) { this.maxConcurrent = maxConcurrent; }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/concurrency/RequestQueue.ets#L28-L30
a9485ccd5995dafed7058a73eec183977df23768
github
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
ensureFavorites
--- Favorites (SocialList) ---
ensureFavorites(): void { this.socialListSettings.ensureFavorites() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ensureFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
ensureFavorites(): void { this.socialListSettings.ensureFavorites() }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L126-L126
4709c83e7c24e9f8eed9334e1cff938c09e17044
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets
arkts
getDecimalDigits
Returns the number of decimal digits this formatter uses or -1, if unspecified. @return
public getDecimalDigits(): number { return this.digits; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDecimalDigits 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 getDecimalDigits(): number { return this.digits; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
28dc8c6804f394bb0eea195430989e6eb781705a
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/HistoryManager.ets
arkts
getAdvancedHistory
获取高级评估器历史记录列表
static async getAdvancedHistory(context: Context): Promise<AdvancedHistoryItem[]> { try { const prefs = await HistoryManager.getPreferences(context); const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string; return JSON.parse(historyStr); } catch (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 getAdvancedHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
static async getAdvancedHistory(context: Context): Promise<AdvancedHistoryItem[]> { try { const prefs = await HistoryManager.getPreferences(context); const historyStr = await prefs.get(HistoryManager.ADVANCED_HISTORY_KEY, '[]') as string; return JSON.parse(historyStr); } catch (error) { ...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
3f1744b847cd01aba8ab7163ff3fa4e51ba55091
github
yuyu5333/Healthy_life
entry/src/main/ets/view/HomeComponent.ets
arkts
build
aboutToAppear(): void { }
build() { Stack() { Scroll(this.scroller) { Column() { HomeTopView({ homeStore: $homeStore }) Row(){ // Text($r('app.string.task_list')).titleTextStyle() Text( $r('app.string.task_list')) .fontSize(Const.DEFAULT_20) .fontW...
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() { Stack() { Scroll(this.scroller) { Column() { HomeTopView({ homeStore: $homeStore }) Row(){ // Text($r('app.string.task_list')).titleTextStyle() Text( $r('app.string.task_list')) .fontSize(Const.DEFAULT_20) .fontW...
https://github.com/yuyu5333/Healthy_life
9536e3a3c1d036cb88c42bfae2b90234a1eebd18
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
getFieldParameters
Get field parameters metadata
static getFieldParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:fieldParams', target, propertyKey) || null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFieldParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static getFieldParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:fieldParams', target, propertyKey) || null; }
https://github.com/killetom/ktretrofit
882d72a12d7db0f380fd4a29976069247307785f
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
openFocus
打开专注覆盖页。
openFocus(): void { this.pushOverlayRoute(AppRoute.FOCUS, new FocusRouteParam(), false); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le...
openFocus(): void { this.pushOverlayRoute(AppRoute.FOCUS, new FocusRouteParam(), false); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L66-L68
64f975b0546c252c64cd7073eb016a10cb88b6be
github
anhao0226/harmony-music-player
entry/src/main/ets/common/utils/AudioService.ets
arkts
addNextPlaySong
@param song
public addNextPlaySong(song: Song) { this._shareData.addNextPlaySong(song); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addNextPlaySong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public addNextPlaySong(song: Song) { this._shareData.addNextPlaySong(song); }
https://github.com/anhao0226/harmony-music-player
8db0af2902a3404a7cc6e42a7886df72db530ab3
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/Evaluator.ets
arkts
handleExpressionWithOperator
Handle expression with operator. @param { string } operator @returns { string } Processed expression.
private handleExpressionWithOperator(res: string, leftExpression: string): string { let expression: string = leftExpression; if (expression.length === 0) { expression = res === '-' ? res : ''; } else { let preCharacter: string = expression.charAt(expression.length - 1); if (res === '-') ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleExpressionWithOperator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left res AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private handleExpressionWithOperator(res: string, leftExpression: string): string { let expression: string = leftExpression; if (expression.length === 0) { expression = res === '-' ? res : ''; } else { let preCharacter: string = expression.charAt(expression.length - 1); if (res === '-') ...
https://gitee.com/openharmony-sig/applications_calculator.git
a1e40391180aed71ee0211b0bf193ed43bcafdbc
gitee
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ProviderViewModel.ets
arkts
getCachedProviders
获取当前内存中的 provider 列表(快速 UI 同步用)
getCachedProviders(): ModelProvider[] { return this.store.getProviders() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCachedProviders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
getCachedProviders(): ModelProvider[] { return this.store.getProviders() }
https://github.com/LongLiveY96/chatcube
c97090ee47b8abceef9bb5a838d4e9f427cacbf8
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SampleImageUtil.ets
arkts
getAllSampleImages
获取所有可用的示例图片
static getAllSampleImages(): SampleImageInfo[] { const images: SampleImageInfo[] = [ { name: '胸部X光示例1', description: '正常胸部X光片', resourcePath: 'sample_images/chest_xray_normal.jpg', imagingType: ImagingType.CHEST_XRAY }, { name: '胸部X光示例2', descripti...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllSampleImages 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 Sam...
static getAllSampleImages(): SampleImageInfo[] { const images: SampleImageInfo[] = [ { name: '胸部X光示例1', description: '正常胸部X光片', resourcePath: 'sample_images/chest_xray_normal.jpg', imagingType: ImagingType.CHEST_XRAY }, { name: '胸部X光示例2', descripti...
https://github.com/LJ666-ui/harmony-health-care
4da6df204610c8835ca73553f0ef9e0e085bd7e2
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/InputProcessor.ets
arkts
createResultFromTarget
根据 InputTarget 创建 ProcessResult
private createResultFromTarget(target: InputTarget, isDown: boolean): ProcessResult { if (target.type === 'nds_key') { return { type: 'nds_key', ndsKey: target.key, isDown: isDown } } else { return { type: 'frontend_action', frontendAction: target.acti...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createResultFromTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private createResultFromTarget(target: InputTarget, isDown: boolean): ProcessResult { if (target.type === 'nds_key') { return { type: 'nds_key', ndsKey: target.key, isDown: isDown } } else { return { type: 'frontend_action', frontendAction: target.acti...
https://github.com/richshaw2015/nds
e3c20b60a5fdc59e9b772e9e1435e6d5c9cadfca
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
confirmStartTime
确认开始时间
confirmStartTime(): void { const date = new Date(this.scheduleStartTime) date.setHours(this.tempHour, this.tempMinute, 0, 0) this.scheduleStartTime = date.getTime() // 如果结束时间早于开始时间,调整结束时间 if (this.scheduleEndTime <= this.scheduleStartTime) { this.scheduleEndTime = this.scheduleStartTime + 60...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmStartTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
confirmStartTime(): void { const date = new Date(this.scheduleStartTime) date.setHours(this.tempHour, this.tempMinute, 0, 0) this.scheduleStartTime = date.getTime() // 如果结束时间早于开始时间,调整结束时间 if (this.scheduleEndTime <= this.scheduleStartTime) { this.scheduleEndTime = this.scheduleStartTime + 60...
https://gitcode.com/openharmony/codelabs
48009c781e9e6257870c6102f73a54ba806b2097
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/module/expeditionNotification.ets
arkts
_cancel
── 取消通知 ──
private async _cancel(): Promise<void> { try { await notificationManager.cancel(LIVE_NOTIFICATION_ID); console.debug('[ExpeditionLiveNotification] cancelled'); } catch (_) { // 通知不存在时忽略错误 } }
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 _cancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
private async _cancel(): Promise<void> { try { await notificationManager.cancel(LIVE_NOTIFICATION_ID); console.debug('[ExpeditionLiveNotification] cancelled'); } catch (_) { // 通知不存在时忽略错误 } }
https://github.com/CsCesium/KantaiHomo
eb424c64ce390dabdba5cee18e2910182131d3c5
github