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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets | arkts | getNetworkConnectionType | [Start get_network_connection_type] | getNetworkConnectionType() {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
hilog.info(0x0000, 'Sample', 'bearerTypes: %{public}s', JSON.stringify(netCa... | AST#method_declaration#Left getNetworkConnectionType 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#variable_declaration#Left let AST#variable_declarator#Left netHandle = AST#expression#Left ... | getNetworkConnectionType() {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
hilog.info(0x0000, 'Sample', 'bearerTypes: %{public}s', JSON.stringify(netCa... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets#L33-L49 | 968cc3ae553ebb1996f0895c1d8ad0c5ea863760 | gitee |
buqiuz/game-puzzle.git | 605dc0fac0738466db308a8ba255b5e9094c52ac | entry/src/main/ets/model/ImageModel.ets | arkts | getPictureFromAlbum | 从图库中选择图片然后划分 | async getPictureFromAlbum(splitCount: number): Promise<PictureItem[]> {
// 拉起相册,选择图片
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photo... | AST#method_declaration#Left async getPictureFromAlbum AST#parameter_list#Left ( AST#parameter#Left splitCount : 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#gener... | async getPictureFromAlbum(splitCount: number): Promise<PictureItem[]> {
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelper... | https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/model/ImageModel.ets#L73-L114 | 99a99ad98695ea670ea0be851e2e8585b34955d3 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets | arkts | setData | Sets a new data object for the chart. The data object contains all values
and information needed for displaying.
@param data | public setData(data: T) {
this.mData = data;
this.mOffsetsCalculated = false;
if (data == null) {
return;
}
// calculate how many digits are needed
// @ts-ignore 缺失方法
this.setupDefaultFormatter(data.getYMin(), data.getYMax());
// @ts-ignore 缺失方法
for (let item of this.mData.g... | AST#method_declaration#Left public setData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#... | public setData(data: T) {
this.mData = data;
this.mOffsetsCalculated = false;
if (data == null) {
return;
}
this.setupDefaultFormatter(data.getYMin(), data.getYMax());
for (let item of this.mData.getDataSets()) {
if (item.needsFormatter() || item.getValueFormatter()... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L209-L234 | 8863dadd7cc58f88b31d21f3072493edc85377d4 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/constants/AppConstants.ets | arkts | getCurrentTheme | 获取当前主题 | private static getCurrentTheme(): ThemeModel {
return AppThemeManager.getInstance().getCurrentTheme();
} | AST#method_declaration#Left private static getCurrentTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeModel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left ... | private static getCurrentTheme(): ThemeModel {
return AppThemeManager.getInstance().getCurrentTheme();
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/constants/AppConstants.ets#L12-L14 | 8668a370c80bfd3cebc46181f8a4dc1ed9d7ce68 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the version hash.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get buildRootHash(): string; | AST#method_declaration#Left static get AST#ERROR#Left build RootH as h AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get buildRootHash(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L371-L371 | fb19a01d3dc636580aacdfad3ab39837e741ef99 | 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/ECDSA.ets | arkts | signSegmentSync | 对数据进行分段签名,同步
@param data 待签名数据
@param priKey 私钥
@param len 自定义的数据拆分长度,此处取64
@returns | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, 'ECC256|SHA256', len);
} | AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified... | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, 'ECC256|SHA256', len);
} | 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/ECDSA.ets#L92-L94 | 5d72526173e90d97e2288fd7a643245ca7a558c0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | LoadingBuilder | LoadingDialog | @Builder
export function LoadingBuilder(options: LoadingOptions) {
LoadingView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | @Builder
export function LoadingBuilder(options: LoadingOptions) {
LoadingView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L196-L199 | 0b7db88c24369c4853d00cfcccab9fe160d8698b | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/PeerNode.ets | arkts | override | reuse and recycle object on RootPeers | override reuse(reuseKey: string, id: KoalaCallsiteKey): Disposable | undefined {
if (!this.isRootNode()) {
return this.parent?.reuse(reuseKey, id)
}
if (this._reusePool === undefined)
return undefined
if (this._reusePool!.has(reuseKey)) {
const pool =... | AST#method_declaration#Left override AST#ERROR#Left reuse AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left reuseKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type... | override reuse(reuseKey: string, id: KoalaCallsiteKey): Disposable | undefined {
if (!this.isRootNode()) {
return this.parent?.reuse(reuseKey, id)
}
if (this._reusePool === undefined)
return undefined
if (this._reusePool!.has(reuseKey)) {
const pool =... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/PeerNode.ets#L76-L88 | e665baf21019c028a1ae3b790f4e25707080a698 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/model/ImageKnifeData.ets | arkts | 解码后的图片的size | export interface DecodeImageInfo {
contentWidth ?: number // 解码后宽高
contentHeight?: number
contentSize ?: number // 大小
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DecodeImageInfo AST#object_type#Left { AST#type_member#Left contentWidth ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 解码后宽高 AST#type_member#Left contentHeigh... | export interface DecodeImageInfo {
contentWidth ?: number
contentHeight?: number
contentSize ?: number
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L40-L44 | 48d707fb0e1c8deeb1cfb57d0a99ff7a5e1e6228 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PickerUtil.ets | arkts | selectAudioCallBack | 拉起picker选择音频 - 回调方式
@param options 选择入参详见efPickerOptions 参数中只有selectCallBack使用
@returns | static async selectAudioCallBack(options?: efPickerOptions): Promise<void> {
try {
//创建picker
let context = getContext() as common.UIAbilityContext;
let audioPicker = new picker.AudioViewPicker(context);
//调起选择
audioPicker.select(new picker.AudioSelectOptions()).then((list: Array<strin... | AST#method_declaration#Left static async selectAudioCallBack AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left efPickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type... | static async selectAudioCallBack(options?: efPickerOptions): Promise<void> {
try {
let context = getContext() as common.UIAbilityContext;
let audioPicker = new picker.AudioViewPicker(context);
audioPicker.select(new picker.AudioSelectOptions()).then((list: Array<string>) => {
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L193-L211 | 07126017a0ca35be7d99ba285e89142724c74507 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | set | Set value.
@param w
@param h | set(w: number, h: number): void {
this.w = w;
this.h = h;
} | AST#method_declaration#Left set AST#parameter_list#Left ( AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left h : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annot... | set(w: number, h: number): void {
this.w = w;
this.h = h;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L42-L45 | f0e00c5f27a33fc323cefe2bdbf3479f1fb0e633 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/CategoryPage.ets | arkts | 构建分类页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.category"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightIn... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.category... | build() {
AppNavDestination({
title: $r("app.string.category"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightIn... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L37-L57 | bc94efd2e5f75caf53e7b8680dff2579c3983ab8 | github | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 按钮点击是否可点击
@param status 状态
@return 是否可点击 | export function isButtonEnable(status: number): boolean {
return OtaUpdateManager.getInstance().getStateObj(status).isButtonClickable;
} | AST#export_declaration#Left export AST#function_declaration#Left function isButtonEnable AST#parameter_list#Left ( AST#parameter#Left status : 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 ... | export function isButtonEnable(status: number): boolean {
return OtaUpdateManager.getInstance().getStateObj(status).isButtonClickable;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L71-L73 | 17292dde33c7fe622e94e9f775d8d69153ef71a0 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets | arkts | 存放区信息 | constructor(code: string = '', name: string = '', children: Region[]) {
this.code = code;
this.name = name;
this.children = children;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left A... | constructor(code: string = '', name: string = '', children: Region[]) {
this.code = code;
this.name = name;
this.children = children;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L52-L56 | 08298f993bf232602a719553f699bee0bda1deb1 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getRawFileContentStrSync | 获取resources/rawfile目录下对应的rawfile文件内容
@param path rawfile文件路径
@returns | static getRawFileContentStrSync(path: string): string {
let uint8Array = ResUtil.getRawFileContentSync(path);
return StrUtil.unit8ArrayToStr(uint8Array);
} | AST#method_declaration#Left static getRawFileContentStrSync AST#parameter_list#Left ( AST#parameter#Left path : 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 string AS... | static getRawFileContentStrSync(path: string): string {
let uint8Array = ResUtil.getRawFileContentSync(path);
return StrUtil.unit8ArrayToStr(uint8Array);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L446-L449 | 9d7f640fb31eeb207a54318d9132a87078dae642 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Default minimum width for cards in panels, like those in settings and downloads panel.
@returns 480 | export function minimum_card_width() {
return 480;
} | AST#export_declaration#Left export AST#function_declaration#Left function minimum_card_width AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 480 AST#expression#Right ; AST#return_statement#Right AST#statement#Right }... | export function minimum_card_width() {
return 480;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L57-L59 | 4f259e690fd3d0cb1209f06174d834179ae4bbc6 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets | arkts | 判断图标是否存在(因ArkTS限制,改为直接返回匹配结果)
@param name 图标名称
@returns 是否存在 | export function hasIcon(name: string): boolean {
const icon = getFunctionIconByName(name);
return icon !== AppIcons.default_icon;
} | AST#export_declaration#Left export AST#function_declaration#Left function hasIcon 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_list#Right : AST#type_annotation#Left AST#prima... | export function hasIcon(name: string): boolean {
const icon = getFunctionIconByName(name);
return icon !== AppIcons.default_icon;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L207-L210 | 601d4a2470ebed00ff04e196b6c183b7b1d6df18 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets | arkts | makeNode | 必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContianer中 在对应NodeContianer创建的时候调用、或者通过rebuild方法调用刷新 | makeNode(uiContext: UIContext): FrameNode | null {
console.info(' uicontext is undifined : '+ (uiContext === undefined));
if (this.rootnode != null) {
// 返回FrameNode节点
return this.rootnode.getFrameNode();
}
// 返回null控制动态组件脱离绑定节点
return null;
} | AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Fram... | makeNode(uiContext: UIContext): FrameNode | null {
console.info(' uicontext is undifined : '+ (uiContext === undefined));
if (this.rootnode != null) {
return this.rootnode.getFrameNode();
}
return null;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L59-L67 | d3ff786998d7ebc5970889c5a2e626e8d1d4f434 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment6.ets | arkts | getInstance | Adopting a singleton pattern avoids creating a new modifier for each component, increasing the performance overhead incurred by creating the | public static getInstance(): RowModifier {
if (!RowModifier.instance) {
RowModifier.instance = new RowModifier();
}
return RowModifier.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RowModifier 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#... | public static getInstance(): RowModifier {
if (!RowModifier.instance) {
RowModifier.instance = new RowModifier();
}
return RowModifier.instance;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment6.ets#L42-L47 | 4edf585941e11d503af76d96e1e9d92bee82b2ff | gitee |
azhuge233/Wake-HarmonyOS.git | 68c4e961f9cf5fab8699af99313dd5854ea313a1 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | alert | 按照 API 版本显示 Toast 提醒 | public alert(message: string | Resource, newerPromptAction: PromptAction) {
if(deviceInfo.sdkApiVersion <= 17) {
try {
promptAction.showToast({
message: message
});
} catch (err) {
Logger.error(this.LOG_TAG, `<alert API ... | AST#method_declaration#Left public alert AST#parameter_list#Left ( AST#parameter#Left message : 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#parameter#Right , AS... | public alert(message: string | Resource, newerPromptAction: PromptAction) {
if(deviceInfo.sdkApiVersion <= 17) {
try {
promptAction.showToast({
message: message
});
} catch (err) {
Logger.error(this.LOG_TAG, `<alert API ... | https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/common/utils/CommonUtils.ets#L25-L41 | 90523811c25c61d5425222b1460217f171169923 | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/detail/movie/MovieViewModel.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/19 22:26
@Version V1.0
@Description Movie | export class MovieViewModel extends DetailViewModel implements SimpleRepository {
async loadData(type: LoadType): Promise<Object> {
// await this.getUserItem()
try {
let movieDto = await this.repository.getMovie(this.args.id)
this.userItemDto = movieDto.data
return movieDto
} catch (err... | AST#export_declaration#Left export AST#class_declaration#Left class MovieViewModel 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_d... | export class MovieViewModel extends DetailViewModel implements SimpleRepository {
async loadData(type: LoadType): Promise<Object> {
try {
let movieDto = await this.repository.getMovie(this.args.id)
this.userItemDto = movieDto.data
return movieDto
} catch (error) {
throw error as ... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/detail/movie/MovieViewModel.ets#L12-L25 | 938ed4fdc33e4776387eba1148d0c3ca9c331055 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets | arkts | digestSHA384 | SHA384摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digestSHA384(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SHA384', resultCoding);
} | AST#method_declaration#Left static digestSHA384 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t... | static digestSHA384(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SHA384', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets#L64-L66 | 7106a39f9e8d41388b0dd551a23bc003ea07c549 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReuseFramePage.ets | arkts | aboutToReuse | 每帧最多处理的数据量 | aboutToReuse(params: Record<string, Object>): void {
hiTraceMeter.startTrace("reuse_" + (params.monthItem as Month).month, 1);
this.temp.push(params.monthItem as Month);
hiTraceMeter.finishTrace("reuse_" + (params.monthItem as Month).month, 1);
} | AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio... | aboutToReuse(params: Record<string, Object>): void {
hiTraceMeter.startTrace("reuse_" + (params.monthItem as Month).month, 1);
this.temp.push(params.monthItem as Month);
hiTraceMeter.finishTrace("reuse_" + (params.monthItem as Month).month, 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReuseFramePage.ets#L146-L150 | bfce066698bfd3e7b72b8e68b7b5e3101c1af632 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/AddBill.ets | arkts | getTodayDate | 是否显示数字键盘 获取今天的日期(格式:10/16 星期四) | getTodayDate(): string {
const today = new Date();
const month = today.getMonth() + 1;
const day = today.getDate();
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
const weekDay = weekDays[today.getDay()];
return `${month}/${day} ${weekDay}`;
} | AST#method_declaration#Left getTodayDate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left today = AS... | getTodayDate(): string {
const today = new Date();
const month = today.getMonth() + 1;
const day = today.getDate();
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
const weekDay = weekDays[today.getDay()];
return `${month}/${day} ${weekDay}`;
} | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L23-L30 | 34993ed734c367df04114965021342cfe7b064dd | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleUpdate.ets | arkts | 应用了约束60:使用export代替module.exports | export default GuildRoleUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left GuildRoleUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default GuildRoleUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildRoleUpdate.ets#L14-L14 | 5b7c42563abd4415b85a0d99d6c19a8f3c8217ab | github | |
yiyefangzhou24/hmwechat | 27d11056003843c7e331e683478720d8efa49d17 | entry/src/main/ets/default/common/components/emojiLayout.ets | arkts | searchTabContent | 搜索表情标签
Tab_item | @Builder searchTabContent(){
Column(){
TextInput({ placeholder: $r('app.string.emoji_search')})
.width('90%')
.height(30)
.type(InputType.Normal)
.fontFamily($r('sys.float.id_text_size_body1'))
.fontSize(15)
.placeholderFont({size: 15 , family: $r('sys.float.id... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right searchTabContent 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#container_content_body#Left { AST#arkts_ui... | @Builder searchTabContent(){
Column(){
TextInput({ placeholder: $r('app.string.emoji_search')})
.width('90%')
.height(30)
.type(InputType.Normal)
.fontFamily($r('sys.float.id_text_size_body1'))
.fontSize(15)
.placeholderFont({size: 15 , family: $r('sys.float.id... | https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/components/emojiLayout.ets#L103-L125 | bc0663fc86b97b2e611c843bdc2db1418b5e36e5 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/SpinType.ets | arkts | TODO Spin类型
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | export enum SpinType {
spinA,
spinB,
spinC,
spinD,
spinE,
spinF,
spinG,
spinH,
spinI,
spinJ,
spinK,
spinL,
spinM,
spinN,
spinO,
spinP,
spinQ,
spinR,
spinS,
spinT,
spinU,
spinV,
spinW,
spinX,
spinY,
spinZ
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SpinType AST#enum_body#Left { AST#enum_member#Left spinA AST#enum_member#Right , AST#enum_member#Left spinB AST#enum_member#Right , AST#enum_member#Left spinC AST#enum_member#Right , AST#enum_member#Left spinD AST#enum_member#Right , AST#enum_member#Left... | export enum SpinType {
spinA,
spinB,
spinC,
spinD,
spinE,
spinF,
spinG,
spinH,
spinI,
spinJ,
spinK,
spinL,
spinM,
spinN,
spinO,
spinP,
spinQ,
spinR,
spinS,
spinT,
spinU,
spinV,
spinW,
spinX,
spinY,
spinZ
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/SpinType.ets#L26-L53 | 59011b408738e0d8040970f549b8e32c4cd4c955 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/app.ets | arkts | Copyright (c) 2021 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 {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
onStartContinuation() {
console.info('onStartContinuation');
return true;
},
onRestoreData(data) {
console.info('onRestoreData' + data);
return true;
},
... | AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCreate AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le... | export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
onStartContinuation() {
console.info('onStartContinuation');
return true;
},
onRestoreData(data) {
console.info('onRestoreData' + data);
return true;
},
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/app.ets#L16-L38 | 86ce110622c21a8ba5bb33e2e1fdcbc541ba8227 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets | arkts | clearTempData | 每次退出选择状态就将临时数据清空 | clearTempData() {
if (this.isSelect) {
this.selectedFiles = [];
this.selectedFilesTime = '';
this.needDeleteFiles.clear();
this.needMoveFiles = [];
}
} | AST#method_declaration#Left clearTempData 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 this AST#expression#Right . isSelect AST#member_expression#Right AST#e... | clearTempData() {
if (this.isSelect) {
this.selectedFiles = [];
this.selectedFilesTime = '';
this.needDeleteFiles.clear();
this.needMoveFiles = [];
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets#L179-L186 | e2b0d4214a94ee23ecff47fd96164710693502e2 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/SysUtil.ets | arkts | getMaxWidth | 获取底部类弹框的最大宽度
@param maxWidth 默认360vp
@returns 单位vp | static getMaxWidth(maxWidth: Length = 360): number {
if (SysUtil.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') { //number
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') { //string
oldWidth = SysUtil.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 (SysUtil.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') {
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') {
oldWidth = SysUtil.getVpByStr(maxWidth);
} else ... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L126-L154 | 09438d39e9a54e29198ec098e2de647d311f3c4f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | 字体配置接口 | export interface FontConfig {
id: string;
name: string;
displayName: string;
fontFamily: string;
sizeMultiplier: number;
letterSpacing: number;
lineHeight: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FontConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#... | export interface FontConfig {
id: string;
name: string;
displayName: string;
fontFamily: string;
sizeMultiplier: number;
letterSpacing: number;
lineHeight: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L74-L82 | 7f3054fb712a887507bc0e7310e07a98671ccf93 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getNumberByName | 获取指定资源名称对应的integer数值或者float数值
@param resName 资源名称。
@returns | static getNumberByName(resName: string): number {
return ResUtil.getResourceManager().getNumberByName(resName);
} | AST#method_declaration#Left static getNumberByName AST#parameter_list#Left ( AST#parameter#Left resName : 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 number AST#prim... | static getNumberByName(resName: string): number {
return ResUtil.getResourceManager().getNumberByName(resName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L80-L82 | 524f0c7f7d655c929828004fb78501d136089d78 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | clearAllData | 清除所有数据 | private async clearAllData(): Promise<void> {
try {
promptAction.showDialog({
title: '⚠️ 危险操作',
message: '此操作将删除所有联系人和设置,且不可恢复!是否确认?',
buttons: [
{
text: '取消',
color: '#999999'
},
{
text: '确认删除',
color: '#FF6... | AST#method_declaration#Left private async clearAllData 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#... | private async clearAllData(): Promise<void> {
try {
promptAction.showDialog({
title: '⚠️ 危险操作',
message: '此操作将删除所有联系人和设置,且不可恢复!是否确认?',
buttons: [
{
text: '取消',
color: '#999999'
},
{
text: '确认删除',
color: '#FF6... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1361-L1417 | a692716034963c60b7c8dcde2878596e54542122 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/Model.ets | arkts | 我的页面-各种服务信息 | export interface MinePageCommonService{
/**
* 图标
*/
icon: string,
/**
* 标签名称
*/
label: string,
/**
* 跳转到下一页
*/
nextPage: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MinePageCommonService AST#object_type#Left { /**
* 图标
*/ AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , /**
* 标签名称
*/ AST#ty... | export interface MinePageCommonService{
icon: string,
label: string,
nextPage: string
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/Model.ets#L102-L115 | ed26cd4baac9e52931952e168ddf81aba902b5db | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | clear | 清空所有键值并 flush
@returns {Promise<void>} Promise<void> | async clear(): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.clear();
await prefs.flush();
} catch (error) {
throw this.wrapError(error, "清空偏好数据失败");
}
} | AST#method_declaration#Left async clear 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_arguments#... | async clear(): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.clear();
await prefs.flush();
} catch (error) {
throw this.wrapError(error, "清空偏好数据失败");
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L103-L111 | 1fc710b8cca908f625c884b34f8ed13e0cb453ae | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/multinavigation/source/multinavigation.ets | arkts | isColumn | Check if is column
@returns true if is column | static isColumn(): boolean {
let isColumn: boolean = false;
try {
isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED ||
display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED);
} catch (e) {
hilog.error(0x0000, TAG, 'is... | AST#method_declaration#Left static isColumn 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#variable_declaration#Left let AST#variable_declarator#Left isColumn... | static isColumn(): boolean {
let isColumn: boolean = false;
try {
isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED ||
display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED);
} catch (e) {
hilog.error(0x0000, TAG, 'is... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/multinavigation/source/multinavigation.ets#L87-L96 | 94d73a3ab70ebbbe11bb0c7528f8ffd78a9bcf84 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | isValidLunarDate | 验证农历日期是否有效
@param year 农历年
@param month 农历月
@param day 农历日
@param isLeapMonth 是否闰月
@returns 是否有效 | static isValidLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false): boolean {
if (!ComprehensiveLunarDatabase.isSupportedYear(year)) {
return false;
}
if (month < 1 || month > 12) {
return false;
}
// 检查闰月
const leapMonth = ComprehensiveLunarDatabase.ge... | AST#method_declaration#Left static isValidLunarDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | static isValidLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false): boolean {
if (!ComprehensiveLunarDatabase.isSupportedYear(year)) {
return false;
}
if (month < 1 || month > 12) {
return false;
}
const leapMonth = ComprehensiveLunarDatabase.getLeapMo... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L536-L557 | 2c56587b3ede3c06cefa692c79350983d192d316 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | 玩Android http网络请求客户端 | export class WanHttpClient extends BaseAxiosDelegate {
static readonly BASE_URL = "https://www.wanandroid.com"
static readonly TIME_OUT = 5000
configurationRequestInterceptor(): List<AxiosClientRequestInterceptor> {
let interceptors = new List()
//添加拦截器
interceptors.add(new WanRequestInterceptor())
... | AST#export_declaration#Left export AST#class_declaration#Left class WanHttpClient extends AST#type_annotation#Left AST#primary_type#Left BaseAxiosDelegate AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left static readonly BASE_URL = AST#expression#Left "https://www.wana... | export class WanHttpClient extends BaseAxiosDelegate {
static readonly BASE_URL = "https://www.wanandroid.com"
static readonly TIME_OUT = 5000
configurationRequestInterceptor(): List<AxiosClientRequestInterceptor> {
let interceptors = new List()
interceptors.add(new WanRequestInterceptor())
inte... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/WanHttpClient.ets#L33-L43 | bf7cd701a130ddb3c9628a8be4a63a9236932a2e | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/DataJson.ets | arkts | 从rawfile中addressbook.json文件中json数据解析成json字符串
@param { string } jsonFileDir - json文件路径 | export function getJsonData(jsonFileDir: string): Array<Contact> {
// 从本地文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult = textDecoder.decodeToString(ne... | AST#export_declaration#Left export AST#function_declaration#Left function getJsonData AST#parameter_list#Left ( AST#parameter#Left jsonFileDir : 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#Lef... | export function getJsonData(jsonFileDir: string): Array<Contact> {
const value = getContext().resourceManager.getRawFileContentSync(jsonFileDir);
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult = textDecoder.decodeToString(new Uint8Array(value.buffer)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/model/DataJson.ets#L8-L30 | 52bb1151bd28f953cb8c74824a224e41c9c4bb24 | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/CloudDBService.ets | arkts | 云数据库服务类
用于管理用户信息和播放历史记录 | export class CloudDBService {
private static instance: CloudDBService;
private cloudDBZone?: CloudDBZone;
private initialized: boolean = false;
// 获取单例实例
static getInstance(): CloudDBService {
if (!CloudDBService.instance) {
CloudDBService.instance = new CloudDBService();
}
return CloudDBSe... | AST#export_declaration#Left export AST#class_declaration#Left class CloudDBService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left CloudDBService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_de... | export class CloudDBService {
private static instance: CloudDBService;
private cloudDBZone?: CloudDBZone;
private initialized: boolean = false;
static getInstance(): CloudDBService {
if (!CloudDBService.instance) {
CloudDBService.instance = new CloudDBService();
}
return CloudDBService.ins... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L21-L180 | dc32cbd7e53d555efb6e8211fcabe00ec73a023b | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/MyCenterFileSearch.ets | arkts | MyCenterFileSearch | @author 惟草木之零落兮
@date 2024/5/22 15:05 | @Preview
@Component
export default struct MyCenterFileSearch{
@State @Watch("searchEvent") searchValue: string = ''
// 回调函数,回调搜索框输入的值
onResultCallBack?: (searchValue: string)=> void
controller: SearchController = new SearchController()
build() {
Row(){
Search({ value: this.s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export default struct MyCenterFileSearch AST#component_body#Left { AST#ERROR#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left "sea... | @Preview
@Component
export default struct MyCenterFileSearch{
@State @Watch("searchEvent") searchValue: string = ''
onResultCallBack?: (searchValue: string)=> void
controller: SearchController = new SearchController()
build() {
Row(){
Search({ value: this.searchValue, place... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/MyCenterFileSearch.ets#L6-L38 | 1588d44f8ec5c73f6079f4f0f2ba10ad235c138f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Consts {
/** 告警toast弹窗持续时长 */
public static readonly WARN_TOAST_DURATION: number = 800;
/** 测试用评论数量 */
public static readonly TEST_COMMENTS_COUNT: number = 10;
/** 测试用评论列表预加载数量 */
public static readonly COMMENTS_LIST_CACHE: number = 5;
/** 测试评论的默认用户名 */
public static readonly COMMEN... | AST#export_declaration#Left export default AST#class_declaration#Left class Consts AST#class_body#Left { /** 告警toast弹窗持续时长 */ AST#property_declaration#Left public static readonly WARN_TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression... | export default class Consts {
public static readonly WARN_TOAST_DURATION: number = 800;
public static readonly TEST_COMMENTS_COUNT: number = 10;
public static readonly COMMENTS_LIST_CACHE: number = 5;
public static readonly COMMENTS_DEFAULT_USERNAME: string = '买家';
public static readonly SHOP_B... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/common/Constants.ets#L16-L59 | 6f829688e219c2f7b634c3b392059141ea748b4a | gitee | |
buqiuz/Account.git | b843a38c24a833a9a4386f63cffec5fa5dadc674 | entry/src/main/ets/view/BillsListComponent.ets | arkts | BillsListComponent | 主页面组件 | @Component
export struct BillsListComponent {
@Link listData: Array<BillItem> ;
private time:string ='';
private timeUtil:TimeUtil =new TimeUtil();
@State isInsert: boolean = false;
@Link isEdit: boolean ;
@State index: number = -1;
@Link deleteList: Array<BillItem> ;
@Link uniqueTimes: Array<string> ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BillsListComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right listData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_a... | @Component
export struct BillsListComponent {
@Link listData: Array<BillItem> ;
private time:string ='';
private timeUtil:TimeUtil =new TimeUtil();
@State isInsert: boolean = false;
@Link isEdit: boolean ;
@State index: number = -1;
@Link deleteList: Array<BillItem> ;
@Link uniqueTimes: Array<string> ... | https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/entry/src/main/ets/view/BillsListComponent.ets#L12-L38 | 58764d9945c4d939abc2548c6172c806c39dbffe | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | scaleRectBasedOnPoint | Scale rectangle by points.
@param rect
@param p
@param scale | static scaleRectBasedOnPoint(rect: RectF, p: Point, scale: number): void {
let operate: RectF = rect;
operate.left = (rect.left - p.x) * scale + p.x;
operate.right = (rect.right - p.x) * scale + p.x;
operate.top = (rect.top - p.y) * scale + p.y;
operate.bottom = (rect.bottom - p.y) * scale + p.y;
... | AST#method_declaration#Left static scaleRectBasedOnPoint AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left Point AST#primary... | static scaleRectBasedOnPoint(rect: RectF, p: Point, scale: number): void {
let operate: RectF = rect;
operate.left = (rect.left - p.x) * scale + p.x;
operate.right = (rect.right - p.x) * scale + p.x;
operate.top = (rect.top - p.y) * scale + p.y;
operate.bottom = (rect.bottom - p.y) * scale + p.y;
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L137-L144 | e593df5b57d799d1bc70e25252d70d9b2e9d258e | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/KMP.ets | arkts | search | 使用 KMP 算法在文本中搜索模式串
@param text 要搜索的文本
@param pattern 要查找的模式串
@returns 模式串在文本中的起始位置,如果未找到则返回 -1 | public static search(text: string, pattern: string): number {
if (!text || !pattern || pattern.length > text.length) {
return -1;
}
const lps = KMP.computeLPS(pattern);
let i = 0; // 文本索引
let j = 0; // 模式串索引
while (i < text.length) {
if (pattern[j] === text[i]) {
i++;
... | AST#method_declaration#Left public static search 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 pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | public static search(text: string, pattern: string): number {
if (!text || !pattern || pattern.length > text.length) {
return -1;
}
const lps = KMP.computeLPS(pattern);
let i = 0;
let j = 0;
while (i < text.length) {
if (pattern[j] === text[i]) {
i++;
j++;
}... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L12-L39 | 716189dd384ff63229d6b834ed0f955846ed1352 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | requestRepository | 子类必须实现此方法,返回网络请求 Promise
@returns {Promise<NetworkResponse<T>>} 网络请求 Promise | protected abstract requestRepository(): Promise<NetworkResponse<T>>; | AST#method_declaration#Left protected abstract requestRepository 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 AST#generic_type#Left NetworkResponse AST#type_arg... | protected abstract requestRepository(): Promise<NetworkResponse<T>>; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L33-L33 | fcc6542c92d19f7397bf21f7295a54896a985d01 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets | arkts | getWifiStatus | [Start get_wifi_status] | getWifiStatus() {
try {
let isWifiActive = wifiManager.isWifiActive();
hilog.info(0x0000, 'Sample', 'isWifiActive: %{public}s', isWifiActive);
// [StartExclude get_wifi_status]
this.textArea = 'isWifiActive:' + isWifiActive;
// [EndExclude get_wifi_status]
} catch (error) {
h... | AST#method_declaration#Left getWifiStatus 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#variable_declaration#Left let AST#variable_declarator#Left isWifiActive = AST#expression#Left AST#call... | getWifiStatus() {
try {
let isWifiActive = wifiManager.isWifiActive();
hilog.info(0x0000, 'Sample', 'isWifiActive: %{public}s', isWifiActive);
this.textArea = 'isWifiActive:' + isWifiActive;
} catch (error) {
hilog.error(0x0000, 'Sample', 'failed: err->: %{public}s', JSON.s... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets#L30-L40 | a170b92ad504a605b8b13979e7bf7983a7068ea9 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets | arkts | computeAxis | Computes the axis values.
@param yMin - the minimum y-value in the data object for this axis
@param yMax - the maximum y-value in the data object for this axis | public computeAxis(yMin: number, yMax: number, inverted: boolean) {
if (!this.mTrans || !this.mViewPortHandler) {
return;
}
// calculate the starting and entry point of the y-labels (depending on
// zoom / contentrect bounds)
if (this.mViewPortHandler.contentHeight() > 10 && !this.mViewPortHa... | AST#method_declaration#Left public computeAxis AST#parameter_list#Left ( AST#parameter#Left yMin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yMax : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | public computeAxis(yMin: number, yMax: number, inverted: boolean) {
if (!this.mTrans || !this.mViewPortHandler) {
return;
}
if (this.mViewPortHandler.contentHeight() > 10 && !this.mViewPortHandler.isFullyZoomedOutX()) {
let p1: MPPointD = this.mTrans.getValuesByTouchPoint(this.mViewP... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets#L45-L72 | 705dff242c741171acc51b6138d85f38ab3d0929 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/IndexFind.ets | arkts | IndexFind | @author 2008
@datetime 2024/6/26 23:55
@className: RefreshComponent
发现入口 | @Component
@Entry
@Preview
export default struct IndexFind {
private scrollController: Scroller = new Scroller();
titleArray: Array<string> = ['小说', '漫画', '有声书']
@State currentIndex: number = 0
tabsController: TabsController = new TabsController();
@StorageLink('topRectHeight') topRectHeight: number = 0
@St... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Preview AST#decorator#Right export default struct IndexFind AST#component_body#Left { AST#property_declaration#Left private scrollController : AST#type_annotation#... | @Component
@Entry
@Preview
export default struct IndexFind {
private scrollController: Scroller = new Scroller();
titleArray: Array<string> = ['小说', '漫画', '有声书']
@State currentIndex: number = 0
tabsController: TabsController = new TabsController();
@StorageLink('topRectHeight') topRectHeight: number = 0
@St... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/IndexFind.ets#L23-L206 | b09bea87e61a1adc3bc4e3d60afe0e636730a526 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history.ets | arkts | year_month_to_string | Statics
Connects a year and a month to string.
@param year A number, the year.
@param month A number, the month.
@returns A string, in the format (year - month). | static year_month_to_string(year: number, month: number) {
return "(" + year.toString() + " - " + month.toString() + ")"
} | AST#method_declaration#Left static year_month_to_string AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | static year_month_to_string(year: number, month: number) {
return "(" + year.toString() + " - " + month.toString() + ")"
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L140-L142 | 9f0408f571b7a9261fbf35cfda058c6f74241765 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | sessionFlowFn | 会话流程 | async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput,
previewOutput: camera.PreviewOutput, photoOutput: camera.PhotoOutput | undefined,
videoOutput: camera.VideoOutput | undefined): Promise<void> {
try {
// 创建CaptureSession实例
if (this.curSceneMode === camera.S... | AST#method_declaration#Left async sessionFlowFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ca... | async sessionFlowFn(cameraManager: camera.CameraManager, cameraInput: camera.CameraInput,
previewOutput: camera.PreviewOutput, photoOutput: camera.PhotoOutput | undefined,
videoOutput: camera.VideoOutput | undefined): Promise<void> {
try {
if (this.curSceneMode === camera.SceneMode.NORMAL_PHOTO... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L500-L549 | fd3280aedff76d85de9d2c471207abb12f20f10c | gitee |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/ArticleContentApi.type.ets | arkts | 分页查询文章内容 | export interface ArticleContentPageParam extends PageParam {
/**
* 标题
*/
title?: string
/**
* 内容分类:1鸿蒙 2 Java 3 web 4 运维
*/
contentCategory?: string
/**
* 平台分类:1学习平台 2面试题
*/
platformCategory?: string
/**
* 难度分类:1 简单 2 中等 3 困难
*/
difficultyCategory?: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ArticleContentPageParam AST#extends_clause#Left extends PageParam AST#extends_clause#Right AST#object_type#Left { /**
* 标题
*/ AST#type_member#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#... | export interface ArticleContentPageParam extends PageParam {
title?: string
contentCategory?: string
platformCategory?: string
difficultyCategory?: string
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/ArticleContentApi.type.ets#L43-L60 | 2826026644be66668191d3ac51ed74e39aa3f650 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets | arkts | aboutToAppear | ************************************build********************************************* | aboutToAppear(): void {
this.getGraphData()
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
this.getGraphData()
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets#L183-L185 | 42fbd9aa5359e1090ab037d878168a5db2900e5c | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | scrollToBottom | 滚动消息列表到最底部,以备显示最新消息。 | scrollToBottom() {
this.scroller.scrollEdge(Edge.Bottom);
} | AST#method_declaration#Left scrollToBottom AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left th... | scrollToBottom() {
this.scroller.scrollEdge(Edge.Bottom);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L190-L192 | 54c1822bbbeef608ac831c9e7f743ab662a1a84c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | generateSymKey | 生成对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的对称密钥 | static async generateSymKey(symAlgName: string): Promise<OutDTO<string>> {
// 创建对称密钥生成器
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseSymKey = await symKeyGenerator.generateSymKey();
//转换成可以读懂的字符串
let key = StrAndUintUtil.unitArray2String(prom... | AST#method_declaration#Left static async generateSymKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen... | static async generateSymKey(symAlgName: string): Promise<OutDTO<string>> {
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
let promiseSymKey = await symKeyGenerator.generateSymKey();
let key = StrAndUintUtil.unitArray2String(promiseSymKey.getEncoded().data);
return Ou... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L88-L97 | 181dc070d9a7f883a2593e0d6d0642e0f761beb5 | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Sub.ets | arkts | listItemStyle | 自定义样式:listItem | @Styles listItemStyle() {
.width('90%')
.height(60)
.backgroundColor('#FFFFFF')
.borderRadius(8)
.padding({ left: 20, right: 20})
.margin({ top: 10, bottom: 10})
.shadow({
radius: 8,
color: '#9E9E9E',
offsetX: 2,
offsetY: 6
}) // 阴影
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right listItemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#e... | @Styles listItemStyle() {
.width('90%')
.height(60)
.backgroundColor('#FFFFFF')
.borderRadius(8)
.padding({ left: 20, right: 20})
.margin({ top: 10, bottom: 10})
.shadow({
radius: 8,
color: '#9E9E9E',
offsetX: 2,
offsetY: 6
})
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Sub.ets#L38-L51 | dc78b4332e8710b923cb06931fd9708bad7ce186 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets | arkts | baseNameWithInnerExtension | / 获取主名+第一层扩展名(去除最外层扩展) / - "Book.sqlite" → "Book" / - "Book.sqlite.zip" → "Book.sqlite" | static baseNameWithInnerExtension(value: string): string {
const parts: string[] = value.split(".");
if (parts.length <= 1) {
return value;
}
return parts.slice(0, parts.length - 1).join(".");
} | AST#method_declaration#Left static baseNameWithInnerExtension AST#parameter_list#Left ( AST#parameter#Left value : 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 string... | static baseNameWithInnerExtension(value: string): string {
const parts: string[] = value.split(".");
if (parts.length <= 1) {
return value;
}
return parts.slice(0, parts.length - 1).join(".");
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L49-L55 | 668e94ed38c2054b1de191cc10f262e640fd6e68 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | translate | Post-translates to the specified points. Less Performant.
@param transformedPts
@return | public translate(transformedPts: number[], outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix();
save.reset();
save.set(this.mMatrixTouch);
const x: number = transformedPts[0] - this.offsetLeft();
const y: number = tra... | AST#method_declaration#Left public translate AST#parameter_list#Left ( AST#parameter#Left transformedPts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputMatrix ? : AST#typ... | public translate(transformedPts: number[], outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix();
save.reset();
save.set(this.mMatrixTouch);
const x: number = transformedPts[0] - this.offsetLeft();
const y: number = tra... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ViewPortHandler.ets#L299-L308 | aa47f1ea96e5ec91d153e948ccb8639eec74a8b6 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/InterpolationSearch.ets | arkts | findLast | 查找最后一个等于目标值的元素
@param arr 已排序的数组
@param target 目标值
@returns 最后一个等于目标值的元素索引,如果不存在则返回-1 | public static findLast(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
let result = -1;
while (left <= right && target >= arr[left] && target <= arr[right]) {
if (left === right) {
if (arr[left]... | AST#method_declaration#Left public static findLast AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#... | public static findLast(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
let result = -1;
while (left <= right && target >= arr[left] && target <= arr[right]) {
if (left === right) {
if (arr[left]... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/InterpolationSearch.ets#L139-L169 | 88e74ac11b4165b6e1ecb3a249ca6c7ed670ce41 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/analytics/ReportsPage.ets | arkts | buildHeader | 构建标题栏 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
if (this.sh... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
if (this.sh... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/ReportsPage.ets#L81-L186 | 7a9d1abbcaad342c1ef7a95b5380adad2ff678c3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/DataFactory.ets | arkts | 获取ChatModel的模拟数据列表 | export async function getChatModelObjFromJSON(MockDataFileDir: string): Promise<Array<ChatModel>> {
Logger.info(TAG, 'getChatModelObjFromJSON');
let jsonObj: JsonObject = new JsonObject(MockDataFileDir);
return await jsonObj.getChatModelObj(MockDataFileDir);
} | AST#export_declaration#Left export AST#function_declaration#Left async function getChatModelObjFromJSON AST#parameter_list#Left ( AST#parameter#Left MockDataFileDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A... | export async function getChatModelObjFromJSON(MockDataFileDir: string): Promise<Array<ChatModel>> {
Logger.info(TAG, 'getChatModelObjFromJSON');
let jsonObj: JsonObject = new JsonObject(MockDataFileDir);
return await jsonObj.getChatModelObj(MockDataFileDir);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/DataFactory.ets#L68-L72 | 76c663b7c36c6476ada14797d2d07a3b7f0fe6f9 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/RegexUtils.ets | arkts | isDigits | 检查字符串是否只包含数字字符
@param str - 要检查的字符串
@returns 如果字符串只包含数字则返回 true,否则返回 false | static isDigits(str: string): boolean {
if (typeof str !== 'string' || str.length === 0) {
return false;
}
return RegexUtils.isMatch(str, RegexUtils.REG_NUMBERS);
} | AST#method_declaration#Left static isDigits 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 AST#primary_type#Left boolean AST#primary_type#R... | static isDigits(str: string): boolean {
if (typeof str !== 'string' || str.length === 0) {
return false;
}
return RegexUtils.isMatch(str, RegexUtils.REG_NUMBERS);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/RegexUtils.ets#L208-L213 | 43f8a3b7f22c8e22f4f789ab2a8e447479c19c1e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | equal | 判断两个传入的数值或者是字符串是否相等
@param source
@param target
@returns | static equal(source: string | number, target: string | number): boolean {
return source === target;
} | AST#method_declaration#Left static equal AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p... | static equal(source: string | number, target: string | number): boolean {
return source === target;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L222-L224 | 4df44ff06492583114c2bae2d70cc64d2578be98 | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 用户搜索请求参数 | export interface UserSearchParams {
keyword: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserSearchParams AST#object_type#Left { AST#type_member#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declarat... | export interface UserSearchParams {
keyword: string;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L190-L192 | 600d3ed5dcb7c3b71145080cd725d009389a9c0b | github | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | searchEpisodes | 搜索单集(数据库查询) | async searchEpisodes() {
if (!this.episodeSearchKeyword || this.episodeSearchKeyword.trim() === '') {
return;
}
this.isSearching = true;
try {
const result = await this.dbService.searchEpisodes(
this.episodeSearchKeyword.trim(),
0,
this.episodesPageSize
);
... | AST#method_declaration#Left async searchEpisodes 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#ex... | async searchEpisodes() {
if (!this.episodeSearchKeyword || this.episodeSearchKeyword.trim() === '') {
return;
}
this.isSearching = true;
try {
const result = await this.dbService.searchEpisodes(
this.episodeSearchKeyword.trim(),
0,
this.episodesPageSize
);
... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L220-L242 | b2fd6631893211ac69f35c64bb690e826828e173 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/view/GroupHeaderBuilder.ets | arkts | 定义一个构建器函数,用于生成分组表头 | @Builder
export default function groupHeader(accounts: Array<Account>) {
// 创建横向布局
Row() {
// 显示日期信息
Text(formatDateTime(accounts[0].date, 'yyyy.MM.dd'))
.fontColor($r('app.color.black'))
.fontSize($r('app.float.font_size_M'));
// 创建横向布局,用于显示支出、收入、结余的统计信息
Row() {
// 显示支出总额
T... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expre... | @Builder
export default function groupHeader(accounts: Array<Account>) {
Row() {
Text(formatDateTime(accounts[0].date, 'yyyy.MM.dd'))
.fontColor($r('app.color.black'))
.fontSize($r('app.float.font_size_M'));
,用于显示支出、收入、结余的统计信息
Row() {
Text('支 ' + totalAmount(accounts, 0))... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/GroupHeaderBuilder.ets#L10-L46 | c72878d300bb90d4a415c879507ae9b6203b4a0a | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets | arkts | onLoadMore | 加载更多 | onLoadMore() {
if (this.isRefreshing || this.isLoadingMore || !this.hasMoreData) {
return;
}
this.loadData(false);
} | AST#method_declaration#Left onLoadMore 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression... | onLoadMore() {
if (this.isRefreshing || this.isLoadingMore || !this.hasMoreData) {
return;
}
this.loadData(false);
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets#L133-L138 | 3412062a3fdba945f72590d469cb03cd00657c32 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 上传相关事件 | export class uploadEvent {
/**
* 监听上传进度
*/
onUploadProgress: (progress: number) => void = (progress: number) => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class uploadEvent AST#class_body#Left { /**
* 监听上传进度
*/ AST#property_declaration#Left onUploadProgress : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_ty... | export class uploadEvent {
onUploadProgress: (progress: number) => void = (progress: number) => {
};
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L123-L129 | 2f4253694ffee1828c498ceff80f2670c5d1838b | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/pages/Index.ets | arkts | [End use_the_native_interface_to_bind_arkweb] | build() {
Column() {
Row() {
Button('runJS hello')
.fontSize(12)
.onClick(() => {
testNapi.runJavaScript(this.webTag, 'runJSRetStr(\"" + "hello" + "\")');
})
}.height('20%')
Row() {
Web({ src: $rawfile('runJS.html'), controller: this.contr... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Button('runJS hello')
.fontSize(12)
.onClick(() => {
testNapi.runJavaScript(this.webTag, 'runJSRetStr(\"" + "hello" + "\")');
})
}.height('20%')
Row() {
Web({ src: $rawfile('runJS.html'), controller: this.contr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/pages/Index.ets#L51-L70 | 3607be4e6c7a9a3e9f0eb5f65bae6b81b29731b4 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | drawYLabels | draws the y-labels on the specified x-position
@param fixedPosition
@param positions | protected drawYLabels(c: CanvasRenderingContext2D, fixedPosition: number, positions: number[], offset: number, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
// let paints:Paint[] = [];
if (!this.mYAxis) {
return;
}
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
... | AST#method_declaration#Left protected drawYLabels AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fixedPosition : AST#type_annotation#Left AST#primary_type#L... | protected drawYLabels(c: CanvasRenderingContext2D, fixedPosition: number, positions: number[], offset: number, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
if (!this.mYAxis) {
return;
}
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
const to = this.mYAxis.i... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRenderer.ets#L201-L229 | d868425d9001a3cfe57319c4745b371745014676 | gitee |
hefengbao/jingmo-for-HarmonyOS.git | a208f3fdc95c0914749072e811301b9dfd6678d6 | features/settings/src/main/ets/pages/SettingPage.ets | arkts | dialogBuilder | 选中项索引 | @Builder
dialogBuilder(): void {
SelectDialogV2({
title: '请选择模式', // 必选标题
selectedIndex: this.themeMode, // 当前选中项
confirm: new AdvancedDialogV2Button({
content: '取消',
action: () => {
},
}),
radioContent: [
{
title: '跟随系统',
action: (... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dialogBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element... | @Builder
dialogBuilder(): void {
SelectDialogV2({
title: '请选择模式',
selectedIndex: this.themeMode,
confirm: new AdvancedDialogV2Button({
content: '取消',
action: () => {
},
}),
radioContent: [
{
title: '跟随系统',
action: () => {
... | https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/features/settings/src/main/ets/pages/SettingPage.ets#L17-L78 | cde9fc41e32531791692917ab192f0cc0eeefdf1 | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/AddAccount.ets | arkts | aboutToAppear | 是否为信用账户 | async aboutToAppear() {
// 获取路由参数
const params = router.getParams() as Record<string, string>;
if (params) {
this.selectedType = params['name'] || '';
this.selectedIcon = params['iconText'] || '';
this.selectedColor = params['iconColor'] || '#5B7FFF';
this.isCredit = params['isCredit... | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取路由参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left A... | async aboutToAppear() {
const params = router.getParams() as Record<string, string>;
if (params) {
this.selectedType = params['name'] || '';
this.selectedIcon = params['iconText'] || '';
this.selectedColor = params['iconColor'] || '#5B7FFF';
this.isCredit = params['isCredit'] === 't... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddAccount.ets#L21-L33 | 318aa5ab17ffabd2ad904ab70820f071f81b5781 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/ImageUtil.ets | arkts | pixelMap2Base64Str | PixelMap转图片base64字符串
@param pixelMap
@param format 目标格式,默认png,只支持jpg、webp和png。
@returns 转换后的结果 | static async pixelMap2Base64Str(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<OutDTO<string>> {
try {
//创建操作对象
let packOpts: image.PackingOption = { format: format, quality: 100 }
//pixelMap转arrayBuffer
const arrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, form... | AST#method_declaration#Left static async pixelMap2Base64Str AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left f... | static async pixelMap2Base64Str(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<OutDTO<string>> {
try {
let packOpts: image.PackingOption = { format: format, quality: 100 }
const arrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, format);
if (arrayBuffer.get... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L129-L150 | 868b3e004e46455f6947fdaa79abd6221f069d33 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | offCameraStatusChange | Stop listening to camera status changes
@returns No return value | offCameraStatusChange(): void {
Logger.info(TAG, 'offCameraStatusChange is called');
this.cameraManager?.off('cameraStatus', this.registerCameraStatusChange);
} | AST#method_declaration#Left offCameraStatusChange 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#ex... | offCameraStatusChange(): void {
Logger.info(TAG, 'offCameraStatusChange is called');
this.cameraManager?.off('cameraStatus', this.registerCameraStatusChange);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L606-L609 | 1c0bc6d6c8ac09e692b778fb50a9a39ddfbf7af1 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | toDateString_YTT | 获取相对于今天的日期字符串
如果是今天、昨天、明天,则返回对应本地化字符串
否则返回 "YYYY-MM-DD" 格式
@param date 目标日期 | static toDateString_YTT(date: Date): string {
const today = new Date();
// 只保留年月日
const daysToNow = DateUtils.daysTo(date, today);
if (daysToNow === 0) {
return getString($r("app.string.common_date_str_today")); // 今天
} else if (daysToNow === 1) {
return getString($r("app.string.common... | AST#method_declaration#Left static toDateString_YTT AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | static toDateString_YTT(date: Date): string {
const today = new Date();
const daysToNow = DateUtils.daysTo(date, today);
if (daysToNow === 0) {
return getString($r("app.string.common_date_str_today"));
} else if (daysToNow === 1) {
return getString($r("app.string.common_date_str_yest... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L115-L130 | 42422996401763549fc187410f791240674da5f0 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/TabsSample/entry/src/main/ets/pages/functionalScenes/FunctionalScenes.ets | arkts | buildReadMeSheet | 帮助功能:半模态弹窗显示对应案例README | @Builder
buildReadMeSheet(): void {
Column() {
Row() {
Row() {
Text(this.listData.name)
.textOverflow({ overflow: TextOverflow.Clip } as TextOverflowOptions)
.fontColor(Color.White)
.fontWeight(700)
.fontSize($r('app.integer.nav_destination_t... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildReadMeSheet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_elem... | @Builder
buildReadMeSheet(): void {
Column() {
Row() {
Row() {
Text(this.listData.name)
.textOverflow({ overflow: TextOverflow.Clip } as TextOverflowOptions)
.fontColor(Color.White)
.fontWeight(700)
.fontSize($r('app.integer.nav_destination_t... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/pages/functionalScenes/FunctionalScenes.ets#L287-L329 | 9e33e43e54a5d86efc1b6612aae3101692f989d8 | gitee |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/net/wanAPI/interceptors/WanRequestInterceptor.ets | arkts | 玩安卓发 | export class WanRequestInterceptor implements AxiosClientRequestInterceptor {
onFulfilled(config: InternalAxiosRequestConfig) {
//配置Cookie
if (globalVM_User.hasLogged()) {
let cookie = globalVM_User.getCookie()
config.headers.set('Cookie', cookie)
}
return config
}
} | AST#export_declaration#Left export AST#class_declaration#Left class WanRequestInterceptor AST#implements_clause#Left implements AxiosClientRequestInterceptor AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left onFulfilled AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotatio... | export class WanRequestInterceptor implements AxiosClientRequestInterceptor {
onFulfilled(config: InternalAxiosRequestConfig) {
if (globalVM_User.hasLogged()) {
let cookie = globalVM_User.getCookie()
config.headers.set('Cookie', cookie)
}
return config
}
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/interceptors/WanRequestInterceptor.ets#L8-L17 | 8f4f6bbc2b62b5a09747e0949155b7fffeb28273 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | 用户统计接口 | export interface UserStatistics {
totalPosts: number;
totalLikes: number;
totalComments: number;
totalShares: number;
totalFollowers: number;
totalFollowing: number;
totalBirthdays: number;
joinDays: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserStatistics AST#object_type#Left { AST#type_member#Left totalPosts : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalLikes : AST#type_an... | export interface UserStatistics {
totalPosts: number;
totalLikes: number;
totalComments: number;
totalShares: number;
totalFollowers: number;
totalFollowing: number;
totalBirthdays: number;
joinDays: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L35-L44 | 0d7d9f6e1a61bc7b449e51f532fd1999165d0c3e | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Rect.ets | arkts | Create a new rectangle with the specified coordinates. Note: no range
checking is performed, so the caller must ensure that left <= right and
top <= bottom.
@param left The X coordinate of the left side of the rectangle
@param top The Y coordinate of the top of the rectangle
@param right The X coordinate of the ... | constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) {
this.left = left == undefined ? 0 : left
this.top = top == undefined ? 0 : top;
this.right = right == undefined ? 0 : right;
this.bottom = bottom == undefined ? 0 : bottom;
if (r != null || r != undefined) {
... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left left ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left top ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) {
this.left = left == undefined ? 0 : left
this.top = top == undefined ? 0 : top;
this.right = right == undefined ? 0 : right;
this.bottom = bottom == undefined ? 0 : bottom;
if (r != null || r != undefined) {
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L40-L51 | 3707e776f974c7c9eacc3708b1c7eae46a79b642 | gitee | |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/Logger.ets | arkts | console.log() | export class Logger {
domain: number
tag: string
format: string
constructor | AST#export_declaration#Left export AST#ERROR#Left class Logger { domain AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left tag : string for mat AST#ERROR#Right : string AST#ERROR#Right AST#variable_declaration#Left const... | export class Logger {
domain: number
tag: string
format: string
constructor | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Logger.ets#L4-L9 | c4f5904ec0339fdbd8fb8655e0483cf7e94131cd | github | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | Index.ets | arkts | FFMpegUtils | FFmpeg 原生封装 | export { FFMpegUtils, FFmpegCommandOptions } from './src/main/ets/ffmpeg/FFMpegUtils'; | AST#export_declaration#Left export { FFMpegUtils , FFmpegCommandOptions } from './src/main/ets/ffmpeg/FFMpegUtils' ; AST#export_declaration#Right | export { FFMpegUtils, FFmpegCommandOptions } from './src/main/ets/ffmpeg/FFMpegUtils'; | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L27-L27 | f1e7062f7a1285576620f69530ab0f95171ac8c7 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getSignatureInfoSync | 获取应用包的签名信息
@returns | static getSignatureInfoSync(): bundleManager.SignatureInfo {
return AppUtils.getBundleInfoSync().signatureInfo
} | AST#method_declaration#Left static getSignatureInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . SignatureInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#sta... | static getSignatureInfoSync(): bundleManager.SignatureInfo {
return AppUtils.getBundleInfoSync().signatureInfo
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L106-L108 | e7af10fdb6e9bc8efbf01580dd0a20938eb8f477 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | textPickerDialog | Text dialog dialog | textPickerDialog(sexArray: Resource, sexCallback: (sexValue: string) => void) {
if (this.isEmptyArr(sexArray)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'sex is null');
return;
}
TextPickerDialog.show({
range: sexArray,
selected: 0,
onAccept: (result: TextPickerResult) =... | AST#method_declaration#Left textPickerDialog AST#parameter_list#Left ( AST#parameter#Left sexArray : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sexCallback : AST#type_annotation#Left AST#function_type#Left AST#paramet... | textPickerDialog(sexArray: Resource, sexCallback: (sexValue: string) => void) {
if (this.isEmptyArr(sexArray)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'sex is null');
return;
}
TextPickerDialog.show({
range: sexArray,
selected: 0,
onAccept: (result: TextPickerResult) =... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L76-L91 | 5af29cc53cae9fcc7c43b2d137ba7fa5d9b56bb2 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets | arkts | isSelectRows | Check whether there are selected rows. | isSelectRows(): boolean {
return this.selectArray.filter((selected: boolean) => selected === true).length !== 0;
} | AST#method_declaration#Left isSelectRows 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#binary_expression... | isSelectRows(): boolean {
return this.selectArray.filter((selected: boolean) => selected === true).length !== 0;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets#L166-L168 | ca0309c2d2ecf22b43c540f55eed717ee1b6b4c4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/modalwindow/src/main/ets/ModalWindow.ets | arkts | ModalWindowComponent | 功能描述:全屏登录页面:在主页面点击跳转到全屏登录页后,显示全屏模态页面,全屏模态页面从下方滑出并覆盖整个屏幕,模态页面内容自定义,此处分为默认一键登录方式和其他登录方式。
推荐场景:需要登录场景的app
核心组件:
1. DefaultLogin
实现步骤:
1. 模态转场是新的界面覆盖在旧的界面上,旧的界面不消失的一种转场方式。
2. 通过bindContentCover属性为Button组件绑定全屏模态页面,点击Button后显示模态页面,模态页面内容自定义,包含默认一键登录页面和其他登录方式页面。 | @Component
export struct ModalWindowComponent {
// 是否显示全屏模态页面
@State isPresent: boolean = false;
@Builder
loginBuilder() {
Column() {
DefaultLogin({ isPresentInLoginView: this.isPresent }) // 通过@State和@Link使isPresentInLoginView和isPresent产生关联
}
}
build() {
Column() {
// TODO:需求:增加其他... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ModalWindowComponent AST#component_body#Left { // 是否显示全屏模态页面 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPresent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | @Component
export struct ModalWindowComponent {
@State isPresent: boolean = false;
@Builder
loginBuilder() {
Column() {
DefaultLogin({ isPresentInLoginView: this.isPresent })
}
}
build() {
Column() {
Button($r('app.string.modalwindow_full_screen_modal_login_description'))
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/modalwindow/src/main/ets/ModalWindow.ets#L32-L71 | f0ec326fe6249af3ef21a8c0f2e8a01bbbd4899e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileSizeUtils.ets | arkts | 文件大小工具类
提供额外的文件大小相关功能 | export class FileSizeUtils {
/**
* 格式化文件大小(带单位)
* @param bytes - 字节数
* @param decimalPlaces - 小数位数 (默认1位)
* @returns 格式化的字符串
*/
static formatBytes(bytes: number, decimalPlaces: number = 1): string {
if (bytes === 0) return '0B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB']... | AST#export_declaration#Left export AST#class_declaration#Left class FileSizeUtils AST#class_body#Left { /**
* 格式化文件大小(带单位)
* @param bytes - 字节数
* @param decimalPlaces - 小数位数 (默认1位)
* @returns 格式化的字符串
*/ AST#method_declaration#Left static formatBytes AST#parameter_list#Left ( AST#parameter#Left bytes : AS... | export class FileSizeUtils {
static formatBytes(bytes: number, decimalPlaces: number = 1): string {
if (bytes === 0) return '0B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixe... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileSizeUtils.ets#L5-L46 | 119b447c726849b58f9b668d2c5fbb73a1068539 | github | |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/appsampled/data/User.ets | arkts | Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | export default class User{
private username: string;
private userIcon: Resource;
constructor(username: string, userIcon: Resource) {
this.username = username;
this.userIcon = userIcon;
}
public getUsername(): string{
return this.username;
}
public setUsername(username: string){
this.user... | AST#export_declaration#Left export default AST#class_declaration#Left class User AST#class_body#Left { AST#property_declaration#Left private username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left pr... | export default class User{
private username: string;
private userIcon: Resource;
constructor(username: string, userIcon: Resource) {
this.username = username;
this.userIcon = userIcon;
}
public getUsername(): string{
return this.username;
}
public setUsername(username: string){
this.user... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/User.ets#L15-L36 | b73100275c3fd2be19b8470b70ad2d0ac6a0d1c7 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets | arkts | getCigenWordsByText | ============================================================ 根据英文查询词根 ============================================================ | async getCigenWordsByText(enText: string): Promise<Array<CigenWord> | null> {
if (!this.db) return null;
const encoded = StringEncoder.encodedToBase64(enText);
if (!encoded) return null;
const sql = `
SELECT
a.${CigenTable.CWord.idx} AS CWord_idx,
a.${CigenTable.CWord.cid} ... | AST#method_declaration#Left async getCigenWordsByText AST#parameter_list#Left ( AST#parameter#Left enText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async getCigenWordsByText(enText: string): Promise<Array<CigenWord> | null> {
if (!this.db) return null;
const encoded = StringEncoder.encodedToBase64(enText);
if (!encoded) return null;
const sql = `
SELECT
a.${CigenTable.CWord.idx} AS CWord_idx,
a.${CigenTable.CWord.cid} ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L90-L115 | 0085a0bd7dca5b496b5106ecb1af9b0e6a3e9d6a | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PreviewUtil.ets | arkts | previewHtml | 预览网页
@param uri 预览uri | static async previewHtml(uri: string): Promise<void> {
await PreviewUtil.openPreview('html', uri);
} | AST#method_declaration#Left static async previewHtml AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | static async previewHtml(uri: string): Promise<void> {
await PreviewUtil.openPreview('html', uri);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L43-L45 | b5413ab3d7e451e36d84e3049dfd34b00ed88c49 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | removeLimitLine | Removes the specified LimitLine from the axis.
@param l | public removeLimitLine(l: LimitLine): void {
this.mLimitLines.remove(l);
} | AST#method_declaration#Left public removeLimitLine AST#parameter_list#Left ( AST#parameter#Left l : AST#type_annotation#Left AST#primary_type#Left LimitLine 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 removeLimitLine(l: LimitLine): void {
this.mLimitLines.remove(l);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L469-L471 | f2958523383849632d89ffb338a0be170c5684f9 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets | arkts | deleteFile | 删除文件
@param path 文件绝对路径 | static deleteFile(path: string): void {
fs.unlinkSync(path);
} | AST#method_declaration#Left static deleteFile AST#parameter_list#Left ( AST#parameter#Left path : 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 void AST#primary_type#R... | static deleteFile(path: string): void {
fs.unlinkSync(path);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L48-L50 | d3fc0ca555fd4f2c005da6f0dde88d2e75f89949 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | lstat | 获取链接文件信息,使用Promise异步回调。
@param path string 文件的应用沙箱路径。
@returns | static lstat(path: string): Promise<fs.Stat> {
return fs.lstat(path);
} | AST#method_declaration#Left static lstat AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promis... | static lstat(path: string): Promise<fs.Stat> {
return fs.lstat(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L717-L719 | c32750244014e2481a8aaf81b50a5b195a65b36d | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/pages/VerifyPage.ets | arkts | onVerifySuccess | 验证成功处理 | onVerifySuccess() {
Logger.info('验证码验证成功,登录流程完成!');
// 更新全局登录状态
AppStorage.setOrCreate<boolean>(LoginConstants.LOGIN_STATUS_KEY, true);
// 显示成功提示
promptAction.showToast({
message: '登录成功!欢迎来到溪村园区',
duration: 2000
});
// 销毁子窗口
this.windowModel.destroySubWindow();
} | AST#method_declaration#Left onVerifySuccess 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 Logger AST#expression#Right . info AST#member_ex... | onVerifySuccess() {
Logger.info('验证码验证成功,登录流程完成!');
AppStorage.setOrCreate<boolean>(LoginConstants.LOGIN_STATUS_KEY, true);
promptAction.showToast({
message: '登录成功!欢迎来到溪村园区',
duration: 2000
});
this.windowModel.destroySubWindow();
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/VerifyPage.ets#L67-L81 | d0427dddd4799d12efeba6fd4336f0d17aa69496 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | mime_types/src/main/ets/Mime.ets | arkts | contentType | 根据文件名的后缀名获取MIME类型
@param fileExtention 文件后缀名,例如:html txt .doc .ts .mp3
@returns MIME类型名称,输出:text/html | static contentType(fileExtention: string): string {
const typeDescriptor = Mime.getTypeDescriptorByFileExtension(fileExtention);
const mimeTypes = typeDescriptor.mimeTypes;
if (mimeTypes && mimeTypes.length > 0) {
return mimeTypes[0];
} else {
return '*/*';
}
} | AST#method_declaration#Left static contentType AST#parameter_list#Left ( AST#parameter#Left fileExtention : 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 string AST#pr... | static contentType(fileExtention: string): string {
const typeDescriptor = Mime.getTypeDescriptorByFileExtension(fileExtention);
const mimeTypes = typeDescriptor.mimeTypes;
if (mimeTypes && mimeTypes.length > 0) {
return mimeTypes[0];
} else {
return '*/*';
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L39-L47 | d1ec4f642f367efad5e87f8d9b457e5c77aa885d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/book/CategoryManager.ets | arkts | 分类数据模型 | export class CategoryManager {
private static instance: CategoryManager;
private categories: Category[] = [];
private constructor() {}
public static get shared(): CategoryManager {
if (!CategoryManager.instance) {
CategoryManager.instance = new CategoryManager();
}
return CategoryManager.ins... | AST#export_declaration#Left export AST#class_declaration#Left class CategoryManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left CategoryManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_... | export class CategoryManager {
private static instance: CategoryManager;
private categories: Category[] = [];
private constructor() {}
public static get shared(): CategoryManager {
if (!CategoryManager.instance) {
CategoryManager.instance = new CategoryManager();
}
return CategoryManager.ins... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L18-L95 | 1b4db5c0ab4eecb2d3c983251ee16838d9b68fa9 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationUtil.ets | arkts | cancelNotificationById | cancel notification by id | async cancelNotificationById(id: number) {
try {
await notificationManager.cancel(id);
Logger.info(TAG, `cancel success`);
} catch (err) {
if (err) {
Logger.info(TAG, `cancel err ${JSON.stringify(err)}`);
}
}
} | AST#method_declaration#Left async cancelNotificationById 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#block_statement#Left { AST#statement#Left AST#try_statement... | async cancelNotificationById(id: number) {
try {
await notificationManager.cancel(id);
Logger.info(TAG, `cancel success`);
} catch (err) {
if (err) {
Logger.info(TAG, `cancel err ${JSON.stringify(err)}`);
}
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationUtil.ets#L70-L79 | d34979298aef5836d70babe7076d5ac63b09ad28 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | aboutToAppear | 页面生命周期 - 即将出现 | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SearchPage aboutToAppear');
this.loadSearchHistory();
// 获取路由参数
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
const searchType = paramsRecord.searchType;
if... | AST#method_declaration#Left aboutToAppear 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 hilog AST#expression#Right . info AST#member_expre... | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SearchPage aboutToAppear');
this.loadSearchHistory();
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
const searchType = paramsRecord.searchType;
if (searchT... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L43-L54 | 9b2e4265d65da39860ff96068a8305583b5b133c | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets | arkts | wait4ServerResponse | 等待服务器响应 | async wait4ServerResponse() {
while (!this.isServerResponse) {
await sleep(100)
}
} | AST#method_declaration#Left async wait4ServerResponse AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression... | async wait4ServerResponse() {
while (!this.isServerResponse) {
await sleep(100)
}
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets#L331-L335 | 334617ce199baac6f5d8d9e697983277ff841c04 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/ReminderScheduler.ets | arkts | getContactReminders | 获取指定联系人的提醒 | getContactReminders(contactId: string): ReminderConfig[] {
return Array.from(this.activeReminders.values()).filter(
config => config.contactId === contactId
);
} | AST#method_declaration#Left getContactReminders AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#L... | getContactReminders(contactId: string): ReminderConfig[] {
return Array.from(this.activeReminders.values()).filter(
config => config.contactId === contactId
);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L466-L470 | bd09d79f6a91d097c825b44faf2edd57fab5609d | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static decodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, dataCoding);
} | AST#method_declaration#Left static decodeCBC 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L232-L235 | b5e15c3e076817adaf3dfec16134b473e7882c93 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.