nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets | arkts | queryForList | 查询数据
@param predicates 条件
@param columns
@returns | queryForList<T> (predicates: relationalStore.RdbPredicates, columns: ColumnInfo[]): Promise<T[]> {
return new Promise((resolve, reject) => {
this.rdbStore?.query(predicates, columns.map(info => info.columnName), (err, result) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!... | AST#method_declaration#Left queryForList AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualifie... | queryForList<T> (predicates: relationalStore.RdbPredicates, columns: ColumnInfo[]): Promise<T[]> {
return new Promise((resolve, reject) => {
this.rdbStore?.query(predicates, columns.map(info => info.columnName), (err, result) => {
if (err) {
Logger.error(`[${CommonConstants.RDB_TAG}]`,'查询失败!... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L188-L201 | 688e43b57446628880098e2835f5ac292fae54e0 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/MePage.ets | arkts | buildUserInfoTitle | 构建用户信息标题区域
@returns {void} 无返回值 | @Builder
private buildUserInfoTitle(): void {
ColumnStart() {
Text(this.getDisplayName())
.fontSize($r("app.float.display_medium"))
.fontColor($r("app.color.text_primary"))
.fontWeight(FontWeight.Medium);
SpaceVerticalXSmall();
this.buildUserPhoneLine();
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildUserInfoTitle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left A... | @Builder
private buildUserInfoTitle(): void {
ColumnStart() {
Text(this.getDisplayName())
.fontSize($r("app.float.display_medium"))
.fontColor($r("app.color.text_primary"))
.fontWeight(FontWeight.Medium);
SpaceVerticalXSmall();
this.buildUserPhoneLine();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L159-L171 | a11e1820462901ff6d54045dd37c75174fba9cd7 | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/card/components/ShowCardArea.ets | arkts | watchCurrentCardNum | 监听传回来的值 | watchCurrentCardNum () {
if (this.saveCardNum1) {
console.log('saveCardNum', this.saveCardNum1.substr(-4))
const list = JSON.parse(JSON.stringify(this.addDoneCardInfo))
const addIndex = list[1].cardList.length + 1
list[1].cardList.push({
id: `creditCard_${addIndex}`,
img: $... | AST#method_declaration#Left watchCurrentCardNum AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . saveCardNum1 AST#member_expression#Right AST#expres... | watchCurrentCardNum () {
if (this.saveCardNum1) {
console.log('saveCardNum', this.saveCardNum1.substr(-4))
const list = JSON.parse(JSON.stringify(this.addDoneCardInfo))
const addIndex = list[1].cardList.length + 1
list[1].cardList.push({
id: `creditCard_${addIndex}`,
img: $... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/ShowCardArea.ets#L26-L51 | c6f23d0dff8c14743e3d4a65c6f238948bfae27d | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets | arkts | handle | 假设client类型为any,实际应根据具体类型替换 | handle(data: any): void { // 应用约束10:显式指定参数和返回类型,避免any
this.client = this.client;
const guild = this.client.guilds.get(data.id);
if (guild) {
if (data.presences) {
// 应用约束41:使用常规for循环替代for..in
for (let presence of data.presences) {
guild._setPresence(presence.user.id, presenc... | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_... | handle(data: any): void {
this.client = this.client;
const guild = this.client.guilds.get(data.id);
if (guild) {
if (data.presences) {
for (let presence of data.presences) {
guild._setPresence(presence.user.id, presence);
}
}
if (data.members) {
... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets#L8-L36 | 4c36c07c0be49f86a1f88a81d5d5238f3146d9a6 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets | arkts | getHash | 获取对象的Hash值。如果是第一次获取,则计算Hash值并保存到对象的Hash域(返回随机的Hash值);如果不是第一次获取,则从Hash域中获取并返回Hash值(同一对象多次返回值保持不变)。
@param object
@returns | static getHash(object: object): number {
return util.getHash(object);
} | AST#method_declaration#Left static getHash AST#parameter_list#Left ( AST#parameter#Left object : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | static getHash(object: object): number {
return util.getHash(object);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets#L8-L10 | ad3227d32e208d8ff3848713c00b65ad45f3ba62 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets | arkts | changeProgressNum | 改变进度
@param isIncrease 是否增加 | changeProgressNum(isIncrease: boolean) {
// 根据isIncrease来决定是对progressNum自增还是自减
isIncrease ? this.progressNum += Constants.PROGRESS_STEP : this.progressNum -= Constants.PROGRESS_STEP;
this.changeColor();
this.pathCommands = this.getPathCommands(this.progressNum);
} | AST#method_declaration#Left changeProgressNum AST#parameter_list#Left ( AST#parameter#Left isIncrease : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 根据isIncrease来决定是对progressNum自... | changeProgressNum(isIncrease: boolean) {
isIncrease ? this.progressNum += Constants.PROGRESS_STEP : this.progressNum -= Constants.PROGRESS_STEP;
this.changeColor();
this.pathCommands = this.getPathCommands(this.progressNum);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L122-L127 | b8987aaaf6539c6175aca1f8938d85abc0d5dcd8 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/PageRequest.ets | arkts | @param {Partial<PageRequest>} init - 初始化数据 | constructor(init?: Partial<PageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.sort = init.sort ?? this.sort;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right > AST#type... | constructor(init?: Partial<PageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.sort = init.sort ?? this.sort;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/PageRequest.ets#L22-L27 | dc4365f7a68b401f6f5a8720d8f42783a87dd55f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets | arkts | NativePictureToSandboxViewComponent | 功能描述: 本示例主要介绍Native如何将网络上的图片及Rawfile中的图片保存到应用沙箱中。
推荐场景: 将网络上的图片及Rawfile中的图片保存到应用沙箱中
核心组件:
1. saveImageOfInternetCallback
2. saveImageOfRawfileCallback
实现步骤:
1. 调用native侧saveImageOfInternetCallback接口,将返回的沙箱路径转换为Uri路径后绑定到Image组件
2. 调用native侧saveImageOfRawfileCallback接口,将返回的沙箱路径转换为Uri路径后绑定到Image组件 | @Component
export struct NativePictureToSandboxViewComponent {
private resMgr = getContext().resourceManager; // 获取js的资源对象
private fileDir = getContext().filesDir; // 获取应用的文件路径
private rawfilePicPath:string = "sandBoxTest.jpg"; // rawfile中的图片名
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NativePictureToSandboxViewComponent AST#component_body#Left { AST#property_declaration#Left private resMgr = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#L... | @Component
export struct NativePictureToSandboxViewComponent {
private resMgr = getContext().resourceManager;
private fileDir = getContext().filesDir;
private rawfilePicPath:string = "sandBoxTest.jpg";
private internetPicUrl:string = "https:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativesavepictosandbox/src/main/ets/view/NativePictureToSandboxView.ets#L35-L162 | 6216ed8d242bbbf264834b38ba2538ee0205dc41 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | getWindowType | 获取窗口类型。
@param windowClass 不传该值,默认主窗口。
@returns | static getWindowType(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowType {
return WindowUtil.getWindowProperties(windowClass).type;
} | AST#method_declaration#Left static getWindowType AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#... | static getWindowType(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowType {
return WindowUtil.getWindowProperties(windowClass).type;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L315-L317 | 1b0112b001b9df12ebcfa3dae7a369a5fc3d3446 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_dialog/ace_ets_module_dialog_api12/entry/src/main/ets/MainAbility/common/Utils.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over..... | AST#export_declaration#Left export default AST#class_declaration#Left class Utils AST#class_body#Left { AST#property_declaration#Left static rect_left ; AST#property_declaration#Right AST#property_declaration#Left static rect_top ; AST#property_declaration#Right AST#property_declaration#Left static rect_right ; AST#pro... | export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over..... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_dialog/ace_ets_module_dialog_api12/entry/src/main/ets/MainAbility/common/Utils.ets#L15-L112 | e04a1d7424f651417b5a6420d9b704c0a1d27f60 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/settings/SettingsService.ets | arkts | mergeNotificationSettings | 合并通知设置 | private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings {
const result: NotificationSettings = {
enabled: updates.enabled !== undefined ? updates.enabled : current.enabled,
methods: updates.methods !== undefined ? updates.methods : c... | AST#method_declaration#Left private mergeNotificationSettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primar... | private mergeNotificationSettings(current: NotificationSettings, updates: Partial<NotificationSettings>): NotificationSettings {
const result: NotificationSettings = {
enabled: updates.enabled !== undefined ? updates.enabled : current.enabled,
methods: updates.methods !== undefined ? updates.methods : c... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L488-L498 | 40db07ade135391e598be3e5bd06a9b2a88cf573 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets | arkts | bmiUnit | 根据标记配单位 | bmiUnit(title: string) {
return title === '身高' ? 'cm' : 'kg'
} | AST#method_declaration#Left bmiUnit AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AS... | bmiUnit(title: string) {
return title === '身高' ? 'cm' : 'kg'
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets#L12-L14 | 9feac034d94c1fbc807c7a15091fb036763545db | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the device serial number represented by a string.
@permission ohos.permission.sec.ACCESS_UDID
@syscap SystemCapability.Startup.SystemInfo
@since 20
@arkts 1.2 | static get serial(): string; | AST#method_declaration#Left static get AST#ERROR#Left serial AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get serial(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L153-L153 | 6302ebb79c49364ea824d6e1bdf8436380eb2f5f | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | red | from Color red()
@param color | public static red(color: number): number {
return (color >> 16) & 0xFF;
} | AST#method_declaration#Left public static red AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | public static red(color: number): number {
return (color >> 16) & 0xFF;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L250-L252 | a54a5d49abbc811c4d4a2d8150418b05fe84e357 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildWelcomeBanner | 构建欢迎横幅 | @Builder
buildWelcomeBanner() {
Column({ space: 8 }) {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Text(`今天是 ${this.getCurrentDateString()} 星期${this.getCurrentWeekday()}`)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWelcomeBanner AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildWelcomeBanner() {
Column({ space: 8 }) {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Text(`今天是 ${this.getCurrentDateString()} 星期${this.getCurrentWeekday()}`)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L416-L458 | 09996e9b9fddeb3ca3cef9ebf145aaf2ed155517 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets | arkts | aboutToAppear | 渐变结束点的亮度值 | aboutToAppear(): void {
// 初始化 Grid 模板
this.initGridTemplate();
// 计算 HSL 渐变颜色,并更新颜色数组
this.colors = this.computeHSLGradient(this.hslHues, this.levels);
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 初始化 Grid 模板 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left... | aboutToAppear(): void {
this.initGridTemplate();
this.colors = this.computeHSLGradient(this.hslHues, this.levels);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets#L342-L347 | c9f6dfcfdf738e93e60b16e2b14bd0ec429ddcb0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/ar/ARCardCreatorPage.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ar/ARCardCreatorPage.ets#L73-L109 | f6bacd44ade147793ad14534ac8c56e4c3f6f4a9 | github |
yangsongming/ArkTs-HuXiHelper.git | ed148299fc6dcf351bcc0f2863a5aee4885fbaf5 | ets/controller/MapController.ets | arkts | Used for map control. | export class MapController {
private leftTop: Array<number> = [];
private previousScale: number = 0;
private pinchCount: number = 0;
private panX: number = 0;
private panY: number = 0;
/**
* Initialize the map.
*
* @param mapContext This object of MapComponent.
*/
initLeftTop(screenMapWidth: ... | AST#export_declaration#Left export AST#class_declaration#Left class MapController AST#class_body#Left { AST#property_declaration#Left private leftTop : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | export class MapController {
private leftTop: Array<number> = [];
private previousScale: number = 0;
private pinchCount: number = 0;
private panX: number = 0;
private panY: number = 0;
initLeftTop(screenMapWidth: number, mapWidth: number): void {
this.leftTop = [(screenMapWidth - mapWidth), 0];
}
... | https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/controller/MapController.ets#L10-L138 | 6303054d4086df220a1a86d3b08096e40f806208 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | getBoxes | / 划分好的每一个 box 列表 | getBoxes(): Box[] {
return this.boxes;
} | AST#method_declaration#Left getBoxes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#... | getBoxes(): Box[] {
return this.boxes;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L85-L87 | 280ac42a1383bdd796d39dc658d9995a0471b418 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModule.ets | arkts | 这段代码在导入时会立即执行,可能会导致副作用。 | export const data = 1; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left data = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const data = 1; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModule.ets#L18-L18 | c1d0b9ea56f4f640397db7c12c3ca55e45802def | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | features/harA/src/main/ets/components/Page2.ets | arkts | Page2 | @author: HZWei
@date: 2024/7/18
@desc: | @Route({ name: "harAPage2",description:"测试" })
@Component
export struct Page2 {
@State message: string = 'Hello World';
build() {
NavDestination(){
Column({space:12}){
Button('toHarAPage1').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harAPage1")
})
Butt... | AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "harAPage2" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#proper... | @Route({ name: "harAPage2",description:"测试" })
@Component
export struct Page2 {
@State message: string = 'Hello World';
build() {
NavDestination(){
Column({space:12}){
Button('toHarAPage1').onClick((event: ClickEvent) => {
ZRouter.getInstance().push("harAPage1")
})
Butt... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/Page2.ets#L10-L41 | 12fca6330ec43ccaea8e86ad2384fb7484b47622 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/ai-metrics-advisor/99.10.9/package/index.ets | arkts | getIps | 处理IP地址转换 | function getIps(): string {
let str = "";
let networkInterfaces = os.networkInterfaces();
Object.keys(networkInterfaces).forEach(item => {
if (item != "lo") {
networkInterfaces[item].forEach(addr => {
str += toHex(addr.address) + ".";
});
}
});
... | AST#function_declaration#Left function getIps AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left str = A... | function getIps(): string {
let str = "";
let networkInterfaces = os.networkInterfaces();
Object.keys(networkInterfaces).forEach(item => {
if (item != "lo") {
networkInterfaces[item].forEach(addr => {
str += toHex(addr.address) + ".";
});
}
});
... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/ai-metrics-advisor/99.10.9/package/index.ets#L68-L79 | bad651702199674a6a6133fd536288d14e4e7cea | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getDaysUntilBirthday | 获取距离下次生日的天数
@param birthDate 出生日期
@param referenceDate 参考日期,默认为今天
@returns 距离生日的天数 | static getDaysUntilBirthday(birthDate: Date, referenceDate: Date = new Date()): number {
const nextBirthday = DateUtils.getNextBirthday(birthDate, referenceDate);
return DateUtils.daysBetween(referenceDate, nextBirthday);
} | AST#method_declaration#Left static getDaysUntilBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left referenceDate : AST#type_annotation#Left AST#primary_type#Left Da... | static getDaysUntilBirthday(birthDate: Date, referenceDate: Date = new Date()): number {
const nextBirthday = DateUtils.getNextBirthday(birthDate, referenceDate);
return DateUtils.daysBetween(referenceDate, nextBirthday);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L306-L309 | 7d44462cdae72cb6b655b8b21821aa0320f4ba46 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 2025/01/05 14:06 | export const DATE_FORMAT9: string = "yyyy/MM/dd HH"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT9 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy/MM/dd HH" AST#expression#Right AST#variable_declarator#Right ; AST#variabl... | export const DATE_FORMAT9: string = "yyyy/MM/dd HH"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L20-L20 | 95f7405d549ef606773338c8d1ef617fea269e7e | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/Utils.ets | arkts | copyFile | 复制文件,使用Promise异步回调。
@param src string|number 待复制文件的路径或待复制文件的文件描述符。
@param dest string|number 目标文件路径或目标文件的文件描述符。
@param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。
@returns | static copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> {
return fs.copyFile(src, dest, mode);
} | AST#method_declaration#Left static copyFile AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p... | static copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> {
return fs.copyFile(src, dest, mode);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L127-L129 | b7ef76dcd5f3dd781f01c97f48f92c8ff0962e07 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets | arkts | aboutToAppear | Call back when the NodeContainer corresponding to the controller is in Appear. | aboutToAppear(): void {
console.info('aboutToAppear');
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
console.info('aboutToAppear');
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L69-L71 | a9cd3c9844147459bc98e15efc26175a33b93ec6 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets | arkts | imageProcessing | [EndExclude image_processing] Define asynchronous tasks | @Concurrent
function imageProcessing(arrayBuffer: ArrayBuffer): ArrayBuffer {
// Here add business logic, the input is ArrayBuffer, and the output is an ArrayBuffer storing the parsed results.
let message: ArrayBuffer = arrayBuffer;
return message;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function imageProcessing AST#parameter_list#Left ( AST#parameter#Left arrayBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | @Concurrent
function imageProcessing(arrayBuffer: ArrayBuffer): ArrayBuffer {
let message: ArrayBuffer = arrayBuffer;
return message;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement3.ets#L30-L35 | e4367225e78894cae6490f2ff5b168ee6e2ae3cf | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LRUCacheUtil.ets | arkts | has | 判断是否包含key对应的缓存 | public has(key: string): boolean {
return this.lruCache.contains(key);
} | AST#method_declaration#Left public has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right ... | public has(key: string): boolean {
return this.lruCache.contains(key);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LRUCacheUtil.ets#L48-L50 | 749a2153e558b40a54c7717732518b315282b24b | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/identity/IdentityManager.ets | arkts | setTimeout | Mock 验证(实际需要调用第三方API) const result = await Http.post('/api/identity/verify', info); 模拟验证结果 | setTimeout(() => {
identityInfo.status = 'verified';
identityInfo.verifiedAt = Date.now();
this.saveIdentityInfo(identityInfo);
} | AST#method_declaration#Left setTimeout AST#ERROR#Left ( AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left => AST#ERROR#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ... | setTimeout(() => {
identityInfo.status = 'verified';
identityInfo.verifiedAt = Date.now();
this.saveIdentityInfo(identityInfo);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/identity/IdentityManager.ets#L55-L59 | 8f48239633a5fa28a32b99c087260062c99d2b9f | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/lottie/LottieView.ets | arkts | play | 播放动画
@since 8
@design | play() {
this.animationItem?.play()
} | AST#method_declaration#Left play AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#exp... | play() {
this.animationItem?.play()
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L150-L152 | a508e2f88c8c291fed26b0cb8c2b1a645642ef1f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | startNetObserve | 开启网络监听
@param netType 需要监听的网络类型 | public startNetObserve(...netType: connection.NetBearType[]) {
netType.forEach((type: connection.NetBearType) => {
this.networkObserve(type);
if (type === connection.NetBearType.BEARER_WIFI) {
this.wifiStateObserve();
}
})
} | AST#method_declaration#Left public startNetObserve AST#parameter_list#Left ( AST#parameter#Left ... netType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] A... | public startNetObserve(...netType: connection.NetBearType[]) {
netType.forEach((type: connection.NetBearType) => {
this.networkObserve(type);
if (type === connection.NetBearType.BEARER_WIFI) {
this.wifiStateObserve();
}
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L98-L105 | 9c656b31db573e9290548124e1a92cdbd79c317d | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/WatchGiftBuilder.ets | arkts | WatchGiftView | 常用设置底部弹窗视图 | @Component
export struct WatchGiftView {
private highlightDataSource: AwardDataSource = new AwardDataSource();
@State winners:WinnerDataSource = new WinnerDataSource();
// private settingDataSource: SettingDataSource = new SettingDataSource();
@State settingDataSource: VHGiftAwardFiled[] = [];
@State models:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WatchGiftView AST#component_body#Left { AST#property_declaration#Left private highlightDataSource : AST#type_annotation#Left AST#primary_type#Left AwardDataSource AST#primary_type#Right AST#type_annotation#Right = AST... | @Component
export struct WatchGiftView {
private highlightDataSource: AwardDataSource = new AwardDataSource();
@State winners:WinnerDataSource = new WinnerDataSource();
@State settingDataSource: VHGiftAwardFiled[] = [];
@State models:VHGiftAwardItem[] = [];
private watchGiftId:VHWatchGiftInfo = new VHWatc... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/WatchGiftBuilder.ets#L140-L879 | e34f67e984f0e50c5363c32701d1bf11e6130036 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/setting/ReclaimView.ets | arkts | buildReclaimContent | 构建反馈内容字符串 | private async buildReclaimContent(): Promise<string> {
let content = `【投诉】${this.content.trim()}\n\n--------------\n`;
content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`;
content += `用户ID: ${UserManager.shared.userId}\n`;
content += `用户名: ${UserManager.shared.userName}`;
return con... | AST#method_declaration#Left private async buildReclaimContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig... | private async buildReclaimContent(): Promise<string> {
let content = `【投诉】${this.content.trim()}\n\n--------------\n`;
content += `应用版本: ${BundleUtils.getBundleInfoSync().versionName}\n`;
content += `用户ID: ${UserManager.shared.userId}\n`;
content += `用户名: ${UserManager.shared.userName}`;
return con... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/ReclaimView.ets#L162-L169 | 31aac3ca732ea8b2546ac1d25f68d75bdde18c2a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/limitedheightbottomdialog/Index.ets | arkts | LimitedHeightBottomDialogComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent'; | AST#export_declaration#Left export { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent' ; AST#export_declaration#Right | export { LimitedHeightBottomDialogComponent } from './src/main/ets/view/LimitedHeightBottomDialogComponent'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/Index.ets#L15-L15 | 040eb2d3766298b464a11610a07fef2450d9ab1b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | isSameSecond | 是否是同一秒 | static isSameSecond(selectDate: Date, date: Date): boolean {
return DateHelper.isSameMinute(selectDate, date) && selectDate.getSeconds() == date.getSeconds();
} | AST#method_declaration#Left static isSameSecond AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_t... | static isSameSecond(selectDate: Date, date: Date): boolean {
return DateHelper.isSameMinute(selectDate, date) && selectDate.getSeconds() == date.getSeconds();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L151-L153 | 51c313a74a13da96884e5ae6d09aa62afcc47d65 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/NotificationOptions.ets | arkts | 描述多行文本通知。 | export interface NotificationMultiLineOptions extends NotificationBasicOptions {
briefText: string; //通知概要内容,是对通知内容的总结(不可为空字符串)。
longTitle: string; //通知展开时的标题(不可为空字符串)。
lines: Array<string>; //通知的多行文本。
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationMultiLineOptions AST#extends_clause#Left extends NotificationBasicOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left briefText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right ... | export interface NotificationMultiLineOptions extends NotificationBasicOptions {
briefText: string;
longTitle: string;
lines: Array<string>;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationOptions.ets#L77-L81 | 3e58401aad2eff5a4d4b699825af7fb23fce2e9a | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/cache/GlobalThis.ets | arkts | @Author csx
@DateTime 2024/7/29 11:04:59
@TODO GlobalThis 全局替换版本GlobalThis 单例对象
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core | export class GlobalThis {
private constructor() {
}; | AST#export_declaration#Left export AST#class_declaration#Left class GlobalThis AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#class_body#Right AS... | export class GlobalThis {
private constructor() {
}; | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/cache/GlobalThis.ets#L25-L27 | 1159f3b7dbbed0e7da7da79538e46aa1d682159f | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets | arkts | sign | 签名
@param str 需要签名的字符串
@param priKey 私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns string 签名对象 | static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, resultCoding, false);
} | AST#method_declaration#Left static sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right... | static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, resultCoding, false);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L70-L73 | 645811da1e8bd724cb9b5141518b1a56d46f35ff | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets | arkts | Defines ChipGroupPaddingOptions.
@interface ChipGroupPaddingOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface ChipGroupPaddingOptions {
/**
* Top of chip group padding.
*
* @type { Length }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
top: Length;
/**
* Bottom of chip group padding.
*
* @type { Le... | AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupPaddingOptions AST#object_type#Left { /**
* Top of chip group padding.
*
* @type { Length }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_m... | export interface ChipGroupPaddingOptions {
top: Length;
bottom: Length;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L286-L307 | 44d354670a25d8252d045390170809485342af7f | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets | arkts | startDownloadIfNeeds | MARK: - 公共方法 | public async startDownloadIfNeeds(
text: string,
finished: (data: Uint8Array | null, error: string | null) => void
) {
// 校验text是否有效
if (!text || text.trim().length === 0) {
finished(null, "text is empty");
return;
}
// 检查网络连接(需实现checkConnection方法)
if (!NetWorkTool.checkInter... | AST#method_declaration#Left public async startDownloadIfNeeds AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left finished : AST#type_annotation#Left AST#function_type#Left AST... | public async startDownloadIfNeeds(
text: string,
finished: (data: Uint8Array | null, error: string | null) => void
) {
if (!text || text.trim().length === 0) {
finished(null, "text is empty");
return;
}
if (!NetWorkTool.checkInternetConnection()) {
finished(null, "Net... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L119-L158 | 344d82dc428c710b8d0eedbd7c75cf2d38ec987b | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NdkDrawing/entry/src/main/ets/view/GlassCoverView.ets | arkts | drawOneCell | Draw a circle according to the specified position and width | private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void {
canvas.moveTo(x + width, y);
canvas.arc(x, y, width, 0, Math.PI * 2);
} | AST#method_declaration#Left private drawOneCell AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void {
canvas.moveTo(x + width, y);
canvas.arc(x, y, width, 0, Math.PI * 2);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/view/GlassCoverView.ets#L87-L90 | 63f32de32bf75e5c9dfdfaaa25a6ca03c2f09a45 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets | arkts | setTopSafeHeight | 存储顶部安全区域高度 | private setTopSafeHeight(topSafeHeight: number) {
this.topSafeHeight = topSafeHeight;
} | AST#method_declaration#Left private setTopSafeHeight AST#parameter_list#Left ( AST#parameter#Left topSafeHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statemen... | private setTopSafeHeight(topSafeHeight: number) {
this.topSafeHeight = topSafeHeight;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L68-L70 | e37ffead18bbe88a92cc216cb62f1fc8c022adb6 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/array_lib_func_007_T.ets | arkts | Introduction 库函数-array_shift | export function array_lib_func_007_T(taint_src : string) {
let arr : string[] = [taint_src,"a","b"];
let t = arr.shift();
taint.Sink(t!);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_007_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function array_lib_func_007_T(taint_src : string) {
let arr : string[] = [taint_src,"a","b"];
let t = arr.shift();
taint.Sink(t!);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_007_T.ets#L6-L10 | 07395975fe20975d25e979c50e864825c5012a3c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/ImgSheetView.ets | arkts | ImgSheetView | 图片内容展示 | @Preview
@ComponentV2
export struct ImgSheetView {
private scroller: Scroller = new Scroller();
@Require @Param options: TISheetOptions;
@Local src: string | PixelMap | Resource = "";
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ImgSheetView AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right... | @Preview
@ComponentV2
export struct ImgSheetView {
private scroller: Scroller = new Scroller();
@Require @Param options: TISheetOptions;
@Local src: string | PixelMap | Resource = "";
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/ImgSheetView.ets#L12-L39 | ea461352f4192dbc6610c4f215c4554bd57b9fe2 | gitee |
hai-gou/haigou-harmonys.git | e96c0e599b151920e672d4dfc3a287db9855d368 | entry/src/main/ets/config/config.example.ets | arkts | API 基础地址 - 修改为你的后端服务地址 本地开发示例: "http://192.168.x.x:3000/" 生产环境示例: "https://api.example.com/" | export const API_BASE_URL = "http://localhost:3000/"
// 请求超时时间 (毫秒) | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left API_BASE_URL = AST#expression#Left "http://localhost:3000/" AST#expression#Right AST#variable_declarator#Right // 请求超时时间 (毫秒) AST#variable_declaration#Right AST#export_declaration#Right | export const API_BASE_URL = "http://localhost:3000/" | https://github.com/hai-gou/haigou-harmonys.git/blob/e96c0e599b151920e672d4dfc3a287db9855d368/entry/src/main/ets/config/config.example.ets#L13-L15 | 403f2c194ddda166bc66a6b11b7d37686b987348 | github | |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/model/RecordModel.ets | arkts | deleteById | 删 | deleteById(id:number): Promise<number>{
//1.删除条件
let predicates = new relationalStore.RdbPredicates(TABLE_NAME)
predicates.equalTo(ID_COLUMN,id)
//2.删除
return DbUtil.delete(predicates)
} | AST#method_declaration#Left deleteById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AS... | deleteById(id:number): Promise<number>{
let predicates = new relationalStore.RdbPredicates(TABLE_NAME)
predicates.equalTo(ID_COLUMN,id)
return DbUtil.delete(predicates)
} | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/RecordModel.ets#L40-L46 | 8fae1974f36b8bfded5e57b40c92db03ffe9d040 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | The metrics of an Font.
@typedef FontMetrics
@syscap SystemCapability.Graphics.Drawing
@since 11 | export interface FontMetrics {
/**
* Maximum range above the glyph bounding box.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 11
*/
top: number;
/**
* Distance Retained Above Baseline.
* @type { number }
* @syscap SystemCapability.Graphics.... | AST#export_declaration#Left export AST#interface_declaration#Left interface FontMetrics AST#object_type#Left { /**
* Maximum range above the glyph bounding box.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 11
*/ AST#type_member#Left top : AST#type_annotation#Left AST#... | export interface FontMetrics {
top: number;
ascent: number;
descent: number;
bottom: number;
leading: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L889-L929 | 2361cb885a835f3fd776ac5710f5f1aaae50546f | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets | arkts | loadRankDataSource1 | Load data from the rankData1 of the Mock file. | loadRankDataSource1(): RankData[] {
return rankData1;
} | AST#method_declaration#Left loadRankDataSource1 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RankData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#... | loadRankDataSource1(): RankData[] {
return rankData1;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/viewmodel/RankViewModel.ets#L21-L23 | 080233f5d2d1bda5f4414d6c2804058aa25f7bfc | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | makeRequest | 构建通知请求对象
@param {number} notificationId 通知唯一ID
@param {NotificationOptions} options 自定义通知配置项
@param {notificationManager.NotificationContent} content 通知内容体
@param {notificationManager.NotificationTemplate} template 可选,通知模板(优先级高于options中的template)
@returns {notificationManager.NotificationRequest} 鸿蒙通知请求对象 | function makeRequest(
notificationId: number,
options: NotificationOptions,
content: notificationManager.NotificationContent,
template?: notificationManager.NotificationTemplate
): notificationManager.NotificationRequest {
// 初始化基础请求对象(必选字段:content)
const request: notificationMan... | AST#function_declaration#Left function makeRequest AST#parameter_list#Left ( AST#parameter#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left Notifi... | function makeRequest(
notificationId: number,
options: NotificationOptions,
content: notificationManager.NotificationContent,
template?: notificationManager.NotificationTemplate
): notificationManager.NotificationRequest {
const request: notificationManager.NotificationRequest =... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L211-L293 | b5d05b7bbbd023594353a36a868102c278f439d0 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.ets | arkts | Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | export default class PixelMapQueue {
private items: PixelMap[] = [];
constructor() {
this.items = [];
}
push(pm: PixelMap): void {
this.items.push(pm);
}
pop(): PixelMap | undefined {
return this.items.pop();
}
} | AST#export_declaration#Left export default AST#class_declaration#Left class PixelMapQueue AST#class_body#Left { AST#property_declaration#Left private items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PixelMap [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expres... | export default class PixelMapQueue {
private items: PixelMap[] = [];
constructor() {
this.items = [];
}
push(pm: PixelMap): void {
this.items.push(pm);
}
pop(): PixelMap | undefined {
return this.items.pop();
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.ets#L16-L30 | 780d06b90f5f6c5c31a923c7a5ea6c16563c7963 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/plan/plan.ets | arkts | getFormattedDate | 获取当前时间 返回YYYY-MM-DD | function getFormattedDate() {
const date = new Date()
const year = date.getFullYear() // 年(4位数字)
const month = date.getMonth() + 1 // 月(0-11,需+1)
const day = date.getDate() // 日(1-31)
// 补零处理,确保月份和日期为两位数
const formattedMonth = month.toString().padStart(2, '0')
const formattedDay = day.toString().padStar... | AST#function_declaration#Left function getFormattedDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new ... | function getFormattedDate() {
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const formattedMonth = month.toString().padStart(2, '0')
const formattedDay = day.toString().padStart(2, '0')
return `${year}-${formattedMonth}-${forma... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L114-L124 | 378f0ad4026527b42f4c431acca40ff2ab45b61b | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | startsWith | 检查字符串是否以给定的字符串卡头
@param string 要检索的字符串
@param target 要检索字符
@param position 检索的位置
@returns 如果字符串以字符串开头,那么返回 true,否则返回 false | static startsWith(string: string = '', target: string, position: number = 0): boolean {
return string.startsWith(target, position);
} | AST#method_declaration#Left static startsWith AST#parameter_list#Left ( AST#parameter#Left string : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#L... | static startsWith(string: string = '', target: string, position: number = 0): boolean {
return string.startsWith(target, position);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L205-L207 | 42877758d5587d2e1bcb7cf20ffe39333fedb29f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | onSubmitOrderClick | 提交订单点击事件
@returns {void} 无返回值 | onSubmitOrderClick(): void {
const addressId: number | undefined = this.data?.defaultAddress?.id;
if (!addressId) {
ToastUtils.showError($r("app.string.select_address"));
return;
}
const title: string = this.getPurchaseTitle();
const params: CreateOrderRequest = new CreateOrderRequest({... | AST#method_declaration#Left onSubmitOrderClick AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addres... | onSubmitOrderClick(): void {
const addressId: number | undefined = this.data?.defaultAddress?.id;
if (!addressId) {
ToastUtils.showError($r("app.string.select_address"));
return;
}
const title: string = this.getPurchaseTitle();
const params: CreateOrderRequest = new CreateOrderRequest({... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L286-L312 | 256c471faae623325180b41f1c66492c9f669218 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x4.ets | arkts | onWidgetClick | 整个组件点击事件 | private onWidgetClick(): void {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'openApp'
}
});
} | AST#method_declaration#Left private onWidgetClick AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left postCardAction ( AST#expression#Left this ... | private onWidgetClick(): void {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'openApp'
}
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L289-L297 | 0a67d07ad3b80c64f754edf0bb8726e5e34ab568 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CitySearch/casesfeature/citysearch/src/main/ets/view/SearchView.ets | arkts | SearchView | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct SearchView {
// List组件里可以绑定的可滚动组件的控制器
private scroller: Scroller = new Scroller();
// 搜索列表
@Link searchList: string[];
// 选定的城市
@Link changeValue: string;
build() {
Stack({ alignContent: Alignment.TopEnd }) {
List({ space: 14, initialIndex: 0, scroller: this.scroller })... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SearchView AST#component_body#Left { // List组件里可以绑定的可滚动组件的控制器 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right =... | @Component
export struct SearchView {
private scroller: Scroller = new Scroller();
@Link searchList: string[];
@Link changeValue: string;
build() {
Stack({ alignContent: Alignment.TopEnd }) {
List({ space: 14, initialIndex: 0, scroller: this.scroller }) {
ForEach(this.searchList, (it... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CitySearch/casesfeature/citysearch/src/main/ets/view/SearchView.ets#L16-L55 | b84311988e56104dc148b3f4a86c47440058660d | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_search_engines.ets | arkts | add_search_engine | Add a new search engine to the current search engine list.
@param se A search_engine object, the search engine to be added. | static add_search_engine(se: search_engine) {
bunch_of_search_engines.list_of_search_engines.push(se);
bunch_of_search_engines.update_last_accessed();
} | AST#method_declaration#Left static add_search_engine AST#parameter_list#Left ( AST#parameter#Left se : AST#type_annotation#Left AST#primary_type#Left search_engine AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Le... | static add_search_engine(se: search_engine) {
bunch_of_search_engines.list_of_search_engines.push(se);
bunch_of_search_engines.update_last_accessed();
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L39-L42 | cf750b55402b2edb32d766bd6b99f40da39b5a10 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerOption.ets | arkts | VideoTrimmerOption | 视频剪辑参数选项 | @Observed
export class VideoTrimmerOption {
constructor() {
this.scaleNum = 100;
this.videoMaxTime = 8;
this.videoMinTime = 3;
this.maxCountRange = 8;
this.thumbWidth = 30;
this.paddingLineHeight = 10;
}
// 源文件路径
@Track public srcFilePath: string = '';
// 视频剪辑回调接口
@Track public list... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class VideoTrimmerOption AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#... | @Observed
export class VideoTrimmerOption {
constructor() {
this.scaleNum = 100;
this.videoMaxTime = 8;
this.videoMinTime = 3;
this.maxCountRange = 8;
this.thumbWidth = 30;
this.paddingLineHeight = 10;
}
@Track public srcFilePath: string = '';
@Track public listener: VideoTrimList... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerOption.ets#L23-L69 | d8ea076ea25c239d4e7a0e7dd3676bad14f3ab1f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DownloadUtils.ets | arkts | requestEnableNotification | 申请通知权限 | static async requestEnableNotification() {
const isNotificationEnabled = NotificationUtils.isNotificationEnabledSync();
if (!isNotificationEnabled) {
NotificationUtils.requestEnableNotification();
}
} | AST#method_declaration#Left static async requestEnableNotification AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isNotificationEnabled = AST#expression#Left AST#call_expression#Left AST#expression#Left ... | static async requestEnableNotification() {
const isNotificationEnabled = NotificationUtils.isNotificationEnabledSync();
if (!isNotificationEnabled) {
NotificationUtils.requestEnableNotification();
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L104-L109 | 03629f6fd6b90fa18f50894f8b15ac089c23ac0f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/common/resource.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class P2PManager {
public resourceToString(resource: Resource): string {
return getContext(this).resourceManager.getStringSync(resource);
}
} | AST#export_declaration#Left export AST#class_declaration#Left class P2PManager AST#class_body#Left { AST#method_declaration#Left public resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#pa... | export class P2PManager {
public resourceToString(resource: Resource): string {
return getContext(this).resourceManager.getStringSync(resource);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/common/resource.ets#L16-L20 | 5b847e43407c4081000da16db799d4f519297876 | gitee | |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/configure/device.ets | arkts | updateAvoidArea | @throws | updateAvoidArea(refer: window.AvoidAreaOptions) {
if (this.orientation !== display.Orientation.PORTRAIT) {
return
}
if (refer.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) {
this.bottom = refer.area.bottomRect.height
}
if (refer.type === window.AvoidAreaType.TYPE_SYSTEM) {
... | AST#method_declaration#Left updateAvoidArea AST#parameter_list#Left ( AST#parameter#Left refer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . AvoidAreaOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#b... | updateAvoidArea(refer: window.AvoidAreaOptions) {
if (this.orientation !== display.Orientation.PORTRAIT) {
return
}
if (refer.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) {
this.bottom = refer.area.bottomRect.height
}
if (refer.type === window.AvoidAreaType.TYPE_SYSTEM) {
... | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/device.ets#L83-L95 | b83786d636a96111cdc15d0c9990439ce79b5cd6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/FavoritesService.ets | arkts | cleanupExpiredData | 清理过期数据 | async cleanupExpiredData(daysToKeep: number = 30): Promise<void> {
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - daysToKeep);
// 清理过期历史记录
const initialHistoryLength = this.generationHistory.length;
this.generationHistory = this.generationHistory.filter(h =>
new Date... | AST#method_declaration#Left async cleanupExpiredData AST#parameter_list#Left ( AST#parameter#Left daysToKeep : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an... | async cleanupExpiredData(daysToKeep: number = 30): Promise<void> {
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - daysToKeep);
const initialHistoryLength = this.generationHistory.length;
this.generationHistory = this.generationHistory.filter(h =>
new Date(h.createdA... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L454-L471 | ded86507a5a3e2d8a671d808c8b4fc107969aae9 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/libraryOverlay/src/main/ets/Index.ets | arkts | add | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { add } from "./utils/Calc" | AST#export_declaration#Left export { add } from "./utils/Calc" AST#export_declaration#Right | export { add } from "./utils/Calc" | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/libraryOverlay/src/main/ets/Index.ets#L16-L16 | b27400abe963e312ca0195ce13d9f40932b3e768 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets | arkts | registerDataChangeListener | 该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听 | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L39-L43 | 86af794033d0e7699fa06a156d484376eda0b211 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/NotificationUtils.ets | arkts | setDefaultConfig | 默认配置
设置通知的默认统一配置
@param configs | static setDefaultConfig(configs: (config: NotificationConfig) => void): void {
configs(NotificationUtils.defaultConfig);
} | AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Ri... | static setDefaultConfig(configs: (config: NotificationConfig) => void): void {
configs(NotificationUtils.defaultConfig);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L47-L49 | abcb430eb048211ac94c9996221151c4a980a3de | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/constants/AppConstants.ets | arkts | get | 动态颜色常量(基于当前主题) | static get PRIMARY_COLOR(): string {
return this.getCurrentTheme().colors.primaryColor;
} | AST#method_declaration#Left static get AST#ERROR#Left PRIMARY_COLOR AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return... | static get PRIMARY_COLOR(): string {
return this.getCurrentTheme().colors.primaryColor;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/constants/AppConstants.ets#L17-L19 | d2450299d7d1173011f5445074425ac4521b8b49 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DeviceUtils.ets | arkts | stopVibration | 停止振动(按照VIBRATOR_STOP_MODE_TIME模式),ohos.permission.VIBRATE | static stopVibration(): Promise<void> {
return vibrator.stopVibration(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME);
} | AST#method_declaration#Left static stopVibration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | static stopVibration(): Promise<void> {
return vibrator.stopVibration(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L262-L264 | adb44648cd259949803c0f1eaf24379b556ce2de | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | 如果UIAbility已在后台运行,在收到Router事件后会触发onNewWant生命周期回调 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
if (want.parameters!['ability.params.stream'] !== undefined) {
AppStorage.setOrCreate('imageUri', want.parameters!['ability.params.stream'].toString());
return;
}
if (want?.parameters?.params) {
// want.parameters.para... | AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
if (want.parameters!['ability.params.stream'] !== undefined) {
AppStorage.setOrCreate('imageUri', want.parameters!['ability.params.stream'].toString());
return;
}
if (want?.parameters?.params) {
let params: Reco... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryability/EntryAbility.ets#L38-L61 | 7f1e2657f73724e85db911f6cc2e16d67c50beb5 | gitee |
guojiabing/await-to-arkts.git | 0b1df61d34006b3d8ca020c89d859ffdc056f7c8 | library/src/main/ets/await-to-arkts.ets | arkts | @param { Promise } promise
@param { Object= } errorExt - Additional Information you can pass to the err object
@return { Promise } | export function to<T, U extends Error = Error>(
promise: Promise<T>,
errorExt?: object
): Promise<[U, undefined] | [null, T]> {
return promise
.then<[null, T]>((data: T) => [null, data])
.catch<[U, undefined]>((err: U) => {
if (errorExt) {
const parsedError = new Object() as U;
for ... | AST#export_declaration#Left export AST#function_declaration#Left function to AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left U extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right = AST#type_annotation#Left ... | export function to<T, U extends Error = Error>(
promise: Promise<T>,
errorExt?: object
): Promise<[U, undefined] | [null, T]> {
return promise
.then<[null, T]>((data: T) => [null, data])
.catch<[U, undefined]>((err: U) => {
if (errorExt) {
const parsedError = new Object() as U;
for ... | https://github.com/guojiabing/await-to-arkts.git/blob/0b1df61d34006b3d8ca020c89d859ffdc056f7c8/library/src/main/ets/await-to-arkts.ets#L6-L29 | a4148cd12c16e47ca1bb542b19a9220c6524f558 | github | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/search.ets | arkts | hotSearchItem | **************************************** 热搜榜 *********************************************// | @Builder
hotSearchItem(text: string, color: string) {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
// 热搜图标
Image('image/home/fire.png')
.width(24)
.height(24)
.margin({ right: 12 })
// 热搜文本
Text(text)
.fontSize(13)
.font... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right hotSearchItem AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left color : AST#type_annotation#Left ... | @Builder
hotSearchItem(text: string, color: string) {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Image('image/home/fire.png')
.width(24)
.height(24)
.margin({ right: 12 })
Text(text)
.fontSize(13)
.fontColor(color)
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L114-L134 | eeb27b2f5cc03d048f31ff4c9655f6ea28892ab7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onMirrorChange | Rotate and flip. | onMirrorChange(): void {
Logger.debug(TAG, 'onMirrorChange');
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
} else {
if (MathUtils.isOddRotation(this.rotationAngle)) {
this.isFlipVertically = !this.isFlipVertically;
} else {
t... | AST#method_declaration#Left onMirrorChange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | onMirrorChange(): void {
Logger.debug(TAG, 'onMirrorChange');
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
this.cropShow.enlargeCropArea();
} else {
if (MathUtils.isOddRotation(this.rotationAngle)) {
this.isFlipVertically = !this.isFlipVertically;
} else {
t... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L145-L159 | 3e092e6399a56cdfb9e51198f48da4736071a91f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildDialogBirthdays | 生日信息 | @Builder
buildDialogBirthdays() {
if (this.selectedDateDetail?.birthdays && this.selectedDateDetail.birthdays.length > 0) {
Column({ space: 8 }) {
Text('今日生日')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.alignSelf(ItemAlig... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDialogBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_exp... | @Builder
buildDialogBirthdays() {
if (this.selectedDateDetail?.birthdays && this.selectedDateDetail.birthdays.length > 0) {
Column({ space: 8 }) {
Text('今日生日')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.alignSelf(ItemAlig... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4608-L4660 | daa5a2aa2138f389586902802634ddd0e9d01566 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets | arkts | removeFile | 删除指定文件
@param filePath 文件完整路径 | static async removeFile(filePath: string): Promise<void> {
try {
const fileInfo = await fs.stat(filePath);
// 10. 正确调用异步方法[8](@ref)
if (fileInfo.isFile()) {
await fs.unlink(filePath);
console.info(`已删除临时文件: ${filePath}`);
}
} catch (err) {
console.error(`删除文件失败: ${e... | AST#method_declaration#Left static async removeFile AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | static async removeFile(filePath: string): Promise<void> {
try {
const fileInfo = await fs.stat(filePath);
if (fileInfo.isFile()) {
await fs.unlink(filePath);
console.info(`已删除临时文件: ${filePath}`);
}
} catch (err) {
console.error(`删除文件失败: ${err}`);
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L94-L105 | e9d50e07de748c3b9f48689db3c52b81c78ca368 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | toSetting | 跳转系统设置页面(配合WantUtil里的URI常量一起使用,可跳转更多的设置页面)
@param uri: 传入WantUtil的URI常量,不传默认为设置页面
@param parameters: WantParams参数
@returns | static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': ArkWebHelper.getContext().abilityInfo.bundleName }): Promise<void> {
const want: Want = {
bundleName: 'com.huawei.hmos.settings', //设置应用bundleName
abilityName: 'com.huawei.hmos.settings.MainAbility', //设置应用abilityN... | AST#method_declaration#Left static async toSetting AST#parameter_list#Left ( AST#parameter#Left uri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left parameters : AST#type_annotation#Left AST#primary_type#Left AST#generic_... | static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': ArkWebHelper.getContext().abilityInfo.bundleName }): Promise<void> {
const want: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: uri,
parame... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L88-L96 | 08eff1447a812b42cc78c7712eb2f82841b93a06 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets | arkts | getRandomIndex | 你给我一个数组。我给你从数组中 随机返回一个该数组的索引 | getRandomIndex<T>(array: T[]): number {
if (array.length === 0) {
throw new Error("数组不能为空");
}
return Math.floor(Math.random() * array.length);
} | AST#method_declaration#Left getRandomIndex AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right A... | getRandomIndex<T>(array: T[]): number {
if (array.length === 0) {
throw new Error("数组不能为空");
}
return Math.floor(Math.random() * array.length);
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L12-L17 | be1ed79e376af2362d3a9c46429cc6ee34328faf | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets | arkts | startVibrate | 触发手机振动效果 | startVibrate() {
try {
// TODO: 知识点:vibrator.startVibration 根据指定振动效果和振动属性触发马达振动
vibrator.startVibration({
type: 'time',
// 持续触发马达振动时间600ms
duration: CONFIGURATION.VIBRATION_TIME,
}, {
id: 0,
usage: 'alarm',
}, (error: BusinessError) => {
if (er... | AST#method_declaration#Left startVibrate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // TODO: 知识点:vibrator.startVibration 根据指定振动效果和振动属性触发马达振动 AST#statement#Left AST#expression_statement#Left AST#expression#Left ... | startVibrate() {
try {
vibrator.startVibration({
type: 'time',
duration: CONFIGURATION.VIBRATION_TIME,
}, {
id: 0,
usage: 'alarm',
}, (error: BusinessError) => {
if (error) {
logger.error(`Failed to start vibration. Code: ${error.co... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets#L48-L67 | 9564cc1e989720382c673f770f10d83537c0ddeb | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets | arkts | 应用约束48:显式声明构造函数参数类型 | constructor(player: Object) {
super(player);
// 应用约束7:使用private代替#私有字段
// 应用约束18:移除构造函数参数中的字段声明
// 应用约束30:使用as进行类型转换
this.encoder = new (opus as any).OpusEncoder(this.samplingRate, this.channels);
super.init();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left player : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#... | constructor(player: Object) {
super(player);
this.encoder = new (opus as any).OpusEncoder(this.samplingRate, this.channels);
super.init();
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/NodeOpusEngine.ets#L11-L18 | f6621540d1dcb9950708c39e039d1f6c76e247dd | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets | arkts | GoodsListItem | 商品列表项 | @Builder
GoodsListItem(goods: Goods) {
Row({ space: AppDimensions.spaceMedium }) {
Image(goods.mainPic)
.width(100)
.height(100)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
Column({ space: AppDimensions.spaceSmall }) {
Text(goods.name)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right GoodsListItem AST#parameter_list#Left ( AST#parameter#Left goods : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder
GoodsListItem(goods: Goods) {
Row({ space: AppDimensions.spaceMedium }) {
Image(goods.mainPic)
.width(100)
.height(100)
.borderRadius(AppDimensions.radiusSmall)
.objectFit(ImageFit.Cover)
Column({ space: AppDimensions.spaceSmall }) {
Text(goods.name)
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L295-L338 | 5008120c14577054f5a6f144d40546a87f32585e | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Rect.ets | arkts | offsetTo | Offset the rectangle to a specific (left, top) position,
keeping its width and height the same.
@param newLeft The new "left" coordinate for the rectangle
@param newTop The new "top" coordinate for the rectangle | public offsetTo(newLeft: number, newTop: number) {
this.right += newLeft - this.left;
this.bottom += newTop - this.top;
this.left = newLeft;
this.top = newTop;
} | AST#method_declaration#Left public offsetTo AST#parameter_list#Left ( AST#parameter#Left newLeft : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newTop : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | public offsetTo(newLeft: number, newTop: number) {
this.right += newLeft - this.left;
this.bottom += newTop - this.top;
this.left = newLeft;
this.top = newTop;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L183-L188 | 480f749d38f365b4483c2f4ad5c34105670d5438 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets | arkts | pushData | 在数据尾部增加一个元素 | public pushData(data: FileItem): void {
this.fileList.push(data);
this.notifyDataAdd(this.fileList.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left FileItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | public pushData(data: FileItem): void {
this.fileList.push(data);
this.notifyDataAdd(this.fileList.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets#L48-L51 | 4b180d9d33f35795cbecffc41ec669273e79a5c3 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Default fontSize_Icon_Button for HarmonyOS Symbols.
Usually used on buttons, like linysSymbol.
@returns 25 | export function fontSize_Icon_Button() {
return 25;
} | AST#export_declaration#Left export AST#function_declaration#Left function fontSize_Icon_Button AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 25 AST#expression#Right ; AST#return_statement#Right AST#statement#Right ... | export function fontSize_Icon_Button() {
return 25;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L41-L43 | 66d7c275f7757e0417ae096b10e923373e01d160 | gitee | |
Puiching-Memory/HOMOAPP_Q5.git | 53e36a21984de7bf41b6fafc840fde013236b9d2 | entry/src/main/ets/components/AudioCard.ets | arkts | getButtonIcon | 获取按钮图标 | private getButtonIcon(): Resource {
switch (this.state) {
case PlaybackState.PLAYING:
return $r('sys.symbol.pause_fill');
case PlaybackState.LOADING:
return $r('sys.symbol.arrow_clockwise');
default:
return $r('sys.symbol.play_fill');
}
} | AST#method_declaration#Left private getButtonIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component... | private getButtonIcon(): Resource {
switch (this.state) {
case PlaybackState.PLAYING:
return $r('sys.symbol.pause_fill');
case PlaybackState.LOADING:
return $r('sys.symbol.arrow_clockwise');
default:
return $r('sys.symbol.play_fill');
}
} | https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/AudioCard.ets#L36-L45 | 10cb709a029a6bacc2a5fb10aa8b76b485731e59 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | calcMinMax | @Override | protected calcMinMax(): void {
if (!this.mData) {
return;
}
if (this.mXAxis) {
if (this.mFitBars) {
this.mXAxis.calculate(this.mData.getXMin() - this.mData.getBarWidth() / 2, this.mData.getXMax() + this.mData.getBarWidth() / 2);
} else {
this.mXAxis.calculate(this.mData.get... | AST#method_declaration#Left protected calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#... | protected calcMinMax(): void {
if (!this.mData) {
return;
}
if (this.mXAxis) {
if (this.mFitBars) {
this.mXAxis.calculate(this.mData.getXMin() - this.mData.getBarWidth() / 2, this.mData.getXMax() + this.mData.getBarWidth() / 2);
} else {
this.mXAxis.calculate(this.mData.get... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L93-L111 | 05ee9718f164b256f6b8197cfc5b4c71b9fca3f1 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets | arkts | Used to control and feedback the behavior of nodes on the corresponding NodeContainer, which needs to be used together with NodeContainer | export class MyNodeController extends NodeController {
private rootNode: BuilderNode<Data[]> | null = null;
private root: FrameNode | null = null;
private rootWebviewController: webview.WebviewController | null = null;
// The method that must be overridden is used to build the number of nodes and return the no... | AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left ... | export class MyNodeController extends NodeController {
private rootNode: BuilderNode<Data[]> | null = null;
private root: FrameNode | null = null;
private rootWebviewController: webview.WebviewController | null = null;
makeNode(uiContext: UIContext): FrameNode | null {
console.info(' uicontext is und... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L34-L103 | f9ef8c0426e84bec7929aa6bad1d9fc9d55b5084 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PickerUtil.ets | arkts | saveAudio | 通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。
@param newFileNames 拉起audioPicker进行保存音频资源的文件名,若无此参数,则默认需要用户自行输入。
@returns 返回保存文件的uri数组。 | static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
const audioPicker = new picker.AudioViewPicker(getContext());
const audioSaveOptions = new picker.AudioSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
audioSaveOptions.newFileNames = newFileNames... | AST#method_declaration#Left static async saveAudio AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A... | static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
const audioPicker = new picker.AudioViewPicker(getContext());
const audioSaveOptions = new picker.AudioSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
audioSaveOptions.newFileNames = newFileNames... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L169-L176 | 0f16a952718055190f0c5e5587f877c8f26bac02 | gitee |
jerryzhou2/ArkTS-news-app.git | 6dfa8631948f1def4269be5a48554b99ee64a18d | fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets | arkts | notifyDataDelete | Notify the LazyForEach component that the subcomponent needs to be deleted from the index corresponding to the index. | notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | AST#method_declaration#Left notifyDataDelete AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets#L81-L85 | da0d59cca48d7d7189130f59bcfd382762308250 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setValueFormatter | Sets the formatter to be used for formatting the axis labels. If no formatter is set, the
chart will
automatically determine a reasonable formatting (concerning decimals) for all the values
that are drawn inside
the chart. Use chart.getDefaultValueFormatter() to use the formatter calculated by the chart.
@param f | public setValueFormatter(f: IAxisValueFormatter): void {
if (!f || f == null)
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
else
this.mAxisValueFormatter = f;
} | AST#method_declaration#Left public setValueFormatter AST#parameter_list#Left ( AST#parameter#Left f : AST#type_annotation#Left AST#primary_type#Left IAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void A... | public setValueFormatter(f: IAxisValueFormatter): void {
if (!f || f == null)
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
else
this.mAxisValueFormatter = f;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L553-L559 | 1b2ee147f29c8d28653c25bc8bfe81da7442507c | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/components/VideoView.ets | arkts | onTimeUpdate | Timeline middle line change (when user is dragging).
This method is the key place to keep the player and the time bar in sync.
It also includes the fix for 'jumping back to the start at the absolute end'.
@param _changedPropertyName State property name (unused). | onTimeUpdate(_changedPropertyName: string) {
if (!this.controller) {
return;
}
if (!this.videosInfo || (this.videosInfo && this.videosInfo.length === 0)) {
return;
}
// Respond only when the time bar is actively dragged by the user
if (PlayStatus.PLAYING !== this.timeBarStatus) {
... | AST#method_declaration#Left onTimeUpdate AST#parameter_list#Left ( AST#parameter#Left _changedPropertyName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statemen... | onTimeUpdate(_changedPropertyName: string) {
if (!this.controller) {
return;
}
if (!this.videosInfo || (this.videosInfo && this.videosInfo.length === 0)) {
return;
}
if (PlayStatus.PLAYING !== this.timeBarStatus) {
return;
}
const now = Date.now();
this.suppr... | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/components/VideoView.ets#L238-L315 | bf936a1ed2513c8f09d914f8ba6c5e2ce907c8ac | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/todo/TodoEditPage.ets | arkts | aboutToAppear | 页面生命周期 - 即将出现 | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TodoEditPage aboutToAppear');
// 获取路由参数
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
if (paramsRecord.id) {
// 编辑模式
this.editMode = true;
th... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST... | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TodoEditPage aboutToAppear');
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
if (paramsRecord.id) {
this.editMode = true;
this.todoId = para... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L58-L77 | 84e381447119e4165205911ea739a6be0410bf23 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Camera/CameraPreviewFormat.ets | arkts | dealWithResolutionFn | 对分辨率数据处理 获取到需要的格式 | dealWithResolutionFn(arr: ResolutionItem[]) {
let newResolution : Obj[]= []
arr.forEach((item) => {
let indexOf = item.value.indexOf("x")
if (indexOf !== -1) {
let objW = Number(item.value.slice(0, indexOf))
let objH = Number(item.value.slice(indexOf + 1))
let obj: Obj = {
... | AST#method_declaration#Left dealWithResolutionFn AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResolutionItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | dealWithResolutionFn(arr: ResolutionItem[]) {
let newResolution : Obj[]= []
arr.forEach((item) => {
let indexOf = item.value.indexOf("x")
if (indexOf !== -1) {
let objW = Number(item.value.slice(0, indexOf))
let objH = Number(item.value.slice(indexOf + 1))
let obj: Obj = {
... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Camera/CameraPreviewFormat.ets#L132-L150 | 4b27a7dd09382bc79fb06a76599e028b37582ca7 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets | arkts | Emitted whenever a member is banned from a guild.
@event Client#guildBanAdd
@param {Guild} guild The guild that the ban occurred in
@param {User} user The user that was banned
应用约束60: 使用export代替module.exports | export default GuildBanAddHandler; | AST#export_declaration#Left export default AST#expression#Left GuildBanAddHandler AST#expression#Right ; AST#export_declaration#Right | export default GuildBanAddHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets#L28-L28 | 3d80c6092fce662b87fc42fe39aea98d564c775a | github | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/TaskConfig.ets | arkts | isUseHardwareDecoder | ==================== Getters ==================== | public isUseHardwareDecoder(): boolean {
return this.useHardwareDecoder;
} | AST#method_declaration#Left public isUseHardwareDecoder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#me... | public isUseHardwareDecoder(): boolean {
return this.useHardwareDecoder;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskConfig.ets#L31-L33 | cc531412edecb45ea09590284ab135e64822bea3 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | onDraw | @Override | public onDraw(canvas: CanvasRenderingContext2D): void {
super.onDraw(canvas);
if (this.mData == null)
return;
this.mRenderer?.drawData(canvas);
if (this.valuesToHighlight() && this.mIndicesToHighlight) {
this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight);
}
this.mRe... | AST#method_declaration#Left public onDraw AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS... | public onDraw(canvas: CanvasRenderingContext2D): void {
super.onDraw(canvas);
if (this.mData == null)
return;
this.mRenderer?.drawData(canvas);
if (this.valuesToHighlight() && this.mIndicesToHighlight) {
this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight);
}
this.mRe... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L134-L154 | 3930d36f553a3b63f3165544cdfc65e66fa5b486 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | getHttpErrorMessage | 获取HTTP错误信息 | private getHttpErrorMessage(code: number): string {
switch (code) {
case 400:
return '请求参数错误';
case 401:
return 'API密钥无效或已过期';
case 403:
return '访问被拒绝,请检查权限';
case 404:
return 'API地址不存在';
case 429:
return '请求频率过高,已被限流';
case 500:
re... | AST#method_declaration#Left private getHttpErrorMessage AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | private getHttpErrorMessage(code: number): string {
switch (code) {
case 400:
return '请求参数错误';
case 401:
return 'API密钥无效或已过期';
case 403:
return '访问被拒绝,请检查权限';
case 404:
return 'API地址不存在';
case 429:
return '请求频率过高,已被限流';
case 500:
re... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L682-L705 | 5976df75699e71a22620c64e518eb108851701c3 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | staticClear | Called when a cleanup occurs.
@since 7
@deprecated since 9
@useinstead AppStorage.Clear | static staticClear(): boolean {
return AppStorage.clear()
} | AST#method_declaration#Left static staticClear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expres... | static staticClear(): boolean {
return AppStorage.clear()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L214-L216 | a4d031068f62cea47131e9cebcecf68c86ca1319 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets | arkts | ListItemGroupView | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ListItemGroupView {
@Link _offset: Position;
private componentKey: string;
private parentWidth: number;
private parentHeight: number;
private subassemblyWidth: number;
private subassemblyHeight: number;
private parentComponentKey: string;
private referenceComponentKey: string;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _offset : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type... | @Component
export struct ListItemGroupView {
@Link _offset: Position;
private componentKey: string;
private parentWidth: number;
private parentHeight: number;
private subassemblyWidth: number;
private subassemblyHeight: number;
private parentComponentKey: string;
private referenceComponentKey: string;
... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets#L16-L85 | 92c9ce9a044949fcab4759bcb1f6d9b33f12b641 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | updateSensorData | Update Steps. | updateSensorData() {
// Get today's steps.
DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object | undefined) => {
if (!rdbStore) {
Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'update sensor data rdbStore is null');
return;
}
let getSensorData: Promise<Sens... | AST#method_declaration#Left updateSensorData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // Get today's steps. AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left ... | updateSensorData() {
DatabaseUtils.createRdbStore(this.context).then((rdbStore: Object | undefined) => {
if (!rdbStore) {
Logger.error(CommonConstants.ENTRY_FORM_ABILITY_TAG, 'update sensor data rdbStore is null');
return;
}
let getSensorData: Promise<SensorData> =
Datab... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/entryformability/EntryFormAbility.ets#L96-L117 | e0961cea454b1958537dd11a25b29981181ff0df | gitee |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/学习/30.泛型.ets | arkts | fn | 泛型: 类型可以作为参数传递,类型是可变的 | function fn<T>(param: T): T {
return param
} | AST#function_declaration#Left function fn AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right )... | function fn<T>(param: T): T {
return param
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/30.泛型.ets#L4-L6 | 647ec155c78e089809393b86a1c5286fca8e1e75 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/CloudDBService.ets | arkts | 模拟云数据库配置接口 | export interface CloudDBZoneConfig {
// 模拟云数据库配置接口
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CloudDBZoneConfig AST#object_type#Left { // 模拟云数据库配置接口 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface CloudDBZoneConfig {
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L13-L15 | 95c32794feb60fd50949954670c8d4d1ef356f78 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets | arkts | Text统一样式类 | export class TextModifier implements AttributeModifier<TextAttribute> {
private publicFontSize: number | string | Resource = TextConstants.TEXT_FONT_SIZE;
private publicLineHeight: number | string | Resource = TextConstants.TEXT_LINE_HEIGHT;
applyNormalAttribute(instance: TextAttribute): void {
instance.font... | AST#export_declaration#Left export AST#class_declaration#Left class TextModifier AST#implements_clause#Left implements AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TextAttribute AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Righ... | export class TextModifier implements AttributeModifier<TextAttribute> {
private publicFontSize: number | string | Resource = TextConstants.TEXT_FONT_SIZE;
private publicLineHeight: number | string | Resource = TextConstants.TEXT_LINE_HEIGHT;
applyNormalAttribute(instance: TextAttribute): void {
instance.font... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ComponetModifier.ets#L44-L62 | feeec452b7e5668a0a51ed453b761124823a1172 | github | |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/common/util/GameUtils.ets | arkts | shuffle | 打乱函数
@param array 分割后的子图数组
@param cols 分割的列数 | public static shuffle(array: Array<CroppedImage>, cols: number): void {
// 获取空白图块的索引
let blankIndex = this.getBlankIndex(array);
// 定义移动方向,包括左、右、上、下
const n = array.length, direction = [-1, 1, -cols, cols];
// 循环 n*n 次,打乱图块的位置
for (let i = 0; i < n * n; i++) {
let nextBlankIndex;
// ... | AST#method_declaration#Left public static shuffle AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CroppedImage AST#primary_type#Right AST#type_annotation#Right > AST#t... | public static shuffle(array: Array<CroppedImage>, cols: number): void {
let blankIndex = this.getBlankIndex(array);
const n = array.length, direction = [-1, 1, -cols, cols];
for (let i = 0; i < n * n; i++) {
let nextBlankIndex;
do {
nextBlankIndex = blankIndex + dir... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/GameUtils.ets#L14-L30 | df28fe781d526a87e209b51a1dea928952ba2bfa | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.