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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets | arkts | 可理解的字符串转成字节流 | export function stringToUint8Array(str: string): Uint8Array {
console.info('字符串转成字节流:' + new Uint8Array(buffer.from(str, 'utf-8').buffer));
return new Uint8Array(buffer.from(str, 'utf-8').buffer);
} | AST#export_declaration#Left export AST#function_declaration#Left function stringToUint8Array 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_list#Right : AST#type_annotation#Left... | export function stringToUint8Array(str: string): Uint8Array {
console.info('字符串转成字节流:' + new Uint8Array(buffer.from(str, 'utf-8').buffer));
return new Uint8Array(buffer.from(str, 'utf-8').buffer);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets#L75-L78 | c2c3c3eeab0d2d5a159c2477a9a2169251715418 | gitee | |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets | arkts | set | 设置属性监听器,用于接收平台下发的属性读写。
此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理
@param propertyListener 属性监听器 | public set propertyListener(value: PropertyListener | null) {
this._propertyListener = value;
} | AST#method_declaration#Left public set AST#ERROR#Left property List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PropertyListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Righ... | public set propertyListener(value: PropertyListener | null) {
this._propertyListener = value;
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets#L77-L79 | 08e6fdc6e5f0f59744576d2e895b5c75b01b9c5a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/Touch/TouchEvent.ets | arkts | Touch | [Start touch_event_handle] | @Entry
@Component
export struct Touch {
@State text: string = '';
@State eventType: string = '';
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('Touch').height(40).width(100)
.onTouch((event?: TouchEvent) => {
if (event) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Touch AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left string ... | @Entry
@Component
export struct Touch {
@State text: string = '';
@State eventType: string = '';
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('Touch').height(40).width(100)
.onTouch((event?: TouchEvent) => {
if (event) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/Touch/TouchEvent.ets#L17-L74 | f2e399eecac090b3e253b1449939982e8dc8a93d | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | resetCircleColors | public getCircleColor(): number { return this.mCircleColor; }
resets the circle-colors array and creates a new one | public resetCircleColors(): void {
if (this.mCircleColors == null) {
this.mCircleColors = new JArrayList<Number>();
}
this.mCircleColors.clear();
} | AST#method_declaration#Left public resetCircleColors 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST... | public resetCircleColors(): void {
if (this.mCircleColors == null) {
this.mCircleColors = new JArrayList<Number>();
}
this.mCircleColors.clear();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L320-L325 | 23080a85c60c68504f9e1a451913d05445ba309b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/social/PostDetailPage.ets | arkts | buildContent | 构建内容 | @Builder
buildContent() {
if (!this.post) return;
Column() {
Refresh({ refreshing: this.refreshing }) {
Scroll() {
Column({ space: 0 }) {
// 帖子内容
this.buildPostContent(this.post)
// 评论区域
this.buildCommentsSection()
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent 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 AST#unary_expression#Left ! AST#expre... | @Builder
buildContent() {
if (!this.post) return;
Column() {
Refresh({ refreshing: this.refreshing }) {
Scroll() {
Column({ space: 0 }) {
this.buildPostContent(this.post)
this.buildCommentsSection()
}
.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/PostDetailPage.ets#L125-L140 | 7803f44cd44652d5459fed2309c188b199675553 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/dialog/src/main/ets/tips/TipsDialogManager.ets | arkts | showProgress | 进度提示 弹窗
@param params | static showProgress(msg: string | Resource = '', progress: number): string {
let dialogVo: TipsDialogParams = new TipsDialogParams(TipsType.PROGRESS, msg)
dialogVo.dialogId = TIPS_PROGRESS_DIALOG_ID
dialogVo.progress = progress
if (msg.toString().length > 0) {
dialogVo.msg = msg
} | AST#method_declaration#Left static showProgress AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left... | static showProgress(msg: string | Resource = '', progress: number): string {
let dialogVo: TipsDialogParams = new TipsDialogParams(TipsType.PROGRESS, msg)
dialogVo.dialogId = TIPS_PROGRESS_DIALOG_ID
dialogVo.progress = progress
if (msg.toString().length > 0) {
dialogVo.msg = msg
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/dialog/src/main/ets/tips/TipsDialogManager.ets#L51-L57 | aacae2804658999a3a0ed3cff7341466ce4de5ce | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export class CommonConstants {
/**
* Full percent.
*/
static readonly FULL_PERCENT: string = '100%';
/**
* Ninety percent.
*/
static readonly NINETY_PERCENT: string = '90%';
/**
* Fifty percent.
*/
static readonly FIFTY_PERCENT: string = '50%';
/**
* Playback page path.
*/
sta... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Full percent.
*/ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left... | export class CommonConstants {
static readonly FULL_PERCENT: string = '100%';
static readonly NINETY_PERCENT: string = '90%';
static readonly FIFTY_PERCENT: string = '50%';
static readonly PAGE: string = 'pages/PlayPage';
static readonly TYPE_LOCAL: number = 0;
static readonly TYPE_IN... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L6-L107 | a4cf037666e2dec51c742facc0623e46f2e742e3 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | tipsDialog | 提示弹出框 | tipsDialog(index: number) {
if (index == 0) {
//简单使用
DialogHelper.showTipsDialog({
uiContext:this.getUIContext(),
content: '想要卸载这个APP嘛?',
showInSubWindow:false,
onAction: (action) => {
ToastUtil.showToast(`${action}`);
}
})
} else if (index == ... | AST#method_declaration#Left tipsDialog 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#... | tipsDialog(index: number) {
if (index == 0) {
DialogHelper.showTipsDialog({
uiContext:this.getUIContext(),
content: '想要卸载这个APP嘛?',
showInSubWindow:false,
onAction: (action) => {
ToastUtil.showToast(`${action}`);
}
})
} else if (index == 1) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L322-L376 | 6c00edd57159240734cd2cc767d50fb89baad29f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/ReceiveCouponRequest.ets | arkts | @param {ReceiveCouponRequest} init - 初始化数据 | constructor(init: ReceiveCouponRequest) {
this.couponId = init.couponId;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left ReceiveCouponRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expressio... | constructor(init: ReceiveCouponRequest) {
this.couponId = init.couponId;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/ReceiveCouponRequest.ets#L14-L16 | 1b69921ce3cfed29af10e1e257c10893553cd14f | github | |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/pages/Index.ets | arkts | EditButton | 编辑按钮 | @Builder
EditButton(entry: CommandEntryViewModel) {
Row() {
Button() {
Image($r("app.media.square_and_pencil"))
.objectFit(ImageFit.Cover)
.width(StyleConstants.SIXTY_PERCENT)
.height(StyleConstants.SIXTY_PERCENT)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right EditButton AST#parameter_list#Left ( AST#parameter#Left entry : AST#type_annotation#Left AST#primary_type#Left CommandEntryViewModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu... | @Builder
EditButton(entry: CommandEntryViewModel) {
Row() {
Button() {
Image($r("app.media.square_and_pencil"))
.objectFit(ImageFit.Cover)
.width(StyleConstants.SIXTY_PERCENT)
.height(StyleConstants.SIXTY_PERCENT)
... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L245-L272 | 54cd589c9f8876a2c3a839f78fa42a64f6fb9559 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getLanguage | 获取应用的语言
@returns | static getLanguage(): string | undefined {
return AppUtil.getConfiguration().language;
} | AST#method_declaration#Left static getLanguage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_stateme... | static getLanguage(): string | undefined {
return AppUtil.getConfiguration().language;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L193-L195 | e28cb30c0b2e36300c52e66d6eedb439fccef856 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | $_instantiate | Set the value.
@param { function } factory
@param { RotationGestureHandlerOptions } value
@returns { RotationGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | static $_instantiate(factory: () => RotationGesture, value?: RotationGestureHandlerOptions): RotationGesture; | AST#method_declaration#Left static $_instantiate AST#parameter_list#Left ( AST#parameter#Left factory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left RotationGesture AST#primary_type#Right AST#type_annotation#Right ... | static $_instantiate(factory: () => RotationGesture, value?: RotationGestureHandlerOptions): RotationGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L665-L665 | cf0e879d1f12de8417fc24685461bec5599f86e0 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/icon/ArrowLeftIcon.ets | arkts | ArrowLeftIcon | @file 左箭头图标组件
@author Joker.X | @ComponentV2
export struct ArrowLeftIcon {
/**
* 图标大小(单位:vp)
*/
@Param
iconSize: number = 28;
/**
* 图标颜色
*/
@Param
tintColor: ResourceColor = $r("app.color.text_primary");
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建左箭头图标
* @returns {void} 无返回值
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ArrowLeftIcon AST#component_body#Left { /**
* 图标大小(单位:vp)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconSize : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | @ComponentV2
export struct ArrowLeftIcon {
@Param
iconSize: number = 28;
@Param
tintColor: ResourceColor = $r("app.color.text_primary");
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
CommonIcon({
icon: $r("app.media.ic_left"),
iconSize: this.iconSize,
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/ArrowLeftIcon.ets#L7-L37 | ad5cacf12aa0d27da4300b7ddc379eb85f3cb08f | github |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/model/CommandEntryList.ets | arkts | updateCommandEntry | 更新成功返回更新 entry 对应的所有 formID 只有更新失败返回布尔值 | async updateCommandEntry(commandEntry: CommandEntry): Promise<boolean | string[]> {
try {
const result = await this.db.updateCommandEntry(commandEntry);
Logger.debug(this.LOG_TAG, `命令更新成功, ${result}`);
let updatedFormIDs: string[] = [];
// 如果条目更改为需要自定义输入,则取消绑定所有... | AST#method_declaration#Left async updateCommandEntry AST#parameter_list#Left ( AST#parameter#Left commandEntry : AST#type_annotation#Left AST#primary_type#Left CommandEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | async updateCommandEntry(commandEntry: CommandEntry): Promise<boolean | string[]> {
try {
const result = await this.db.updateCommandEntry(commandEntry);
Logger.debug(this.LOG_TAG, `命令更新成功, ${result}`);
let updatedFormIDs: string[] = [];
if(commandEn... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/model/CommandEntryList.ets#L49-L68 | d28906e09bf857ccf07138535400b59f80c641c5 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildLoadingView | 构建加载视图 | @Builder
buildLoadingView() {
PageLoadingView({ message: '保存配置中...' })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLoadingView 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 PageLoadingView ( AST#component_parameters#Left { AST#com... | @Builder
buildLoadingView() {
PageLoadingView({ message: '保存配置中...' })
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L568-L571 | be16961112649b9258960df64a7e5c5e13f13b40 | github |
de8gemaker/AccountApp.git | b5156cd90ac02239b39fd0f91d32851acad8ba42 | entry/src/main/ets/models/account/account.ets | arkts | 数据库映射字段 | export enum ColumnType {
LONG,
DOUBLE,
STRING,
BLOB,
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ColumnType AST#enum_body#Left { AST#enum_member#Left LONG AST#enum_member#Right , AST#enum_member#Left DOUBLE AST#enum_member#Right , AST#enum_member#Left STRING AST#enum_member#Right , AST#enum_member#Left BLOB AST#enum_member#Right , } AST#enum_body#Ri... | export enum ColumnType {
LONG,
DOUBLE,
STRING,
BLOB,
} | https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/models/account/account.ets#L44-L49 | 0abb27768a4f6be86463df3f948c3b06c2500812 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/model/AnimationAttribute.ets | arkts | 动效属性 | export class AnimationAttribute {
// 标准标题栏高度
private normalTitleHeightVar: number;
// 扩展标题栏高度
private expandTitleHeightVar: number;
// 扩展后标题继续下拉阈值
private continuePullThresholdVar: number;
// 标题放缩系数
private titleScaleVar: number;
// 动画持续时间
private animationDurationVar: number;
constructor(normalT... | AST#export_declaration#Left export AST#class_declaration#Left class AnimationAttribute AST#class_body#Left { // 标准标题栏高度 AST#property_declaration#Left private normalTitleHeightVar : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // ... | export class AnimationAttribute {
private normalTitleHeightVar: number;
private expandTitleHeightVar: number;
private continuePullThresholdVar: number;
private titleScaleVar: number;
private animationDurationVar: number;
constructor(normalTitleHeight: number, expandTitleHeight: number, conti... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/model/AnimationAttribute.ets#L20-L60 | 60604a51a063d4d8fcea8e35f0e7f548ea55615a | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/SettingsService.ets | arkts | 设置服务 | export class SettingsService {
private static instance: SettingsService;
private preferences: preferences.Preferences | null = null;
private settings: AppSettings = new AppSettings();
private context: Context | null = null;
private constructor() {}
static getInstance(): SettingsService {
if (!Settings... | AST#export_declaration#Left export AST#class_declaration#Left class SettingsService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left SettingsService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_... | export class SettingsService {
private static instance: SettingsService;
private preferences: preferences.Preferences | null = null;
private settings: AppSettings = new AppSettings();
private context: Context | null = null;
private constructor() {}
static getInstance(): SettingsService {
if (!Settings... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L9-L145 | 08bcd9e35fac1b6c39c517472e6344322106f96b | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getNowDay | 获取当前日 | static getNowDay(): number {
let date = new Date();
return date.getDate();
} | AST#method_declaration#Left static getNowDay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left date = A... | static getNowDay(): number {
let date = new Date();
return date.getDate();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L133-L136 | 5c7f3892d38e97f0d92bfa9eac8b304b47def694 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets | arkts | drawData | Draws the actual data in form of lines, bars, ... depending on Renderer subclass.
@param c | public abstract drawData(): Paint[]; | AST#method_declaration#Left public abstract drawData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Paint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | public abstract drawData(): Paint[]; | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L141-L141 | e3de70c949ad721456a7fd16c689bf5fa4cd0533 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/MapModel.ets | arkts | Initializing Map Data. | export class MapModel {
private data?: AddressItem;
private addressArray: Array<AddressItem> = new Array(Const.MAP_LANDMARKS_LENGTH).fill(undefined);
/**
* Obtains landmark objects on the map based on the longitude and latitude.
*
* @param geoCoordinates Longitude and latitude.
* @param type Landmark... | AST#export_declaration#Left export AST#class_declaration#Left class MapModel AST#class_body#Left { AST#property_declaration#Left private data ? : AST#type_annotation#Left AST#primary_type#Left AddressItem AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left pri... | export class MapModel {
private data?: AddressItem;
private addressArray: Array<AddressItem> = new Array(Const.MAP_LANDMARKS_LENGTH).fill(undefined);
calCoordinateByLonAndLat(geoCoordinates: Array<GeoCoordinates>, type: number,
mapWidth: number, mapHeight: number): AddressItem {
... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/MapModel.ets#L25-L47 | 956de9752c0a8a1de284f2cc8cf846383d693cc0 | github | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/components/ChatInputView.ets | arkts | doSendMessage | 发送消息实现方法 | doSendMessage() {
if(this.messageInput.length > 0 && this.receiverInput.length > 0) {
if(this.receiverInput === ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId) {
ToolKits.showToast('不能给自已发送消息哦!');
return;
}
// 先生成指纹码
let fingerPring: string = Protocal.genFingerPri... | AST#method_declaration#Left doSendMessage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | doSendMessage() {
if(this.messageInput.length > 0 && this.receiverInput.length > 0) {
if(this.receiverInput === ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId) {
ToolKits.showToast('不能给自已发送消息哦!');
return;
}
let fingerPring: string = Protocal.genFingerPrint();
... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/components/ChatInputView.ets#L31-L58 | 8bd84d8f95a4ec0b5d0db59c81a2ae812cdcf89f | github |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/common/utils/AssetUtils.ets | arkts | / AssetStore query 操作结果 | export interface AssetStoreQueryResult {
res?: asset.AssetMap[];
error?: BusinessError;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AssetStoreQueryResult AST#object_type#Left { AST#type_member#Left res ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left asset AST#ERROR#Left . AssetMap AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#typ... | export interface AssetStoreQueryResult {
res?: asset.AssetMap[];
error?: BusinessError;
} | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L14-L17 | e1459b5e7670a849adfbef8856d19cab3629d70a | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets | arkts | PageOneBuilder | [Start PageOne_builder] | @Builder
export function PageOneBuilder(name: string,param: Object) {
PageOne()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PageOneBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ... | @Builder
export function PageOneBuilder(name: string,param: Object) {
PageOne()
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets#L17-L20 | 443c98b7821c6d33c81eb167b73a8d00f0dce56c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets | arkts | attachWeb | 挂载Webview | attachWeb() : void {
if (this.builderNode) {
let frameNode : FrameNode | null = this.builderNode.getFrameNode();
if (frameNode?.getParent() != null) {
// 挂载自定义节点前判断该节点是否已经被挂载
hilog.error(0x0000, 'testTag', '%{public}s', 'The frameNode is already attached');
return;
}
... | AST#method_declaration#Left attachWeb 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#Left AST#ex... | attachWeb() : void {
if (this.builderNode) {
let frameNode : FrameNode | null = this.builderNode.getFrameNode();
if (frameNode?.getParent() != null) {
hilog.error(0x0000, 'testTag', '%{public}s', 'The frameNode is already attached');
return;
}
this.rootNode = this.bu... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/pages/common.ets#L67-L77 | 6652040b68cd5d66a746589244afc5dac65fbab8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/AudioCapturerHelper.ets | arkts | release | 销毁实例,释放资源 | static async release() {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
//采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release
if (state === audio.AudioState.STATE_RELEASED || state === audio.AudioSt... | AST#method_declaration#Left static async release AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left blResult : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#... | static async release() {
let blResult: boolean = false;
if (AudioCapturerHelper.audioCapturer !== undefined) {
const state = AudioCapturerHelper.audioCapturer.state.valueOf();
if (state === audio.AudioState.STATE_RELEASED || state === audio.AudioState.STATE_NEW) {
return false;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/AudioCapturerHelper.ets#L135-L151 | 2317994b5da81f807443dce9b6f5a4d7302d7420 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/dbUtils/DBPrepare.ets | arkts | 数据库准备协议接口 | export interface DBPrepareProtocol {
/**
* 检查数据库是否可打开
* @param dbPath 数据库文件路径
* @returns 返回是否可打开
*/
isDbOpenable(dbPath: string): Promise<boolean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DBPrepareProtocol AST#object_type#Left { /**
* 检查数据库是否可打开
* @param dbPath 数据库文件路径
* @returns 返回是否可打开
*/ AST#type_member#Left isDbOpenable AST#parameter_list#Left ( AST#parameter#Left dbPath : AST#type_annotation#Left AST#primary_typ... | export interface DBPrepareProtocol {
isDbOpenable(dbPath: string): Promise<boolean>;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBPrepare.ets#L15-L22 | e00d192bb231e160aa3f0a66456882db2231df80 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets | arkts | updateStateByMode | 根据识别模式设置不同样式 | updateStateByMode(): void {
if (this.mode === VerifyModeEnum.VOICE) {
// 语音识别
this.backgroundVoice = Color.White;
this.fontColorVoice = Color.Black;
this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg");
this.fontColorCancel = Color.White;
this.backgroundCancel = C... | AST#method_declaration#Left updateStateByMode 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member... | updateStateByMode(): void {
if (this.mode === VerifyModeEnum.VOICE) {
this.backgroundVoice = Color.White;
this.fontColorVoice = Color.Black;
this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg");
this.fontColorCancel = Color.White;
this.backgroundCancel = Color.Gr... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets#L105-L134 | b8a178eff872a191b6bdd77e3ddc681d3b6ebd54 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/VideoSection.ets | arkts | playVideo | 是否展示全局弹窗 播放短视频 | playVideo() {
if (this.currentVideoIndex === this.videoItemIndex) {
this.controller.start();
}
} | AST#method_declaration#Left playVideo 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left ... | playVideo() {
if (this.currentVideoIndex === this.videoItemIndex) {
this.controller.start();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/VideoSection.ets#L47-L51 | 0460d0c102646b31f6f080067b5a4110deaaad1b | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/MediaService/src/main/ets/common/CommonConstants.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 enum AVPlayerState {
/**
* Idle state of avPlayer.
*/
IDLE = 'idle',
/**
* Initialized state of avPlayer.
*/
INITIALIZED = 'initialized',
/**
* Prepared state of avPlayer.
*/
PREPARED = 'prepared',
/**
* Playing state of avPlayer.
*/
PLAYING = 'playing',
/**
* Pau... | AST#export_declaration#Left export AST#enum_declaration#Left enum AVPlayerState AST#enum_body#Left { /**
* Idle state of avPlayer.
*/ AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , /**
* Initialized state of avPlayer.
*/ AST#enum_member#Left INITIALIZED =... | export enum AVPlayerState {
IDLE = 'idle',
INITIALIZED = 'initialized',
PREPARED = 'prepared',
PLAYING = 'playing',
PAUSED = 'paused',
COMPLETED = 'completed',
STOPPED = 'stopped',
RELEASED = 'released',
ERROR = 'error'
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/common/CommonConstants.ets#L16-L61 | 985f2c83b7d498efe32d1a9fb82dbe9de43a2ffb | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | entry/src/main/ets/common/CustomEngineKeyImpl.ets | arkts | CustomEngineKeyImpl | 全局自定义key demo | @Sendable
export class CustomEngineKeyImpl implements IEngineKey {
// 生成内存缓存key
generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,
imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string {
let key = ""
if(imageKnifeO... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class CustomEngineKeyImpl AST#implements_clause#Left implements IEngineKey AST#implements_clause#Right AST#class_body#Left { // 生成内存缓存key AST#method_declaration#Left generateMemoryKey AST#parameter_list#Left ( AST#parameter#L... | @Sendable
export class CustomEngineKeyImpl implements IEngineKey {
generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,
imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string {
let key = ""
if(imageKnifeOption.signat... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/entry/src/main/ets/common/CustomEngineKeyImpl.ets#L19-L44 | f1f6de0126c9e7eabb1cb8b32a5f4eb33bdb2e07 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets | arkts | @file
@kit ArkUI
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class TabTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.F... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TabTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon resour... | export declare class TabTitleBarMenuItem {
value: ResourceStr;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets#L30-L81 | 3c3bf33e164f74d27e6699546f94ad5f7c4bfb14 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/memo/ComposeMemoView.ets | arkts | buildMenuItems | === 导航菜单 === | buildMenuItems(): NavigationMenuItem[] {
return [
// {
// value : "edit",
// icon : $r('app.media.edit'),
// action: () => {
// // 编辑,显示 键盘
// this.actionEdit();
// }
// },
];
} | AST#method_declaration#Left buildMenuItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NavigationMenuItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_state... | buildMenuItems(): NavigationMenuItem[] {
return [
];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/memo/ComposeMemoView.ets#L97-L108 | 64fcdae2d250862e81ba3fea051698decb27de43 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.utils.d.ets | arkts | notifyAll | Notify all waiting promise.
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 18 | notifyAll(): void; | AST#method_declaration#Left notifyAll 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#method_declaration#Right | notifyAll(): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L691-L691 | 6480251119bb3ed34b128cc2d1302135e4a3a074 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/utils/JhEncryptUtils.ets | arkts | aesEncrypt | / 字符串AES加密 | public static aesEncrypt(dataStr: string) {
const dataHex: CryptoJS.lib.WordArray = CryptoJS.enc.Utf8.parse(dataStr)
const encrypted: CryptoJS.lib.CipherParams = CryptoJS.AES.encrypt(dataHex, SECRET_KEY, {
iv: SECRET_IV,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
return en... | AST#method_declaration#Left public static aesEncrypt AST#parameter_list#Left ( AST#parameter#Left dataStr : 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#variable_dec... | public static aesEncrypt(dataStr: string) {
const dataHex: CryptoJS.lib.WordArray = CryptoJS.enc.Utf8.parse(dataStr)
const encrypted: CryptoJS.lib.CipherParams = CryptoJS.AES.encrypt(dataHex, SECRET_KEY, {
iv: SECRET_IV,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
return en... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhEncryptUtils.ets#L33-L41 | b96f99e13fb5342a6ffdb12706151ef47ee9ba35 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/AlphabetIndexerView.ets | arkts | AlphabetIndexerView | 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 AlphabetIndexerView {
@Link _position: Position;
private componentKey: string;
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z']
build() {
AlphabetIndexer({ a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AlphabetIndexerView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#... | @Component
export struct AlphabetIndexerView {
@Link _position: Position;
private componentKey: string;
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z']
build() {
AlphabetIndexer({ a... | 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/position/AlphabetIndexerView.ets#L16-L39 | 554c90411e88a01e8fc0efd3f98475d19632c8c5 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets | arkts | encryptGCMSync | 加密(GCM模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@returns | static encryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let enc... | AST#method_declaration#Left static encryptGCMSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe... | static encryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let enc... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L52-L60 | 237c37cf59f3973799b42db3cb282ef99dbbdda5 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets | arkts | pushData | 在数据尾部增加一个元素 | public pushData(data: CustomMessage): void {
this.messageList.push(data);
this.notifyDataAdd(this.messageList.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CustomMessage 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_t... | public pushData(data: CustomMessage): void {
this.messageList.push(data);
this.notifyDataAdd(this.messageList.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets#L48-L51 | c6b1e0f66b654b6e8f2f8705b6f5bad4a0e99890 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DES.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param desKey 3DES密钥
@returns | static async encodeECB(str: string, desKey: string): Promise<string> {
return CryptoUtil.encodeECB(str, desKey, '3DES192', '3DES192|ECB|PKCS7', 192);
} | AST#method_declaration#Left static async encodeECB 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 desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeECB(str: string, desKey: string): Promise<string> {
return CryptoUtil.encodeECB(str, desKey, '3DES192', '3DES192|ECB|PKCS7', 192);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DES.ets#L42-L44 | c4d87b992ab2ccfba2b1e765a57c2a646e3a66c5 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/web/src/main/ets/WebViewManager.ets | arkts | injectScript | runJavaScriptExt
@param script
@param controller | static injectScript(script: string | ArrayBuffer, controller?: WebviewController) {
controller?.runJavaScriptExt(script)
.catch((error: BusinessError) => {
Logger.error(`injectScript runJavaScriptExt ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`)
})
} | AST#method_declaration#Left static injectScript AST#parameter_list#Left ( AST#parameter#Left script : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#R... | static injectScript(script: string | ArrayBuffer, controller?: WebviewController) {
controller?.runJavaScriptExt(script)
.catch((error: BusinessError) => {
Logger.error(`injectScript runJavaScriptExt ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`)
})
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebViewManager.ets#L27-L33 | bfe3c4653fb0f900ac1eaba540fab9fb9610c673 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AVPlayer.ets | arkts | setAVPlayerCallback | 注册avplayer回调函数 | setAVPlayerCallback(avPlayer: media.AVPlayer): void {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程
avPlayer.on('error', (err: BusinessError) => {... | AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERR... | setAVPlayerCallback(avPlayer: media.AVPlayer): void {
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
avPlayer.on('error', (err: BusinessError) => {
console.error(`Invoke avPlayer failed, code is ${err.code},... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AVPlayer.ets#L29-L51 | c9a31b8f5db70322434bc63f925bffe3a523b2b3 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets | arkts | submitUserInput | 用户输入消息函数 | public submitUserInput(userIputText: string) {
if (userIputText == '') {
console.log(`dxin => "输入内容为空,请重新输入!" `)
return;
}
this.userInput = userIputText;
if (this.userInput && !this.isResponding) {
if (this.onSendMessage) {
this.isResponding = true;
this.onSendMessage(t... | AST#method_declaration#Left public submitUserInput AST#parameter_list#Left ( AST#parameter#Left userIputText : 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_statem... | public submitUserInput(userIputText: string) {
if (userIputText == '') {
console.log(`dxin => "输入内容为空,请重新输入!" `)
return;
}
this.userInput = userIputText;
if (this.userInput && !this.isResponding) {
if (this.onSendMessage) {
this.isResponding = true;
this.onSendMessage(t... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets#L214-L229 | 5471da4e14648fe63797ab85bee020b3d745b810 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | getContactById | 根据ID获取联系人
@param id 联系人ID | async getContactById(id: number): Promise<ContactEntity | null> {
this.checkInitialization();
return await this.contactDAO.getContactById(id);
} | AST#method_declaration#Left async getContactById 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 ... | async getContactById(id: number): Promise<ContactEntity | null> {
this.checkInitialization();
return await this.contactDAO.getContactById(id);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L108-L111 | 5df09cb935d3ace40032dc60debfaf82ea4fac34 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/NumberUtility.ets | arkts | isInt | / 判断是否为整数 | public static isInt(str: string | null): boolean {
if (str === null) {
return false;
}
// 支持可选正负号
const regEx: RegExp = /^[\+\-]?\d+$/;
return regEx.test(str);
} | AST#method_declaration#Left public static isInt AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST... | public static isInt(str: string | null): boolean {
if (str === null) {
return false;
}
const regEx: RegExp = /^[\+\-]?\d+$/;
return regEx.test(str);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/NumberUtility.ets#L4-L13 | 688b3a93415af6b655273bd8e54f6e2ce1ede2cd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets | arkts | 会话数据结构 | export interface SessionData {
wid: string; // 用户wid
headImg: ResourceStr | image.PixelMap; // 头像
name: string; // 用户昵称
lastMsg: string; // 最后一条消息简要内容
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SessionData AST#object_type#Left { AST#type_member#Left wid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 用户wid AST#type_member#Left headImg : AST#type_annota... | export interface SessionData {
wid: string;
headImg: ResourceStr | image.PixelMap;
name: string;
lastMsg: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets#L39-L44 | 250f327f77293561d0b94cb8035580b109e85763 | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets | arkts | Configuration parameter of ExceptionPrompt.
@interface PromptOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Configuration parameter of ExceptionPrompt.
@interface PromptOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface PromptOptions {
/**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @cr... | AST#export_declaration#Left export AST#interface_declaration#Left interface PromptOptions AST#object_type#Left { /**
* Icon of PromptOptions.
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Icon of PromptOptions.
* @type { ... | export interface PromptOptions {
icon?: ResourceStr;
tip?: ResourceStr;
marginType: MarginType;
actionText?: ResourceStr;
marginTop: Dimension;
isShown?: boolean;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L79-L176 | b68136a015704323bc8797107fb54d8c53651eab | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Defines add operation.
@interface DataAddOperation
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface DataAddOperation {
/**
* How to operate added data.
*
* @type { DataOperationType.ADD }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
type: DataOperationType;
/**
* Index of added data.
*
*... | AST#export_declaration#Left export AST#interface_declaration#Left interface DataAddOperation AST#object_type#Left { /**
* How to operate added data.
*
* @type { DataOperationType.ADD }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AS... | export interface DataAddOperation {
type: DataOperationType;
index: number;
count?: number;
key?: string | Array<string>;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L102-L145 | e8c6dde029a90a46b1d68ac15f9380ca4f02333a | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/UserState.ets | arkts | isLoggedIn | 当前是否已登录(依据 auth 与 userInfo 是否存在)
@returns {boolean} 登录状态 | isLoggedIn(): boolean {
return !!this.getToken();
} | AST#method_declaration#Left isLoggedIn 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_expression#Lef... | isLoggedIn(): boolean {
return !!this.getToken();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L146-L148 | 69583eeaa7e8da7bb0130c4983ec508c7fc6e5cc | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets | arkts | unit8ArrayToString | 字节流转成可理解的字符串
@param array Uint8Array数组
@param isC1C3C2 是否需要输出为C1C3C2格式的字符串,true需要
@returns 字符串 | static unit8ArrayToString(array: Uint8Array, isC1C3C2?: boolean): string {
let sb = new StringBuilder();
for (let i = 0; i < array.length; i++) {
sb.append(String.fromCharCode(array[i]));
}
let asn1Str = sb.toString();
// if (isC1C3C2) {
// asn1Str = new SM2Convert().d2i(asn1Str);
//... | AST#method_declaration#Left static unit8ArrayToString AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isC1C3C2 ? : AST#type_annotation#Left AST#primary_type#Left boole... | static unit8ArrayToString(array: Uint8Array, isC1C3C2?: boolean): string {
let sb = new StringBuilder();
for (let i = 0; i < array.length; i++) {
sb.append(String.fromCharCode(array[i]));
}
let asn1Str = sb.toString();
return asn1Str;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L69-L79 | a8eadbe8e7e664dadd06861c769e890f83077a66 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/ActionSheetDialogView.ets | arkts | ActionSheetDialogView | ActionSheetDialog菜单组件 | @ComponentV2
export struct ActionSheetDialogView {
@Require @Param options: IBottomSheetOptions;
// @Local isClose: boolean = false
@Local fontSize: number | string | Resource = 16; //按钮的文字大小,字体大小16。
@Local length: number = 0; //ActionSheet选项长度
// @Local themeColorMode: ThemeColorMode = DialogHub.getThemeCol... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ActionSheetDialogView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#pr... | @ComponentV2
export struct ActionSheetDialogView {
@Require @Param options: IBottomSheetOptions;
@Local fontSize: number | string | Resource = 16;
@Local length: number = 0;
aboutToAppear(): void {
if (this.options.sheets && this.options.sheets.length >= 1) {
this.length = this.options.sheet... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ActionSheetDialogView.ets#L10-L190 | 33f0033b2b57d7a084180bbe87548232710231f1 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSVideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets | arkts | padding | Zero padding, 2 bits.
@param num Number to be converted.
@return Result after zero padding. | padding(num: string) {
let length = CommonConstants.PADDING_LENGTH;
for (var len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left num : 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#variable_declaration#Left let AST... | padding(num: string) {
let length = CommonConstants.PADDING_LENGTH;
for (var len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets#L34-L40 | 5e23e5f5d9ac4a3cb49baf7c9ff33006a92222e1 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/detail/show/ShowViewModel.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/21 22:11
@Version V1.0
@Description | export class ShowViewModel extends DetailViewModel implements SimpleRepository {
async loadData(type: LoadType): Promise<Object> {
let show = await this.repository.getShow(this.args.id)
let info: ShowInfo = {
show: show
}
let nextUps = await this.repository.getShowNextUp(this.args.id)
let s... | AST#export_declaration#Left export AST#class_declaration#Left class ShowViewModel extends AST#type_annotation#Left AST#primary_type#Left DetailViewModel AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements SimpleRepository AST#implements_clause#Right AST#class_body#Left { AST#method_de... | export class ShowViewModel extends DetailViewModel implements SimpleRepository {
async loadData(type: LoadType): Promise<Object> {
let show = await this.repository.getShow(this.args.id)
let info: ShowInfo = {
show: show
}
let nextUps = await this.repository.getShowNextUp(this.args.id)
let s... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/detail/show/ShowViewModel.ets#L13-L29 | 75b6c7f2a92b76b3bfe1129212d4ce7c7a01dcbb | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DESSync.ets | arkts | @Author csx
@DateTime 2024/3/18 10:07:03
@TODO DESSync 3DES同步操作类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto | export class DESSync {
/**
* 生成3DES的对称密钥
* @param resultCoding 生成3DES秘钥的字符串格式(hex/base64)-默认不传为base64格式
* @returns 3DES密钥
*/
static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): string {
// 获取对称密钥的二进制数据
return CryptoSyncUtil.generateSymKey('3DES192', resultCoding);
}
/**
... | AST#export_declaration#Left export AST#class_declaration#Left class DESSync AST#class_body#Left { /**
* 生成3DES的对称密钥
* @param resultCoding 生成3DES秘钥的字符串格式(hex/base64)-默认不传为base64格式
* @returns 3DES密钥
*/ AST#method_declaration#Left static generate3DESKey AST#parameter_list#Left ( AST#parameter#Left resultCoding... | export class DESSync {
static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.generateSymKey('3DES192', resultCoding);
}
static encodeECB(str: string, desKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L27-L91 | 038586132042c7bc3e1953ece12f4d95e751ca6b | gitee | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | notify | 提醒 | async notify(context?: common.Context, eventId?: update.EventId): Promise<void> {
} | AST#method_declaration#Left async notify AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventId ? : AST#typ... | async notify(context?: common.Context, eventId?: update.EventId): Promise<void> {
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L251-L252 | c8a6050efb73e8086476a24258cbef47eb8e02e6 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BorderImageSample/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export class CommonConstants {
/**
* Minimum value of the slider for cropping the source image.
*/
public static readonly SLICE_SLIDER_MIN: number = 0;
/**
* Number of decimal places reserved for slider value.
*/
public static readonly DECIMAL_DIGITS: number = 0;
/**
* Adjust the step of the... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Minimum value of the slider for cropping the source image.
*/ AST#property_declaration#Left public static readonly SLICE_SLIDER_MIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | export class CommonConstants {
public static readonly SLICE_SLIDER_MIN: number = 0;
public static readonly DECIMAL_DIGITS: number = 0;
public static readonly SLIDER_STEP: number = 1;
public static readonly LAYOUT_WEIGHT: number = 1;
public static readonly PREVIEW_SLIDER_STEP: number = 1;
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BorderImageSample/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L235 | ebe3c72079fb80c82e0751d163ca3786f325691c | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showLoading | 显示加载中提示
@returns {void} 无返回值 | static showLoading(): void {
IBestToast.showLoading();
} | AST#method_declaration#Left static showLoading 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#expre... | static showLoading(): void {
IBestToast.showLoading();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L57-L59 | c9c589c54cfedc9c3d7282b362b78bd58ff877d1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CharUtil.ets | arkts | isSpaceChar | 判断字符串char是否是空格符
@param char
@returns | static isSpaceChar(char: string): boolean {
return i18n.Unicode.isSpaceChar(char);
} | AST#method_declaration#Left static isSpaceChar AST#parameter_list#Left ( AST#parameter#Left char : 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_ty... | static isSpaceChar(char: string): boolean {
return i18n.Unicode.isSpaceChar(char);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L67-L69 | cd9a38653e844f377295d34da23117f21f568b8d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/HelpDescription.ets | arkts | HelpDescription | 自定义帮助组件 | @Component
export struct HelpDescription {
@State isShow: boolean = false;
@Prop info: string | Resource = '';
/**
* popup构造器定义弹框内容
*/
@Builder
popupBuilder() {
Column() {
Text(this.info).fontSize($r('app.integer.image_compression_font_size_fourteen'))
}
.justifyContent(FlexAlign.Spac... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HelpDescription AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct HelpDescription {
@State isShow: boolean = false;
@Prop info: string | Resource = '';
@Builder
popupBuilder() {
Column() {
Text(this.info).fontSize($r('app.integer.image_compression_font_size_fourteen'))
}
.justifyContent(FlexAlign.SpaceAround)
.padding($r('app... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/HelpDescription.ets#L17-L50 | 0ec1545adc9e8856c619c30b988bfbee76f921a1 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/src/main/ets/Calc.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 function add(a:number, b:number): number {
let c = a + b;
return c;
} | AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef... | export function add(a:number, b:number): number {
let c = a + b;
return c;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/src/main/ets/Calc.ets#L16-L20 | 86dda8466e6ec1056a561cf953bc75ac81e3e719 | gitee | |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets | arkts | reload | public move(from: number, to: number): void { // TODO: optimize let temp: Message = this.sortedMessages[from]; this.sortedMessages[from] = this.sortedMessages[to]; this.sortedMessages[to] = temp; this.notifyDataMove(from, to); } | public reload(): void {
this.notifyDataReload();
} | AST#method_declaration#Left public reload 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... | public reload(): void {
this.notifyDataReload();
} | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets#L85-L87 | aae3f6fdb070407d885542aada8c9da853c1a34f | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/DataSet.ets | arkts | copy | @param dataSet | abstract copy(): DataSet<T>; | AST#method_declaration#Left abstract copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#R... | abstract copy(): DataSet<T>; | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L177-L177 | 8a35f49d7425e0f33d64b8aa9b35ea1f7d294f66 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/CameraService.ets | arkts | releaseCamera | 创建相机 | async releaseCamera() {
await this.captureSession?.release();
await this.cameraInput?.close();
await this.photoOutput?.release();
await this.previewOutput?.release();
await this.imageReceiver.release();
} | AST#method_declaration#Left async releaseCamera 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#Le... | async releaseCamera() {
await this.captureSession?.release();
await this.cameraInput?.close();
await this.photoOutput?.release();
await this.previewOutput?.release();
await this.imageReceiver.release();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/CameraService.ets#L98-L104 | 235d45af258563697dec64ba25dc2bacd63dd077 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/PacketEndFlag/entry/src/main/ets/pages/Index.ets | arkts | test | 粘包测试 | async test() {
//服务端地址
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.port, family: 1 }
//执行TCP通讯的对象
let tcpSocket: socket.TCPSocket = socket.constructTCPSocketInstance()
//收到消息时的处理
tcpSocket.on("message", (value: socket.SocketMessageInfo) => {
this.receiveMsgF... | AST#method_declaration#Left async test AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //服务端地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left serverAddress : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . NetAddress AST#... | async test() {
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.port, family: 1 }
let tcpSocket: socket.TCPSocket = socket.constructTCPSocketInstance()
tcpSocket.on("message", (value: socket.SocketMessageInfo) => {
this.receiveMsgFromServer(value)
})
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/PacketEndFlag/entry/src/main/ets/pages/Index.ets#L95-L121 | 5ea812788d00bcf2b1f8672d3728d8dd99464191 | gitee |
hushenghao/ArkTS-RelativeContainerExtend.git | 8df722220a15be576736c7a58a8ed30820c3a1ea | entry/src/main/ets/utils/SpaceExtend.ets | arkts | 水平方向边距
@param size
@returns | export function horizontal(size: Length): Padding {
return { left: size, right: size }
} | AST#export_declaration#Left export AST#function_declaration#Left function horizontal AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr... | export function horizontal(size: Length): Padding {
return { left: size, right: size }
} | https://github.com/hushenghao/ArkTS-RelativeContainerExtend.git/blob/8df722220a15be576736c7a58a8ed30820c3a1ea/entry/src/main/ets/utils/SpaceExtend.ets#L6-L8 | 1604b89cc3d527e2073f8fee927a4f2aee1f5186 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | addViewportJob | Either posts a job immediately if the chart has already setup it's
dimensions or adds the job to the execution queue.
@param job | public addViewportJob(job: MoveViewJob | AnimatedMoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
} | AST#method_declaration#Left public addViewportJob AST#parameter_list#Left ( AST#parameter#Left job : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MoveViewJob AST#primary_type#Right | AST#primary_type#Left AnimatedMoveViewJob AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST... | public addViewportJob(job: MoveViewJob | AnimatedMoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L295-L301 | b9d6f841129e5e9d2bbc7d44761293f3a76d6ba0 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets | arkts | requestNotification | Request notification bar permissions. | requestNotification() {
Notification.requestEnableNotification().then(() => {
Logger.info(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification success');
}).catch((err: Error) => {
Logger.error(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification failed : ' + JSON.stringify(err));
});
... | AST#method_declaration#Left requestNotification 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#call_expression#Left AST#expression#Left... | requestNotification() {
Notification.requestEnableNotification().then(() => {
Logger.info(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification success');
}).catch((err: Error) => {
Logger.error(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification failed : ' + JSON.stringify(err));
});
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets#L67-L73 | 78cfe38331af6b6ec4918c44b7fedfd6ec391d20 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets | arkts | zoomIn | ################ ################ ################ ################
CODE BELOW THIS RELATED TO SCALING AND GESTURES
Zooms in by 1.4f, x and y are the coordinates (in pixels) of the zoom
center.
@param x
@param y | public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix {
var save: Matrix = outputMatrix == null || outputMatrix == undefined ? new Matrix() : outputMatrix;
save.reset();
save.set(this.mMatrixTouch);
save.postScale(1.4, 1.4, x, y);
return save;
} | AST#method_declaration#Left public zoomIn AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#... | public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix {
var save: Matrix = outputMatrix == null || outputMatrix == undefined ? new Matrix() : outputMatrix;
save.reset();
save.set(this.mMatrixTouch);
save.postScale(1.4, 1.4, x, y);
return save;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L198-L204 | 482289cc15a47f2c2e32504c97306a8eb4dc0080 | gitee |
wenqi1/MallHomepage.git | a09765bee60b214f73b875570f8721a004d0bc3b | entry/src/main/ets/components/Home.ets | arkts | Home | 首页 | @Component
export default struct Home {
@State classifyIndex: number = 0;
@State commodities: Commodity[] = commodities
// 搜索栏
@Builder SearchBar() {
Row() {
Image($r('app.media.main_page_search'))
.height($r('app.float.main_page_search_image_size'))
.width($r('app.float.main_page_sea... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Home AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right classifyIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type... | @Component
export default struct Home {
@State classifyIndex: number = 0;
@State commodities: Commodity[] = commodities
@Builder SearchBar() {
Row() {
Image($r('app.media.main_page_search'))
.height($r('app.float.main_page_search_image_size'))
.width($r('app.float.main_page_search_im... | https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/components/Home.ets#L9-L117 | 1545ded7a4c028bc030f44c0ab195039c3862ad8 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/src/main/ets/views/ClockInSamplePage.ets | arkts | ClockInSamplePage | 功能描述: 本示例使用geoLocationManager进行地理位置定位和地理信息获取,并利用MapComponent组件展示地图,添加用户位置和打卡范围,通过计算用户位置和打卡中心点的距离判断用户是否处于打卡区域,实现了打卡功能。
推荐场景: 定位打卡场景
核心组件:
1. MapComponent 地图组件
2. MapComponentController 地图组件控制器
3. MapCircleOptions 打卡范围参数
4. geoLocationManager 位置服务,获取用户位置和地理信息
实现步骤:
1. 初始化地图参数。
2. 初始化打卡范围参数。
3. 设置是否显示定位按钮及按钮位置。
4. 初始化打... | @Component
export struct ClockInSamplePage {
// 是否正在加载打卡信息
@State isLoading: boolean = false;
// 初始打卡按钮文本
@State clockInButtonText: Resource = $r('app.string.clock_in_button_text_clock_in');
// 是否在打卡范围内
@State isInArea: boolean = true;
// 上班打卡信息
@State clockInInfo: ClockInInfo | null = null;
// 下班打卡信息... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ClockInSamplePage AST#component_body#Left { // 是否正在加载打卡信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | @Component
export struct ClockInSamplePage {
@State isLoading: boolean = false;
@State clockInButtonText: Resource = $r('app.string.clock_in_button_text_clock_in');
@State isInArea: boolean = true;
@State clockInInfo: ClockInInfo | null = null;
@State clockOutInfo: ClockInInfo | null = null;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/views/ClockInSamplePage.ets#L44-L315 | dac15bf609ca94996ddcd934e2b43b46a3f47221 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearView.ets | arkts | YearView | 年视图 | @Component
export struct YearView {
// swiper当前显示的子组件索引
@State swiperYearIndex: number = 1;
// 当前显示的年
@State currentShowYear: number = Constants.TODAY_YEAR;
// 上一年
@State lastYear: number = Constants.TODAY_YEAR - 1;
// 当前年
@State currentYear: number = Constants.TODAY_YEAR;
// 下一年
@State nextYear: nu... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct YearView AST#component_body#Left { // swiper当前显示的子组件索引 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right swiperYearIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | @Component
export struct YearView {
@State swiperYearIndex: number = 1;
@State currentShowYear: number = Constants.TODAY_YEAR;
@State lastYear: number = Constants.TODAY_YEAR - 1;
@State currentYear: number = Constants.TODAY_YEAR;
@State nextYear: number = Constants.TODAY_YEAR + 1;
private ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearView.ets#L24-L71 | c05b828dae13bfdf375092fc5226daed01d63933 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment5.ets | arkts | Segment05Builder | 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... | @Builder
export function Segment05Builder() {
NavDestination(){
UnnecessaryState2()
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment05Builder 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 NavDestination ( ) AST#containe... | @Builder
export function Segment05Builder() {
NavDestination(){
UnnecessaryState2()
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment5.ets#L15-L20 | 41ddba3d8107e0a465311f133b8dbb2589c85c6a | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/icon/LogoIcon.ets | arkts | LogoIcon | @file 应用 Logo 图标组件
@author Joker.X | @ComponentV2
export struct LogoIcon {
/**
* 图标大小(单位:vp)
*/
@Param
iconSize: number = 24;
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建 Logo 图标
* @returns {void} 无返回值
*/
build(): void {
CommonIcon({
icon: $r("app.media.ic_logo"),
iconSize... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LogoIcon AST#component_body#Left { /**
* 图标大小(单位:vp)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | @ComponentV2
export struct LogoIcon {
@Param
iconSize: number = 24;
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
CommonIcon({
icon: $r("app.media.ic_logo"),
iconSize: this.iconSize,
onTap: this.onTap
});
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/LogoIcon.ets#L7-L31 | 698a0f7965b37481782dfd0132f93246b588c425 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/navigation/AddressDetailNav.ets | arkts | AddressDetailNav | @file 地址详情页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function AddressDetailNav(): void {
AddressDetailPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function AddressDetailNav 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_cust... | @Builder
export function AddressDetailNav(): void {
AddressDetailPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/navigation/AddressDetailNav.ets#L8-L11 | a40b2e7a004a9cf6d200e99dbf093c6644e054af | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets | arkts | calcExamScore | 模拟考试-计算考试成绩是否合格 | calcExamScore(): boolean {
return this.examManager.total * 0.9 <= this.examManager.correctNumber;
} | AST#method_declaration#Left calcExamScore 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#member_expressio... | calcExamScore(): boolean {
return this.examManager.total * 0.9 <= this.examManager.correctNumber;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L223-L225 | 5748bed45486d924d1ac6566a495a8c64d110045 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | unit8ArrayToBuffer | Uint8Array转ArrayBuffer
@param str
@returns | static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer {
// return buffer.from(src).buffer;
return src.buffer as ArrayBuffer;
} | AST#method_declaration#Left static unit8ArrayToBuffer AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer ... | static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer {
return src.buffer as ArrayBuffer;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L367-L370 | c7fb4ebd65dab0884055468ce2acabe0f43bf761 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/SmsLoginPage.ets | arkts | SmsLoginPage | @file 短信登录页面视图
@author Joker.X | @ComponentV2
export struct SmsLoginPage {
/**
* 短信登录页面 ViewModel
*/
@Local
private vm: SmsLoginViewModel = new SmsLoginViewModel();
/**
* 手机号输入
*/
@Local
private phone: string = "";
/**
* 验证码输入
*/
@Local
private verificationCode: string = "";
/**
* 构建短信登录页面
* @returns {void}... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SmsLoginPage AST#component_body#Left { /**
* 短信登录页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left SmsLogi... | @ComponentV2
export struct SmsLoginPage {
@Local
private vm: SmsLoginViewModel = new SmsLoginViewModel();
@Local
private phone: string = "";
@Local
private verificationCode: string = "";
build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOp... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/SmsLoginPage.ets#L16-L109 | 81809f320439cf7410962eed7fded7189f907de0 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets | arkts | getRadioImage | 获取单选题的图片
@param option
@param answer
@returns | getRadioImage(option: string, answer: string): ResourceStr {
let select: string = this.item.selected[0] ? this.item.selected[0] : '';
if (option === select && option !== answer) {
return $r('app.media.error');
}
if (option !== select && option !== answer) {
return $r('app.media.no_select');
... | AST#method_declaration#Left getRadioImage AST#parameter_list#Left ( AST#parameter#Left option : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left answer : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | getRadioImage(option: string, answer: string): ResourceStr {
let select: string = this.item.selected[0] ? this.item.selected[0] : '';
if (option === select && option !== answer) {
return $r('app.media.error');
}
if (option !== select && option !== answer) {
return $r('app.media.no_select');
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets#L305-L314 | c1979e630b3cdfb711890196a32815177d17b81e | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ScatterChartModel.ets | arkts | Predefined ScatterShapes that allow the specification of a shape a ScatterDataSet should be drawn with.
If a ScatterShape is specified for a ScatterDataSet, the required renderer is set. | export enum ChartShape {
SQUARE, CIRCLE, TRIANGLE, CROSS, X, CHEVRON_UP, CHEVRON_DOWN
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ChartShape AST#enum_body#Left { AST#enum_member#Left SQUARE AST#enum_member#Right , AST#enum_member#Left CIRCLE AST#enum_member#Right , AST#enum_member#Left TRIANGLE AST#enum_member#Right , AST#enum_member#Left CROSS AST#enum_member#Right , AST#enum_memb... | export enum ChartShape {
SQUARE, CIRCLE, TRIANGLE, CROSS, X, CHEVRON_UP, CHEVRON_DOWN
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ScatterChartModel.ets#L91-L93 | ef0454207309ea7fab8cb468acae96817c249f9d | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | getTruncateText | 缩短长文本,超出部分用省略号表示
@param text 原始文本
@param maxLength 最大长度
@returns 缩短后的文本 | static getTruncateText(text: string, maxLength: number = 20): string {
if (!text || text.length <= maxLength) {
return text;
}
return text.substring(0, maxLength) + '...';
} | AST#method_declaration#Left static getTruncateText 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 maxLength : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | static getTruncateText(text: string, maxLength: number = 20): string {
if (!text || text.length <= maxLength) {
return text;
}
return text.substring(0, maxLength) + '...';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L134-L139 | ea7c45e0861c74740a9044b6943eb98baa553272 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/common/PictureView.ets | arkts | PictureView | Picture component. | @Component
export struct PictureView {
private photos: PictureItem = new PictureItem();
build() {
Column() {
Image(this.photos.image)
.borderRadius(CommonConstants.BORDER_RADIUS)
.width(CommonConstants.PAGE_WIDTH)
.height(CommonConstants.WIDTH_PICTURE)
.onClick(() => {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PictureView AST#component_body#Left { AST#property_declaration#Left private photos : AST#type_annotation#Left AST#primary_type#Left PictureItem AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AS... | @Component
export struct PictureView {
private photos: PictureItem = new PictureItem();
build() {
Column() {
Image(this.photos.image)
.borderRadius(CommonConstants.BORDER_RADIUS)
.width(CommonConstants.PAGE_WIDTH)
.height(CommonConstants.WIDTH_PICTURE)
.onClick(() => {
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/common/PictureView.ets#L23-L55 | 3b56a0f4ee0a3a83a8cbab48a5407ac79511313b | gitee |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | products/phone/src/main/ets/pages/Index.ets | arkts | onPageShow | 生命周期函数 | async onPageShow(): Promise<void> {
this.onForeground = true;
this.preferences.get("disclaimerIsConfirm", false).then((value) => {
hilog.debug(Constants.DOMAIN, TAG, "The disclaimerIsConfirm is: %{public}s", value.toString())
if (!value) {
this.disclaimer.open();
}
});
this.... | AST#method_declaration#Left async onPageShow 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_argum... | async onPageShow(): Promise<void> {
this.onForeground = true;
this.preferences.get("disclaimerIsConfirm", false).then((value) => {
hilog.debug(Constants.DOMAIN, TAG, "The disclaimerIsConfirm is: %{public}s", value.toString())
if (!value) {
this.disclaimer.open();
}
});
this.... | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/products/phone/src/main/ets/pages/Index.ets#L356-L407 | 607a48cce7469796be527172e1816070305d9007 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/customComponent.d.ets | arkts | Defining interface of PageLifeCycle for custom component, when decorate with @Entry.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface PageLifeCycle {
/**
* onPageShow Method.
*
* The page is triggered once each time it is displayed, including scenarios such as the routing process and the application entering the foreground
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomics... | AST#export_declaration#Left export AST#interface_declaration#Left interface PageLifeCycle AST#object_type#Left { /**
* onPageShow Method.
*
* The page is triggered once each time it is displayed, including scenarios such as the routing process and the application entering the foreground
*
* @sy... | export interface PageLifeCycle {
onPageShow(): void {} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/customComponent.d.ets#L283-L294 | fe5f059a1a515588e29f4b39411a1d8d04a2346f | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/ets/pages/Index.ets | arkts | [StartExclude create_component] | build() {
RelativeContainer() {
Image($r('app.media.ad_image'))
.height('100%')
.width('100%')
.id('image')
.alignRules({
left: { anchor: '__container__', align: HorizontalAlign.Start },
right: { anchor: '__container__', align: HorizontalAlign.End },
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_exp... | build() {
RelativeContainer() {
Image($r('app.media.ad_image'))
.height('100%')
.width('100%')
.id('image')
.alignRules({
left: { anchor: '__container__', align: HorizontalAlign.Start },
right: { anchor: '__container__', align: HorizontalAlign.End },
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/entry/src/main/ets/pages/Index.ets#L55-L87 | a8a99709a1002400e9406cb23576c24129d5b704 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/update/UpdateManager.ets | arkts | isGrayUser | 检查是否为灰度用户 | async isGrayUser(): Promise<boolean> {
try {
// 简单的灰度策略:根据用户ID或设备ID判断
const userId = await StorageManager.getString('user_id', '');
if (!userId) {
return false;
}
// 简单的哈希判断(实际项目中可以使用更复杂的策略)
const hash = this.simpleHash(userId);
return hash % 100 < 10; // 10% 灰度
... | AST#method_declaration#Left async isGrayUser 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async isGrayUser(): Promise<boolean> {
try {
const userId = await StorageManager.getString('user_id', '');
if (!userId) {
return false;
}
const hash = this.simpleHash(userId);
return hash % 100 < 10;
} catch (error) {
Logger.error('UpdateManager', `Fail... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/update/UpdateManager.ets#L215-L229 | e6b6af34db87f15c651d853896c64149ed4f5968 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets | arkts | getRdb | 获取一个RdbStore来操作关系型数据库 | getRdb(context: Context): Promise<RdbHelper> {
this.storeConfig = {
// 配置数据库文件名、安全级别
name: this.mDatabaseName, securityLevel: dataRdb.SecurityLevel.S1
};
return new Promise<RdbHelper>((success, error) => {
dataRdb.getRdbStore(context, this.storeConfig).then(dbStore => {
this.rdbSto... | AST#method_declaration#Left getRdb AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context 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 ... | getRdb(context: Context): Promise<RdbHelper> {
this.storeConfig = {
name: this.mDatabaseName, securityLevel: dataRdb.SecurityLevel.S1
};
return new Promise<RdbHelper>((success, error) => {
dataRdb.getRdbStore(context, this.storeConfig).then(dbStore => {
this.rdbStore = dbStore;
... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L21-L34 | 5352f36594d15f7f89ad31a1706b63b6664d8cfa | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets | arkts | @file 订单评论页面 ViewModel
@author Joker.X | @ObservedV2
export default class OrderCommentViewModel extends BaseViewModel {
/**
* 路由参数
*/
private readonly routeParam: OrderCommentParam | undefined = getRouteParams<OrderCommentParam>(OrderRoutes.Comment);
/**
* 订单 ID
*/
private readonly orderId: number = this.routeParam?.orderId ?? 0;
/**
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderCommentViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 路由参数
*/ ... | @ObservedV2
export default class OrderCommentViewModel extends BaseViewModel {
private readonly routeParam: OrderCommentParam | undefined = getRouteParams<OrderCommentParam>(OrderRoutes.Comment);
private readonly orderId: number = this.routeParam?.orderId ?? 0;
private readonly goodsId: number = this.rou... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets#L11-L74 | 694c9fd2c500cf871da2865a22f760284ed84a97 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollDetail.ets | arkts | onDataRefresh | 是否刷新
监听到刷新状态变化,执行回调 | onDataRefresh() {
if (this.isRefresh === false) {
this.refreshData();
}
} | AST#method_declaration#Left onDataRefresh 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_expression#Left AST#expression#Left this AST#expression#Rig... | onDataRefresh() {
if (this.isRefresh === false) {
this.refreshData();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollDetail.ets#L37-L41 | 24df6b50ed765d0bb84ec8966847cb8a4ab92894 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_commonEvents/ace_ets_module_commonEvents_api20/entry/src/main/ets/MainAbility/common/Rect.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 default class RectValue {
left: number = 0;
top: number = 0;
right: number = 0;
bottom: number = 0;
} | AST#export_declaration#Left export default AST#class_declaration#Left class RectValue AST#class_body#Left { AST#property_declaration#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#... | export default class RectValue {
left: number = 0;
top: number = 0;
right: number = 0;
bottom: number = 0;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonEvents/ace_ets_module_commonEvents_api20/entry/src/main/ets/MainAbility/common/Rect.ets#L16-L21 | ab2be05b015b1ee3258a5b154428ff1a69cf3619 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildSendSettings | 构建发送设置 | @Builder
buildSendSettings() {
Column({ space: 12 }) {
Text('发送设置')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
// 发送方式选择
Column({ space: 8 }) {
Text('发送方式')
.fontSize(14)
.fontC... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendSettings 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_p... | @Builder
buildSendSettings() {
Column({ space: 12 }) {
Text('发送设置')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 8 }) {
Text('发送方式')
.fontSize(14)
.fontColor('#66... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L481-L528 | fdde6bea50463dafb24cfef430e3a53256ebb22d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FeedbackRepository.ets | arkts | 构造函数
@param networkDataSource 反馈网络数据源 | constructor(networkDataSource?: FeedbackNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceImpl();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left FeedbackNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statemen... | constructor(networkDataSource?: FeedbackNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceImpl();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FeedbackRepository.ets#L18-L20 | c18f737b206720c1df4a36611271529cac201dbe | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | connectSocket | 连接Socket
@param oppositeAddress
@param oppositePort
@param callback | public connectSocket(oppositeAddress: string, oppositePort: number, callback: (data: string) => void): void {
Logger.info(TAG, ` mSocket connect ing ${JSON.stringify(this.mSocket)}`);
this.mSocket?.connectSocket(oppositeAddress, oppositePort).then(res => {
Logger.info(TAG, ` mSocket connect success ${JSON... | AST#method_declaration#Left public connectSocket AST#parameter_list#Left ( AST#parameter#Left oppositeAddress : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oppositePort : AST#type_annotation#Left AST#primary_type#Left nu... | public connectSocket(oppositeAddress: string, oppositePort: number, callback: (data: string) => void): void {
Logger.info(TAG, ` mSocket connect ing ${JSON.stringify(this.mSocket)}`);
this.mSocket?.connectSocket(oppositeAddress, oppositePort).then(res => {
Logger.info(TAG, ` mSocket connect success ${JSON... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L41-L52 | bcd717debb13ccb518ffd6a4f30e92dbaf21abbc | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ObjectPool.ets | arkts | create | Returns an ObjectPool instance, of a given starting capacity, that recycles instances of a given Poolable object.
@param withCapacity A positive integer value.
@param object An instance of the object that the pool should recycle.
@return | public static create(withCapacity: number, object: Poolable): ObjectPool {
let result = new ObjectPool(withCapacity, object);
result.poolId = this.ids;
this.ids++;
return result;
} | AST#method_declaration#Left public static create AST#parameter_list#Left ( AST#parameter#Left withCapacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left object : AST#type_annotation#Left AST#primary_type#Left Poolable AS... | public static create(withCapacity: number, object: Poolable): ObjectPool {
let result = new ObjectPool(withCapacity, object);
result.poolId = this.ids;
this.ids++;
return result;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ObjectPool.ets#L54-L60 | 956e15c0b67ce0cd1622a061952245478368c077 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/radio/radioCustom.ets | arkts | RadioCustomBuilder | 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... | @Builder
export function RadioCustomBuilder(name: string, param: Object) {
RadioCustomExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function RadioCustomBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pa... | @Builder
export function RadioCustomBuilder(name: string, param: Object) {
RadioCustomExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/radio/radioCustom.ets#L16-L19 | e5612340f75ecce256483696dd6a4a6b100a4012 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getMaxWidth | 获取底部类弹框的最大宽度
@param maxWidth 默认360vp
@returns 单位vp | static getMaxWidth(maxWidth: Length = 360): number {
if (Helper.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') { //number
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') { //string
oldWidth = Helper.getVpByStr(maxWidth);
... | AST#method_declaration#Left static getMaxWidth AST#parameter_list#Left ( AST#parameter#Left maxWidth : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio... | static getMaxWidth(maxWidth: Length = 360): number {
if (Helper.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') {
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') {
oldWidth = Helper.getVpByStr(maxWidth);
} else {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L212-L240 | 2de09afccb6c949429a7587ed9960f921edc7f65 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets | arkts | itemBuilder | 列表Item | @Builder
itemBuilder(value: ResourceStr, fontColor: ResourceColor, fontSize: number | string | Resource, index: number) {
Column() {
Text(value)
.fontSize(fontSize)
.fontColor(fontColor)
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding({ top: 18, bottom:... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemBuilder AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fontColor : AST#type_annotati... | @Builder
itemBuilder(value: ResourceStr, fontColor: ResourceColor, fontSize: number | string | Resource, index: number) {
Column() {
Text(value)
.fontSize(fontSize)
.fontColor(fontColor)
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding({ top: 18, bottom:... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets#L93-L119 | 4ccbafe88807313c2e56114cac6804725a2ffa95 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets | arkts | setDrawVerticalHighlightIndicator | Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn.
@param enabled | public setDrawVerticalHighlightIndicator(enabled: boolean): void {
this.mDrawVerticalHighlightIndicator = enabled;
} | AST#method_declaration#Left public setDrawVerticalHighlightIndicator AST#parameter_list#Left ( AST#parameter#Left enabled : 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#type_annotation#Left AST#primary_type#L... | public setDrawVerticalHighlightIndicator(enabled: boolean): void {
this.mDrawVerticalHighlightIndicator = enabled;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineScatterCandleRadarDataSet.ets#L52-L54 | 2716aeca188d7e0e1e69f44da7769107ebdb7b8a | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPVersionUtils.ets | arkts | compareVersion | 版本号比较
@param version1
@param version2
@return | public static compareVersion(version1: string, version2: string): number {
try {
if (!version1 || !version2) {
DMPLogger.e(Tags.BUNDLE, "compareVersion version is undefined")
return 0
}
if (version1 === version2) {
return 0;
}
//处理第四位_情况
version1 = version... | AST#method_declaration#Left public static compareVersion AST#parameter_list#Left ( AST#parameter#Left version1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left version2 : AST#type_annotation#Left AST#primary_type#Left strin... | public static compareVersion(version1: string, version2: string): number {
try {
if (!version1 || !version2) {
DMPLogger.e(Tags.BUNDLE, "compareVersion version is undefined")
return 0
}
if (version1 === version2) {
return 0;
}
version1 = version1.replace(... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPVersionUtils.ets#L39-L88 | 99e67261dbba4c8630f8a7d26e93ab18d268627f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | offBLEDeviceFind | 取消订阅查找蓝牙设备 | private offBLEDeviceFind() {
try {
ble.off('BLEDeviceFind');
} catch (err) {
Log.showError(TAG, `offBLEDeviceFind: err = ${err}`);
}
} | AST#method_declaration#Left private offBLEDeviceFind AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ... | private offBLEDeviceFind() {
try {
ble.off('BLEDeviceFind');
} catch (err) {
Log.showError(TAG, `offBLEDeviceFind: err = ${err}`);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L228-L234 | 2541aa22653175318be89731e8cab8a1793bea22 | gitee |
Delsin-Yu/JustPDF.git | d53f566e02820dac46e1752151750144acbed50a | entry/src/main/ets/components/Numbers.ets | arkts | Convert Vector2 from viewport units to pixels | export function vpToPx(v: Vector2, uiContext: UIContext): Vector2 {
return Vec2(uiContext.vp2px(v.x), uiContext.vp2px(v.y));
} | AST#export_declaration#Left export AST#function_declaration#Left function vpToPx AST#parameter_list#Left ( AST#parameter#Left v : AST#type_annotation#Left AST#primary_type#Left Vector2 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#prim... | export function vpToPx(v: Vector2, uiContext: UIContext): Vector2 {
return Vec2(uiContext.vp2px(v.x), uiContext.vp2px(v.y));
} | https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/Numbers.ets#L40-L42 | 4e6b9943952d08249b2f46adfb8c4459435ea00d | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets | arkts | CommonItemColorSelect | Select Color
@param color change color | @Component
export struct CommonItemColorSelect {
@Link selectColor: Resource;
@State selectIndex: number = 0;
private testId: string = 'test_colorSelect';
private name: Resource = $r('app.string.divider_color_blue');
private isItemStyle: boolean = true;
private colorNames: ValueInfo[] = [
{ value: $r('a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemColorSelect AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right selectColor : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right ... | @Component
export struct CommonItemColorSelect {
@Link selectColor: Resource;
@State selectIndex: number = 0;
private testId: string = 'test_colorSelect';
private name: Resource = $r('app.string.divider_color_blue');
private isItemStyle: boolean = true;
private colorNames: ValueInfo[] = [
{ value: $r('a... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L167-L228 | 61c0e90c9aa24f88bb5577891cdedcb4ee1a03a9 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.