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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/ExceptionInfo.ets | arkts | 异常信息对象 | export class ExceptionInfo {
constructor(name: string, message: string, stack: string) {
this.brandModel = DeviceUtil.getBrandModel();
this.marketName = DeviceUtil.getMarketName();
this.osFullName = DeviceUtil.getOsFullName();
this.displayVersion = DeviceUtil.getDisplayVersion();
this.osVersion =... | AST#export_declaration#Left export AST#class_declaration#Left class ExceptionInfo AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri... | export class ExceptionInfo {
constructor(name: string, message: string, stack: string) {
this.brandModel = DeviceUtil.getBrandModel();
this.marketName = DeviceUtil.getMarketName();
this.osFullName = DeviceUtil.getOsFullName();
this.displayVersion = DeviceUtil.getDisplayVersion();
this.osVersion =... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/ExceptionInfo.ets#L8-L50 | 2acbd91b089793f80ae15dd0d272f9bb5a590f75 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets | arkts | pushData | 在数据尾部增加一个元素 | public pushData(data: SwiperModule): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left SwiperModule 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_ty... | public pushData(data: SwiperModule): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L54-L57 | 430782d9e631be6cedcc4aad2d1c28ceed9af90e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | buildSelectionActions | 构建选择模式操作栏 | @Builder
buildSelectionActions() {
Row({ space: 16 }) {
Button(`全选(${this.filteredGreetings.length})`)
.type(ButtonType.Capsule)
.fontSize(14)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.height('32vp')
.onClick(() => {
if (this.selectedGreetin... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSelectionActions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_... | @Builder
buildSelectionActions() {
Row({ space: 16 }) {
Button(`全选(${this.filteredGreetings.length})`)
.type(ButtonType.Capsule)
.fontSize(14)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.height('32vp')
.onClick(() => {
if (this.selectedGreetin... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L287-L320 | d5180cc38720db17e4c4784fffb7ca549857391e | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/home.ets | arkts | getShowContent | *******网络接口*******// | async getShowContent() {
let httpRequest = http.createHttp();
let url = address.IP+`/getShowContent`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.... | AST#method_declaration#Left async getShowContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST... | async getShowContent() {
let httpRequest = http.createHttp();
let url = address.IP+`/getShowContent`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/home.ets#L155-L177 | d547eaf51a6079bc54226191614e0dca25bbb6dd | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/IdCardUtil.ets | arkts | isValidCard15 | 校验15位身份证号是否合法
@param idCard
@returns | static isValidCard15(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
if (IdCardUtil.CHINA_ID_MIN_LENGTH != idCard.length) {
return OutDTO.Error("身份证长度不足15位");
}
// 省份
let proCode: string = idCard.substring(0, 2) + "0000";
if (n... | AST#method_declaration#Left static isValidCard15 AST#parameter_list#Left ( AST#parameter#Left idCard : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | static isValidCard15(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
if (IdCardUtil.CHINA_ID_MIN_LENGTH != idCard.length) {
return OutDTO.Error("身份证长度不足15位");
}
let proCode: string = idCard.substring(0, 2) + "0000";
if (null =... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L152-L186 | f2e66a3d23d35008f8eedf865037bf8b9e3bba2d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/MultiThreadConcurrencyOverview/entry/src/main/ets/pages/Index.ets | arkts | produce | 跨线程并发任务 | @Concurrent
async function produce(): Promise<number> {
// 添加生产相关逻辑
console.info('producing...');
return Math.random();
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function produce 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 ... | @Concurrent
async function produce(): Promise<number> {
console.info('producing...');
return Math.random();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/MultiThreadConcurrencyOverview/entry/src/main/ets/pages/Index.ets#L20-L25 | 8e6772900a5c17791503b8b1ae3ff2d6e4a4ef44 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | 年份范围接口 | export interface YearRange {
min: number;
max: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface YearRange AST#object_type#Left { AST#type_member#Left min : 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 max : AST#type_annotation#Left AST#p... | export interface YearRange {
min: number;
max: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L55-L58 | c45234976ab73ea60afc2431c493eda855a0bf75 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets | arkts | getData | 获取索引对应的数据
@param index 数组索引
@returns | public getData(index: number): TabDataModel {
return this.dataArray[index];
} | AST#method_declaration#Left public getData 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 TabDataModel AST#primary_... | public getData(index: number): TabDataModel {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets#L132-L134 | 00a809bb56a61e49b2471de26e49cb9421aa9498 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/radio/radioBuild.ets | arkts | RadioBuildBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function RadioBuildBuilder(name: string, param: Object) {
RadioBuildExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function RadioBuildBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left par... | @Builder
export function RadioBuildBuilder(name: string, param: Object) {
RadioBuildExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/radio/radioBuild.ets#L16-L19 | 02ea267ec990f39b197a5706a160a45b6436d655 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | removeSpec | 删除商品规格
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@returns {Promise<void>} Promise<void> | async removeSpec(goodsId: number, specId: number): Promise<void> {
await this.cartRepository.removeSpecFromCart(goodsId, specId);
// 更新本地数据
for (let i = 0; i < this.cartList.length; i++) {
const cart = this.cartList[i];
if (cart.goodsId === goodsId) {
cart.spec = cart.spec.filter((s: Car... | AST#method_declaration#Left async removeSpec AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | async removeSpec(goodsId: number, specId: number): Promise<void> {
await this.cartRepository.removeSpecFromCart(goodsId, specId);
for (let i = 0; i < this.cartList.length; i++) {
const cart = this.cartList[i];
if (cart.goodsId === goodsId) {
cart.spec = cart.spec.filter((s: CartGoodsSpe... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L192-L212 | 55ef739820104dbc400fc08b3efc3f2262e8c9fb | github |
flowerca/arkTs--Menu-APP.git | 2d41960e707ccc69ce2ad2f12c8b9b1ac9106ec1 | entry/src/main/ets/pages/RecommendationPage.ets | arkts | RecommendationPage | @Entry @Preview | @Component
export default struct RecommendationPage {
@State menucontent:Array<MenuModel>=[]
private swiperController: SwiperController = new SwiperController()
aboutToAppear(){
this.menucontent=new Menudata().getmenuData()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RecommendationPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right menucontent : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Arra... | @Component
export default struct RecommendationPage {
@State menucontent:Array<MenuModel>=[]
private swiperController: SwiperController = new SwiperController()
aboutToAppear(){
this.menucontent=new Menudata().getmenuData()
} | https://github.com/flowerca/arkTs--Menu-APP.git/blob/2d41960e707ccc69ce2ad2f12c8b9b1ac9106ec1/entry/src/main/ets/pages/RecommendationPage.ets#L6-L14 | ad250912d5767a47164c74119c86658959a30590 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets | arkts | initRdbStore | 初始化数据库
@param context 上下文 | public async initRdbStore(context: common.Context): Promise<void> {
logger.info(TAG, 'init rdbStore begin');
if (!context) {
logger.error(TAG, 'initRdbStore context is invalid');
return;
}
if (this.rdbStore) {
logger.info(TAG, 'rdbStore is exist');
return;
}
try {
... | AST#method_declaration#Left public async initRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | public async initRdbStore(context: common.Context): Promise<void> {
logger.info(TAG, 'init rdbStore begin');
if (!context) {
logger.error(TAG, 'initRdbStore context is invalid');
return;
}
if (this.rdbStore) {
logger.info(TAG, 'rdbStore is exist');
return;
}
try {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L52-L72 | e12917d8b8d74f8313961165951c390e12a408ee | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/CorePage.ets | arkts | 构建核心页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.core"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.CoreContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.core" AS... | build() {
AppNavDestination({
title: $r("app.string.core"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.CoreContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L41-L53 | 4a1d9d96823fc8d209f53e618da6a6b3260522a8 | github | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPicture/features/pictureView/src/main/ets/view/BottomBar.ets | arkts | BottomBar | 底部操作栏 | @Component
export struct BottomBar {
build() {
Flex({
justifyContent: FlexAlign.Center,
direction: FlexDirection.Row
}) {
ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => {
Column() {
Image(item.icon)
.height(BaseConstants.DEFAULT_ICON_SIZE)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomBar AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#c... | @Component
export struct BottomBar {
build() {
Flex({
justifyContent: FlexAlign.Center,
direction: FlexDirection.Row
}) {
ForEach(PictureViewConstants.ACTIONS, (item: ActionInterface) => {
Column() {
Image(item.icon)
.height(BaseConstants.DEFAULT_ICON_SIZE)
... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/src/main/ets/view/BottomBar.ets#L7-L30 | 133b1965a77d07ecaee4db5a1a6ee7a0773c5c3b | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets | arkts | value | 默认选中项
@param value
@returns | value(value: string | string[]) {
this.builderOptions.value = value
return this
} | AST#method_declaration#Left value AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotat... | value(value: string | string[]) {
this.builderOptions.value = value
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L29-L32 | a63e4af29702439ca7fe1412625815d53e4a23b6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets | arkts | bottomRightListItem | 下部分右侧纵向滚动列表里的每一行参数信息
@param item 展示数据 | @Builder
bottomRightListItem(item: ShowData) {
// TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销
LazyForEach(item.sub, (partInfo: PartInfo, key: number) => {
ListItem() {
ItemCompo... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomRightListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ShowData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_functio... | @Builder
bottomRightListItem(item: ShowData) {
LazyForEach(item.sub, (partInfo: PartInfo, key: number) => {
ListItem() {
ItemComponent({
listContent: partInfo.info,
scroller: item.scrollerArray[key],
scrollCallback: (value) => {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L215-L251 | c65cf6133a6437d68fc6739f9b42e02cea07e973 | gitee |
MissTeven/ArkTS-demo.git | fd9f7695fa29889ad4a9ecf3330fda9991aca24c | entry/src/main/ets/view/MinePageContentComponent.ets | arkts | MinePageContentComponent | Personal page component. | @Component
export default struct MinePageContentComponent {
build() {
Column() {
List() {
ForEach(LoginPageViewModel.getPersonalListItems(), (item: ListItemData) => {
ListItem() {
MinePageItemComponent({ itemTitle: item.title })
}
}, (item, index) => index + J... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MinePageContentComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#contai... | @Component
export default struct MinePageContentComponent {
build() {
Column() {
List() {
ForEach(LoginPageViewModel.getPersonalListItems(), (item: ListItemData) => {
ListItem() {
MinePageItemComponent({ itemTitle: item.title })
}
}, (item, index) => index + J... | https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/view/MinePageContentComponent.ets#L8-L36 | dc46bc2c32c5c4da98893d7939d0a08e16f926ca | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets | arkts | getResourceItem | 获取账单来源单项数据 | public getResourceItem(key: number): BalanceResourceItem {
const list =
key > 200 ? this.displayIncomeResource : this.displayExpenseResource;
const resource = list.find((item) => item.key === key)!;
return resource;
} | AST#method_declaration#Left public getResourceItem AST#parameter_list#Left ( AST#parameter#Left key : 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 BalanceResourceItem... | public getResourceItem(key: number): BalanceResourceItem {
const list =
key > 200 ? this.displayIncomeResource : this.displayExpenseResource;
const resource = list.find((item) => item.key === key)!;
return resource;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L80-L85 | 37ec948a95dcc3889bdac4e708b6bd5f9212854a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | verifySync | 对数据进行验签,同步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
@returns | static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
} | AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signD... | static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): boolean {
return CryptoUtil.verifySync(dataBlob, signDataBlob, pubKey, algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L249-L252 | 945956942a0569c773ab7e3353ab49fcd687fa36 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets | arkts | @Author csx
@DateTime 2024/7/24 00:39
@TODO EfRcpClientApi rcp请求工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp | export class EfRcpClientApi {
/**
* 构建请求的header
* @param headers 传入的自定义header
* @returns 拼接完公共系列全部完整header
*/
private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders {
//需要添加的header对象
let addHead: rcp.RequestHeaders = {};
//是否需要拼接token
if (efRcpConfig.token.toke... | AST#export_declaration#Left export AST#class_declaration#Left class EfRcpClientApi AST#class_body#Left { /**
* 构建请求的header
* @param headers 传入的自定义header
* @returns 拼接完公共系列全部完整header
*/ AST#method_declaration#Left private static buildHeaders AST#parameter_list#Left ( AST#parameter#Left headers ? : AST#type_a... | export class EfRcpClientApi {
private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders {
let addHead: rcp.RequestHeaders = {};
if (efRcpConfig.token.tokenValue) {
if (efRcpConfig.token.tokenName && efRcpConfig.token.tokenName != 'authorization') {
addHead[ef... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L39-L221 | f4ca35591e7bb8e01ac0709cc2beb3ba5fd62b76 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/collections/set_002_F.ets | arkts | Introduction 集合-集合类型 | export function set_002_F(taint_src : Set<string>) {
let _t = taint_src;
let _clean = new Set<string>();
_clean.add("a");
taint.Sink(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function set_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST... | export function set_002_F(taint_src : Set<string>) {
let _t = taint_src;
let _clean = new Set<string>();
_clean.add("a");
taint.Sink(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/set_002_F.ets#L5-L10 | 9ccb98dd32b77ae60b97aa5c41ebd8383c8abf80 | github | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/MoodEntry.ets | arkts | toRow | Convert to database row format | toRow(): MoodEntryData {
return {
date: this.date,
emotion: this.emotion,
intensity: this.intensity,
message_count: this.messageCount,
timestamp: this.timestamp
};
} | AST#method_declaration#Left toRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MoodEntryData 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... | toRow(): MoodEntryData {
return {
date: this.date,
emotion: this.emotion,
intensity: this.intensity,
message_count: this.messageCount,
timestamp: this.timestamp
};
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L72-L80 | bca6470b6bad7efbd3e2e89242bd7e64fc69cc8f | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerDialog.ets | arkts | resumeTimer | 继续计时(从暂停状态恢复,根据当前模式决定递增或递减) | private resumeTimer() {
if (this.isRunning) {
return;
}
this.isRunning = true;
this.isPaused = false;
this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中...";
this.statusPromptColor = Color.Green;
// 计时回调函数
// 使用ArkTS推荐的计时器实现方式
const intervalCallback = () => {
if (this... | AST#method_declaration#Left private resumeTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRunning AST#member_expression#Right AST#expressio... | private resumeTimer() {
if (this.isRunning) {
return;
}
this.isRunning = true;
this.isPaused = false;
this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时进行中...";
this.statusPromptColor = Color.Green;
const intervalCallback = () => {
if (this.isIncrementing) {
th... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L79-L121 | f1d07de565baa17c4c32015479dbf24f10cf91d5 | gitee |
batiluoxuanwan/MomentFlow.git | e57aa461223abca74f48893afc2ccf7c2d73e9b8 | frontend/entry/src/main/ets/api/DiaryApi.ets | arkts | create | 创建日记 | static async create(diary: DiaryDto): Promise<Diary | null> {
return request<Diary>(BASE_URL, {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(diary)
})
} | AST#method_declaration#Left static async create AST#parameter_list#Left ( AST#parameter#Left diary : AST#type_annotation#Left AST#primary_type#Left DiaryDto 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#L... | static async create(diary: DiaryDto): Promise<Diary | null> {
return request<Diary>(BASE_URL, {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(diary)
})
} | https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/DiaryApi.ets#L68-L74 | ec49fca993d74770f71fd65587d0eccdfd0aa2b9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setHoleColor | Sets the color for the hole that is drawn in the center of the PieChart
(if enabled).
@param color | public setHoleColor(color: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color);
} | AST#method_declaration#Left public setHoleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ... | public setHoleColor(color: number): void {
(
this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L432-L435 | 4e0e2fabcc6245db4ef4a84769e07536be00a039 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/scrollingCharts/viewPageItems/fragment_simple_pie_index.ets | arkts | initPieData | 初始化饼状图数据 | private initPieData(count: number, range: number): PieData {
let entries = new JArrayList<PieEntry>();
for (let i = 0; i < count; i++) {
entries.add(new PieEntry(((Math.random() * range) + range / 5), this.parties[i % this.parties.length]))
}
let dataSet: PieDataSet = new PieDataSet(entries, "Ele... | AST#method_declaration#Left private initPieData AST#parameter_list#Left ( AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left range : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | private initPieData(count: number, range: number): PieData {
let entries = new JArrayList<PieEntry>();
for (let i = 0; i < count; i++) {
entries.add(new PieEntry(((Math.random() * range) + range / 5), this.parties[i % this.parties.length]))
}
let dataSet: PieDataSet = new PieDataSet(entries, "Ele... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/viewPageItems/fragment_simple_pie_index.ets#L50-L84 | 51b18ce9585394fc7fc4b66bfb49a28a9ab02ef2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/todo/TodoService.ets | arkts | deleteTodo | 删除代办事项 | async deleteTodo(id: string): Promise<boolean> {
try {
const index = this.todos.findIndex(todo => todo.id === id);
if (index === -1) {
return false;
}
const deletedTodo = this.todos[index];
this.todos.splice(index, 1);
this.recordOperation('delete', id, undefined,... | AST#method_declaration#Left async deleteTodo AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async deleteTodo(id: string): Promise<boolean> {
try {
const index = this.todos.findIndex(todo => todo.id === id);
if (index === -1) {
return false;
}
const deletedTodo = this.todos[index];
this.todos.splice(index, 1);
this.recordOperation('delete', id, undefined,... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L266-L284 | a51f3e090c8d129b522c7b66936d9686823948a8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets | arkts | setDataChangeListener | Set the data change listening function.
@param callback Callback. | setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void {
if (this.kvStore === undefined) {
Logger.error('KvStoreModel', 'setDataChangeListener kvStore is null');
return;
}
try {
this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_... | AST#method_declaration#Left setDataChangeListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . ChangeNotification AST... | setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void {
if (this.kvStore === undefined) {
Logger.error('KvStoreModel', 'setDataChangeListener kvStore is null');
return;
}
try {
this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets#L104-L121 | 256177fd28baf0b13f0e6b8a957a6bc516473bd0 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets | arkts | connectSocketAndOnClose | TCP或TLS连接 服务端或对端 | connectSocketAndOnClose(): void {
this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => {
this.receiveMessage(data);
})
// 连接同时订阅关闭连接回调
this.socketController?.onClose(() => {
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
... | AST#method_declaration#Left connectSocketAndOnClose AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#... | connectSocketAndOnClose(): void {
this.socketController?.connectSocket(oppositeAddress, oppositePort, (data: string) => {
this.receiveMessage(data);
})
this.socketController?.onClose(() => {
CommonEvent.publish(Constants.COMM_EVENT_HANGUP_FROM_HOST, this.publishCallback);
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L110-L120 | a34cca2e10541ad4b2545b24c69411ff27db2c86 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ShareUtils.ets | arkts | shareLink | 优化版链接分享(严格遵循systemShare规范)
@param url - 分享链接(必填)
@param title - 分享标题(必填)
@param summary - 分享描述(必填) | static shareLink(
url: string,
title?: string,
summary?: string
): void {
// 1. 创建主分享数据(必须设置HYPERLINK类型)
const data = new systemShare.SharedData({
utd: utd.UniformDataType.HYPERLINK, // 统一类型描述符,标识为超链接类型
content: url, // 链接地址作为主内容
title: title || '网页分享', ... | AST#method_declaration#Left static shareLink AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static shareLink(
url: string,
title?: string,
summary?: string
): void {
const data = new systemShare.SharedData({
utd: utd.UniformDataType.HYPERLINK,
content: url,
title: title || '网页分享',
description: summary || ''
});
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L155-L193 | dfbee9c1f2ed216fbeb84ebf2a3be78049c00459 | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/notify/NotificationHelper.ets | arkts | 通知辅助者
@since 2022-06-05 | export class NotificationHelper implements INotify {
/**
* 跳转信息--跳转到搜包页面
*/
private checkWantAgentInfo = {
wants: [{
bundleName: PACKAGE_NAME,
abilityName: 'ServiceExtAbility',
action: Action.NOTIFICATION_CHECK
}],
operationType: wantAgent.Operatio... | AST#export_declaration#Left export AST#class_declaration#Left class NotificationHelper AST#implements_clause#Left implements INotify AST#implements_clause#Right AST#class_body#Left { /**
* 跳转信息--跳转到搜包页面
*/ AST#property_declaration#Left private checkWantAgentInfo = AST#expression#Left AST#object_literal#Left { AST... | export class NotificationHelper implements INotify {
private checkWantAgentInfo = {
wants: [{
bundleName: PACKAGE_NAME,
abilityName: 'ServiceExtAbility',
action: Action.NOTIFICATION_CHECK
}],
operationType: wantAgent.OperationType.START_ABILITY,
req... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L28-L252 | 7b70f1b0a22231d46ce3ffa72ea36f0a7969233a | gitee | |
xixi-cquer/BiJiDaiBan.git | 206dc33a837acbe6fc837feff848427e83946534 | entry/src/main/ets/viewmodel/DataModel.ets | arkts | Saving and manipulating data displayed on the page. | export class DataModel {
/**
* Saved Data.
*/
private tasks: Array<Array<string>> = CommonConstants.TODO_DATA;
/**
* Get the data.
*/
getData(): Array<Array<string>> {
function ascend(x,y){
return x[1] - y[1]; //按照数组的第4个值升序排列
}
this.tasks=this.tasks.sort(ascend);
return this.... | AST#export_declaration#Left export AST#class_declaration#Left class DataModel AST#class_body#Left { /**
* Saved Data.
*/ AST#property_declaration#Left private tasks : 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... | export class DataModel {
private tasks: Array<Array<string>> = CommonConstants.TODO_DATA;
getData(): Array<Array<string>> {
function ascend(x,y){
return x[1] - y[1];
}
this.tasks=this.tasks.sort(ascend);
return this.tasks;
}
cheData(data:Array<string>):Array<Array<string>>{
l... | https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/viewmodel/DataModel.ets#L21-L61 | fddb04b17b70983aa7bbffef7e1270f72d02fc76 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | 构建字典选择弹窗
@returns {void} 无返回值 | build(): void {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContentNetWorkLayout()
});
} | 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 BottomModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expressi... | build(): void {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContentNetWorkLayout()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L80-L88 | 4f0c0a7073f6ffd4ce11fef32862e646dc30f484 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | deletePreferences | 从缓存中移出指定的Preferences实例,若Preferences实例有对应的持久化文件,则同时删除其持久化文件。
@param context
@param name Preferences 实例的名称。 | static async deletePreferences(context: Context, name: string): Promise<void> {
return dataPreferences.deletePreferences(context, name);
} | AST#method_declaration#Left static async deletePreferences 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#Left name : AST#type_annotation#Left AST#primary_type#Left string ... | static async deletePreferences(context: Context, name: string): Promise<void> {
return dataPreferences.deletePreferences(context, name);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L263-L265 | 76f74152de970444df198e0bc7726067640d2d6a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringMapUtility.ets | arkts | removedDuplications | / 按指定的分隔符split之后去除重复项 / 返回的结果是按原来的seperator合并的 | public static removedDuplications(
srcStr : string,
seperator : string
): string {
return StringMapUtility.removedDuplicationsWithTrim(srcStr, seperator, true);
} | AST#method_declaration#Left public static removedDuplications 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 s... | public static removedDuplications(
srcStr : string,
seperator : string
): string {
return StringMapUtility.removedDuplicationsWithTrim(srcStr, seperator, true);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringMapUtility.ets#L8-L13 | 90e6fef3f4b62973b50cf3ae55dc77f73dd72b2a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_asynchronous.ets | arkts | encryptMessagePromise | 加密消息 | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null);
let cipherData = await cipher.doFinal(plainText);
return cipherData... | AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null);
let cipherData = await cipher.doFinal(plainText);
return cipherData... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ecb_encryption_decryption/aes_ecb_encryption_decryption_asynchronous.ets#L21-L26 | 3e59adcf2d9281d1db8b44588d8a25188f676a14 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 用户积分记录接口 | export interface PointsRecord {
id: string;
userId: string;
action: GameAction;
points: number;
reason: string;
metadata: Record<string, any>;
timestamp: string;
multiplier?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PointsRecord 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 userId : AST#type_annotation#Left ... | export interface PointsRecord {
id: string;
userId: string;
action: GameAction;
points: number;
reason: string;
metadata: Record<string, any>;
timestamp: string;
multiplier?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L131-L140 | 562e63658eda2ce65c2765b15065b0c44ee09328 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets | arkts | setCrossAxis | 设置交叉轴位置 | setCrossAxis(event: GestureEvent) {
// list当前没有在移动 && 交叉轴时候如果没有放大也不移动
let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset: number = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
... | AST#method_declaration#Left setCrossAxis AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 AST#stat... | setCrossAxis(event: GestureEvent) {
let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset: number = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
}
if (this.isMoveCrossAxis && ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L248-L269 | d4a1ab6f7b4d02f6fa0cf2dfb5a95b7c31ee51d9 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.collections.d.ets | arkts | from | Creates an ArkTS array from an array-like object, and uses a custom function to process each array element.
The type of the elements in the array-like object can be different from that of the array elements.
@param { ArrayLike<U> | Iterable<U> } arrayLike - Array-like object.
@param { ArrayFromMapFn<U, T> } mapFn - ... | static from<U, T>(arrayLike: ArrayLike<U> | Iterable<U>, mapFn: ArrayFromMapFn<U, T>): Array<T>; | AST#method_declaration#Left static from AST#type_parameters#Left < AST#type_parameter#Left U AST#type_parameter#Right , AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arrayLike : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le... | static from<U, T>(arrayLike: ArrayLike<U> | Iterable<U>, mapFn: ArrayFromMapFn<U, T>): Array<T>; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L536-L536 | 2bb02c108e7dc13c5df789e896f9dc40a2eef6e5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ZipTool.ets | arkts | decompress | 解压ZIP文件到指定目录
@param zipFile ZIP文件路径(沙箱路径)
@param destDir 目标目录路径(沙箱路径)
@returns Promise<boolean> 操作是否成功 | static async decompress(
zipFile: string,
destDir: string
): Promise<boolean> {
try {
// 1. 验证ZIP文件是否存在[1](@ref)
if (!fs.accessSync(zipFile)) {
throw new Error(`ZIP file not found: ${zipFile}`);
}
// 2. 创建目标目录(如果不存在)[2](@ref)
if (!fs.accessSync(destDir)) {
fs... | AST#method_declaration#Left static async decompress AST#parameter_list#Left ( AST#parameter#Left zipFile : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left destDir : AST#type_annotation#Left AST#primary_type#Left string AST#p... | static async decompress(
zipFile: string,
destDir: string
): Promise<boolean> {
try {
if (!fs.accessSync(zipFile)) {
throw new Error(`ZIP file not found: ${zipFile}`);
}
if (!fs.accessSync(destDir)) {
fs.mkdirSync(destDir, true);
}
await... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ZipTool.ets#L134-L157 | 8e4ecd374daafc027811159358372b6a0c749272 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleOfflineManager.ets | arkts | saveOfflineOperations | 保存离线操作 | private async saveOfflineOperations(): Promise<void> {
try {
await StorageUtils.putObject('simple_offline_operations', this.offlineOperations);
hilog.info(0x0000, 'SimpleOfflineManager', 'Saved offline operations');
} catch (error) {
hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to save ... | AST#method_declaration#Left private async saveOfflineOperations 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#Rig... | private async saveOfflineOperations(): Promise<void> {
try {
await StorageUtils.putObject('simple_offline_operations', this.offlineOperations);
hilog.info(0x0000, 'SimpleOfflineManager', 'Saved offline operations');
} catch (error) {
hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to save ... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L57-L64 | 6d997ad81231b71be6b0ca77c838bad0dc816f59 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets | arkts | ecdh | ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
@param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
@param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns ECC256共享密钥 | static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static ecdh AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS... | static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/ECDHSync.ets#L35-L38 | d9e3702c71c515a39de15830ec90fe011f67a65f | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/url.ets | arkts | URL | ==================== 导出 ==================== | export { URL, URLSearchParams, parseURL, urlParse }; | AST#export_declaration#Left export { URL , URLSearchParams , parseURL , urlParse } ; AST#export_declaration#Right | export { URL, URLSearchParams, parseURL, urlParse }; | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L888-L888 | 23ec606b3fa2a5515ddab13886c8deb52e7e84cc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | 继承自BasicDataSource的子类,重写了方法
@class SecondDataSource
@extends {BasicDataSource} | export class PanelDataSource extends BasicDataSource {
private dataArray: PanelDataType[] = [];
/**
* 获取数组长度
* @returns {number} 返回数组长度
*/
public totalCount(): number {
return this.dataArray.length;
}
/**
* 获取指定索引数据
* @param {number} index - 索引值
* @returns {PanelDataType} 返回指定索引数据
*... | AST#export_declaration#Left export AST#class_declaration#Left class PanelDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Le... | export class PanelDataSource extends BasicDataSource {
private dataArray: PanelDataType[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): PanelDataType {
return this.dataArray[index];
}
public addData(index: number, data: PanelDataType):... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L188-L230 | e1e9dfed447af62ade150fc5be7154048267ffa6 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/CartService.ets | arkts | addToCart | 添加到购物车 | async addToCart(productId: string, productName: string, image: string, price: number, quantity: number = 1): Promise<void> {
const existingItem = this.cartItems.find(item => item.productId === productId);
if (existingItem) {
existingItem.quantity += quantity;
} else {
this.cartItems.push({
... | AST#method_declaration#Left async addToCart AST#parameter_list#Left ( AST#parameter#Left productId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left productName : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | async addToCart(productId: string, productName: string, image: string, price: number, quantity: number = 1): Promise<void> {
const existingItem = this.cartItems.find(item => item.productId === productId);
if (existingItem) {
existingItem.quantity += quantity;
} else {
this.cartItems.push({
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L74-L89 | 0fa7f14deda56c6f157b63979cd5ed5863e4b224 | github |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleE/entry/src/main/ets/pages/takeaway/Business.ets | arkts | aboutToAppear | 纬度 | aboutToAppear() {
Logger.info(TAG, 'aboutToAppear begin');
this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => {
Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`);
this.businessList = res;
}).catch((err: BusinessError) => {
... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expr... | aboutToAppear() {
Logger.info(TAG, 'aboutToAppear begin');
this.businessController.getBusinessList(this.longitude, this.latitude).then((res: BusinessInfo[]) => {
Logger.info(TAG, `aboutToAppear then res= ${JSON.stringify(res)}`);
this.businessList = res;
}).catch((err: BusinessError) => {
... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleE/entry/src/main/ets/pages/takeaway/Business.ets#L49-L57 | 7d5849098ce1b64fc8223e01903625daf83b66fc | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets | arkts | download2Stream | 下载到流 | download2Stream() {
let localFilePath = getContext(this).tempDir + "/demo.txt"
let fileStream = fs.createStreamSync(localFilePath, "w")
const streamData: rcp.SyncWriteStream = {
writeSync(buffer: ArrayBuffer) {
fileStream.writeSync(buffer)
}
};
let downloadToStream: rcp.Download... | AST#method_declaration#Left download2Stream AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localFilePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#... | download2Stream() {
let localFilePath = getContext(this).tempDir + "/demo.txt"
let fileStream = fs.createStreamSync(localFilePath, "w")
const streamData: rcp.SyncWriteStream = {
writeSync(buffer: ArrayBuffer) {
fileStream.writeSync(buffer)
}
};
let downloadToStream: rcp.Download... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets#L101-L124 | 8dfdf9cc820bf4b947dee541521abb624f6fbd2b | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinJ.ets | arkts | SpinJ | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinJ {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local scaleSize: number = this.spinSize * 0.75;
@Local tran1: number = 0;
private oldSize: number = this.spinSize;
aboutToAppear(): void {
this.oldSize = this.spinSize;
this.scaleSi... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinJ AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinJ {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local scaleSize: number = this.spinSize * 0.75;
@Local tran1: number = 0;
private oldSize: number = this.spinSize;
aboutToAppear(): void {
this.oldSize = this.spinSize;
this.scaleSi... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinJ.ets#L25-L136 | b3f0990e4bab71f1a36f9bdad25f576efcb2ca21 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets | arkts | SetupVpn | 设置VPN网络配置的方法 | SetupVpn() {
console.info('xdw step3');
Logger.info('developTag', '%{public}s', 'vpn SetupVpn');
class Address {
public address: string;
public family: number;
constructor(address: string, family: number) {
this.address = address;
this.family = family;
}
} | AST#method_declaration#Left SetupVpn 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 console AST#expression#Right . info AST#member_expressi... | SetupVpn() {
console.info('xdw step3');
Logger.info('developTag', '%{public}s', 'vpn SetupVpn');
class Address {
public address: string;
public family: number;
constructor(address: string, family: number) {
this.address = address;
this.family = family;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets#L109-L120 | 323f71844ca4c7f6a60e0babd01c926306671d33 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets | arkts | verify | 验签
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey 公钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding, false);
} | AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding, false);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets#L59-L62 | 43cb09d666116ca560aec5fc3a1dd831c10c9a1f | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | deleteFileSync | 删除文件
@param path 文件绝对路径及文件名 | deleteFileSync(path: string): boolean {
try {
let fileExist = fs.accessSync(path);
if (fileExist) {
fs.unlinkSync(path);
}
return true
} catch (err) {
LogUtil.error('FileUtils deleteFileSync failed: err msg=' + err.message + ' err code=' + err.code);
return false
... | AST#method_declaration#Left deleteFileSync 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 boolean AST#primary_type#R... | deleteFileSync(path: string): boolean {
try {
let fileExist = fs.accessSync(path);
if (fileExist) {
fs.unlinkSync(path);
}
return true
} catch (err) {
LogUtil.error('FileUtils deleteFileSync failed: err msg=' + err.message + ' err code=' + err.code);
return false
... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L42-L53 | 2bb75a3adeb4430a322148f6609b60ec7a835b89 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets | arkts | aboutToAppear | 图片原始宽高比 | aboutToAppear(): void {
this.initCurrentImageInfo();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
this.initCurrentImageInfo();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets#L40-L42 | f54e9e6830ca63b1ac4efcaeb67da0abcb925351 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/workers/History_indexer.ets | arkts | rebuild_full_history_index_sync | Builds index for all history and saves (overwrites) the index file onto disk.
THIS IS A SYNC FUNCTION | function rebuild_full_history_index_sync(context_filesDir: string) {
let s = Date.now();
console.log(host.log_head_worker() + ' Start rebuilding full index! Start: ' + new Date(s).toString() + '.')
// Clear all previous index
try {
fs.rmdirSync(context_filesDir + "/history-index");
fs.mkdirSync(context... | AST#function_declaration#Left function rebuild_full_history_index_sync AST#parameter_list#Left ( AST#parameter#Left context_filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#stat... | function rebuild_full_history_index_sync(context_filesDir: string) {
let s = Date.now();
console.log(host.log_head_worker() + ' Start rebuilding full index! Start: ' + new Date(s).toString() + '.')
try {
fs.rmdirSync(context_filesDir + "/history-index");
fs.mkdirSync(context_filesDir + "/history-index... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/workers/History_indexer.ets#L50-L98 | 25144fc52c2c9a4e651739c6aa6fb1466592f6fd | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/MessageUtil.ets | arkts | icon | 左侧icon样式
@param icon 用户自定义
@param defaultIcon 默认 | @Extend(Image)
function icon() {
.width(UiConst.VP_15)
.height(UiConst.VP_15)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function icon AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expres... | @Extend(Image)
function icon() {
.width(UiConst.VP_15)
.height(UiConst.VP_15)
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L137-L141 | 335c8f1df5e997160f9e807cf3dfe7cbe586bd1f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets | arkts | Comment | List子项评论属性 | @Observed
export class Comment {
id?: string; // 评论id
avatar?: Resource; // 评论人头像
name?: string; // 评论人昵称
commentContent?: string; // 评论内容
timeAgo?: string; // 评论时间
address?: string; // 评论地址
likeCount?: string; // 评论的点赞人数
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Comment AST#class_body#Left { AST#property_declaration#Left id ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 评论id AST#prop... | @Observed
export class Comment {
id?: string;
avatar?: Resource;
name?: string;
commentContent?: string;
timeAgo?: string;
address?: string;
likeCount?: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets#L20-L29 | 23dcc2863b8166ea87c447a1d0cee240892d954d | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets | arkts | 从文件读取二进制内容 | export function readArrayBufferContentFromFile(fileUri: string): ArrayBuffer {
let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY);
let fsStat = fs.statSync(file.fd);
let buf = new ArrayBuffer(fsStat.size);
fs.readSync(file.fd, buf);
fs.fsyncSync(file.fd)
fs.closeSync(file);
return buf
} | AST#export_declaration#Left export AST#function_declaration#Left function readArrayBufferContentFromFile AST#parameter_list#Left ( AST#parameter#Left fileUri : 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... | export function readArrayBufferContentFromFile(fileUri: string): ArrayBuffer {
let file = fs.openSync(fileUri, fs.OpenMode.READ_ONLY);
let fsStat = fs.statSync(file.fd);
let buf = new ArrayBuffer(fsStat.size);
fs.readSync(file.fd, buf);
fs.fsyncSync(file.fd)
fs.closeSync(file);
return buf
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L61-L69 | 82005f9157ea657b18b848cd48a224dfc15e943d | gitee | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/api/FinVideoApi.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2025/7/6 23:17
@Version V1.0
@Description Video Fin Api | export interface FinVideoApi extends FinApi {
/**
* 获取恢复播放列表
* @returns
*/
getResumeItems(): Promise<Array<FinItem>>
/**
* 获取继续播放列表
* @param seriesId
* @returns
*/
getNextUp(seriesId?: string): Promise<Array<FinItem>>
/**
* 获取媒体库列表
* @returns
*/
getLibraryList(): Promise<Arr... | AST#export_declaration#Left export AST#interface_declaration#Left interface FinVideoApi AST#extends_clause#Left extends FinApi AST#extends_clause#Right AST#object_type#Left { /**
* 获取恢复播放列表
* @returns
*/ AST#type_member#Left getResumeItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotat... | export interface FinVideoApi extends FinApi {
getResumeItems(): Promise<Array<FinItem>>
getNextUp(seriesId?: string): Promise<Array<FinItem>>
getLibraryList(): Promise<Array<FinItem>>
getLatestItems(id?: string): Promise<Array<FinItem>>
getItemList(id: string, types: Array<FinItemType>, re... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/api/FinVideoApi.ets#L13-L138 | 93e09b75881f43ed8755685abac987642c62d2ac | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | loadSavedCredentials | 加载已保存的账号密码
@returns {Promise<void>} Promise<void> | private async loadSavedCredentials(): Promise<void> {
const savedAccount: string = await this.accountStoreRepository.loadAccount();
const savedPassword: string = await this.accountStoreRepository.loadPassword();
if (savedAccount) {
this.account = savedAccount;
}
if (savedPassword) {
this... | AST#method_declaration#Left private async loadSavedCredentials 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#Righ... | private async loadSavedCredentials(): Promise<void> {
const savedAccount: string = await this.accountStoreRepository.loadAccount();
const savedPassword: string = await this.accountStoreRepository.loadPassword();
if (savedAccount) {
this.account = savedAccount;
}
if (savedPassword) {
this... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L98-L107 | 7d9764cc2c194d8dd68ac506bef11427247ae2c8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 数据库记录接口 | export interface DbRecord {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string;
isCustom: number;
usageCount: number;
rating: number;
authorId: string;
isPublic: number;
metadata: string;
createdAt: string;
updatedAt: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DbRecord 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 AST... | export interface DbRecord {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string;
isCustom: number;
usageCount: number;
rating: number;
authorId: string;
isPublic: number;
metadata: string;
createdAt: string;
updatedAt: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L267-L282 | 87716cd7e10f04e4db0ae5c1e68095edd984cbc3 | github | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/MusicMyComponent.ets | arkts | favoriteBuilder | @author: wuwenqiang
@description: 收藏夹
@date: 2024-07-01 21:45 | @Builder favoriteBuilder(){
Column(){
Row(){
Blank()
.width(size.smallIconSize)
.height(size.smallIconSize)
.margin({right:size.pagePadding})
Text('创建收藏夹')
.padding(size.pagePadding)
.textAlign(TextAlign.Center)
.border({
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right favoriteBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_... | @Builder favoriteBuilder(){
Column(){
Row(){
Blank()
.width(size.smallIconSize)
.height(size.smallIconSize)
.margin({right:size.pagePadding})
Text('创建收藏夹')
.padding(size.pagePadding)
.textAlign(TextAlign.Center)
.border({
... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L80-L114 | 9f0affc3a8b5922cb3a8008a2e3d25b6a7585e23 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets | arkts | addItem | 在指定索引位置增加一个元素
@param index | public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L139-L142 | 46790f8c92fcf5a342da818102d7c67e46606276 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CommonConstantsInfo.ets | arkts | Common constants info | export default class CommonConstantsInfo {
dbName?: string = '';
tableName?: string = '';
columns?: Array<string> = [];
} | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstantsInfo AST#class_body#Left { AST#property_declaration#Left dbName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#proper... | export default class CommonConstantsInfo {
dbName?: string = '';
tableName?: string = '';
columns?: Array<string> = [];
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CommonConstantsInfo.ets#L19-L23 | b081d04db908335f27682ad6a960fd3fbc0e6f81 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | buildBirthdayCard | 构建生日卡片 | @Builder
buildBirthdayCard(metadata: Record<string, any>) {
Column({ space: 8 }) {
Row({ space: 12 }) {
Image($r('app.media.ic_cake'))
.width(24)
.height(24)
.fillColor('#FF5722')
Text(`${metadata.name}的生日`)
.fontSize(16)
.fontColor($r('app.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayCard AST#parameter_list#Left ( AST#parameter#Left metadata : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | @Builder
buildBirthdayCard(metadata: Record<string, any>) {
Column({ space: 8 }) {
Row({ space: 12 }) {
Image($r('app.media.ic_cake'))
.width(24)
.height(24)
.fillColor('#FF5722')
Text(`${metadata.name}的生日`)
.fontSize(16)
.fontColor($r('app.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets#L291-L327 | 53385c12086b3d78dac1be2cd64cd7f5128138ea | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isTypedArray | 检查是否为TypedArray类型。TypedArray类型,包括Int8Array、Int16Array、Int32Array、Uint8Array、Uint8ClampedArray、Uint16Array、Uint32Array、Float32Array、Float64Array、BigInt64Array、BigUint64Array。
@param value
@returns | static isTypedArray(value: Object): boolean {
return new util.types().isTypedArray(value);
} | AST#method_declaration#Left static isTypedArray AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static isTypedArray(value: Object): boolean {
return new util.types().isTypedArray(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L229-L231 | fe6ece0093fbb4258b0af9f87ea41386eec3ccf9 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | RefundInfoTitle | 退款信息标题
@returns {void} 无返回值 | @Builder
private RefundInfoTitle() {
TitleWithLine({
text: $r("app.string.refund_info")
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RefundInfoTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expres... | @Builder
private RefundInfoTitle() {
TitleWithLine({
text: $r("app.string.refund_info")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L273-L278 | 05499a525625f561e8c5ed3d1974bda2bd384704 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the senior (S) version number, which increases with any updates to the partial
architecture or major features.
<p>The S version number monotonically increases from 0 to 99.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get seniorVersion(): int; | AST#method_declaration#Left static get AST#ERROR#Left seniorVersion AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get seniorVersion(): int; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L258-L258 | 758e6a78e38f9ab7c30b69a8a1bbfdfba6327e20 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | getIconFont | 解析iconFont字符
@param iconfont iconFont字符(e631)
@returns | static getIconFont(iconFont: string): string {
return String.fromCharCode(parseInt(iconFont, 16))
} | AST#method_declaration#Left static getIconFont AST#parameter_list#Left ( AST#parameter#Left iconFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static getIconFont(iconFont: string): string {
return String.fromCharCode(parseInt(iconFont, 16))
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L147-L149 | 462f8be0a92314803858f2650408d03dc7c1c6fc | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | aboutToAppear | 列表当前索引值 | async aboutToAppear() {
// 视频列表数据初始化
NEWS_LIST_DATA.forEach((news: NewsItem) => {
this.newsList.pushData(news);
})
// 获取列表的长度
this.arrayLength = this.newsList.totalCount()
if (this.index === 0 || this.index === this.arrayLength) {
this.startOrEnd = true;
}
// 设置播放状态
this.... | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 视频列表数据初始化 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NEWS_LIST_DATA AST#expression#R... | async aboutToAppear() {
NEWS_LIST_DATA.forEach((news: NewsItem) => {
this.newsList.pushData(news);
})
this.arrayLength = this.newsList.totalCount()
if (this.index === 0 || this.index === this.arrayLength) {
this.startOrEnd = true;
}
this.setCompleteCallback(() => {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L57-L76 | c756358907b6d1f9772b4cddfe188c08cfcc2386 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | deleteDirectoryAt | 递归删除目录 | static deleteDirectoryAt(path: string | null): boolean {
if (!path) return false;
let dirPath = path.endsWith('/') ? path : path + '/';
try {
const stat = fs.statSync(dirPath);
if (!stat.isDirectory) return false;
const files = fs.listFileSync(dirPath);
let success = true;
f... | AST#method_declaration#Left static deleteDirectoryAt AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right... | static deleteDirectoryAt(path: string | null): boolean {
if (!path) return false;
let dirPath = path.endsWith('/') ? path : path + '/';
try {
const stat = fs.statSync(dirPath);
if (!stat.isDirectory) return false;
const files = fs.listFileSync(dirPath);
let success = true;
f... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L43-L73 | bb4a86734bd7fbc06c15181d20f4147247adfc10 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringDealUtility.ets | arkts | getJoinedTextsFromList | / 合并字符串列表 | public static getJoinedTextsFromList(
list : Array<string> | null,
seperator : string
): string | null {
if (list === null) {
return null;
}
let result: string = '';
for (let i = 0; i < list.length; i++) {
if (i !== 0) {
result += seperator;
}
result += l... | AST#method_declaration#Left public static getJoinedTextsFromList AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t... | public static getJoinedTextsFromList(
list : Array<string> | null,
seperator : string
): string | null {
if (list === null) {
return null;
}
let result: string = '';
for (let i = 0; i < list.length; i++) {
if (i !== 0) {
result += seperator;
}
result += l... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L36-L53 | e3d29420b03249c4f8845f3394aba9e9c5390aaa | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/SectionDatas.ets | arkts | allSections | ========== 查询 ========== | allSections(): K[] {
return this.sectionOrder;
} | AST#method_declaration#Left allSections AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left K [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST... | allSections(): K[] {
return this.sectionOrder;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/SectionDatas.ets#L50-L52 | 9163a3aa13234e55e646deec96cd4d2983b91868 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/ThemeManager.ets | arkts | getContrastColor | 获取主题对比色 | getContrastColor(backgroundColor: string): string {
return '#000000'; // 临时返回黑色
} | AST#method_declaration#Left getContrastColor AST#parameter_list#Left ( AST#parameter#Left backgroundColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | getContrastColor(backgroundColor: string): string {
return '#000000';
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L246-L248 | 98ea00fd94bfcffe66b518cc9a0afbd14734adf4 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets | arkts | ListVideo | 轮播样式 | @Builder
ListVideo() {
Column() {
Text($r('app.string.pip_window_list_video_text'))
.width($r('app.string.pip_window_full_width'))
Row() {
List({ space: 20, scroller: this.scrollerForList }) {
ForEach(this.arr, (index: number) => {
ListItem() {
Image... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ListVideo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_elemen... | @Builder
ListVideo() {
Column() {
Text($r('app.string.pip_window_list_video_text'))
.width($r('app.string.pip_window_full_width'))
Row() {
List({ space: 20, scroller: this.scrollerForList }) {
ForEach(this.arr, (index: number) => {
ListItem() {
Image... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/VideoInfoComponent.ets#L204-L234 | b814ca7288af03b68b6a95158439b096b763a34f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets | arkts | getPixelMapFromMedia | 从指定的媒体资源中获取PixelMap
@param {Resource} resource - 要获取图像的媒体资源,包含资源的 bundle 名称、模块名称和 ID。 | private async getPixelMapFromMedia(resource: Resource) {
let unit8Array = await getContext(this).resourceManager.getMediaContent({
bundleName: resource.bundleName,
moduleName: resource.moduleName,
id: resource.id
});
let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit... | AST#method_declaration#Left private async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST... | private async getPixelMapFromMedia(resource: Resource) {
let unit8Array = await getContext(this).resourceManager.getMediaContent({
bundleName: resource.bundleName,
moduleName: resource.moduleName,
id: resource.id
});
let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets#L100-L110 | 6dc27a16d0edbd73ad2b7d29920d26b0117f372d | gitee |
cuilanxin/ArkTs-demo.git | 3764799bb38e1f316055f57dae20822e215cb6f9 | features/quickstart/src/main/ets/view/EnablementView.ets | arkts | private title: string = 'HarmonyOS第一课' private brief: string = '基于真实的开发场景,提供向导式学习,多维度融合课程等内容,给开发者提供全新的学习体验' | build() {
Column(){
Image($r(this.enablementItem.imageSrc))
.width('100%')
.borderRadius({topLeft: 16, topRight: 16})
.height(96)
.objectFit(ImageFit.Cover)
Text(this.enablementItem.title)
.height(19)
.width('100%')
.fontSize(14)
.textAlign... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Lef... | build() {
Column(){
Image($r(this.enablementItem.imageSrc))
.width('100%')
.borderRadius({topLeft: 16, topRight: 16})
.height(96)
.objectFit(ImageFit.Cover)
Text(this.enablementItem.title)
.height(19)
.width('100%')
.fontSize(14)
.textAlign... | https://github.com/cuilanxin/ArkTs-demo.git/blob/3764799bb38e1f316055f57dae20822e215cb6f9/features/quickstart/src/main/ets/view/EnablementView.ets#L10-L42 | b8e6ab4798c7a3c581763c26cd5516de9c412f7a | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets | arkts | this | 手指移动,绘制移动轨迹 | this.currentNodeDraw.path.lineTo(positionX, positionY); | AST#method_declaration#Left this AST#ERROR#Left . currentNodeDraw . path . l in eTo AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left positionX AST#parameter#Right , AST#parameter#Left positionY AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | this.currentNodeDraw.path.lineTo(positionX, positionY); | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L300-L300 | 6f6e8736a30e7cf571b237d46aa569ccf3dc8476 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets | arkts | encodeGCM | 加密-GCM模式
@param str 待加密的字符串
@param aesKey AES密钥
@returns | static async encodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> {
//转换key
let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256);
// 初始化加解密操作环境
let mode = crypto.CryptoMode.ENCRYPT_MODE;
//创建加密器
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
//初始化加密
aw... | AST#method_declaration#Left static async encodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> {
let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256);
let mode = crypto.CryptoMode.ENCRYPT_MODE;
let cipher = crypto.createCipher('AES256|GCM|PKCS7');
await cipher.init(mode, symKey, AES.... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L85-L108 | d7554fe461f9ab7596c10546b31a9fa9908598f2 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets | arkts | startRecording | ===================== 录音核心方法 ===================== | private async startRecording(): Promise<void> {
await this.stopRecording()
if (this.isRecording) return;
try {
// 1. 创建录音文件并获取文件描述符 ✅
const filePath = this.getRecordedFilePath();
this.recordFile = await fs.open(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
// 2. 创建录音器
... | AST#method_declaration#Left private async startRecording 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 > AS... | private async startRecording(): Promise<void> {
await this.stopRecording()
if (this.isRecording) return;
try {
const filePath = this.getRecordedFilePath();
this.recordFile = await fs.open(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
this.avRecorder = await media.... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L90-L129 | 85f7aff4af4dab7bc5dfcb8c8853c4d426f2000a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Contact.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 Contact {
name: string
destinationHost: string
constructor | AST#export_declaration#Left export AST#ERROR#Left default class Contact { name AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left dest in ationHost AST#ERROR#Right : string AST#ERROR#Right AST#variable_declaration#Left c... | export default class Contact {
name: string
destinationHost: string
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/Contact.ets#L16-L20 | 8f3c9b193b9e59e6073796b92648b15c61d6d2e4 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | @file 订单退款页面 ViewModel
@author Joker.X | @ObservedV2
export default class OrderRefundViewModel extends BaseNetWorkViewModel<Order> {
/**
* 订单仓库
*/
private readonly repository: OrderRepository = new OrderRepository();
/**
* 公共仓库
*/
private readonly commonRepository: CommonRepository = new CommonRepository();
/**
* 路由参数
*/
private ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderRefundViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_... | @ObservedV2
export default class OrderRefundViewModel extends BaseNetWorkViewModel<Order> {
private readonly repository: OrderRepository = new OrderRepository();
private readonly commonRepository: CommonRepository = new CommonRepository();
private readonly routeParam: OrderIdParam | undefined = getRouteP... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L22-L214 | 709310c461ccf63dbdb187fd1bb1a9c175623ddd | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets | arkts | setWindowStage | 缓存windowStage
@param windowStage 当前WindowStage实例
@returns {void} | setWindowStage(windowStage: window.WindowStage): void {
this.windowStage = windowStage;
} | AST#method_declaration#Left setWindowStage AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST... | setWindowStage(windowStage: window.WindowStage): void {
this.windowStage = windowStage;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L50-L52 | 95f6bb11c6eed44ef2c300ae9ab601a216ae804e | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/AudioToVideoSync/entry/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
/**
* Index page Tag.
*/
public static readonly INDEX_TAG: string = 'INDEX';
/**
* PX.
*/
public static readonly PX: string = 'px';
/**
* Default value.
*/
public static readonly DEFAULT_VALUE: number = 0;
/**
* Default width.
*/
public static re... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Index page Tag.
*/ AST#property_declaration#Left public static readonly INDEX_TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expressio... | export class CommonConstants {
public static readonly INDEX_TAG: string = 'INDEX';
public static readonly PX: string = 'px';
public static readonly DEFAULT_VALUE: number = 0;
public static readonly DEFAULT_WIDTH: number = 1920;
public static readonly DEFAULT_HEIGHT: number = 1080;
pub... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AudioToVideoSync/entry/src/main/ets/common/CommonConstants.ets#L16-L56 | 41a4e8430a572ca43aac2bcffebde80223a50b02 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets | arkts | 旋转中心点参数y,表示垂直方向上旋转起始位置 | build() {
// TODO: 知识点: 创建文本组件。创建时添加rotate属性,用来控制组件旋转。
Text(`${this.pageNum}`)
.fontSize($r('app.integer.page_turning_animation_font_size'))
.fontColor(Color.White)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.page_turning_animation_color... | AST#build_method#Left build ( ) AST#build_body#Left { // TODO: 知识点: 创建文本组件。创建时添加rotate属性,用来控制组件旋转。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left A... | build() {
Text(`${this.pageNum}`)
.fontSize($r('app.integer.page_turning_animation_font_size'))
.fontColor(Color.White)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.page_turning_animation_color_dark_blue'))
.width($r('app.string.pa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets#L26-L46 | dedc472cf5efa6a73079ceefc791a266c34f22e9 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SHA.ets | arkts | hmac | 消息认证码计算,异步
@param data 传入的消息
@param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512)。
@param symKey 共享对称密钥。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 | static async hmac(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey,
resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.hmac(data, algName, symKey, resultCoding);
} | AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le... | static async hmac(data: string, algName: crypto.SHA = 'SHA256', symKey: cryptoFramework.SymKey = SHA.symKey,
resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.hmac(data, algName, symKey, resultCoding);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L89-L92 | 2e8189fe83563210ccd2ddf5f147636c0124441a | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | copy | @Override public DataSet<PieEntry> copy() { List<PieEntry> entries = new ArrayList<>(); for (int i = 0; i < mEntries.size(); i++) { entries.add(mEntries.get(i).copy()); } PieDataSet copied = new PieDataSet(entries, getLabel()); copy(copied); return copied; } protected void copy(PieDataSet pieDataSet) { super.copy(pieD... | public copy(): DataSet<PieEntry> {
let entries = new JArrayList<PieEntry>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
let copied = new PieDataSet(entries, this.getLabel());
this.copyTo(copied);
... | AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieEntry AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | public copy(): DataSet<PieEntry> {
let entries = new JArrayList<PieEntry>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
let copied = new PieDataSet(entries, this.getLabel());
this.copyTo(copied);
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L64-L74 | 34921b30b0591b7e36f25e4e5c345d1ed6cc45a8 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/DataModel.ets | arkts | Video data structure. | export interface VideoData {
video: Resource | string;
name: string;
description: string;
time: string;
controller: VideoController;
auto: boolean;
head: Resource;
likeCount: string;
commentCount: string;
favoriteCount: string;
shareCount: string;
hotspot: string;
play: boolean;
index: numbe... | AST#export_declaration#Left export AST#interface_declaration#Left interface VideoData AST#object_type#Left { AST#type_member#Left video : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type... | export interface VideoData {
video: Resource | string;
name: string;
description: string;
time: string;
controller: VideoController;
auto: boolean;
head: Resource;
likeCount: string;
commentCount: string;
favoriteCount: string;
shareCount: string;
hotspot: string;
play: boolean;
index: numbe... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/DataModel.ets#L19-L34 | d1ea11bf3611cc77ac23ea84b735d6d6137dc1cd | gitee | |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/client/listener/ShadowListener.ets | arkts | 设备影子监听器,用于设备向平台获取设备影子数据 | export interface ShadowListener {
/**
*
* @param requestId 请求id
* @param shadowDataList 服务影子数据
*/
onShadow: (requestId: string, shadowDataList?: ShadowData[]) => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ShadowListener AST#object_type#Left { /**
*
* @param requestId 请求id
* @param shadowDataList 服务影子数据
*/ AST#type_member#Left onShadow : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Lef... | export interface ShadowListener {
onShadow: (requestId: string, shadowDataList?: ShadowData[]) => void;
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/listener/ShadowListener.ets#L20-L27 | 00a9d56864f3e286a354a1a793bb4aa673b0b48d | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets | arkts | getPriorityText | 获取优先级文本 | getPriorityText(priority: number): string {
switch (priority) {
case 1:
return '最高';
case 2:
return '高';
case 3:
return '中';
case 4:
return '低';
case 5:
return '最低';
default:
return '中';
}
} | AST#method_declaration#Left getPriorityText AST#parameter_list#Left ( AST#parameter#Left priority : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | getPriorityText(priority: number): string {
switch (priority) {
case 1:
return '最高';
case 2:
return '高';
case 3:
return '中';
case 4:
return '低';
case 5:
return '最低';
default:
return '中';
}
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L598-L613 | cf009282e1f9f214cf4d1580915e4558b08fdfb4 | github |
buqiuz/game-puzzle.git | 605dc0fac0738466db308a8ba255b5e9094c52ac | entry/src/main/ets/model/ImageModel.ets | arkts | splitPic | 图片划分 | async splitPic(index: number,splitCount: number): Promise<PictureItem[]> {
let imagesData: Array<photoAccessHelper.PhotoAsset> = await this.getAllImg();
let imagePackerApi = image.createImagePacker();
let file=await fileIo.open(imagesData[index].uri, fileIo.OpenMode.READ_ONLY)
let imagePixelMap: Pict... | AST#method_declaration#Left async splitPic 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#Left splitCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | async splitPic(index: number,splitCount: number): Promise<PictureItem[]> {
let imagesData: Array<photoAccessHelper.PhotoAsset> = await this.getAllImg();
let imagePackerApi = image.createImagePacker();
let file=await fileIo.open(imagesData[index].uri, fileIo.OpenMode.READ_ONLY)
let imagePixelMap: Pict... | https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/model/ImageModel.ets#L118-L158 | 345600d07f7f8bfce266fd9f279a2f823b101282 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/demo/DemoResult.ets | arkts | @file Demo 模块导航返回结果定义
@author Joker.X
Demo 返回结果 | export interface DemoResult {
/**
* 标题
*/
title: string;
/**
* 说明
*/
description: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DemoResult 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#Le... | export interface DemoResult {
title: string;
description: string;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoResult.ets#L9-L18 | 5b76e53919ca8c271128c57f711af3332d6cd8c4 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/MyMath.ets | arkts | toDegrees | Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
Params:
angrad – an angle, in radians | public static toDegrees(ang: number) {
return ang * MyMath.radians
} | AST#method_declaration#Left public static toDegrees AST#parameter_list#Left ( AST#parameter#Left ang : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#... | public static toDegrees(ang: number) {
return ang * MyMath.radians
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MyMath.ets#L47-L49 | 8fb12c16b07c44d483d1b109b93fe4cb41e928eb | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/WindowViewModel.ets | arkts | 窗口管理ViewModel - 提供验证码数据
Binds verify data to components and provides interfaces. | export class WindowViewModel {
/**
* 获取验证码集合
* Get verify items map.
*
* @return {Map<number, VerifyItem>} verifyMap - 验证码映射表
*/
getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
// Source: 从 WindowManager 项目迁移的验证码数据
verifyMap.set(0, new Verify... | AST#export_declaration#Left export AST#class_declaration#Left class WindowViewModel AST#class_body#Left { /**
* 获取验证码集合
* Get verify items map.
*
* @return {Map<number, VerifyItem>} verifyMap - 验证码映射表
*/ AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#t... | export class WindowViewModel {
getVerifyMap(): Map<number, VerifyItem> {
let verifyMap: Map<number, VerifyItem> = new Map();
verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK'));
verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR'));
return v... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/WindowViewModel.ets#L22-L37 | 651aa7531630e501ed36840f3bcf100086a4d3d9 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ColumnInfo.ets | arkts | Column Info. | export default class ColumnInfo {
name: string;
type: string;
length?: number;
nullable?: boolean;
primary?: boolean;
autoincrement?: boolean;
constructor(name: string, type: string, length?: number, nullable?: boolean,
primary?: boolean, autoincrement?: boolean) {
this.name = name;
... | AST#export_declaration#Left export default AST#class_declaration#Left class ColumnInfo AST#class_body#Left { AST#property_declaration#Left 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 type : A... | export default class ColumnInfo {
name: string;
type: string;
length?: number;
nullable?: boolean;
primary?: boolean;
autoincrement?: boolean;
constructor(name: string, type: string, length?: number, nullable?: boolean,
primary?: boolean, autoincrement?: boolean) {
this.name = name;
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/ColumnInfo.ets#L20-L37 | 77b54da84db8a5bb03ce76087d6436d9ff6da06a | gitee | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 登录返回数据结构 | export interface IUserDao {
userInfo: IUserInfo;
token: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IUserDao AST#object_type#Left { AST#type_member#Left userInfo : AST#type_annotation#Left AST#primary_type#Left IUserInfo AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left token : AST#type_annotation#L... | export interface IUserDao {
userInfo: IUserInfo;
token: string;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L57-L60 | ab5ada8e767f657ad87eb5d41c6c713d2f55317f | github | |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhToast.ets | arkts | showLoadingText | / 加载中 - 系统样式 | public static showLoadingText(loadingText = '加载中...') {
JhToast._showToast(loadingText, _ToastType.loading)
} | AST#method_declaration#Left public static showLoadingText AST#parameter_list#Left ( AST#parameter#Left loadingText = AST#expression#Left '加载中...' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Lef... | public static showLoadingText(loadingText = '加载中...') {
JhToast._showToast(loadingText, _ToastType.loading)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L64-L66 | 39662f9e9fc1b564b1b1feb84e059e8d2e05074e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | ActionSheetDialogBuilder | ActionSheetDialog
@param options | @Builder
export function ActionSheetDialogBuilder(options: BottomSheetOptions) {
ActionSheetDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ActionSheetDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) ... | @Builder
export function ActionSheetDialogBuilder(options: BottomSheetOptions) {
ActionSheetDialogView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L167-L170 | 6d1a76a317680eaea78c376b7b5add61123f81fa | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIService.ets | arkts | initializeDefaultConfigs | 初始化默认模型配置 | private initializeDefaultConfigs(): void {
this.modelConfigs = [
{
id: 'zhipu_default',
name: '智谱AI (GLM-4)',
provider: AIProvider.CUSTOM,
apiKey: '',
apiUrl: 'https://open.bigmodel.cn/api/paas/v4/chat/completions',
model: 'glm-4',
maxTokens: 2000,
... | AST#method_declaration#Left private initializeDefaultConfigs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expre... | private initializeDefaultConfigs(): void {
this.modelConfigs = [
{
id: 'zhipu_default',
name: '智谱AI (GLM-4)',
provider: AIProvider.CUSTOM,
apiKey: '',
apiUrl: 'https://open.bigmodel.cn/api/paas/v4/chat/completions',
model: 'glm-4',
maxTokens: 2000,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIService.ets#L56-L105 | de6f85c57f502679f3cbf60decc3d3a0c9e0a774 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationResult.ets | arkts | @file 公共导航返回结果定义
@author Joker.X
刷新返回结果 | export interface RefreshResult {
/**
* 是否需要刷新
*/
refresh?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RefreshResult AST#object_type#Left { /**
* 是否需要刷新
*/ AST#type_member#Left refresh ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right ... | export interface RefreshResult {
refresh?: boolean;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationResult.ets#L9-L14 | e176a9cf5d17e7be92600e877a6a5d87c086eed8 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/GetDate.ets | arkts | 日历表上周六对应的序列号,从周日开始算起,取值0~6
根据指定年份和月份获取该月在日历表上的日期排布数据
@param {number} specifiedMonth - 指定月份
@param {number} specifiedYear - 指定年份 | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] {
let currentFirstWeekDay: number = 0; // 初始化指定月的第一天是周几
let currentLastWeekDay: number = 0; // 初始化指定月的最后一天是周几
let currentAllDay: number[] = []; // 初始化指定月的日期排列数组
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDat... | AST#export_declaration#Left export AST#function_declaration#Left function getMonthDate AST#parameter_list#Left ( AST#parameter#Left specifiedMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specifiedYear : AST#type_an... | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] {
let currentFirstWeekDay: number = 0;
let currentLastWeekDay: number = 0;
let currentAllDay: number[] = [];
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate();
currentFirstWeekDay = new Date(specifiedY... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/GetDate.ets#L60-L80 | ca4a887381375c15535ec7109b298594c9e3e54f | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | getDisplayId | 获取当前窗口的 displayId
@returns {number | undefined} displayId | private getDisplayId(): number | undefined {
return this.windowClass?.getWindowProperties().displayId;
} | AST#method_declaration#Left private getDisplayId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_state... | private getDisplayId(): number | undefined {
return this.windowClass?.getWindowProperties().displayId;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L225-L227 | 99ba2bc196739011679d2ecabcc5fb002a7813ae | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.