nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/collect/nullPage.ets | arkts | NullPage | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NullPage {
@Prop ratio: number
@Prop str: string
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(this.str)
.fontSize(15 * this.ratio)
.fontColor(Color.Grey)
.margin({ top: 10 })
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NullPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right ratio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#R... | @Component
export struct NullPage {
@Prop ratio: number
@Prop str: string
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(this.str)
.fontSize(15 * this.ratio)
.fontColor(Color.Grey)
.margin({ top: 10 })
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/collect/nullPage.ets#L16-L32 | 289a248c6ee00807fe4b05cce74e9323f120ef17 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/KvUtil.ets | arkts | delete | 删除数据
@param key 删除的key
@returns 结果 | async delete(key: string): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.delete(key);
return "删除数据:" + key + "成功~";
}
return "用户禁止授权,删除失败~";
} | AST#method_declaration#Left async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise... | async delete(key: string): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.delete(key);
return "删除数据:" + key + "成功~";
}
return "用户禁止授权,删除失败~";
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L140-L147 | ccafe5df422ebf2ef2fb7f31906ca3ee1023c526 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | ============================================================ EncourageType:激励类型枚举 ============================================================ | export enum EncourageType {
wordPronRewardAd = "wordPronRewardAd", // 激励广告奖励发音次数
wordPronShareApp = "wordPronShareApp" // 分享应用奖励发音次数
} | AST#export_declaration#Left export AST#enum_declaration#Left enum EncourageType AST#enum_body#Left { AST#enum_member#Left wordPronRewardAd = AST#expression#Left "wordPronRewardAd" AST#expression#Right AST#enum_member#Right , // 激励广告奖励发音次数 AST#enum_member#Left wordPronShareApp = AST#expression#Left "wordPronShareApp" AS... | export enum EncourageType {
wordPronRewardAd = "wordPronRewardAd",
wordPronShareApp = "wordPronShareApp"
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L19-L22 | 66f6be9cc1b457082a59046b566a85e44dca2a63 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets | arkts | 商品列表数据源 | export const PRODUCT_DATA: Array<ProductDataModel> = [
new ProductDataModel(0, $r("app.media.component_stack_product00"), $r("app.string.component_stack_product_title00"), $r("app.string.component_stack_product_price00"), $r("app.string.component_stack_product_insurance00")),
new ProductDataModel(1, $r("app.media.c... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PRODUCT_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ProductDataModel AST#primary_type#Right AST#type_annotati... | export const PRODUCT_DATA: Array<ProductDataModel> = [
new ProductDataModel(0, $r("app.media.component_stack_product00"), $r("app.string.component_stack_product_title00"), $r("app.string.component_stack_product_price00"), $r("app.string.component_stack_product_insurance00")),
new ProductDataModel(1, $r("app.media.c... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets#L38-L45 | f3aac107483572b5fa811b4dca511144bdb6f5dd | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Player.ets | arkts | Player | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Component
export default struct Player {
@StorageProp('fontSize') fontSize: number = 0
build() {
Row() {
Image($r('app.media.pic_music_cover'))
.height(32)
.width(32)
.borderRadius(5)
.margin({ right: 12 })
Column() {
Text($r('app.string.song_name'))
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Player AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'fontSize' AST#expression#Right ) AST#decorator#Right fontSize : AST#type_annotation#Left A... | @Component
export default struct Player {
@StorageProp('fontSize') fontSize: number = 0
build() {
Row() {
Image($r('app.media.pic_music_cover'))
.height(32)
.width(32)
.borderRadius(5)
.margin({ right: 12 })
Column() {
Text($r('app.string.song_name'))
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Player.ets#L16-L62 | 12f4f6b5bb63c743a210f1893f386ada1998c715 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LIstOptimizationBak/entry/src/main/ets/model/TabBarModel.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 interface TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
animationIcon: ResourceStr;
defaultIcon: ResourceStr;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TabBarData AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left... | export interface TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
animationIcon: ResourceStr;
defaultIcon: ResourceStr;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LIstOptimizationBak/entry/src/main/ets/model/TabBarModel.ets#L16-L22 | 0b7d01bc05d504531f3e50c6a7a5ca77cf80d8ac | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionAdd.ets | arkts | handle | 根据实际Client类型替换any | handle(data: ReactionData): { message: any | null, reaction: any | null, user: any | null } {
// 应用约束10:使用具体类型替代any
const user = this.client.users.get(data.user_id) as any | null;
if (!user) return { message: null, reaction: null, user: null };
// 应用约束22:显式类型转换
const channel = t... | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ReactionData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#statement#Lef... | handle(data: ReactionData): { message: any | null, reaction: any | null, user: any | null } {
const user = this.client.users.get(data.user_id) as any | null;
if (!user) return { message: null, reaction: null, user: null };
const channel = this.client.channels.get(data.channel_... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionAdd.ets#L17-L39 | ddcc7788989d11870107269c6ac954adb06468a8 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets | arkts | scaleImage | 缩放图片大小为原来的1/2 | private scaleImage() {
if (this.pixelMap != undefined) {
// [Start pixelmap_scale_image]
// 宽为原来的0.5
// 高为原来的0.5
this.pixelMap.scale(0.5, 0.5).then(() => {
this.updateImageInfo();
})
// [End pixelmap_scale_image]
}
} | AST#method_declaration#Left private scaleImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressio... | private scaleImage() {
if (this.pixelMap != undefined) {
this.pixelMap.scale(0.5, 0.5).then(() => {
this.updateImageInfo();
})
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L241-L251 | 70065d6f048049e4a8323eb10f6eca809602cc62 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
} | AST#method_declaration#Left static encodeCBC 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets#L72-L75 | c5a8c8465ff44d284bd7f00cebecdd8624cafcc0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 开发者配置接口 | export interface DeveloperConfig {
debugMode: boolean;
enableLogging: boolean;
logLevel: LogLevel;
showPerformanceMetrics: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DeveloperConfig AST#object_type#Left { AST#type_member#Left debugMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left enableLogging : AST#typ... | export interface DeveloperConfig {
debugMode: boolean;
enableLogging: boolean;
logLevel: LogLevel;
showPerformanceMetrics: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L115-L120 | a8928d00c38f3b74187a862a667eeacf50afe295 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderListPage.ets | arkts | OrderListPage | @file 订单列表页面视图
@author Joker.X | @ComponentV2
export struct OrderListPage {
/**
* 订单列表页面 ViewModel
*/
@Local
private vm: OrderListViewModel = new OrderListViewModel();
/**
* 列表滚动控制器
*/
private listScroller: Scroller = new Scroller();
/**
* 构建订单列表页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
ti... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderListPage AST#component_body#Left { /**
* 订单列表页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left OrderL... | @ComponentV2
export struct OrderListPage {
@Local
private vm: OrderListViewModel = new OrderListViewModel();
private listScroller: Scroller = new Scroller();
build() {
AppNavDestination({
title: $r("app.string.order_list"),
viewModel: this.vm
}) {
BaseNetWorkListView({
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderListPage.ets#L12-L104 | 0dab370722c46d831d9ca0f9c2e8de037e37763f | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_hvigor/entry/src/main/ets/MainAbility/themes/checkSystemTokens/CheckColorTokens.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, softw... | export class ColorsValues {
public readonly brand: string = 'sys.color.brand';
public readonly warning: string = 'sys.color.warning' ;
public readonly alert: string = 'sys.color.alert';
public readonly confirm: string = 'sys.color.confirm';
public readonly fontPrimary: string = 'sys.color.font_primary';
pub... | AST#export_declaration#Left export AST#class_declaration#Left class ColorsValues AST#class_body#Left { AST#property_declaration#Left public readonly brand : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.brand' AST#expression#Right... | export class ColorsValues {
public readonly brand: string = 'sys.color.brand';
public readonly warning: string = 'sys.color.warning' ;
public readonly alert: string = 'sys.color.alert';
public readonly confirm: string = 'sys.color.confirm';
public readonly fontPrimary: string = 'sys.color.font_primary';
pub... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_hvigor/entry/src/main/ets/MainAbility/themes/checkSystemTokens/CheckColorTokens.ets#L15-L67 | 9c407b0a7014ab539a2fa8aa143455b50554a717 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets | arkts | 定义图标映射类 | export class IconMapping {
defaultIcon = $r('app.media.default_icon');
} | AST#export_declaration#Left export AST#class_declaration#Left class IconMapping AST#class_body#Left { AST#property_declaration#Left defaultIcon = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.default_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ;... | export class IconMapping {
defaultIcon = $r('app.media.default_icon');
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L10-L12 | 79bfef680a0aa716e932d7d577d1cc780bd0f70d | github | |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/component/src/main/ets/default/switchComponent.ets | arkts | SwitchComponent | Toggle component | @Component
export default struct SwitchComponent {
@Link isOn: boolean;
@State isEnabled?: boolean = true;
private title: string | Resource = '';
private controller?: SwitchController;
private summary?: string | Resource = '';
private switchHeight: string | number | Resource = '';
build() {
Row() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SwitchComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isOn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#ty... | @Component
export default struct SwitchComponent {
@Link isOn: boolean;
@State isEnabled?: boolean = true;
private title: string | Resource = '';
private controller?: SwitchController;
private summary?: string | Resource = '';
private switchHeight: string | number | Resource = '';
build() {
Row() {
... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/switchComponent.ets#L22-L93 | f3a96b21e21a39c4b87ce76e8814638690e0465b | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/LotteryDialog.ets | arkts | LotteryDialog | 抽奖弹窗 | @Component
export struct LotteryDialog {
@State icon: ResourceStr = ''
//关闭弹窗
@State closeDialog: boolean = true
@State lottery_status: number = 0
@State type: string = 'lottery_result_notice'
@Consume lotteryPush: VHLotteryResultNoticeModel | null
@Prop LotteryCarryOut: VHLotteryCarryOut = new VHLotteryC... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LotteryDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_an... | @Component
export struct LotteryDialog {
@State icon: ResourceStr = ''
@State closeDialog: boolean = true
@State lottery_status: number = 0
@State type: string = 'lottery_result_notice'
@Consume lotteryPush: VHLotteryResultNoticeModel | null
@Prop LotteryCarryOut: VHLotteryCarryOut = new VHLotteryCarryOu... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/LotteryDialog.ets#L20-L37 | eb13b81a0ca153316e10941f9cc100c0dda9df72 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets | arkts | @Author csx
@DateTime 2024/3/20 21:19
@TODO DynamicUtil 动态协商工具类 | export class DynamicSyncUtil {
/**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 共享密钥
*/
static... | AST#export_declaration#Left export AST#class_declaration#Left class DynamicSyncUtil AST#class_body#Left { /**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCod... | export class DynamicSyncUtil {
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: number, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
let pubKeyArray: Uint8Array = new Uint8Array();
let p... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L28-L103 | f24bb20e44650a98370b88c7927d8330094d00e4 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets | arkts | 查询当前是尺寸 | export function getImgSize(imageSize: image.Size, rotate: number,
dimensionWH: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT): number {
const isStandardRotation = [90, 270].includes(Math.abs(rotate % 360));
const Key =
isStandardRotation ? (dimensionWH == ImageFitType.TYPE_WIDTH ? ImageFitType.TYPE_HEIGH... | AST#export_declaration#Left export AST#function_declaration#Left function getImgSize AST#parameter_list#Left ( AST#parameter#Left imageSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ... | export function getImgSize(imageSize: image.Size, rotate: number,
dimensionWH: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT): number {
const isStandardRotation = [90, 270].includes(Math.abs(rotate % 360));
const Key =
isStandardRotation ? (dimensionWH == ImageFitType.TYPE_WIDTH ? ImageFitType.TYPE_HEIGH... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets#L105-L113 | af7eded4f10e5818171f6017c83129d6321f8fbd | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets | arkts | onWindowStageCreate | [Start soft_keyboard_entryability] | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
let keyboardAvoidMode = windowStage.getMainWindowSync().... | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
let keyboardAvoidMode = windowStage.getMainWindowSync().getUIContext().getKeyboardAvoidMode();
windo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L30-L44 | 234851f9294ac96c24ffdcb98db5d43aefdbdb26 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showToastTip | 显示带图形吐司
@param options | static showToastTip(options: ToastTipOptions) {
ActionParameter.initToastTipDefault(options);
options.dialogId = DialogHelper.generateId();
ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ToastTipBuilder), options);
let timeID = setTimeout(() => {
DialogHelper.closeDialog(options.dialogI... | AST#method_declaration#Left static showToastTip AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastTipOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#... | static showToastTip(options: ToastTipOptions) {
ActionParameter.initToastTipDefault(options);
options.dialogId = DialogHelper.generateId();
ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ToastTipBuilder), options);
let timeID = setTimeout(() => {
DialogHelper.closeDialog(options.dialogI... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L432-L440 | ddbbac2bf64327cdaa1d922528e887edb06076b4 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | updateUserAccount | 更新用户账号 | updateUserAccount(account: string): void {
if (account && account.trim().length > 0) {
this.userInfo.account = account.trim();
console.info(`用户账号ID已更新为: ${account}`);
}
} | AST#method_declaration#Left updateUserAccount AST#parameter_list#Left ( AST#parameter#Left account : 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_typ... | updateUserAccount(account: string): void {
if (account && account.trim().length > 0) {
this.userInfo.account = account.trim();
console.info(`用户账号ID已更新为: ${account}`);
}
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L170-L175 | eae9e990f3b9d774a875aa2c1a830d4bcc07528b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | disconnect | 断开连接 | disconnect() {
Log.showInfo(TAG, `disconnect`);
this.disconnectInner(this.mGattClientDevice!);
} | AST#method_declaration#Left disconnect 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 Log AST#expression#Right . showInfo AST#member_expres... | disconnect() {
Log.showInfo(TAG, `disconnect`);
this.disconnectInner(this.mGattClientDevice!);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L144-L147 | 90fc9898287e278b265becb8f2056647cbd89600 | gitee |
HarmonyCandies/like_button.git | c3928cbfd952bd3dec41a9937faa518295ea6464 | like_button/src/main/ets/common/Color.ets | arkts | / convert from dart Color | export class DartColor {
readonly value: number;
constructor(value: number) {
// this.value = value & 0xFFFFFFFF;
// 强制转换为无符号32位整数
this.value = value >>> 0;
}
static fromARGB(a: number, r: number, g: number, b: number): DartColor {
let value =
((a & 0xff) << 24) |
((r & 0xff) <... | AST#export_declaration#Left export AST#class_declaration#Left class DartColor AST#class_body#Left { AST#property_declaration#Left readonly value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left cons... | export class DartColor {
readonly value: number;
constructor(value: number) {
this.value = value >>> 0;
}
static fromARGB(a: number, r: number, g: number, b: number): DartColor {
let value =
((a & 0xff) << 24) |
((r & 0xff) << 16) |
((g & 0xff) << 8) |
(b & 0xf... | https://github.com/HarmonyCandies/like_button.git/blob/c3928cbfd952bd3dec41a9937faa518295ea6464/like_button/src/main/ets/common/Color.ets#L3-L184 | 72e4872b844d7d40d365586d95a588ac3c0d2b61 | github | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/view/ChatBubble.ets | arkts | speakMessage | 播放消息语音 | private async speakMessage(): Promise<void> {
try {
// 如果已经有TTS在播放,先停止
if (this.ttsService.isSpeakingNow()) {
await this.ttsService.stop();
this.isSpeaking = false;
this.logService.tts('停止当前播放');
return;
}
// 检查TTS是否可用
if (!this.ttsService.isAvailable()... | AST#method_declaration#Left private async speakMessage 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 speakMessage(): Promise<void> {
try {
if (this.ttsService.isSpeakingNow()) {
await this.ttsService.stop();
this.isSpeaking = false;
this.logService.tts('停止当前播放');
return;
}
if (!this.ttsService.isAvailable()) {
this.logService.tt... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ChatBubble.ets#L248-L304 | f5e61136cc6cb8c49cf9b715e1376042cec1e4e8 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/TextToSpeechService.ets | arkts | isAvailable | 检查TTS是否可用 | isAvailable(): boolean {
return this.isInitialized && this.ttsEngine !== null;
} | AST#method_declaration#Left isAvailable 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#... | isAvailable(): boolean {
return this.isInitialized && this.ttsEngine !== null;
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L379-L381 | 9a197a658ea448101e3a79adc68513ad0843fb63 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets | arkts | debug | 打印DEBUG级别日志
@param args | static debug(...args: string[]): void {
if (LogUtil.showLog) {
hilog.debug(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
} | AST#method_declaration#Left static debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | static debug(...args: string[]): void {
if (LogUtil.showLog) {
hilog.debug(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L54-L58 | 94d625dce4cc0dbe451755c5f9f1733f50766fd1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets | arkts | getWeekViewData | 获取指定周数据 | getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
} | AST#method_declaration#Left getWeekViewData AST#parameter_list#Left ( AST#parameter#Left weekNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expr... | getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L81-L83 | ad448813e33d1aae59cf3d5660dfbae6baf20176 | gitee |
hefengbao/jingmo-for-HarmonyOS.git | a208f3fdc95c0914749072e811301b9dfd6678d6 | features/classicalliterature/classicpoem/src/main/ets/model/ClassicPoem.ets | arkts | 分类 | constructor(
id: number,
dynasty: string,
writer: string,
writer_introduction: string,
title: string,
subtitle: string | null,
preface: string | null,
content: string,
annotation: string | null,
translation: string | null,
creative_background: string | null,
explain: stri... | AST#constructor_declaration#Left constructor 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#Left dynasty : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | constructor(
id: number,
dynasty: string,
writer: string,
writer_introduction: string,
title: string,
subtitle: string | null,
preface: string | null,
content: string,
annotation: string | null,
translation: string | null,
creative_background: string | null,
explain: stri... | https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/features/classicalliterature/classicpoem/src/main/ets/model/ClassicPoem.ets#L26-L58 | e97718e857f19757688404a89afcb0a20515dcf9 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | offset range | export const MAX_OFFSET_Y: number = 100; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MAX_OFFSET_Y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaratio... | export const MAX_OFFSET_Y: number = 100; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L45-L45 | 8b7e5fda9bd153ee4256a5d073b7554293f29c69 | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/model/WeatherData.ets | arkts | 天气数据类型。与高德地图天气 API 请求结果向对应。 | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/WeatherData.ets#L4-L4 | 0f0a9ff934ab8fe1e6db3e96b9c59a59cf569b61 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/plan/DayOfWordsView.ets | arkts | / 参数类型 | export interface Param {
dayOf: DayOf
plan: Plan
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Param AST#object_type#Left { AST#type_member#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left plan : AST#type_annotation#Left AST#prima... | export interface Param {
dayOf: DayOf
plan: Plan
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/plan/DayOfWordsView.ets#L47-L51 | acd00e748649718e9fffee498f50468103557f0e | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets | arkts | Resource management tool class. | export class ResourceManagerUtil {
/**
* Obtains the description of a media file.
*
* @param path Resource path.
* @param callback Callback function.
*/
public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is ... | AST#export_declaration#Left export AST#class_declaration#Left class ResourceManagerUtil AST#class_body#Left { /**
* Obtains the description of a media file.
*
* @param path Resource path.
* @param callback Callback function.
*/ AST#method_declaration#Left public static getSrcPath AST#parameter_list#Left ... | export class ResourceManagerUtil {
public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is empty.');
return;
}
try {
let resourceManager = GlobalContext.getContext()
.getObject('resourceManager')... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets#L25-L52 | 3a49a0dcc0d160f1d915482bf41375bfdf321a16 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeBanner.ets | arkts | getIndicator | 获取轮播图指示器
@returns {DotIndicator | boolean} 指示器配置 | private getIndicator(): DotIndicator | boolean {
if (this.breakpointState.isXS() || this.breakpointState.isSM()) {
return Indicator.dot()
.color($r("app.color.bg_purple_light"))
.selectedColor($r("app.color.primary"));
}
return false;
} | AST#method_declaration#Left private getIndicator AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DotIndicator AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_s... | private getIndicator(): DotIndicator | boolean {
if (this.breakpointState.isXS() || this.breakpointState.isSM()) {
return Indicator.dot()
.color($r("app.color.bg_purple_light"))
.selectedColor($r("app.color.primary"));
}
return false;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeBanner.ets#L65-L73 | 88b34ea8e8a7311d1f97a9c8da9be10d166b0442 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/SysUtil.ets | arkts | getIndicatorHeight | 获取底部导航条的高度,单位为vp。
@returns | static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHub.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.topRec... | AST#method_declaration#Left static getIndicatorHeight AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHub.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.topRec... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L86-L101 | 8bbf794cb495e0bfe5e9f83e9ac8213cf6a33bb6 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets | arkts | aboutToDisappear | [Start net_con_unregister] | aboutToDisappear(): void {
this.netCon?.unregister((error: BusinessError) => {
if (error) {
hilog.error(0x0000, 'Sample', 'unregister failed, callback: err->: %{public}s', JSON.stringify(error));
}
});
} | AST#method_declaration#Left aboutToDisappear 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#express... | aboutToDisappear(): void {
this.netCon?.unregister((error: BusinessError) => {
if (error) {
hilog.error(0x0000, 'Sample', 'unregister failed, callback: err->: %{public}s', JSON.stringify(error));
}
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L49-L55 | efb6d422b0dfeef2fb2218fe9498f2888eb4719e | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/ImageDialog.ets | arkts | initDialogDefault | ------------------------- 保护、私有方法 protected | private methods -------------------------
初始化DialogOptions参数
@param options | protected initDialogDefault(options: IImageDialogOptions) {
if (options.isOnlineImage === undefined && DownloadFileUtil.isOnlineUri(options.imageURI)) {
options.isOnlineImage = true
}
options._dialogType = 'modal'
// 未设置图片关闭,默认添加
if (options.attaches === undefined && options.isShowClose || op... | AST#method_declaration#Left protected initDialogDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IImageDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_contro... | protected initDialogDefault(options: IImageDialogOptions) {
if (options.isOnlineImage === undefined && DownloadFileUtil.isOnlineUri(options.imageURI)) {
options.isOnlineImage = true
}
options._dialogType = 'modal'
if (options.attaches === undefined && options.isShowClose || options.isShowClo... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/ImageDialog.ets#L97-L112 | 37ace723d7fa1d9a463ac3a1949dfe265c8d3b37 | github |
Duke_Bit/ElfRefresh | 56faf5431c1643ec5ae227dc854a31b391778b2c | entry/src/main/ets/components/TitleBar.ets | arkts | TitleBar | 标准头部 | @ComponentV2
export struct TitleBar {
@Param title: ResourceStr = ''
@Param right?: ResourceStr = undefined
@Param BtnStrColor?: ResourceColor = undefined
@Event onRightClick?: () => void = undefined
@Event onBackClick?: () => void = undefined
build() {
RelativeContainer() {
Button() {
Im... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_anno... | @ComponentV2
export struct TitleBar {
@Param title: ResourceStr = ''
@Param right?: ResourceStr = undefined
@Param BtnStrColor?: ResourceColor = undefined
@Event onRightClick?: () => void = undefined
@Event onBackClick?: () => void = undefined
build() {
RelativeContainer() {
Button() {
Im... | https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/entry/src/main/ets/components/TitleBar.ets#L6-L53 | d23cdffd209619ccbc19d344f548a929497ed314 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets | arkts | Declare type SelectOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type SelectOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class SelectOptions {
/**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.Ark... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class SelectOptions AST#class_body#Left { /**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* SubOption... | export declare class SelectOptions {
options: Array<SelectOption>;
selected?: number;
value?: string;
onSelect?: (index: number, value?: string) => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L135-L192 | d0109fa2fcb45f0c824bd21c2548e9e06fe61e73 | github | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/ContactPage.ets | arkts | filterContacts | 搜索联系人 | filterContacts() {
if (!this.searchText.trim()) {
this.updateContactGroups(this.allContacts);
return;
}
const keyword = this.searchText.toLowerCase();
const filtered = this.allContacts.filter(friend => {
const notation = friend.notation?.toLowerCase() || '';
const friendId = fri... | AST#method_declaration#Left filterContacts AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | filterContacts() {
if (!this.searchText.trim()) {
this.updateContactGroups(this.allContacts);
return;
}
const keyword = this.searchText.toLowerCase();
const filtered = this.allContacts.filter(friend => {
const notation = friend.notation?.toLowerCase() || '';
const friendId = fri... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L178-L192 | bde28afd630da8438bb767abe9f3ddc06609c3e5 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets | arkts | 快捷图标数据 | export const ICON_DATA1: Array<IconDataModel> = [
new IconDataModel(0, 2, $r("app.media.component_stack_ic_device_matebook_filled"), '笔记本'),
new IconDataModel(1, 2, $r("app.media.component_stack_ic_device_smartscreen_filled"), '智慧屏'),
new IconDataModel(2, 1, $r("app.media.component_stack_ic_device_soundx_filled")... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ICON_DATA1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IconDataModel AST#primary_type#Right AST#type_annotation#Ri... | export const ICON_DATA1: Array<IconDataModel> = [
new IconDataModel(0, 2, $r("app.media.component_stack_ic_device_matebook_filled"), '笔记本'),
new IconDataModel(1, 2, $r("app.media.component_stack_ic_device_smartscreen_filled"), '智慧屏'),
new IconDataModel(2, 1, $r("app.media.component_stack_ic_device_soundx_filled")... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets#L19-L26 | 107c79669b82cf00c479e920e801d085d6d8c84f | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawSliceText | Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
Deprecated -> use setDrawEntryLabels(...) instead.
@param enabled
@Deprecated | public setDrawSliceText(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | AST#method_declaration#Left public setDrawSliceText AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim... | public setDrawSliceText(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L692-L694 | d62e305d0e49a3b3e45a1904697c2f5b0db9d3a5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | buildTypingIndicator | 构建正在输入指示器 | @Builder
buildTypingIndicator() {
Row({ space: 12 }) {
Circle({ width: 32, height: 32 })
.fill($r('app.color.primary'))
.overlay(
Image($r('app.media.ic_robot'))
.width('20vp')
.height('20vp')
.fillColor(Color.White)
)
Row({ space:... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTypingIndicator 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#component_parameters#Left { AST#component_p... | @Builder
buildTypingIndicator() {
Row({ space: 12 }) {
Circle({ width: 32, height: 32 })
.fill($r('app.color.primary'))
.overlay(
Image($r('app.media.ic_robot'))
.width('20vp')
.height('20vp')
.fillColor(Color.White)
)
Row({ space:... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L332-L371 | 50d2355b27b70fd5cf019317c4930adab72ca1d1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | getGenderLabel | 获取性别标签 | private getGenderLabel(gender: Gender): string {
const labels: Record<Gender, string> = {
[Gender.MALE]: '男',
[Gender.FEMALE]: '女',
[Gender.UNKNOWN]: '未知'
};
return labels[gender] || '未知';
} | AST#method_declaration#Left private getGenderLabel AST#parameter_list#Left ( AST#parameter#Left gender : AST#type_annotation#Left AST#primary_type#Left Gender 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#prima... | private getGenderLabel(gender: Gender): string {
const labels: Record<Gender, string> = {
[Gender.MALE]: '男',
[Gender.FEMALE]: '女',
[Gender.UNKNOWN]: '未知'
};
return labels[gender] || '未知';
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L658-L665 | f9efcc6df0dd391ecf9e90ea65982819dcacd1d2 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildMemberRemove.ets | arkts | 应用约束:构造函数参数类型声明(错误1) | constructor(client: any) {
super(client);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Lef... | constructor(client: any) {
super(client);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildMemberRemove.ets#L11-L13 | 0eae79299df704a6f035241ed5eaa449c240d825 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets | arkts | getScanInfos | 扫描wifi | async getScanInfos() {
// 不停地扫描wifi
let result: wifi.WifiScanInfo[] = await wifi.getScanInfoList();
if (this.isSwitchOn) {
setTimeout(async () => {
this.wifilist = result
await this.getScanInfos();
}, 3000)
}
} | AST#method_declaration#Left async getScanInfos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 不停地扫描wifi AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left wifi AST#ERROR#Left . ... | async getScanInfos() {
let result: wifi.WifiScanInfo[] = await wifi.getScanInfoList();
if (this.isSwitchOn) {
setTimeout(async () => {
this.wifilist = result
await this.getScanInfos();
}, 3000)
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets#L32-L42 | 6f8a6162f89de10181932ef99476a896af93165f | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets | arkts | connectToWebSocket | 应用约束1:参数添加类型注解 | connectToWebSocket(token: string, resolve: (value: string) => void, reject: (reason: any) => void): void {
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
this.client.token = token;
// 应用约束26:使用箭头函数
const timeout = this.client.setTimeout(() => reject(new Error(Consta... | AST#method_declaration#Left connectToWebSocket AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resolve : AST#type_annotation#Left AST#function_type#Left AST#parameter_list... | connectToWebSocket(token: string, resolve: (value: string) => void, reject: (reason: any) => void): void {
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
this.client.token = token;
const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets#L46-L66 | 5e06433a6484b736c4521b64ade1884f06121ba2 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets | arkts | initButtonNotificationRequest | init NotificationRequest width buttons
@param notificationContent
@param notificationActionButtons
@return return the created NotificationRequest | initButtonNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationActionButtons: notificationManager.NotificationActionButton[]): notificationManager.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) { // 当前通知接口最大允... | AST#method_declaration#Left initButtonNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#para... | initButtonNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationActionButtons: notificationManager.NotificationActionButton[]): notificationManager.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) {
actio... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets#L57-L68 | c52d3c45f2035e7914e12ca929738725c9381ae6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | wifiStateObserve | WI-FI状态监听 | wifiStateObserve() {
// 注册WLAN状态改变事件
// 0,未激活;1,已激活;2,激活中;3:去激活中
wifiManager.on("wifiStateChange", (result: number) => {
logger.info("NetUtils", "wifiStateChange: " + result);
this.postEvent(NetworkEventName.WifiStateChange, result);
});
// 注册WLAN连接状态改变事件
// 0,已断开;1,已连接
wifiManag... | AST#method_declaration#Left wifiStateObserve AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 注册WLAN状态改变事件 // 0,未激活;1,已激活;2,激活中;3:去激活中 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wif... | wifiStateObserve() {
wifiManager.on("wifiStateChange", (result: number) => {
logger.info("NetUtils", "wifiStateChange: " + result);
this.postEvent(NetworkEventName.WifiStateChange, result);
});
wifiManager.on("wifiConnectionChange", (result: number) => {
logger.info("Ne... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L333-L346 | 9e5ffa3d5af13eb7a0f495670aa8392a3ba173bb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets | arkts | [Start Case3_start] Data structure of user information UserData | export interface UserData {
id: string;
username: string;
description: string;
// ...
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserData 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 username : AST#type_annotation#Left AS... | export interface UserData {
id: string;
username: string;
description: string;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets#L27-L32 | 24a296d8be8b670ff81afb25904481e3b1629d0e | gitee | |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | queueit_sdk/src/main/ets/main/QueueItEngine.ets | arkts | run | --- Public API Methods --- | public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
} | AST#method_declaration#Left public async run AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
} | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/main/QueueItEngine.ets#L73-L76 | 7fae51f8cfee3a06cea4e23ea726f26c8a8bc415 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/list/SubListOneView.ets | arkts | @Monitor('sectionWords') onChangeOfWords(){ this.indexers = this.sectionWords.allSections().map(v=>v.charAt(0).toUpperCase()) } | build() {
Stack(){
this.buildList()
if (this.indexers.length > 0){
// 字母表索引组件
Row(){
AlphabetIndexer({
arrayValue: this.indexers,
selected: this.selectedIndexOfIndexers
})
.onSelect((index: number) => {
// 点击字母时滚动到对应位... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Le... | build() {
Stack(){
this.buildList()
if (this.indexers.length > 0){
Row(){
AlphabetIndexer({
arrayValue: this.indexers,
selected: this.selectedIndexOfIndexers
})
.onSelect((index: number) => {
this.scro... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/list/SubListOneView.ets#L38-L60 | 0ab4d0d00b217834f788bf692a7a2237e9c3e45b | github | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | getFileSizeSync | 获取path的文件大小
@param path 文件绝对路径 | getFileSizeSync(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
LogUtil.error('FileUtils getFileSize e ' + e)
return -1
}
} | AST#method_declaration#Left getFileSizeSync 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 number AST#primary_type#R... | getFileSizeSync(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
LogUtil.error('FileUtils getFileSize e ' + e)
return -1
}
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L132-L140 | 4af5c250e12cac60b979597b111e455d08bb10d7 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinK.ets | arkts | SpinK | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinK {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinK AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinK {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinK.ets#L21-L354 | 9eb2af9706c1f3b05236153ee5f272f50581ad40 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | unshiftData | 向数组第一个位置插入数据 | public unshiftData(data: T): void {
this.originDataArray.unshift(data);
this.notifyDataAdd(0);
} | AST#method_declaration#Left public unshiftData 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right... | public unshiftData(data: T): void {
this.originDataArray.unshift(data);
this.notifyDataAdd(0);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L83-L86 | 98d6faa678009f0319bebe9788da2f72738b19a0 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets | arkts | Time operation tool class. | export class DateUtils {
/**
* Obtaining time.
*
* @param {number} days Days.
* @return Return the specific year, month, day, and time.
*/
getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear()... | AST#export_declaration#Left export AST#class_declaration#Left class DateUtils AST#class_body#Left { /**
* Obtaining time.
*
* @param {number} days Days.
* @return Return the specific year, month, day, and time.
*/ AST#method_declaration#Left getDate AST#parameter_list#Left ( AST#parameter#Left days : AST... | export class DateUtils {
getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets#L21-L35 | 7987296a072346904293c9dbc0d947c87c441dfc | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets | arkts | toggleLowDefinition | [Start toggle_low_definition] | toggleLowDefinition() {
this.videoSrc = $rawfile('lowQuality.mp4');
} | AST#method_declaration#Left toggleLowDefinition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoSrc AST#member_expression... | toggleLowDefinition() {
this.videoSrc = $rawfile('lowQuality.mp4');
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L126-L128 | d6310caf33da9053ce234f08426f25822acf7753 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/navigation/MainGraph.ets | arkts | register | 注册主模块导航路由
@returns {void} 无返回值 | register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
} | AST#method_declaration#Left register 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#Left... | register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/navigation/MainGraph.ets#L14-L16 | 6788baad333c42f7ec58e85e1cb8e17a9fb52059 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | mergeAccessibilitySettings | 合并无障碍设置 | private mergeAccessibilitySettings(current: AccessibilitySettings, updates: Partial<AccessibilitySettings>): AccessibilitySettings {
const result: AccessibilitySettings = {
highContrast: updates.highContrast !== undefined ? updates.highContrast : current.highContrast,
largeText: updates.largeText !== un... | AST#method_declaration#Left private mergeAccessibilitySettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#prim... | private mergeAccessibilitySettings(current: AccessibilitySettings, updates: Partial<AccessibilitySettings>): AccessibilitySettings {
const result: AccessibilitySettings = {
highContrast: updates.highContrast !== undefined ? updates.highContrast : current.highContrast,
largeText: updates.largeText !== un... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L602-L611 | 0a8964401c201c75da8dcad8a44ffd0f3621a6ff | github |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/utils/HttpUtil.ets | arkts | post | POST请求 | static post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig)... | AST#method_declaration#Left static post AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotatio... | static post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig)... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L142-L150 | f42007a9f539a102d59fd738f78e16c4aec432ce | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets | arkts | 功能数据类 | export class FeatureDataType {
image: Resource;
text: ResourceStr;
constructor(image: Resource, text: ResourceStr) {
this.image = image;
this.text = text;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class FeatureDataType AST#class_body#Left { AST#property_declaration#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left text : A... | export class FeatureDataType {
image: Resource;
text: ResourceStr;
constructor(image: Resource, text: ResourceStr) {
this.image = image;
this.text = text;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets#L46-L54 | c0423f55f6f2d9142b31898f026284ed3c241b69 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets | arkts | startServer | 启动服务器 | async startServer(serverIp: string, serverPort: number) {
let ipAddress: socket.NetAddress = {
address: serverIp,
port: serverPort
};
try {
await this.tcpServer.listen(ipAddress);
console.info('服务器启动成功');
// 服务器启动成功后的处理逻辑
this.tcpServer.on('connect', (connection: socket.T... | AST#method_declaration#Left async startServer AST#parameter_list#Left ( AST#parameter#Left serverIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serverPort : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | async startServer(serverIp: string, serverPort: number) {
let ipAddress: socket.NetAddress = {
address: serverIp,
port: serverPort
};
try {
await this.tcpServer.listen(ipAddress);
console.info('服务器启动成功');
this.tcpServer.on('connect', (connection: socket.TCPSocketConnecti... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets#L36-L60 | 4d148e4bdbc2012cf35cbd0ef6ba449278e3ea5b | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.utils.d.ets | arkts | request | Find or create an instance of AsyncLock using the specified name.
@param { string } name - name of the lock to find or create.
@returns { AsyncLock } Returns an instance of AsyncLock.
@static
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 12
Find or create an instance of AsyncLock using the specified name... | static request(name: string): AsyncLock; | AST#method_declaration#Left static request 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#primary_type#Left AsyncLock AST#primary_type... | static request(name: string): AsyncLock; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L126-L126 | 9bdc953b49477b8b127d2ce5cc8569ac47c8ccd0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | resetToDefault | 重置为默认设置
@returns 重置后的设置 | async resetToDefault(): Promise<AppSettings> {
try {
const defaultSettings = this.createDefaultSettings();
await this.saveSettings(defaultSettings);
this.settings = defaultSettings;
hilog.info(0x0001, 'BirthdayReminder', 'Settings reset to default');
return defaultSettings;
} catc... | AST#method_declaration#Left async resetToDefault 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 AppSettings AST#primary_type#Right AST#type_annotation#Right > AST... | async resetToDefault(): Promise<AppSettings> {
try {
const defaultSettings = this.createDefaultSettings();
await this.saveSettings(defaultSettings);
this.settings = defaultSettings;
hilog.info(0x0001, 'BirthdayReminder', 'Settings reset to default');
return defaultSettings;
} catc... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L343-L356 | a2f0e56d5ca328e28dcb6643cdd3b48b2559b1c9 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets | arkts | get | / 获取主名+第一层扩展名(去除最外层扩展) / - "Book.sqlite" → "Book" / - "Book.sqlite.zip" → "Book.sqlite" | get baseNameWithInnerExtension(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null;
} | AST#method_declaration#Left get AST#ERROR#Left b as eNameWithInnerExtension AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST... | get baseNameWithInnerExtension(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L28-L30 | a3c1cabc118477028c567b8964e3fc829580594f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -24 },
primaryButton: {
value: $r('app.string.cancel'),
... | AST#export_declaration#Left export AST#function_declaration#Left function showAlertDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST... | export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -24 },
primaryButton: {
value: $r('app.string.cancel'),
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets#L16-L36 | 975106eb85f6281270882282041135ce0bb9675d | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildContactsList | 联系人列表 | @Builder
buildContactsList() {
Column({ space: 16 }) {
Row() {
Text('联系人列表')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`共 ${this.getFilteredContacts().length} 人`)
.fontSize(14)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p... | @Builder
buildContactsList() {
Column({ space: 16 }) {
Row() {
Text('联系人列表')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`共 ${this.getFilteredContacts().length} 人`)
.fontSize(14)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1998-L2032 | c2f3d863bf15130647c472e74b743db5fa8793d2 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DownloadUtils.ets | arkts | onAbilityLifecycle | 注册监听应用内生命周期。 | static onAbilityLifecycle(context: common.UIAbilityContext) {
try {
const abilityLifecycleCallback: AbilityLifecycleCallback = {
onAbilityCreate: (ability: UIAbility): void => {
},
onNewWant:(ability: UIAbility): void => {
const parameters = ability.lastRequestWant.parameter... | AST#method_declaration#Left static onAbilityLifecycle AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | static onAbilityLifecycle(context: common.UIAbilityContext) {
try {
const abilityLifecycleCallback: AbilityLifecycleCallback = {
onAbilityCreate: (ability: UIAbility): void => {
},
onNewWant:(ability: UIAbility): void => {
const parameters = ability.lastRequestWant.parameter... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L39-L98 | 9e97a673e7323a11791be289c2a6acfcef39a46e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets | arkts | buttonBar | 保存或取消保存的操作栏。 | @Builder
buttonBar() {
Row() {
SaveButton({
icon: SaveIconStyle.FULL_FILLED,
text: SaveDescription.SAVE_IMAGE,
buttonType: ButtonType.Capsule
})
.onClick(async (event, result) => {
this.saveSnapshot(result);
})
.padding({
left: Consta... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buttonBar 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#L... | @Builder
buttonBar() {
Row() {
SaveButton({
icon: SaveIconStyle.FULL_FILLED,
text: SaveDescription.SAVE_IMAGE,
buttonType: ButtonType.Capsule
})
.onClick(async (event, result) => {
this.saveSnapshot(result);
})
.padding({
left: Consta... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L196-L243 | 762739e23b1fa368ab4bc475ca5fd7206b13d8d1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getTodayStr | 获取今天的时间,字符串类型
@param format 格式化字符串,(yyyy-MM-dd HH:mm:ss)
@returns | static getTodayStr(format?: string): string {
return DateUtil.getFormatDateStr(new Date(), format)
} | AST#method_declaration#Left static getTodayStr AST#parameter_list#Left ( AST#parameter#Left format ? : 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#primary... | static getTodayStr(format?: string): string {
return DateUtil.getFormatDateStr(new Date(), format)
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L100-L102 | e59fa12ba4b60f4e91685c1d4089e4a5430471e3 | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/PersonalInformation.ets | arkts | setHobbiesValue | 设置兴趣值函数,将选中的兴趣项转换为字符串。 | function setHobbiesValue(hobbyItems: HobbyItem[]): string {
if (CommonUtils.isEmptyArr(hobbyItems)) { // 如果兴趣项列表为空
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'hobbyItems length is 0'); // 记录日志
return '';
}
let hobbiesText: string = '';
// 过滤选中的兴趣项,并将其标签连接成字符串
hobbiesText = hobbyItems.fil... | AST#function_declaration#Left function setHobbiesValue AST#parameter_list#Left ( AST#parameter#Left hobbyItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HobbyItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#typ... | function setHobbiesValue(hobbyItems: HobbyItem[]): string {
if (CommonUtils.isEmptyArr(hobbyItems)) {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'hobbyItems length is 0');
return '';
}
let hobbiesText: string = '';
hobbiesText = hobbyItems.filter((isCheckItem: HobbyItem) => isCheckIte... | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L42-L54 | b92d363aad4a2e0d557dbe1b69594cb3c48b6494 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets | arkts | aboutToAppear | 页面出现时加载数据
@returns {void} 无返回值 | aboutToAppear(): void {
this.loadOrderLogistics();
super.aboutToAppear();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
this.loadOrderLogistics();
super.aboutToAppear();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets#L44-L47 | 6f84357cba99c461c9b7d43b3b5a161449b63bbc | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets | arkts | switchPlayState | Switching the Playback Status.
@param playState | switchPlayState(playState: number) {
let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController;
if (playState === PlayState.PLAY) {
this.playBarModel.playState = PlayState.PAUSE;
this.playBarModel.playStateIcon = $r('app.media.ic_pause');
playC... | AST#method_declaration#Left switchPlayState AST#parameter_list#Left ( AST#parameter#Left playState : 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#variable_declaratio... | switchPlayState(playState: number) {
let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController;
if (playState === PlayState.PLAY) {
this.playBarModel.playState = PlayState.PAUSE;
this.playBarModel.playStateIcon = $r('app.media.ic_pause');
playC... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets#L57-L72 | d7d42e07d2dd73d89bbb8562a2de8aa98846a631 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/TrainsMap.ets | arkts | TrainsMap | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Observed
export class TrainsMap {
imgBg: ImageBitmap | null = null;
interval: number = 0;
/**
* Points of train routes.
*/
lineData: Array<Position> = [];
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class TrainsMap AST#class_body#Left { AST#property_declaration#Left imgBg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ImageBitmap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#R... | @Observed
export class TrainsMap {
imgBg: ImageBitmap | null = null;
interval: number = 0;
lineData: Array<Position> = [];
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/TrainsMap.ets#L16-L24 | 0c06ebdff0907b0a8255e8e27faac9a96f739b00 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/ExceptionDialogUtil.ets | arkts | ExceptionDialogUtil | @Author csx
@DateTime 2024/3/28 10:50:03
@TODO ExceptionDialogUtil 异常提醒弹框工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | @Component
export struct ExceptionDialogUtil {
callBack: (data: string) => void = () => {
};
dialogController: CustomDialogController = new CustomDialogController({
builder: ExceptionUI({
callBack: (data: string) => {
this.callBack(data);
this.dialogController.close();
}
}),
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ExceptionDialogUtil AST#component_body#Left { AST#property_declaration#Left callBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#p... | @Component
export struct ExceptionDialogUtil {
callBack: (data: string) => void = () => {
};
dialogController: CustomDialogController = new CustomDialogController({
builder: ExceptionUI({
callBack: (data: string) => {
this.callBack(data);
this.dialogController.close();
}
}),
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/ExceptionDialogUtil.ets#L27-L57 | 848ae7b26478259665b689100aca3f49eb549a66 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets | arkts | FilterComponent | 功能描述:
1.构建多重筛选的筛选条件。
2.通过筛选条件筛选出来相关数据。
实现原理:
1.得到筛选的数据后根据点击的筛选数据行数,使用has进行if判断看是否满足多重筛选的条件。
@param {Array<OptionsInterface>} filterParam - 筛选数据(必需)
@param {boolean} isShow - 筛选卡片是否显示(必需)
@param {Array<string>} changData - 筛选出来的数据(必需)
@param {Array<number>} arrayListData - 选择的数据的行数index数组(必需)
@param {SiteListDataSourc... | @Component
export struct FilterComponent {
@State filterParam: Array<OptionsInterface> =
[new OptionsInterface('停放时间', ['白天', '夜间', '全天'], []),
new OptionsInterface('套餐类型', ['次套餐', '日套餐', '月套餐'], []),
new OptionsInterface('是否支持充电', ['是'], [])]; // 筛选数据
@Link isShow: boolean; // 筛选卡片是否显示
@Link chan... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FilterComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right filterParam : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_... | @Component
export struct FilterComponent {
@State filterParam: Array<OptionsInterface> =
[new OptionsInterface('停放时间', ['白天', '夜间', '全天'], []),
new OptionsInterface('套餐类型', ['次套餐', '日套餐', '月套餐'], []),
new OptionsInterface('是否支持充电', ['是'], [])];
@Link isShow: boolean;
@Link changData: Array<strin... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets#L48-L187 | 90cbacbc07ada76ff391aa23253552297c506235 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/Index.ets | arkts | PaletteComponent | 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 { PaletteComponent } from './src/main/ets/pages/PaletteMainPage'; | AST#export_declaration#Left export { PaletteComponent } from './src/main/ets/pages/PaletteMainPage' ; AST#export_declaration#Right | export { PaletteComponent } from './src/main/ets/pages/PaletteMainPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/Index.ets#L17-L17 | dfa662bff55cbd6f481dab13ca228fad071822d3 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/LocationUtil.ets | arkts | getGeoLocation | 获取用户当前定位-逆编码后(会申请APPROXIMATELY_LOCATION和LOCATION权限)
@returns 返回当前定位对象的json字符串 | static async getGeoLocation(): Promise<string> {
let isAuth = AuthUtil.checkPermissions('ohos.permission.APPROXIMATELY_LOCATION') &&
AuthUtil.checkPermissions('ohos.permission.LOCATION');
if (!isAuth) {
//获取用户授权
let code =
await AuthUtil.reqPermissionsList(['ohos.permission.APPROXIMATELY... | AST#method_declaration#Left static async getGeoLocation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A... | static async getGeoLocation(): Promise<string> {
let isAuth = AuthUtil.checkPermissions('ohos.permission.APPROXIMATELY_LOCATION') &&
AuthUtil.checkPermissions('ohos.permission.LOCATION');
if (!isAuth) {
let code =
await AuthUtil.reqPermissionsList(['ohos.permission.APPROXIMATELY_LOCATIO... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/LocationUtil.ets#L47-L67 | 23d25d6da561deec1391f53e3c0ed55768db197f | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getMaskedApiKey | 获取脱敏的API密钥(用于显示) | async getMaskedApiKey(): Promise<string> {
return await this.configService.getMaskedApiKey();
} | AST#method_declaration#Left async getMaskedApiKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#typ... | async getMaskedApiKey(): Promise<string> {
return await this.configService.getMaskedApiKey();
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L700-L702 | 7f9325220d00144417bb36c9773d1bc17400b31e | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/UserInfoRepository.ets | arkts | updatePassword | 更新用户密码
@param {Record<string, string>} params - 修改密码参数
@returns {Promise<NetworkResponse<Unknown>>} 更新结果 | async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.updatePassword(params);
} | AST#method_declaration#Left async updatePassword 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_a... | async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.updatePassword(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/UserInfoRepository.ets#L36-L38 | 41fbb029192152b8fd8dc6d39620122ab7f144c5 | github |
AlbertZyc/tab-layout | 4ba256eead3792c84128f8679b26ac159a2d7f06 | entry/src/main/ets/BasicDataSource.ets | arkts | unregisterDataChangeListener | 该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L30-L35 | 950ce01706897cf43097aafaf92290f7fdbdda8b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animateTo/template2/Index.ets | arkts | 向下 | build() {
Column() {
if (this.isShow) {
Column()
.width(200)
.height(this.heightSize)
.backgroundColor('blue')
.onClick(() => {
// 建议使用this.getUIContext()?.animateTo()
this.getUIContext()?.animateTo({
duration: 2000,
... | 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#express... | build() {
Column() {
if (this.isShow) {
Column()
.width(200)
.height(this.heightSize)
.backgroundColor('blue')
.onClick(() => {
this.getUIContext()?.animateTo({
duration: 2000,
curve: Curve.EaseOut,
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animateTo/template2/Index.ets#L23-L56 | 618c6edd2b275be8df0abddb49dfc37c49df2dd8 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PermissionUtil.ets | arkts | requestPermissions | 申请授权(支持权限组合)
@param permissions 需要授权的权限
@returns true表示授权成功继续业务操作,false表示用户拒绝授权 | static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
//requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
let request = await atMana... | AST#method_declaration#Left static async requestPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
let request = await atManager.requestPermissionsFromUser(context,
A... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L66-L74 | 06ac061685723f70d722ef8c5b9ced39ad72b493 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GlobalTypes.ets | arkts | 通知类型枚举 | export enum NotificationType {
BIRTHDAY = 'birthday',
ANNIVERSARY = 'anniversary',
REMINDER = 'reminder',
SYSTEM = 'system'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ANNIVERSARY = AST#expression#Left 'anniversary' AST#expression#Right AST#enum_member#Ri... | export enum NotificationType {
BIRTHDAY = 'birthday',
ANNIVERSARY = 'anniversary',
REMINDER = 'reminder',
SYSTEM = 'system'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L77-L82 | 705ad68d5e16af0f8e0ac0fa65fb340d5f606b49 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | parseJsonContent | 解析JSON内容 | private parseJsonContent() {
if (!this.jsonContent.trim()) {
this.jsonParseResult = null;
return;
}
this.jsonParseResult = JsonParser.parseJsonContent(this.jsonContent);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`JSON parsed: ${this.jsonParseResult.validRecords}/${thi... | AST#method_declaration#Left private parseJsonContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AS... | private parseJsonContent() {
if (!this.jsonContent.trim()) {
this.jsonParseResult = null;
return;
}
this.jsonParseResult = JsonParser.parseJsonContent(this.jsonContent);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`JSON parsed: ${this.jsonParseResult.validRecords}/${thi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L824-L833 | 6f4c0ca10a35d77837e7b65fc0124b66238bfe94 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets | arkts | doEntityRecognition | 智能识别 | doEntityRecognition(): void {
textProcessing.getEntity(this.recognizeText, {
entityTypes: [EntityType.NAME, EntityType.PHONE_NO, EntityType.LOCATION]
}).then(result => {
this.formatEntityResult(result);
}).catch((err: BusinessError) => {
console.error(`getEntity errorCode: ${err.code} erro... | AST#method_declaration#Left doEntityRecognition 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#expr... | doEntityRecognition(): void {
textProcessing.getEntity(this.recognizeText, {
entityTypes: [EntityType.NAME, EntityType.PHONE_NO, EntityType.LOCATION]
}).then(result => {
this.formatEntityResult(result);
}).catch((err: BusinessError) => {
console.error(`getEntity errorCode: ${err.code} erro... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L179-L193 | 9a3be85df54eaed0f87f10cb134a99fba9ff5052 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/model/src/main/ets/entity/Auth.ets | arkts | 构造函数,支持对接口返回的数据做空值兜底
@param {Partial<Auth>} data - 原始认证数据 | constructor(data?: Partial<Auth>) {
if (data) {
this.token = data.token ?? "";
this.refreshToken = data.refreshToken ?? "";
this.expire = data.expire ?? 0;
this.refreshExpire = data.refreshExpire ?? 0;
this.createdAt = data.createdAt ?? Date.now();
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | constructor(data?: Partial<Auth>) {
if (data) {
this.token = data.token ?? "";
this.refreshToken = data.refreshToken ?? "";
this.expire = data.expire ?? 0;
this.refreshExpire = data.refreshExpire ?? 0;
this.createdAt = data.createdAt ?? Date.now();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Auth.ets#L33-L41 | 0656e9ed38892b2508707e1639e938fad69062ab | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PickerUtil.ets | arkts | selectPhotoVideo | 拉起照片和视频选择 -返回值方式
@param options 选择入参详见efPickerOptions 参数中只有maxNumber使用
@returns | static async selectPhotoVideo(options?: efPickerOptions): Promise<Array<string>> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
selectOpt... | AST#method_declaration#Left static async selectPhotoVideo 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#Le... | static async selectPhotoVideo(options?: efPickerOptions): Promise<Array<string>> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
selectOpt... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L166-L186 | ee5a31b597f04d05ccaf5c3cfdbeecabf7e809c2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets | arkts | EditAddressView | 最大输入字符数
功能描述: 本示例通过使用TextPicker滑动选择文本内容组件实现三级联动选择省市区,并回填到输入框
推荐场景: 需要填写地址的场景,如:快递收获地址选择等
核心组件:
1. TextPickerView 滑动选择文本内容组件
实现步骤:
1. 初始化textPicker标题。
@example
title: string | Resource = $r('app.string.editaddress_bind_sheet_title');
2. 读取文件中的省市区json数据。
@example
async loadRegion(): Promise<void> {
try {
// 通过getR... | @Component
export struct EditAddressView {
@StorageLink('keyboardHeight') keyboardHeight: number = 0;
// 收件人输入框是否被选中
@State isClicked: boolean = false;
// 手机号输入框是否被选中
@State isClicked1: boolean = false;
// 所在地区输入框是否被选中
@State isTextViewClicked?: boolean = false;
// 详细地址输入框是否被选中
@State isClicked3: bool... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EditAddressView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'keyboardHeight' AST#expression#Right ) AST#decorator#Right keyboardHeight : AST#type_anno... | @Component
export struct EditAddressView {
@StorageLink('keyboardHeight') keyboardHeight: number = 0;
@State isClicked: boolean = false;
@State isClicked1: boolean = false;
@State isTextViewClicked?: boolean = false;
@State isClicked3: boolean = false;
@State isChecked: boolean = false;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets#L107-L591 | b2c119933516f4eb56ed8727aa0cacdd1f2e879e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 导出的祝福语条目接口(重新定义以匹配使用) | export interface ExportedGreeting {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string[];
isCustom: boolean;
usageCount: number;
rating: number;
createdAt: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ExportedGreeting 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 content : AST#type_annotation#... | export interface ExportedGreeting {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string[];
isCustom: boolean;
usageCount: number;
rating: number;
createdAt: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L322-L333 | 3b50a5de97b9cd7f06ead03eba93fe8b2320ffed | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | @file 用户足迹本地仓库,封装数据库数据源并提供业务方法。
@author Joker.X | export class FootprintRepository {
/**
* 本地数据源实例
*/
private dataSource: FootprintLocalDataSource;
/**
* 构造函数
* @param {FootprintLocalDataSource} dataSource 可选的数据源实例
*/
constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
}
... | AST#export_declaration#Left export AST#class_declaration#Left class FootprintRepository AST#class_body#Left { /**
* 本地数据源实例
*/ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left FootprintLocalDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_... | export class FootprintRepository {
private dataSource: FootprintLocalDataSource;
constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
}
addFootprint(footprint: Footprint): Promise<void> {
return this.dataSource.addFootprint(foo... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L8-L81 | 37e4669864876dd344674b8df5173ae4c3461561 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/RadarData.ets | arkts | setLabels | Sets the labels that should be drawn around the RadarChart at the end of each web line.
@param labels | setLabels(labels: string[]): void; | AST#method_declaration#Left setLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr... | setLabels(labels: string[]): void; | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/RadarData.ets#L43-L43 | 6f7ff2564f45fe04175819dc61c9a1198e93dedb | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 选择器选项接口 | export interface SelectOption {
label: string;
value: string | number;
disabled?: boolean;
icon?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SelectOption AST#object_type#Left { AST#type_member#Left label : 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 value : AST#type_annotation#Lef... | export interface SelectOption {
label: string;
value: string | number;
disabled?: boolean;
icon?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L146-L151 | de8df7e34b2b41f9642c173b526ca2dfa3a60b12 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | AI模型配置接口 | export interface AIModelConfig {
id: string;
name: string;
provider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
isDefault: boolean;
enabled: boolean;
createdAt: string... | AST#export_declaration#Left export AST#interface_declaration#Left interface AIModelConfig 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 A... | export interface AIModelConfig {
id: string;
name: string;
provider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
isDefault: boolean;
enabled: boolean;
createdAt: string... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L487-L503 | 201395148a103fc9319017e83ecdefb27513bc90 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GlobalTypes.ets | arkts | 区域接口 | export interface Area extends Position, Size {} | AST#export_declaration#Left export AST#interface_declaration#Left interface Area AST#extends_clause#Left extends Position , Size AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface Area extends Position, Size {} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L132-L132 | 62d063d97750da871cf20ba3b5a480e26669ebcc | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets | arkts | buildBodyContent | 构造上传文本文件的body内容 | buildBodyContent(boundary: string, fileName: string, content: string) {
let body = `--${boundary}\r\n`
body = body + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
body = body + `Content-Type: text/plain\r\n`
body = body + '\r\n'
body = body + content
body = body + '\r... | AST#method_declaration#Left buildBodyContent AST#parameter_list#Left ( AST#parameter#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | buildBodyContent(boundary: string, fileName: string, content: string) {
let body = `--${boundary}\r\n`
body = body + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
body = body + `Content-Type: text/plain\r\n`
body = body + '\r\n'
body = body + content
body = body + '\r... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets#L101-L111 | 71420987cf737efb990ca42f84e17c1cfcc30e5c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | TODO number工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class NumberUtil {
/**
* 检查值是否为NaN
* @param value
* @returns
*/
static isNaN(value: Any): boolean {
return Number.isNaN(value);
}
/**
* 检查值是否为有限数字
* @param value
* @returns
*/
static isFinite(value: Any): boolean {
return Number.isFinite(value);
}
/**
* 检查值是否为... | AST#export_declaration#Left export AST#class_declaration#Left class NumberUtil AST#class_body#Left { /**
* 检查值是否为NaN
* @param value
* @returns
*/ AST#method_declaration#Left static isNaN AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#... | export class NumberUtil {
static isNaN(value: Any): boolean {
return Number.isNaN(value);
}
static isFinite(value: Any): boolean {
return Number.isFinite(value);
}
static isInteger(value: Any): boolean {
return Number.isInteger(value);
}
static isSafeInteger(value: Any): boole... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L27-L244 | 7908bb4ba3f3000bcdfb9815a44331ecbbb58ab5 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | loadCalendarData | 加载日历数据 | private async loadCalendarData(): Promise<void> {
try {
// 获取当前月份的所有联系人
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
// 生成日历天数
this.calendarDays = this.generateCalendarDays(this.currentDate, contacts);
} catch (error) {
hilog.error(LogConsta... | AST#method_declaration#Left private async loadCalendarData 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 > ... | private async loadCalendarData(): Promise<void> {
try {
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
this.calendarDays = this.generateCalendarDays(this.currentDate, contacts);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConst... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L68-L78 | 8dc8513690f4e20766b321280fb79c186e7b43c7 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/url_tools.ets | arkts | Analyze and divides the text data items and out put a unified list of texts and links
@param data_list strings
@returns [extracted_data: string[], extracted_type: string[]] | export function extract_links_from_text(data_list: string[]) {
let extracted_data: string[] = [];
let extracted_type: string[] = [];
for (let index = 0; index < data_list.length; index++) {
let text = data_list[index];
// let match = text.match(/(file|https?|meow):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z... | AST#export_declaration#Left export AST#function_declaration#Left function extract_links_from_text AST#parameter_list#Left ( AST#parameter#Left data_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig... | export function extract_links_from_text(data_list: string[]) {
let extracted_data: string[] = [];
let extracted_type: string[] = [];
for (let index = 0; index < data_list.length; index++) {
let text = data_list[index];
let match = text.match(/([a-zA-Z][a-zA-Z0-9+.-]*):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L363-L396 | b1d30b47c031876be0f6e58af74f37e0685a201e | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/navigation/GoodsSearchNav.ets | arkts | GoodsSearchNav | @file 商品搜索页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function GoodsSearchNav(): void {
GoodsSearchPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function GoodsSearchNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom... | @Builder
export function GoodsSearchNav(): void {
GoodsSearchPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsSearchNav.ets#L8-L11 | 5b72828b2c50e9186abc782451ca7845d6dbe902 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets | arkts | sharedArrayBufferUsage | 根据传入的值isAtomics判断是否使用原子操作 | sharedArrayBufferUsage(isAtomics: boolean) {
// 创建长度为4的SharedArrayBuffer对象
let sab: SharedArrayBuffer = new SharedArrayBuffer(4);
// 由于SharedArrayBuffer是原始二进制数据缓冲区,无法直接使用,所以这里转换为Int32Array类型进行后续操作
let int32Array: Int32Array = new Int32Array(sab);
int32Array[0] = 0;
// 创建Task对象,并放入TaskGroup中执行
... | AST#method_declaration#Left sharedArrayBufferUsage AST#parameter_list#Left ( AST#parameter#Left isAtomics : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 创建长度为4的SharedArrayBuffer对象 AST#... | sharedArrayBufferUsage(isAtomics: boolean) {
let sab: SharedArrayBuffer = new SharedArrayBuffer(4);
let int32Array: Int32Array = new Int32Array(sab);
int32Array[0] = 0;
let taskGroup: taskpool.TaskGroup = new taskpool.TaskGroup();
for (let i = 0; i < this.taskNum; i++) {
if (isA... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets#L67-L94 | 23f41cd40f72c7c1982abc06ee3deadbbc2c2331 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 55% 百分比 | export const P55: string = "55%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P55 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "55%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P55: string = "55%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L64-L64 | d31b742c7a56f772e2b707d034ffce5d23e534df | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.