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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnEndCenter() { Text("Hi"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L924-L939 | 0e395e38135a7283514d96c6622769552202ebf2 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | playSelectedAnimation | 播放选中 Tab 的动画并重置其他动画帧
@param {number} index - 选中的 Tab 索引
@returns {void} 无返回值 | playSelectedAnimation(index: number): void {
this.lottieControllers.forEach((controller: LottieController, controllerIndex: number) => {
if (controllerIndex === index) {
controller.stop();
controller.play();
return;
}
controller.stop();
controller.goToAndStop(0, true)... | AST#method_declaration#Left playSelectedAnimation AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | playSelectedAnimation(index: number): void {
this.lottieControllers.forEach((controller: LottieController, controllerIndex: number) => {
if (controllerIndex === index) {
controller.stop();
controller.play();
return;
}
controller.stop();
controller.goToAndStop(0, true)... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L117-L127 | bcfeba4e28d3e2f496b8d5c204ff7be86b232a99 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 推荐项接口 | export interface RecommendationItem {
id: string;
type: RecommendationType;
title: string;
description: string;
confidence: number; // 推荐置信度 (0-1)
priority: number; // 优先级 (1-10)
metadata: Record<string, string | number | boolean>;
tags: string[];
imageUrl?: string;
price?: numbe... | AST#export_declaration#Left export AST#interface_declaration#Left interface RecommendationItem 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 type : AST#type_annotation#L... | export interface RecommendationItem {
id: string;
type: RecommendationType;
title: string;
description: string;
confidence: number;
priority: number;
metadata: Record<string, string | number | boolean>;
tags: string[];
imageUrl?: string;
price?: number;
rating?: number;
cre... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L30-L44 | 8e5a5c6592dc4d137d3b72cc20dae25ff3fc985e | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Alarm/PermissionManager.ets | arkts | 权限管理工具类(类似Swift中的static class)
封装权限申请、检查等操作 | export default class PermissionManager {
/**
* 权限组常量声明(类似Kotlin中的companion object)
* 包含各功能对应的权限列表
*/
static readonly PERMISSION_GROUP: PermissionGroup = {
RECORD: ['ohos.permission.MICROPHONE'], // 麦克风权限
STORAGE: ['ohos.permission.STORE_PERSISTENT_DATA'], // 持久化存储权限
CAMERA: ['ohos.permission.CA... | AST#export_declaration#Left export default AST#class_declaration#Left class PermissionManager AST#class_body#Left { /**
* 权限组常量声明(类似Kotlin中的companion object)
* 包含各功能对应的权限列表
*/ AST#property_declaration#Left static readonly PERMISSION_GROUP : AST#type_annotation#Left AST#primary_type#Left PermissionGroup AST#pri... | export default class PermissionManager {
static readonly PERMISSION_GROUP: PermissionGroup = {
RECORD: ['ohos.permission.MICROPHONE'],
STORAGE: ['ohos.permission.STORE_PERSISTENT_DATA'],
CAMERA: ['ohos.permission.CAMERA'],
VIBRATOR: ['ohos.permission.VIBRATE'],
IMAGES: ['ohos.permission.REA... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L28-L288 | 855dbd355783b08ccebc291ef0a1d950404a07a1 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/IndexData.ets | arkts | get Index page dataList | export function getIndexList(): Array<IndexListItem> {
let indexModuleArray: Array<IndexListItem> = []
INDEX_LIST.forEach((item: IndexListItem) => {
indexModuleArray.push(item);
})
return indexModuleArray;
} | AST#export_declaration#Left export AST#function_declaration#Left function getIndexList AST#parameter_list#Left ( ) AST#parameter_list#Right : 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 IndexListItem AST#primary_type... | export function getIndexList(): Array<IndexListItem> {
let indexModuleArray: Array<IndexListItem> = []
INDEX_LIST.forEach((item: IndexListItem) => {
indexModuleArray.push(item);
})
return indexModuleArray;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/IndexData.ets#L23-L29 | c18e8cad02a20c71d5225059f550f46e7c066823 | gitee | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/DialogUtils.ets | arkts | 隐藏loading | export function hideLoadingDialog() {
emitter.emit(loadingEvent, LoadingDialogEvent(false, ""))
} | AST#export_declaration#Left export AST#function_declaration#Left function hideLoadingDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | export function hideLoadingDialog() {
emitter.emit(loadingEvent, LoadingDialogEvent(false, ""))
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/DialogUtils.ets#L16-L18 | 12a637ab7f1fa1d06a1fd94f642adf1c177134be | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets | arkts | rgb2hsv | RGB格式转换为HSV格式,公式参考resources/base/media/rgb_to_hsv.png
@param color RGB像素值
@returns HSV像素值 | public static rgb2hsv(color: ColorRgb): ColorHsv {
// RGB颜色取值范围是0~255,需要转换为0~1的浮点数
const red: number = color.red / MAX_RGB_VALUE;
const green: number = color.green / MAX_RGB_VALUE;
const blue: number = color.blue / MAX_RGB_VALUE;
const max: number = Math.max(red, green, blue);
const min: number... | AST#method_declaration#Left public static rgb2hsv AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ColorRgb AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ColorHsv AST#pri... | public static rgb2hsv(color: ColorRgb): ColorHsv {
const red: number = color.red / MAX_RGB_VALUE;
const green: number = color.green / MAX_RGB_VALUE;
const blue: number = color.blue / MAX_RGB_VALUE;
const max: number = Math.max(red, green, blue);
const min: number = Math.min(red, green, blue);
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets#L59-L96 | 74aedd1b436fe3434fed1738869b415d9d7b1f83 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_animation/ace_ets_module_animation_api11/entry/src/main/ets/MainAbility/pages/RouteType/RouteType1.ets | arkts | pageTransition | 自定义方式1:完全自定义转场过程的效果 | pageTransition() {
PageTransitionEnter({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale1 = 1
this.opacity1 = progress
}) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%)
PageTransitionExit({ duration: 1200, curve... | AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Lef... | pageTransition() {
PageTransitionEnter({ type: RouteType.Pop, duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale1 = 1
this.opacity1 = progress
})
PageTransitionExit({ duration: 1200, curve: Curve.Ease })
.onExit((type: RouteType... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_animation/ace_ets_module_animation_api11/entry/src/main/ets/MainAbility/pages/RouteType/RouteType1.ets#L35-L46 | 63cab27f9768459840fc75798898be1713984f46 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | capitalize | 转换字符串首字母为大写,剩下为小写
@param str 待转换的字符串
@returns 转换后的 | static capitalize(str: string = ''): string {
if (!str) {
return '';
}
const firstChar = str.charAt(0).toUpperCase();
const restChars = str.slice(1).toLowerCase();
return firstChar + restChars;
} | AST#method_declaration#Left static capitalize 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#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | static capitalize(str: string = ''): string {
if (!str) {
return '';
}
const firstChar = str.charAt(0).toUpperCase();
const restChars = str.slice(1).toLowerCase();
return firstChar + restChars;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L168-L175 | 16cee4632313d274cb87c4523e61ae390f201305 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/form.ets | arkts | handleProvinceChange | 处理省份选择变化 | private handleProvinceChange(province: string) {
this.formData.province = province
this.formData.city = ''
const selectedProvince = this.areaData.find(item => item.province === province)
this.cityOptions = selectedProvince ? selectedProvince.cities.map(item => {
return { value: item } as SelectOpt... | AST#method_declaration#Left private handleProvinceChange AST#parameter_list#Left ( AST#parameter#Left province : 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#builder_function_body#Left { AST#expression_statement... | private handleProvinceChange(province: string) {
this.formData.province = province
this.formData.city = ''
const selectedProvince = this.areaData.find(item => item.province === province)
this.cityOptions = selectedProvince ? selectedProvince.cities.map(item => {
return { value: item } as SelectOpt... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/form.ets#L194-L201 | 0a480823520351e2e69c05fa1fa1902c45e728c2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | getStatus | 获取状态 | getStatus(): LLMStatus {
return {
configured: this.status.configured,
provider: this.status.provider,
lastUsed: this.status.lastUsed,
errorCount: this.status.errorCount
};
} | AST#method_declaration#Left getStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LLMStatus AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Lef... | getStatus(): LLMStatus {
return {
configured: this.status.configured,
provider: this.status.provider,
lastUsed: this.status.lastUsed,
errorCount: this.status.errorCount
};
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L263-L270 | f444ba19b056b1ec22f1ba29db586eaab0a65331 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/ali-react-table-monorepo/99.10.9/package/index.ets | arkts | getPathChunks | 应用约束:9. 使用let代替var | function getPathChunks(path: string): string {
let str = "p";
const chunks = path.split('/');
for (let i = 0; i < chunks.length; i++) {
str += toHex(chunks[i]) + ".";
}
str = str.slice(0, -1) + "p";
return str;
} | AST#function_declaration#Left function getPathChunks AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | function getPathChunks(path: string): string {
let str = "p";
const chunks = path.split('/');
for (let i = 0; i < chunks.length; i++) {
str += toHex(chunks[i]) + ".";
}
str = str.slice(0, -1) + "p";
return str;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/ali-react-table-monorepo/99.10.9/package/index.ets#L65-L73 | 06cacfbe5326874ee22b8bf68ca69a2f975d9f22 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getHoleRadius | Returns the size of the hole radius in percent of the total radius.
@return | public getHoleRadius(): number {
return this.mHoleRadiusPercent;
} | AST#method_declaration#Left public getHoleRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | public getHoleRadius(): number {
return this.mHoleRadiusPercent;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L632-L634 | 83b142eda8670c90e9b619ca9ffd8f756358cc8d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | buildUser | 构建用户 | static buildUser(): string {
return deviceInfo.buildUser
} | AST#method_declaration#Left static buildUser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express... | static buildUser(): string {
return deviceInfo.buildUser
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L195-L197 | ccb866c57ddc378feda77f13a47408d09d5b9632 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildGeneratedGreeting | 生成的祝福语项 | @Builder
buildGeneratedGreeting(text: string) {
Row({ space: 12 }) {
Text(text)
.fontSize(14)
.fontColor(this.COLORS.textPrimary)
.lineHeight(20)
.layoutWeight(1)
Row({ space: 8 }) {
// 复制按钮
Text('📋')
.fontSize(16)
.padding(6)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGeneratedGreeting AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_functi... | @Builder
buildGeneratedGreeting(text: string) {
Row({ space: 12 }) {
Text(text)
.fontSize(14)
.fontColor(this.COLORS.textPrimary)
.lineHeight(20)
.layoutWeight(1)
Row({ space: 8 }) {
Text('📋')
.fontSize(16)
.padding(6)
.b... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3187-L3222 | 205e36c738d2d31f459031d9b9c3cad13a5cef8c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets | arkts | ComponentStackComponent | 向上偏移的距离 | @Component
export struct ComponentStackComponent {
build() {
// TODO: 知识点:堆叠容器,子组件按照顺序依次入栈,后一个子组件覆盖前一个子组件。
Stack({ alignContent: Alignment.Top }) {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.component_stack_user_portrait"))
.width($r("app.integer.component_s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ComponentStackComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { // TODO: 知识点:堆叠容器,子组件按照顺序依次入栈,后一个子组件覆盖前一个子组件。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui... | @Component
export struct ComponentStackComponent {
build() {
Stack({ alignContent: Alignment.Top }) {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.component_stack_user_portrait"))
.width($r("app.integer.component_stack_user_portrait_width"))
.aspect... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets#L49-L86 | 74ab2b25f28d68718b95432d29ffef37cb84e9b6 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | setEnvironmentData | 设置环境数据 | setEnvironmentData(data: EnvironmentDataItem[]): void {
this.environmentData = data;
this.isDataLoaded = true;
} | AST#method_declaration#Left setEnvironmentData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EnvironmentDataItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an... | setEnvironmentData(data: EnvironmentDataItem[]): void {
this.environmentData = data;
this.isDataLoaded = true;
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L132-L135 | fbd3088c9441bfb68bd663c763dbe87871483b44 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets | arkts | addCandidateConfig | [End get_signal_level] [Start add_candidate_config] | addCandidateConfig() {
try {
let config: wifiManager.WifiDeviceConfig = {
ssid: '****',
preSharedKey: '****',
securityType: 0
};
wifiManager.addCandidateConfig(config).then(result => {
hilog.info(0x0000, 'Sample', 'result: %{public}s', JSON.stringify(result));
... | AST#method_declaration#Left addCandidateConfig AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left config : AST#type_annotation#Left AST#... | addCandidateConfig() {
try {
let config: wifiManager.WifiDeviceConfig = {
ssid: '****',
preSharedKey: '****',
securityType: 0
};
wifiManager.addCandidateConfig(config).then(result => {
hilog.info(0x0000, 'Sample', 'result: %{public}s', JSON.stringify(result));
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/WiFiQuery.ets#L88-L106 | ea86e1374382c3d7a4c035907a24811a1f5f41fd | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets | arkts | 显示加载提示
@param message 消息内容 | export function showLoading(message: string = '加载中...') {
try {
promptAction.showToast({
message: message,
duration: 2000
});
} catch (error) {
console.error('显示加载提示失败:', error);
}
} | AST#export_declaration#Left export AST#function_declaration#Left function showLoading AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '加载中...' AST#expression#Right AST#parameter#Right ) AS... | export function showLoading(message: string = '加载中...') {
try {
promptAction.showToast({
message: message,
duration: 2000
});
} catch (error) {
console.error('显示加载提示失败:', error);
}
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/PromptUtils.ets#L77-L86 | b7c586d3f23dabe2156b9f4a2c6d86502b490b12 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@returns | static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<string> {
return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<string> {
return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L73-L75 | 778008772c4755433ff30768b6600232f1977dfe | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/tabs_actions.ets | arkts | Determines if extra background is needed, and saves this to key 'extra_background' in AppStorage.
An extra background is for those websites who do not have background colors, so that they would be more readable. | export function determine_extra_background(storage: LocalStorage) {
let need_extra_background = true;
// Determine background
if (!storage.get('meowWebView_init_OK') as boolean) {
need_extra_background = false;
}
let tab_urls = storage.get('tab_urls') as string[];
let tabs = storage.get('bunch_of_tabs'... | AST#export_declaration#Left export AST#function_declaration#Left function determine_extra_background AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bloc... | export function determine_extra_background(storage: LocalStorage) {
let need_extra_background = true;
if (!storage.get('meowWebView_init_OK') as boolean) {
need_extra_background = false;
}
let tab_urls = storage.get('tab_urls') as string[];
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L103-L131 | 76c665b5ffa07031c3138db1d7daabe4f3785586 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/container/array_001_T.ets | arkts | Introduction 数组索引 | export function array_001_T(taint_src : string) {
let arr = [taint_src, "b", "c"]
taint.Sink(arr[0]);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ... | export function array_001_T(taint_src : string) {
let arr = [taint_src, "b", "c"]
taint.Sink(arr[0]);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/array_001_T.ets#L6-L9 | 286d6b051815724d0dfed5c3f9cec836c4efa118 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/swipercomponent/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
// 轮播切换动画时间
static readonly SWIPER_ANIMATION_DURATION: number = 300;
// 轮播图每5s切换一次
static readonly SWIPER_SWITCH_DURATION: number = 2000;
// 是否循环切换
static readonly SWIPER_IS_LOOP: boolean = true;
// 导航点间隔
static readonly INDICATOR_SPACE: number = 10;
// 导航点默认宽度
static ... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 轮播切换动画时间 AST#property_declaration#Left static readonly SWIPER_ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300... | export class CommonConstants {
static readonly SWIPER_ANIMATION_DURATION: number = 300;
static readonly SWIPER_SWITCH_DURATION: number = 2000;
static readonly SWIPER_IS_LOOP: boolean = true;
static readonly INDICATOR_SPACE: number = 10;
static readonly INDICATOR_DEFAULT_WIDTH: number = 8;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/common/CommonConstants.ets#L16-L51 | 1bd0483c57c8f1e9c2ba686ea589a70115e5311a | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/component/base.ets | arkts | Improve: implement this | export interface SubscribaleAbstract { } | AST#export_declaration#Left export AST#interface_declaration#Left interface SubscribaleAbstract AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface SubscribaleAbstract { } | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/component/base.ets#L262-L262 | 48de4829cab3dd417baddc9c4e4d0e16b12ee7e8 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/books/BookListView.ets | arkts | actionShowLanguages | /切换 语言 | actionShowLanguages(){
let options: ItemOption[] = [];
let isCns = LanguageManager.getCurrentLanguage() === AppLanguage.Simplified
let isCnt = LanguageManager.getCurrentLanguage() === AppLanguage.Traditional
///简体中文
options.push(
{text: `简体中文`, color: isCns ? $r('app.color.color_red') : $r('... | AST#method_declaration#Left actionShowLanguages AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ItemOption [ ] AST#array_type#Rig... | actionShowLanguages(){
let options: ItemOption[] = [];
let isCns = LanguageManager.getCurrentLanguage() === AppLanguage.Simplified
let isCnt = LanguageManager.getCurrentLanguage() === AppLanguage.Traditional
options.push(
{text: `简体中文`, color: isCns ? $r('app.color.color_red') : $r('app.col... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/books/BookListView.ets#L133-L156 | 18ce5354a85309fe9de82e9dd71cc0d9f1f73f89 | github |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/database/HerbalTable.ets | arkts | deleteData | updateData(herb: IHerbalModel, callback: Function) { this.query(herb.id, (result) => { if (result.length === 0) { callback(new Error('Herb not found')); } else { const valueBucket = this.generateBucket(herb); this.herbalTable.updateData(valueBucket, { key: 'id', value: herb.id }, callback); callback(null); } }); } | deleteData(id: number, callback: Function) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.HERBAL_TABLE.tableName);
predicates.equalTo('id', id);
this.herbalTable.deleteData(predicates, callback);
} | AST#method_declaration#Left deleteData 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 callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Rig... | deleteData(id: number, callback: Function) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.HERBAL_TABLE.tableName);
predicates.equalTo('id', id);
this.herbalTable.deleteData(predicates, callback);
} | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/HerbalTable.ets#L137-L141 | 032f68aa35cff881c00f4a081effa0b3c47b0ace | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/SearchHistory.ets | arkts | @file 搜索历史模型
@author Joker.X | export class SearchHistory {
/**
* 搜索关键词
*/
keyword: string = "";
/**
* 搜索时间戳
*/
searchTime: number = Date.now();
constructor(init?: Partial<SearchHistory>) {
if (!init) {
return;
}
this.keyword = init.keyword ?? this.keyword;
this.searchTime = init.searchTime ?? this.search... | AST#export_declaration#Left export AST#class_declaration#Left class SearchHistory AST#class_body#Left { /**
* 搜索关键词
*/ AST#property_declaration#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#... | export class SearchHistory {
keyword: string = "";
searchTime: number = Date.now();
constructor(init?: Partial<SearchHistory>) {
if (!init) {
return;
}
this.keyword = init.keyword ?? this.keyword;
this.searchTime = init.searchTime ?? this.searchTime;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/SearchHistory.ets#L5-L22 | b98e074a2286b20aa7fde5b3ba7e050b651404c4 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | isInverted | If this returns true, the y-axis is inverted.
@return | public isInverted(): boolean {
return this.mInverted;
} | AST#method_declaration#Left public isInverted AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre... | public isInverted(): boolean {
return this.mInverted;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L248-L250 | 1f0d1823d20e70c181fd093e5e22382163e7eecb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BptaUseSoftware/entry/src/main/ets/pages/LockBySystem.ets | arkts | [EndExclude bpta_lock_by_system] | export default class EntryAbility extends UIAbility {
// ...
onForeground(): void {
//Apply for the resources required by the system, or reapply for the resources released in onBackground ()
audio.createAudioRenderer(audioRendererOptions,(err: BusinessError) => {});
}
onBackground(): void {
//Rele... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // ... AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#... | export default class EntryAbility extends UIAbility {
onForeground(): void {
audio.createAudioRenderer(audioRendererOptions,(err: BusinessError) => {});
}
onBackground(): void {
audioRenderer.stop((err: BusinessError) => {});
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseSoftware/entry/src/main/ets/pages/LockBySystem.ets#L53-L65 | cea7b5fd29735f6f1283da491915941419f98e54 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/NetworkUtil.ets | arkts | TODO 网络相关工具类
需要 ohos.permission.GET_NETWORK_INFO、ohos.permission.GET_WIFI_INFO 权限。
author: 桃花镇童长老
since: 2024/05/01 | export class NetworkUtil {
private static netConnection: connection.NetConnection;
/**
* 检查当前网络上的数据流量使用是否被计量
* @returns
*/
static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
}
/**
* 检查当前网络上的数据流量使用是否被计量
* @returns
*/
static isDefaultNetMet... | AST#export_declaration#Left export AST#class_declaration#Left class NetworkUtil AST#class_body#Left { AST#property_declaration#Left private static netConnection : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetConnection AST#qualified_type#Right AST#primary_type#Right AST#type_an... | export class NetworkUtil {
private static netConnection: connection.NetConnection;
static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
}
static isDefaultNetMeteredSync(): boolean {
return connection.isDefaultNetMeteredSync();
}
static hasDefa... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NetworkUtil.ets#L29-L434 | 51f514e99afdff43e6e9ef9fafdf97d5adfd4fbe | gitee | |
liudi25385/mybit.git | 865f64ff6b2e10f5b79100064dff05e67607a5bc | entry/src/main/ets/net/CustomNetPlugin.ets | arkts | didReceive | 收到Response响应,响应的所有信息 | didReceive(result: http.HttpResponse): void {
} | AST#method_declaration#Left didReceive AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno... | didReceive(result: http.HttpResponse): void {
} | https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/net/CustomNetPlugin.ets#L10-L12 | d9f3a7cd7047aee6347eb2b2dd8e343544d6550d | github |
ikunbranch666-auto/SimpleCalculator.git | ea24568014d05285ad3def5b741380294308aef2 | entry/src/main/ets/common/InputComponent.ets | arkts | InputComponent | Copyright (c) 2022 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 InputComponent {
@Link result: string
@Link expression: string
private isLand: boolean = false
build() {
Stack({
alignContent: this.isLand ? Alignment.BottomStart : Alignment.TopEnd
}) {
Column() {
Row() {
Text(this.expression)
.margin(... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InputComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right result : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annot... | @Component
export struct InputComponent {
@Link result: string
@Link expression: string
private isLand: boolean = false
build() {
Stack({
alignContent: this.isLand ? Alignment.BottomStart : Alignment.TopEnd
}) {
Column() {
Row() {
Text(this.expression)
.margin(... | https://github.com/ikunbranch666-auto/SimpleCalculator.git/blob/ea24568014d05285ad3def5b741380294308aef2/entry/src/main/ets/common/InputComponent.ets#L15-L61 | c089871ec81c17f8d42913cc947fd8c4f27744e3 | github |
jianguo888/nut-recipes | 262304b5d2bee2d5f1df4e29c094c9ddd58f9d51 | entry/src/main/ets/MainAbility/pages/Main.ets | arkts | getRequest | 请求方式:GET | getRequest() {
// 每一个httpRequest对应一个http请求任务,不可复用
let httpRequest = http.createHttp()
let url = "https://way.jd.com/jisuapi/search?keyword=白菜&num=10&start=0&appkey=7c913be32b690701cd994d804a6d4294"
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
... | AST#method_declaration#Left getRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 每一个httpRequest对应一个http请求任务,不可复用 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#m... | getRequest() {
let httpRequest = http.createHttp()
let url = "https://way.jd.com/jisuapi/search?keyword=白菜&num=10&start=0&appkey=7c913be32b690701cd994d804a6d4294"
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
console.info('=====data.result... | https://github.com/jianguo888/nut-recipes/blob/262304b5d2bee2d5f1df4e29c094c9ddd58f9d51/entry/src/main/ets/MainAbility/pages/Main.ets#L168-L206 | d2395cf0b0ba201bc85e8e7052c6f45cb61755a1 | gitee |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | Provides an interface to the drawing, and samplingOptions used when sampling from the image.
@syscap SystemCapability.Graphics.Drawing
@since 12 | export class SamplingOptions {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | AST#export_declaration#Left export AST#class_declaration#Left class SamplingOptions AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parame... | export class SamplingOptions {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L305-L306 | 6026c84eccef3bbc81efff2a674140b29e73ae57 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the software model represented by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get softwareModel(): string; | AST#method_declaration#Left static get AST#ERROR#Left s of twareModel AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get softwareModel(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L120-L120 | 9d1de2acab4dda57799a853bf7fd73d0ca3c331e | gitee |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/view/ImageSelectComponent.ets | arkts | smallImgClickAction | 处理缩略图的点击事件 | smallImgClickAction(index: number): void {
this.selectedIndex = index;
this.smallScroller.scrollToIndex(this.selectedIndex);
} | AST#method_declaration#Left smallImgClickAction AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ... | smallImgClickAction(index: number): void {
this.selectedIndex = index;
this.smallScroller.scrollToIndex(this.selectedIndex);
} | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/ImageSelectComponent.ets#L41-L44 | 46c9a583bc2090847ffde4a9a9522d7ea68151fc | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/RandomUtil.ets | arkts | getRandomInt | 生成随机整数(可指定范围)
@return 随机数 | static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number {
min = Math.ceil(min); //向上取整
max = Math.floor(max); //向下取整
return Math.floor(Math.random() * (max - min)) + min;
} | AST#method_declaration#Left static getRandomInt AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left A... | static getRandomInt(min: number = 0, max: number = Number.MAX_SAFE_INTEGER): number {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RandomUtil.ets#L40-L44 | e4da4b2509f4a3e41c14b9bafd95ca77b4489af7 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取帖子详情
@param id 帖子ID
@returns 帖子详情 | export function getPostById(id: number): Promise<Post> {
try {
console.info(`获取帖子详情, id: ${id}`);
return request<ApiResponse<Post>>(RequestMethod.GET, `/posts/${id}`)
.then(response => {
if (!response || !response.data) {
console.error('获取帖子详情失败: 无效的API响应格式');
throw new Error... | AST#export_declaration#Left export AST#function_declaration#Left function getPostById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri... | export function getPostById(id: number): Promise<Post> {
try {
console.info(`获取帖子详情, id: ${id}`);
return request<ApiResponse<Post>>(RequestMethod.GET, `/posts/${id}`)
.then(response => {
if (!response || !response.data) {
console.error('获取帖子详情失败: 无效的API响应格式');
throw new Error... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1057-L1143 | 31b99c721ae9283df8b8512595aaeb68c07d5eaa | github | |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | entry/src/main/ets/pages/DemoPage.ets | arkts | DemoPageBuilder | Input field value | @Builder
export function DemoPageBuilder() {
DemoPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DemoPageBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left DemoPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_functio... | @Builder
export function DemoPageBuilder() {
DemoPage();
} | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/pages/DemoPage.ets#L32-L35 | 88894b51483484a7a44678a1669311beabff9049 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_lite.ets | arkts | This bunch_of_history_index could only clear and push data in a sorted manner. | constructor() {
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | constructor() {
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L14-L15 | 0c302a8552a6be4575974b07dd42b9b4347bae2a | gitee | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/TaskService.ets | arkts | 上传信息接口 | export interface AgvUploadInfoVO {
info: string;
type: string;
status: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AgvUploadInfoVO AST#object_type#Left { AST#type_member#Left info : 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 type : AST#type_annotation#Le... | export interface AgvUploadInfoVO {
info: string;
type: string;
status: string;
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/TaskService.ets#L43-L47 | 6d747f52cb16551594ae61ba6d39a2422afd3893 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | saveTestPhoto | 测试图片保存到图库 | async saveTestPhoto(context: common.UIAbilityContext) {
let helper = photoAccessHelper.getPhotoAccessHelper(context);
try {
this.beforeCompressFmt = 'jpeg';
this.afterCompressFmt = this.beforeCompressFmt;
// 创建图片文件
this.uris[0] = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE... | AST#method_declaration#Left async saveTestPhoto 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#Right... | async saveTestPhoto(context: common.UIAbilityContext) {
let helper = photoAccessHelper.getPhotoAccessHelper(context);
try {
this.beforeCompressFmt = 'jpeg';
this.afterCompressFmt = this.beforeCompressFmt;
this.uris[0] = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpeg')... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L135-L165 | 71a025191e81835f886b314d7aa881191b000295 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | getYearDays | 获取指定年份的总天数 | static getYearDays(year: number): number {
let totalDays = 0;
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
// 计算12个月的天数
for (let month = 1; month <= 12; month++) {
totalDays += ComprehensiveLunarDatabase.getMonthDays(year, month);
}
// 加上闰月天数
totalDays += Comprehens... | AST#method_declaration#Left static getYearDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | static getYearDays(year: number): number {
let totalDays = 0;
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
for (let month = 1; month <= 12; month++) {
totalDays += ComprehensiveLunarDatabase.getMonthDays(year, month);
}
totalDays += ComprehensiveLunarDatabase.getL... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L161-L174 | df2476049654b7e8bed6b48d6ad6b30eff86513d | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | entry/src/main/ets/pages/one/models/WxHomeModel.ets | arkts | type 0 没有侧滑 type 1 删除 type 2 标为未读和删除 type 3 不在关注和删除 | export interface WxHomeItemType {
title?: string
subtitle?: string
img?: string
time?: string
isNew?: boolean
type?: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface WxHomeItemType AST#object_type#Left { AST#type_member#Left title ? : 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 subtitle ? : AST#type_annotat... | export interface WxHomeItemType {
title?: string
subtitle?: string
img?: string
time?: string
isNew?: boolean
type?: string
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/entry/src/main/ets/pages/one/models/WxHomeModel.ets#L15-L22 | 44b052809eec5053775b51f7977486a60e267126 | github | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets | arkts | Input组件样式 | export const InputStyle = {
TEXT_INPUT_OPACITY: .2,
TEXT_INPUT_PLACEHOLDER_SIZE: 20,
TEXT_INPUT_PLACEHOLDER_WEIGHT: 300,
TEXT_INPUT_PLACEHOLDER_HEIGHT: '100%',
TEXT_INPUT_PLACEHOLDER_RADIUS: 2,
TEXT_INPUT_PLACEHOLDER_PADDING_RIGHT: 70,
TEXT_INPUT_PLACEHOLDER_MARGIN_RIGHT: 5,
TEXT_INPUT_PLACEHOLDER_MARGI... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left InputStyle = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left TEXT_INPUT_OPACITY AST#property_name#Right : AST#ERROR#Left . AST#ERROR#Right AST#expression#Left 2 AST#expre... | export const InputStyle = {
TEXT_INPUT_OPACITY: .2,
TEXT_INPUT_PLACEHOLDER_SIZE: 20,
TEXT_INPUT_PLACEHOLDER_WEIGHT: 300,
TEXT_INPUT_PLACEHOLDER_HEIGHT: '100%',
TEXT_INPUT_PLACEHOLDER_RADIUS: 2,
TEXT_INPUT_PLACEHOLDER_PADDING_RIGHT: 70,
TEXT_INPUT_PLACEHOLDER_MARGIN_RIGHT: 5,
TEXT_INPUT_PLACEHOLDER_MARGI... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets#L65-L81 | f1acaf393d8819c27224b997b8132890b0a8252a | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | newTab | Creates a new tab.
@param target_url A string, if link is "", then load the default new_tab_url set in this object.
@param recover_on_creation A boolean, if set true, then the tab will restore the serialized web state in
@returns A number, the index of the new tab.
@description While if new_tab_url is also not set ("" ... | newTab(context: UIContext, target_url: string, init_state: boolean, placeholder_label?: string) {
if (!this.my_storage) {
console.warn(`[bunch_of_tabs] INTERCEPTED for undefined my_storage! newTab: url=${target_url}`);
return;
}
console.log(`[bunch_of_tabs] newTab: url=${target_url}, label=${pla... | AST#method_declaration#Left newTab AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target_url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | newTab(context: UIContext, target_url: string, init_state: boolean, placeholder_label?: string) {
if (!this.my_storage) {
console.warn(`[bunch_of_tabs] INTERCEPTED for undefined my_storage! newTab: url=${target_url}`);
return;
}
console.log(`[bunch_of_tabs] newTab: url=${target_url}, label=${pla... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L339-L382 | b4c7a68c34af748e6edf158e75128e22a4da17f8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/DateTimePickerOptions.ets | arkts | TODO 弹窗工具类,DatePicker参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface DateTimePickerOptions extends BasePickerOptions {
dateType: DateType; //选择的日期类型
selected?: Date; // 选中日期,不传默认当前日期
start?: Date; //开始日期(1900-01-01 00:00:00)
end?: Date; //结束日期(2199-12-31 23:59:59)
onAction: ActionDateCallBack; //按钮的CallBack事件。
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DateTimePickerOptions AST#extends_clause#Left extends BasePickerOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left dateType : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_anno... | export interface DateTimePickerOptions extends BasePickerOptions {
dateType: DateType;
selected?: Date;
start?: Date;
end?: Date;
onAction: ActionDateCallBack;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/DateTimePickerOptions.ets#L26-L35 | ce1a60d8252af4c58a2af86921d528580a4d55ed | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets | arkts | mySheet | 半模态页面 | @Builder
mySheet() {
Column({space: 20}) {
Text('bindSheet page')
.fontSize(30)
Row({space: 40}) {
Column({space: 20}) {
ForEach([1, 2, 3, 4], () => {
Stack()
.backgroundColor(Color.Pink)
.borderRadius(20)
.width(60)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right mySheet 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_parameter#L... | @Builder
mySheet() {
Column({space: 20}) {
Text('bindSheet page')
.fontSize(30)
Row({space: 40}) {
Column({space: 20}) {
ForEach([1, 2, 3, 4], () => {
Stack()
.backgroundColor(Color.Pink)
.borderRadius(20)
.width(60)
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets#L212-L249 | 2124e76e31379d263a037b333b20deca1c41425f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringUtils.ets | arkts | isValidEmail | 验证邮箱格式是否正确
@param email 输入的邮箱字符串
@returns 是否是合法的邮箱格式 | static isValidEmail(email: string): boolean {
const emailRegex: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}$/i;
return emailRegex.test(email);
} | AST#method_declaration#Left static isValidEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static isValidEmail(email: string): boolean {
const emailRegex: RegExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}$/i;
return emailRegex.test(email);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L153-L156 | 58afba777761d7c5f219c28a179f7a8af3061954 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | d2c | ASN.1格式的字符串转换成C1C2C3格式的字符
@param standard_data ASN.1格式的字符
@returns C1C3C2格式的字符 | d2c(standard_data: string): string {
let message: string = standard_data;
if (!message.startsWith(ASN1Util.SEQUENCE)) {
Logger.error('转换SM2字符串出错');
}
message = message.slice(ASN1Util.SEQUENCE.length, message.length);
let sequence_lexHex: string = this.getLenHex(message);
message = message... | AST#method_declaration#Left d2c AST#parameter_list#Left ( AST#parameter#Left standard_data : 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_type#Righ... | d2c(standard_data: string): string {
let message: string = standard_data;
if (!message.startsWith(ASN1Util.SEQUENCE)) {
Logger.error('转换SM2字符串出错');
}
message = message.slice(ASN1Util.SEQUENCE.length, message.length);
let sequence_lexHex: string = this.getLenHex(message);
message = message... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L134-L156 | e597426d5a5fd5d6d3d99da558568c0e9f098c8a | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/EmptyNetwork.ets | arkts | EmptyNetwork | @file 网络缺省页
@author Joker.X | @ComponentV2
export struct EmptyNetwork {
/**
* 描述文案
*/
@Param
description: ResourceStr = "网络异常";
/**
* 操作按钮文案(仅当 onAction 存在时展示)
*/
@Param
actionText: ResourceStr = "重试";
/**
* 操作按钮点击回调(不传则不展示按钮)
*/
@Param
onAction: (() => void) | undefined = undefined;
/**
* 构建网络缺省页视图
* @r... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EmptyNetwork AST#component_body#Left { /**
* 描述文案
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#pr... | @ComponentV2
export struct EmptyNetwork {
@Param
description: ResourceStr = "网络异常";
@Param
actionText: ResourceStr = "重试";
@Param
onAction: (() => void) | undefined = undefined;
build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_network"),
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/EmptyNetwork.ets#L7-L37 | 864172c09408332981d74202b9dda8c3ad1546b0 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
RowEndCenter() { Text("Hi"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L364-L379 | 56b3bf3d2602af8d2439c9436b0a6bcce25fd154 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/AboutViewModel.ets | arkts | openUrl | 打开链接
@param {Resource} urlRes - 链接资源
@returns {void} 无返回值 | openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((error... | AST#method_declaration#Left openUrl AST#parameter_list#Left ( AST#parameter#Left urlRes : AST#type_annotation#Left AST#primary_type#Left Resource 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 A... | openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((error... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/AboutViewModel.ets#L56-L70 | acf8a9db4e99c901c6b5c438068a253c434f7f70 | github |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/RequestConfig.ets | arkts | getUserAgent | Getter and setter for userAgent | getUserAgent(): string | undefined {
return this.userAgent;
} | AST#method_declaration#Left getUserAgent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Lef... | getUserAgent(): string | undefined {
return this.userAgent;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/RequestConfig.ets#L40-L42 | 2e014a8e30384f6e5714af44edcc1ce49cb10b7f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | getTotalInterval | 获取总时长 | getTotalInterval(): number {
return this.totalMs;
} | AST#method_declaration#Left getTotalInterval AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express... | getTotalInterval(): number {
return this.totalMs;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L133-L135 | 66d3a7cfba3a704a76c1ae40b5ae5b65c52b46c2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/dbUtils/DBAccessor.ets | arkts | closeDatabase | 关闭数据库连接(私有方法) | private closeDatabase(): void {
try {
this.rdbStore?.close();
this.rdbStore = null;
this.isInitialized = false;
DebugLog.d('DBAccessor-closeDatabased')
} catch (err) {
DebugLog.d("DBAccessor: 关闭数据库连接失败:" + err, );
}
} | AST#method_declaration#Left private closeDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#... | private closeDatabase(): void {
try {
this.rdbStore?.close();
this.rdbStore = null;
this.isInitialized = false;
DebugLog.d('DBAccessor-closeDatabased')
} catch (err) {
DebugLog.d("DBAccessor: 关闭数据库连接失败:" + err, );
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L129-L138 | d2d68e344b2dcbd01e5afc714b51ff213c9001df | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/globalMethods/dialogs/customDialogSample/CustomDialog.ets | arkts | UpgradeDialog | Copyright (c) 2022 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... | @CustomDialog
export struct UpgradeDialog {
private controller: CustomDialogController
build() {
Column() {
Text($r('app.string.custom_dialog_title'))
.padding(8)
.fontSize(24)
this.PermissionIntroduction($r('app.media.ic_custom_dialog_voice'), $r('app.string.custom_dialog_permissio... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct UpgradeDialog AST#component_body#Left { AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST... | @CustomDialog
export struct UpgradeDialog {
private controller: CustomDialogController
build() {
Column() {
Text($r('app.string.custom_dialog_title'))
.padding(8)
.fontSize(24)
this.PermissionIntroduction($r('app.media.ic_custom_dialog_voice'), $r('app.string.custom_dialog_permissio... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/globalMethods/dialogs/customDialogSample/CustomDialog.ets#L16-L63 | 8a79ddbd1c4b399140e2ed7633195d296f8ad4f5 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/GoodsSearchRequest.ets | arkts | @file 商品搜索分页请求模型
@author Joker.X | export class GoodsSearchRequest {
/**
* 页码
*/
page: number = 1;
/**
* 每页大小
*/
size: number = 20;
/**
* 商品分类ID列表
*/
typeId?: number[] | null;
/**
* 最低价格
*/
minPrice?: string | null;
/**
* 最高价格
*/
maxPrice?: string | null;
/**
* 搜索关键词
*/
keyWord?: string | null;... | AST#export_declaration#Left export AST#class_declaration#Left class GoodsSearchRequest AST#class_body#Left { /**
* 页码
*/ AST#property_declaration#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#pr... | export class GoodsSearchRequest {
page: number = 1;
size: number = 20;
typeId?: number[] | null;
minPrice?: string | null;
maxPrice?: string | null;
keyWord?: string | null;
order?: string | null;
sort?: string | null;
recommend?: boolean;
featured?: boolean;
cons... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsSearchRequest.ets#L5-L65 | 205cc8969436c728742164d8054bfa7735beaa42 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppTheme.ets | arkts | ========================== 项目主题定义 ========================== 当前主题(默认绿色主题) | export let theme: Theme = new ThemeGreen() | AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left theme : AST#type_annotation#Left AST#primary_type#Left Theme AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Le... | export let theme: Theme = new ThemeGreen() | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppTheme.ets#L66-L66 | 5bab9580925d7650a4bfb69e64c73edf1f4a30be | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkCigenUsable | / 检查 是否可以使用词根助记 | public checkCigenUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedCigen) { return true } // 非会员 锁定词根助记 功能是否启用
if (this.isActive) { return true } // 非会员才做检查
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_cigen'))
}
return false
} | AST#method_declaration#Left public checkCigenUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#pa... | public checkCigenUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedCigen) { return true }
if (this.isActive) { return true }
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_cigen'))
}
return false
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L338-L347 | 5251193795a924c33e562b2f84c4b1e4c36b680a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FullImagePage.ets | arkts | AnimationComp | 下载状态组件 | @Builder
AnimationComp() {
if (this.downloadStatus) {
Stack() {
Column() {
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.opacity(OPACITY)
Image($r('app.media.loading'))
.width($r('app.integer.loading_size'))
.heig... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AnimationComp AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#R... | @Builder
AnimationComp() {
if (this.downloadStatus) {
Stack() {
Column() {
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.opacity(OPACITY)
Image($r('app.media.loading'))
.width($r('app.integer.loading_size'))
.heig... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FullImagePage.ets#L76-L96 | dd155475561027236e963244d87ea419e712f34b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pageconfig/ContentItem.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class ContentItem {
private name: string;
private desc: string;
private pagePath: string;
private isSection: boolean = false;
constructor(n: string, d?: string, pagePath?: string) {
this.name = n;
if (d == null || d == undefined) {
this.desc = "";
this.isSection = true;
... | AST#export_declaration#Left export default AST#class_declaration#Left class ContentItem AST#class_body#Left { AST#property_declaration#Left private name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left... | export default class ContentItem {
private name: string;
private desc: string;
private pagePath: string;
private isSection: boolean = false;
constructor(n: string, d?: string, pagePath?: string) {
this.name = n;
if (d == null || d == undefined) {
this.desc = "";
this.isSection = true;
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pageconfig/ContentItem.ets#L16-L48 | 6b3b4bdc17b479a4b528b3b64d089a436c926d72 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | 对话消息接口 | export interface ChatMessage {
id: string;
content: string;
type: MessageType;
sender: MessageSender;
timestamp: string;
metadata?: Record<string, string | number | boolean>;
attachments?: MessageAttachment[];
replyTo?: string;
reactions?: MessageReaction[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ChatMessage 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#Left ... | export interface ChatMessage {
id: string;
content: string;
type: MessageType;
sender: MessageSender;
timestamp: string;
metadata?: Record<string, string | number | boolean>;
attachments?: MessageAttachment[];
replyTo?: string;
reactions?: MessageReaction[];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L18-L28 | 4061198df78263cb74a5b6e41e49eabc98f3a41a | github | |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/PhaseExample.ets | arkts | 示例 4: 动态创建多个阶段 | export async function example4_DynamicPhases() {
console.log('========== Example 4: Dynamically Creating Phases ==========')
// 动态创建阶段配置
const phaseConfigs = [
{ name: 'PHASE_1', priority: 10, waitForComplete: true, description: '' } as PhaseConfig,
{ name: 'PHASE_2', priority: 20, waitForComplete: true,... | AST#export_declaration#Left export AST#function_declaration#Left async function example4_DynamicPhases AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#L... | export async function example4_DynamicPhases() {
console.log('========== Example 4: Dynamically Creating Phases ==========')
const phaseConfigs = [
{ name: 'PHASE_1', priority: 10, waitForComplete: true, description: '' } as PhaseConfig,
{ name: 'PHASE_2', priority: 20, waitForComplete: true, descriptio... | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseExample.ets#L310-L341 | 04ce3e51e67b0c957b73a9f3a7820675119976fd | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 应用设置接口 (兼容SettingsService) | export interface AppSettings {
version: string;
language: LanguageSettings;
theme: ThemeSettings;
notification: NotificationSettings;
reminder: ReminderSettings;
privacy: PrivacySettings;
ai: AISettings;
data: DataSettings;
security: SecuritySettings;
accessibility: AccessibilitySettings;
createdA... | AST#export_declaration#Left export AST#interface_declaration#Left interface AppSettings AST#object_type#Left { AST#type_member#Left version : 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 language : AST#type_annotation... | export interface AppSettings {
version: string;
language: LanguageSettings;
theme: ThemeSettings;
notification: NotificationSettings;
reminder: ReminderSettings;
privacy: PrivacySettings;
ai: AISettings;
data: DataSettings;
security: SecuritySettings;
accessibility: AccessibilitySettings;
createdA... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L13-L26 | d7a72924e3eb2cec1c64f0b0af866816b90de76e | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | @file 分类页面 ViewModel
@author Joker.X | @ObservedV2
export default class CategoryViewModel extends BaseNetWorkViewModel<Category[]> {
/**
* 商品仓库
*/
private goodsRepository: GoodsRepository = new GoodsRepository();
/**
* 分类树数据
*/
@Trace
categoryTrees: CategoryTree[] = [];
/**
* 左侧分类标题列表
*/
@Trace
categoryTitles: string[] = []... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class CategoryViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_typ... | @ObservedV2
export default class CategoryViewModel extends BaseNetWorkViewModel<Category[]> {
private goodsRepository: GoodsRepository = new GoodsRepository();
@Trace
categoryTrees: CategoryTree[] = [];
@Trace
categoryTitles: string[] = [];
@Trace
selectedCategoryIndex: number = -1;
@Trac... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L9-L274 | c227d4add52ed320826777661e9ea51c528499cc | github | |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/IoTUtil.ets | arkts | initAll | 初始化连接 | public async initAll(): Promise<void> {
await this.loadConfigs();
this.url = `ssl://${this.IotConfig.host}:${this.IotConfig.port}`;
for (const cfg of this.deviceConfig) {
const client = new IoTDevice(this.url, cfg.deviceId, cfg.secret, 'GlobalSign-rootca.pem');
console.log('正在连接:' + cfg.key);
... | AST#method_declaration#Left public async initAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | public async initAll(): Promise<void> {
await this.loadConfigs();
this.url = `ssl://${this.IotConfig.host}:${this.IotConfig.port}`;
for (const cfg of this.deviceConfig) {
const client = new IoTDevice(this.url, cfg.deviceId, cfg.secret, 'GlobalSign-rootca.pem');
console.log('正在连接:' + cfg.key);
... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/IoTUtil.ets#L45-L58 | 992726e34a5dcd5bb59a317e07a7d351bc9ffddd | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/user/UserManager.ets | arkts | initPreferences | === 3. 数据持久化(Swift UserDefaults → ArkTS Preferences)=== | private initPreferences() {
this.prefs = preferences.getPreferencesSync(this.context, {name: Prefs.Name});
this.loadPreference();
} | AST#method_declaration#Left private initPreferences 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 . prefs AST#member_expressio... | private initPreferences() {
this.prefs = preferences.getPreferencesSync(this.context, {name: Prefs.Name});
this.loadPreference();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/UserManager.ets#L68-L71 | 0b3a4516030afa5cc834451e77e73f30337d3ee0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | initCustomScan | 初始化自定义扫码
@returns {void} | initCustomScan(): void {
logger.info('initCustomScan');
try {
this.initScanData()
customScan.init(this.customScanInitOptions);
this.startCustomScan();
} catch (error) {
logger.error('init fail, error: ' + JSON.stringify(error));
}
} | AST#method_declaration#Left initCustomScan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left ... | initCustomScan(): void {
logger.info('initCustomScan');
try {
this.initScanData()
customScan.init(this.customScanInitOptions);
this.startCustomScan();
} catch (error) {
logger.error('init fail, error: ' + JSON.stringify(error));
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L290-L299 | bddbc83a5d31b229c6fd6f63643971c22ebf00b8 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets | arkts | @file
@kit ArkUI
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class EditableTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.Ar... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class EditableTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon r... | export declare class EditableTitleBarMenuItem {
value: ResourceStr;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets#L30-L81 | ab25132cd8d2fb26b3dd3a1f8ab5fbe7fe40d8b0 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/TlsServerWorker.ets | arkts | startTLSserver | [Start application_transmits_encrypted_data_via_tls_socket_server] | function startTLSserver(message: TlsServerMessage) {
try {
const tlsSecureOptions: socket.TLSSecureOptions = {
key: message.serverKey,
cert: message.serverCert,
ca: message.caCert,
protocols: socket.Protocol.TLSv12,
useRemoteCipherPrefer: true,
signatureAlgorithms: 'rsa_pss_rsa... | AST#function_declaration#Left function startTLSserver AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left TlsServerMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#t... | function startTLSserver(message: TlsServerMessage) {
try {
const tlsSecureOptions: socket.TLSSecureOptions = {
key: message.serverKey,
cert: message.serverCert,
ca: message.caCert,
protocols: socket.Protocol.TLSv12,
useRemoteCipherPrefer: true,
signatureAlgorithms: 'rsa_pss_rsa... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/TlsServerWorker.ets#L42-L72 | aa7c8230261f75a6f9a6de959ebd28f690bce955 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringDealUtility.ets | arkts | clipIfNeedsFull | / 对于太长的翻译,截取指定长度[按分隔符]的部分 | public static clipIfNeedsFull(
srcStr : string,
seperator : string,
subSeperator : string,
maxParts : number
): string | null {
const tempList: Array<string> = [];
return StringDealUtility.deal(
srcStr,
seperator,
subSeperator,
new ClipTransform(tempList, ... | AST#method_declaration#Left public static clipIfNeedsFull AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#Left strin... | public static clipIfNeedsFull(
srcStr : string,
seperator : string,
subSeperator : string,
maxParts : number
): string | null {
const tempList: Array<string> = [];
return StringDealUtility.deal(
srcStr,
seperator,
subSeperator,
new ClipTransform(tempList, ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L102-L116 | f62a65bf5e8cd34e49a2358e67ba3f4a3eff6e3b | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringCrypto.ets | arkts | _toHexString | 私有方法:字节数组转十六进制字符串
@param bytes Uint8Array字节数组
@returns 十六进制字符串 | private static _toHexString(bytes: Uint8Array): string {
return Array.from(bytes)
.map(byte => byte.toString(16).padStart(2, '0'))
.join('');
} | AST#method_declaration#Left private static _toHexString AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string A... | private static _toHexString(bytes: Uint8Array): string {
return Array.from(bytes)
.map(byte => byte.toString(16).padStart(2, '0'))
.join('');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringCrypto.ets#L80-L84 | 0e2d69f1cf5a099122231fa48e531ca1f91e287a | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | deleteMemo | Delete a memo
@param memoId - ID of memo to delete | async deleteMemo(memoId: number): Promise<void> {
try {
await this.rdbHelper.deleteMemo(memoId);
await this.refreshData();
} catch (error) {
console.error(`[MainViewModel] Failed to delete memo: ${JSON.stringify(error)}`);
}
} | AST#method_declaration#Left async deleteMemo AST#parameter_list#Left ( AST#parameter#Left memoId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async deleteMemo(memoId: number): Promise<void> {
try {
await this.rdbHelper.deleteMemo(memoId);
await this.refreshData();
} catch (error) {
console.error(`[MainViewModel] Failed to delete memo: ${JSON.stringify(error)}`);
}
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L508-L515 | b40b8b4e176a9a53b6c2f7f4f470fa8fa972f9fa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildGreetingResults | 构建祝福语搜索结果 | @Builder
buildGreetingResults() {
Column({ space: 12 }) {
Text(`祝福语 (${this.searchResult.greetings.length})`)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 1 }) {
ForEach(this.searchResult.g... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingResults 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#componen... | @Builder
buildGreetingResults() {
Column({ space: 12 }) {
Text(`祝福语 (${this.searchResult.greetings.length})`)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 1 }) {
ForEach(this.searchResult.g... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L545-L583 | f8a3b1f7a91458a15992275b050f8ef4777e09e0 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/axios/EfClientApi.ets | arkts | post | post请求 - json格式
@param efClientParams post请求入参实体
@package cls入参实体转换对象
@returns 响应结果 | async post<F, E>(efClientParams: efClientParams<F>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> {
try {
//如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = efClientParams.loadingTxt;
}
//发送请求
let response... | AST#method_declaration#Left async post AST#type_parameters#Left < AST#type_parameter#Left F AST#type_parameter#Right , AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async post<F, E>(efClientParams: efClientParams<F>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> {
try {
if (efClientParams.loadingTxt) {
efAxiosParams.loadingTxt = efClientParams.loadingTxt;
}
let response: AxiosResponse<E> =
await efAxios.post<E, AxiosRespo... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L77-L108 | 6b1a05ca234e2600013bd9587fcf186d3377ed75 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | 定义通知相关的常量 | export class PlanManagerNotification {
static readonly namePlanUpdated = "PlanManager.Plan.updated.with_book_id"
static readonly kPlanId = "PlanIdKey"
} | AST#export_declaration#Left export AST#class_declaration#Left class PlanManagerNotification AST#class_body#Left { AST#property_declaration#Left static readonly namePlanUpdated = AST#expression#Left "PlanManager.Plan.updated.with_book_id" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left... | export class PlanManagerNotification {
static readonly namePlanUpdated = "PlanManager.Plan.updated.with_book_id"
static readonly kPlanId = "PlanIdKey"
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L27-L33 | d3017bf7ac46e8d92edb075dfa5fb310a3a78ced | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/launch/src/main/ets/view/SplashPage.ets | arkts | SplashContent | 启动页内容视图
@returns {void} 无返回值 | @Builder
private SplashContent() {
Text("启动页内容视图")
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SplashContent 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 Text ( AST#expression#Left "启动页内容视图" AST#expression#... | @Builder
private SplashContent() {
Text("启动页内容视图")
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/view/SplashPage.ets#L33-L36 | c6003b727b2508d84e62f6f0935a1ee5f6068601 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/MockDataService.ets | arkts | getChatMessages | 获取聊天消息 | static getChatMessages(conversationId: string): ChatMessage[] {
const conversations = MockDataService.getConversations();
const conversation = conversations.find(c => c.id === conversationId);
const otherName = conversation?.name || '用户';
const otherAvatar = conversation?.avatar || 'https://via.placehol... | AST#method_declaration#Left static getChatMessages AST#parameter_list#Left ( AST#parameter#Left conversationId : 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#arra... | static getChatMessages(conversationId: string): ChatMessage[] {
const conversations = MockDataService.getConversations();
const conversation = conversations.find(c => c.id === conversationId);
const otherName = conversation?.name || '用户';
const otherAvatar = conversation?.avatar || 'https://via.placehol... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L265-L300 | cae08077dda17f99084f08fb15fc419b327684bd | github |
wenfujing/honms-super-market.git | 0858abecd8be5db7b8dcf88dcd77b7c66d37517a | common/src/main/ets/utils/LocalDataManager.ets | arkts | updateOrder | Update order data.
@param props: update props
@returns Order[] | updateOrder(props: updateOrderProps) {
const result: Order = this.orderData.filter(item => item.orderId === props.orderId)[0];
const newOrder: Order = {
orderId: props.orderId,
commodityId: result.commodityId,
price: result.price,
count: result.count,
specifications: result.specifi... | AST#method_declaration#Left updateOrder AST#parameter_list#Left ( AST#parameter#Left props : AST#type_annotation#Left AST#primary_type#Left updateOrderProps AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarat... | updateOrder(props: updateOrderProps) {
const result: Order = this.orderData.filter(item => item.orderId === props.orderId)[0];
const newOrder: Order = {
orderId: props.orderId,
commodityId: result.commodityId,
price: result.price,
count: result.count,
specifications: result.specifi... | https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L170-L187 | 8df7aafe5dbc1cf4cc3b30ec1804abf2ac1eaaa8 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets | arkts | PinchImage | [Start PinchImage] | @Component
export struct PinchImage {
list: string[] = ['image1', 'image2', 'image3', 'image4', 'image5', 'image6'];
@State GridColumn: string = '1fr 1fr 1fr';
@State GridRow: string = '1fr 1fr';
build() {
Column() {
Grid() {
ForEach(this.list, (item: string) => {
GridItem() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PinchImage AST#component_body#Left { AST#property_declaration#Left 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#R... | @Component
export struct PinchImage {
list: string[] = ['image1', 'image2', 'image3', 'image4', 'image5', 'image6'];
@State GridColumn: string = '1fr 1fr 1fr';
@State GridRow: string = '1fr 1fr';
build() {
Column() {
Grid() {
ForEach(this.list, (item: string) => {
GridItem() {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/PinchImage.ets#L17-L57 | 9f2d30158cd3480ff991e6be0976d6c496bb7303 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | setMinWidth | Sets the minimum width that the axis should take (in dp).
@param minWidth | public setMinWidth(minWidth: number): void {
this.mMinWidth = minWidth;
} | AST#method_declaration#Left public setMinWidth AST#parameter_list#Left ( AST#parameter#Left minWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public setMinWidth(minWidth: number): void {
this.mMinWidth = minWidth;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L151-L153 | d46ee164fb8750ff5fac4bb559258ddaf911ab10 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onForeground | 应用进入前台时调用
刷新应用状态、重新注册路由
@returns {void} 无返回值 | onForeground(): void {
} | AST#method_declaration#Left onForeground 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#builder_function_body#Right AST#method_declaration#Right | onForeground(): void {
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L73-L74 | 7f8501cb1faae80e9880e11fa05f28046eab20c4 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/SettingsService.ets | arkts | init | 初始化设置 | async init(context: Context): Promise<void> {
try {
this.context = context;
this.preferences = await preferences.getPreferences(context, Constants.PREF_SETTINGS);
await this.loadSettings();
// 初始化时应用主题
this.applyTheme(this.settings.themeMode);
} catch (error) {
console.error(... | AST#method_declaration#Left async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async init(context: Context): Promise<void> {
try {
this.context = context;
this.preferences = await preferences.getPreferences(context, Constants.PREF_SETTINGS);
await this.loadSettings();
this.applyTheme(this.settings.themeMode);
} catch (error) {
console.error('[SettingsS... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L27-L37 | 9eda563d3ae5349e96ff295a668610a1e37b5659 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | refresh_onWorkingTab | Refreshes current main tab. | refresh_onWorkingTab() {
this.Tabs[this.main_tab_idx].controller?.refresh();
this.Tabs[this.main_tab_idx].update_url(true);
} | AST#method_declaration#Left refresh_onWorkingTab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L... | refresh_onWorkingTab() {
this.Tabs[this.main_tab_idx].controller?.refresh();
this.Tabs[this.main_tab_idx].update_url(true);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L86-L89 | d3bf39e5e914c3f2bc7e3bae64fd0a4739a995a8 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/common/CommonParam.ets | arkts | @file 公共模块导航参数定义
@author Joker.X
WebView 页面参数 | export interface CommonWebParam {
/**
* 页面 URL
*/
url: string;
/**
* 页面标题
*/
title?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CommonWebParam AST#object_type#Left { /**
* 页面 URL
*/ AST#type_member#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 页面标题
*/ AST#type_m... | export interface CommonWebParam {
url: string;
title?: string;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonParam.ets#L9-L18 | dcf01554fc40127a7fb7219919f2ca41961d9f10 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/DateUtil.ets | arkts | parse | 将输入的日期字符串转换为Date日期类型
@param dateString
@returns | static parse(dateString: string): Date {
return new Date(dateString);
} | AST#method_declaration#Left static parse AST#parameter_list#Left ( AST#parameter#Left dateString : 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 Date AST#primary_type#... | static parse(dateString: string): Date {
return new Date(dateString);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/DateUtil.ets#L30-L32 | abd651af07655fa6da726dae464b26d98d4dfeb3 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/CategoryListSample/entry/src/main/ets/common/bean/Category.ets | arkts | Category item information. | export class Category {
/**
* Category title.
*/
title: Resource;
/**
* Category content(a list).
*/
categoryContent: Array<ListItemData>;
} | AST#export_declaration#Left export AST#class_declaration#Left class Category AST#class_body#Left { /**
* Category title.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Categ... | export class Category {
title: Resource;
categoryContent: Array<ListItemData>;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/common/bean/Category.ets#L6-L17 | ffbaf2c3eb085307e01fa9a82d4446dc2a71454c | gitee | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | isExpired | 检查Offer是否已过期 | isExpired(): boolean {
if (!this.expiryDate) return false;
const expiryTime = new Date(this.expiryDate).getTime();
const now = new Date().getTime();
return expiryTime < now;
} | AST#method_declaration#Left isExpired 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST... | isExpired(): boolean {
if (!this.expiryDate) return false;
const expiryTime = new Date(this.expiryDate).getTime();
const now = new Date().getTime();
return expiryTime < now;
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L205-L210 | c2183e3d2ecc424db3dcca796a3df2aa20679336 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/UserModel.ets | arkts | register | 注册新用户 | static async register(username: string, password: string): Promise<OperationResult> {
if (!username || !password) {
const result: OperationResult = { success: false, message: '用户名和密码不能为空' };
return result;
}
if (username.length < 3) {
const result: OperationResult = { success: false, mess... | AST#method_declaration#Left static async register AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#p... | static async register(username: string, password: string): Promise<OperationResult> {
if (!username || !password) {
const result: OperationResult = { success: false, message: '用户名和密码不能为空' };
return result;
}
if (username.length < 3) {
const result: OperationResult = { success: false, mess... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L37-L81 | bef1280962ea1ac1eaab29ce78659c1b443947e5 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | toUpper | 转换整个字符串的字符为大写
@param str 要转换的字符串
@returns 返回小写的字符串 | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | AST#method_declaration#Left static toUpper 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#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST... | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L223-L225 | 7e0c3f982d11765e6af6dceb2648b1eb2cc45fd0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactEditPage.ets | arkts | buildBasicInfoSection | 构建基本信息区域 | @Builder
buildBasicInfoSection() {
Column({ space: 16 }) {
Text('基本信息')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
// 姓名
Column({ space: 8 }) {
Row() {
Text('姓名')
.fontSize(16)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBasicInfoSection 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#compone... | @Builder
buildBasicInfoSection() {
Column({ space: 16 }) {
Text('基本信息')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 8 }) {
Row() {
Text('姓名')
.fontSize(16)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L351-L510 | ba07d01851550f327b8e76400bdcd4b715ad3d0f | github |
Autumnker/ArkTS_FreeKnowledgeChat.git | cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7 | entry/src/main/ets/commonViews/comInput.ets | arkts | comInput | 通用输入框 | @Component
export struct comInput{
@Prop title:string
@Prop placeholder:string
@Prop type:InputType
@Link value:string
build() {
Flex(){
Flex({alignItems:ItemAlign.Center}){
Text(this.title)
.width(120)
.fontSize(20)
TextInput({ placeholder: this.placeholder })
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct comInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#R... | @Component
export struct comInput{
@Prop title:string
@Prop placeholder:string
@Prop type:InputType
@Link value:string
build() {
Flex(){
Flex({alignItems:ItemAlign.Center}){
Text(this.title)
.width(120)
.fontSize(20)
TextInput({ placeholder: this.placeholder })
... | https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/commonViews/comInput.ets#L2-L32 | 270cba36b3a85fa9ab29db3f59f0ab04e1a7b7ba | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/utils/HttpUtils.ets | arkts | 用户信息结构 | export interface UserInfo {
id: number;
username: string;
phone?: string;
createTime?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation#Left AS... | export interface UserInfo {
id: number;
username: string;
phone?: string;
createTime?: string;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/HttpUtils.ets#L33-L38 | 4fa9b49acc2d75ee9b7007d3308e4292e0a94146 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/SnapshotUtil.ets | arkts | removeSnapshotListener | 关闭系统截屏事件的监听
@param callback 监听事件,不传关闭所有监听。 | static removeSnapshotListener(callback?: VoidCallback): void {
if (callback) {
AppUtil.getMainWindow().off('screenshot', callback);
} else {
AppUtil.getMainWindow().off('screenshot');
}
} | AST#method_declaration#Left static removeSnapshotListener AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left VoidCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | static removeSnapshotListener(callback?: VoidCallback): void {
if (callback) {
AppUtil.getMainWindow().off('screenshot', callback);
} else {
AppUtil.getMainWindow().off('screenshot');
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/SnapshotUtil.ets#L86-L92 | aee8dfcaa3b741514a221b81801e8e4c7291fe18 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_lite.ets | arkts | log_head | The head of logging information.
@returns "[Meow][bunch_of_history_index_indexer_only]" | static log_head() {
return '[Meow][bunch_of_history_index_indexer_only]';
} | AST#method_declaration#Left static log_head AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '[Meow][bunch_of_history_index_indexer_only]' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#bl... | static log_head() {
return '[Meow][bunch_of_history_index_indexer_only]';
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L182-L184 | f8fa95011089836cb9ab7b13278023dd727a2c83 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/DB.ets | arkts | getAllSettings | debug 方法 | async getAllSettings(): Promise<Map<string, string>> {
await this.waitForReady();
const settings = new Map<string, string>();
if (!this.rdbStore) {
Logger.error(this.LOG_TAG, "数据库实例不存在");
return settings;
}
try {
const predicates = new relat... | AST#method_declaration#Left async getAllSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annot... | async getAllSettings(): Promise<Map<string, string>> {
await this.waitForReady();
const settings = new Map<string, string>();
if (!this.rdbStore) {
Logger.error(this.LOG_TAG, "数据库实例不存在");
return settings;
}
try {
const predicates = new relat... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/DB.ets#L155-L183 | 605069a7e94b5043ada10a14d979c3af8ed98d01 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/common/UIUtils.ets | arkts | Dialog配置 | export class DialogOptions {
title: string = '';
message: string = '';
buttons: ButtonOptions[] = [];
constructor(title?: string, message?: string, buttons?: ButtonOptions[]) {
this.title = title || '';
this.message = message || '';
this.buttons = buttons || [];
}
} | AST#export_declaration#Left export AST#class_declaration#Left class DialogOptions AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Ri... | export class DialogOptions {
title: string = '';
message: string = '';
buttons: ButtonOptions[] = [];
constructor(title?: string, message?: string, buttons?: ButtonOptions[]) {
this.title = title || '';
this.message = message || '';
this.buttons = buttons || [];
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L33-L43 | 3c784c7f52b6f218a56b57ec4c2c69bca6090b8b | github | |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/MqttUtil.ets | arkts | subscribe | 订阅消息 | public async subscribe(
topic: string,
callback: (data: string) => void
): Promise<void>{
if (!this.mqttClient) {
console.warn('MQTT 客户端未创建');
return;
}
// 启动监听(订阅任意数据,因系统默认转发所有配置过的订阅)
await this.mqttClient.subscribe({
topic: topic,
qos: 0
}).then((data) => {
... | AST#method_declaration#Left public async subscribe AST#parameter_list#Left ( AST#parameter#Left topic : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter... | public async subscribe(
topic: string,
callback: (data: string) => void
): Promise<void>{
if (!this.mqttClient) {
console.warn('MQTT 客户端未创建');
return;
}
await this.mqttClient.subscribe({
topic: topic,
qos: 0
}).then((data) => {
this.callbackMap.set(topic, cal... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L123-L141 | 81e32f9866cbcdcbad1a846f8612bb9ab379553f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | 弹框按钮的Action类型(从左往右,最多四个按钮) | export enum DialogAction {
ONE = -1, //第一个按钮 - 取消。
TWO = -2, //第二个按钮 - 确定。
THREE = -3, //第三个按钮。
FOUR = -4, //第四个按钮。
FIVE = -5, //第五个按钮。
SIX = -6, //第六个按钮。
CANCEL = ONE, //第一个按钮 - 取消。
SURE = TWO, //第二个按钮 - 确定。
} | AST#export_declaration#Left export AST#enum_declaration#Left enum DialogAction AST#enum_body#Left { AST#enum_member#Left ONE = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#enum_member#Right , //第一个按钮 - 取消。 AST#enum_member#... | export enum DialogAction {
ONE = -1,
TWO = -2,
THREE = -3,
FOUR = -4,
FIVE = -5,
SIX = -6,
CANCEL = ONE,
SURE = TWO,
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L39-L48 | 0c483171e9e0c2a9b3d09a4ecb2b574d63b27cb0 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.