nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets | arkts | WaterRipplesComponent | 功能描述: 本示例主要介绍在很多应用中,会出现点击按钮出现水波纹的特效。
推荐场景: 水波纹的特效
核心组件:
1. ButtonWithWaterRipples
实现步骤:
1. 要实现存在两个连续的涟漪,需要两个层叠的Stack分别以一定延迟进行相同的动画。
2. 通过点击按钮来判断isListening变量,如果为true则添加动画。涟漪动画实际上的效果为透明度0.8->0,半径扩大到6倍的动画,持续时间无限。
3. 如果isListening为false,则用持续时间为0的动画来打断持续时间无限的动画。 | @Component
export struct WaterRipplesComponent {
@State isListening: boolean = false; // 控制组件状态 true:开启水波纹 false:停止水波纹
/**
* 创建一个Column组件,内部的ButtonWithWaterRipples为水波纹按钮,用来切换水波纹动画。
* 当点击按钮时,开始触发水波纹动画,下方的文字从点击开始识曲改为正在聆听
*/
build() {
Column() {
Text($r('app.string.water_ripples_sound_hound'))
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WaterRipplesComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isListening : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right ... | @Component
export struct WaterRipplesComponent {
@State isListening: boolean = false;
build() {
Column() {
Text($r('app.string.water_ripples_sound_hound'))
.fontColor(Color.White)
.fontSize(18)
.margin({ top: $r('app.integer.water_ripples_margin_large') })
ButtonWithWat... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/waterripples/src/main/ets/WaterRipples.ets#L31-L58 | 66b488f3f8613190d96fa1a37204060b3b790eca | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets | arkts | @file 日期工具 | export default class DateTimeUtil {
/**
* 时分
*/
getTime() {
const DATETIME = new Date()
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes())
}
/**
* 月日
*/
getDate() {
const DATETIME = new Date()
return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate())
}... | AST#export_declaration#Left export default AST#class_declaration#Left class DateTimeUtil AST#class_body#Left { /**
* 时分
*/ AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declara... | export default class DateTimeUtil {
getTime() {
const DATETIME = new Date()
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes())
}
getDate() {
const DATETIME = new Date()
return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate())
}
fill(value) {
return (v... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L19-L64 | 9a2cb898cf8ad3b4f48d5509dfcf5eac956e157f | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | getW | Get width.
@returns | getW(): number {
return this.w;
} | AST#method_declaration#Left getW AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST... | getW(): number {
return this.w;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L51-L53 | 9789e26b59d77b852ce3ccc921fb87947fe170b9 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | startPlayUpdateTimer | 启动播放状态更新定时器 | startPlayUpdateTimer() {
this.playUpdateTimer = setInterval(() => {
this.checkCurrentEpisode();
}, 500);
} | AST#method_declaration#Left startPlayUpdateTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playUpdateTimer AST#member_ex... | startPlayUpdateTimer() {
this.playUpdateTimer = setInterval(() => {
this.checkCurrentEpisode();
}, 500);
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L82-L86 | 13d7a4123dedd4f86dcacd13d1a79e8bed4a090b | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets | arkts | selectedIndex | 默认选中索引
@param selectedIndex
@returns | selectedIndex(selectedIndex: number) {
this.builderOptions.selectedIndex = selectedIndex
return this;
} | AST#method_declaration#Left selectedIndex AST#parameter_list#Left ( AST#parameter#Left selectedIndex : 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#expression_statem... | selectedIndex(selectedIndex: number) {
this.builderOptions.selectedIndex = selectedIndex
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L36-L39 | 282f0d1bc23ca4409908f8036134e1412b1616c0 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/pages/AboutUs.ets | arkts | aboutToAppear(): void { const componentContent = new ComponentContent( this.uiContext, wrapBuilder<[Params]>(builderOverlay), new Params(this.uiContext, { x: '2%', y: '3%', }) ) this.overlayNode.addComponentContent(componentContent, 100) // 设置较高层级 this.overlayContent.push(componentContent) } aboutToDisappear(): void { ... | build() {
Column() {
Web({ src: $rawfile('AboutUs.html'), controller: this.webviewController })
}
.width("100%")
.height("100%")
} | 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 Web ( AST#component_parameters#Left { AST#component_par... | build() {
Column() {
Web({ src: $rawfile('AboutUs.html'), controller: this.webviewController })
}
.width("100%")
.height("100%")
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/AboutUs.ets#L53-L61 | b9c7042f8f5beda6d523f71304568d46141e74e0 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/SpecSelectModal.ets | arkts | ModalContentNetWorkLayout | 弹窗内容包装器(包含网络状态处理)
@returns {void} 无返回值 | @Builder
private ModalContentNetWorkLayout(): void {
BaseNetWorkView({
uiState: this.uiState,
onRetry: this.onRetry,
loadingBuilder: (): void => this.CustomLoading(),
errorBuilder: (): void => this.CustomError(),
content: (): void => this.ModalContent()
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ModalContentNetWorkLayout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_compon... | @Builder
private ModalContentNetWorkLayout(): void {
BaseNetWorkView({
uiState: this.uiState,
onRetry: this.onRetry,
loadingBuilder: (): void => this.CustomLoading(),
errorBuilder: (): void => this.CustomError(),
content: (): void => this.ModalContent()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L116-L125 | da65cf0ef3dc521f775fe46654b57cc215bea7ec | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | 获取指定路由的首个参数(类型安全,屏蔽 unknown)
@template T
@param {string} name - 路由名称
@returns {T} 参数对象;未获取到时返回 undefined | export function getRouteParams<T>(name: string): T {
const stack: NavPathStack | undefined = getNavPathStack();
if (!stack) {
return undefined as T;
}
try {
return stack.getParamByName(name)[0] as T;
} catch (err) {
hilog.error(DOMAIN, "NavSvc", "[NavigationService] getRouteParams failed: %{public... | AST#export_declaration#Left export AST#function_declaration#Left function getRouteParams AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri... | export function getRouteParams<T>(name: string): T {
const stack: NavPathStack | undefined = getNavPathStack();
if (!stack) {
return undefined as T;
}
try {
return stack.getParamByName(name)[0] as T;
} catch (err) {
hilog.error(DOMAIN, "NavSvc", "[NavigationService] getRouteParams failed: %{public... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L192-L203 | b3d5e8398ce115ee971c86ad60cfe870055542fb | github | |
RicardoWesleyli/ArkUI-Animations.git | a85f94156d3fde1439bfb68a2108dbc3eb4a1dca | BuyButtonAnimation/entry/src/main/ets/pages/Index.ets | arkts | startSpinAnimation | 处理旋转动画(但 UI 中未使用 rotation 绑定) | private startSpinAnimation() {
animateTo({ duration: 2000, curve: Curve.Linear }, () => {
this.spin = !this.spin
})
} | AST#method_declaration#Left private startSpinAnimation 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 animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration... | private startSpinAnimation() {
animateTo({ duration: 2000, curve: Curve.Linear }, () => {
this.spin = !this.spin
})
} | https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/BuyButtonAnimation/entry/src/main/ets/pages/Index.ets#L74-L78 | a083b988f8bc6a753969f79a29d4988b40a8a39f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets | arkts | 水印文本属性
@param {string} text - 内容
@param {string} [fontSize] - 字体大小
@param {string} [fontColor] - 字体颜色
@param {CanvasTextAlign} [textAlign] - 文本绘制中的文本对齐方式
@param {CanvasTextBaseline} [textBaseline] - 设置文本沿水平方向的对齐方式
@param {number} [offsetY] - 需要绘制的文本的左下角x坐标(图片添加水印方式中引用)
@param {number} [offsetX] - 需要绘制的文本的左下角y坐标(图片添加水印方... | export class TextModify {
text: string;
fontSize: string;
fontColor: string;
textAlign: CanvasTextAlign;
textBaseline: CanvasTextBaseline;
offsetX: number;
offsetY: number;
constructor(text: string, fontSize: string = '16vp', fontColor: string = '#000', textAlign: CanvasTextAlign = 'center',
textBa... | AST#export_declaration#Left export AST#class_declaration#Left class TextModify AST#class_body#Left { AST#property_declaration#Left text : 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 fontSize : AST#t... | export class TextModify {
text: string;
fontSize: string;
fontColor: string;
textAlign: CanvasTextAlign;
textBaseline: CanvasTextBaseline;
offsetX: number;
offsetY: number;
constructor(text: string, fontSize: string = '16vp', fontColor: string = '#000', textAlign: CanvasTextAlign = 'center',
textBa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets#L66-L86 | 1dd4272cb3c7fb12f13a4a01c0591c68de97d24b | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseEntry.ets | arkts | getData | Returns the data, additional information that this Entry represents, or
null, if no data has been specified.
@return | public getData(): Object | null {
return this.mData;
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left {... | public getData(): Object | null {
return this.mData;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L80-L82 | 2d90db60709fbd949167f18307e77ca13aa1b10c | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/model/src/main/ets/common/Id.ets | arkts | ID模型
用于处理只返回ID的接口响应
@author Joker.X | export class Id {
/**
* ID值
*/
id: number;
constructor(id: number = 0) {
this.id = id;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Id AST#class_body#Left { /**
* ID值
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left cons... | export class Id {
id: number;
constructor(id: number = 0) {
this.id = id;
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/common/Id.ets#L6-L15 | e527b084684c3a6b7229a6f5b822496903829034 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceVerticalMedium | 创建一个中等垂直间距(12vp)
@returns {void} 无返回值 | @Builder
export function SpaceVerticalMedium(): void {
Blank().height($r("app.float.space_vertical_medium"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalMedium 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#arkt... | @Builder
export function SpaceVerticalMedium(): void {
Blank().height($r("app.float.space_vertical_medium"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L37-L40 | c2ac6660f19784d4e2aedae84a8cd6aef7cd8ad9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets | arkts | isInBoundsX | Checks if the provided entry object is in bounds for drawing considering the current animation phase.
@param e
@param set
@return | protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean {
if (e == null)
return false;
let entryIndex = dataSet.getEntryIndexByEntry(e);
if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) {
r... | AST#method_declaration#Left protected isInBoundsX AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | protected isInBoundsX(e: EntryOhos, dataSet: IBarLineScatterCandleBubbleDataSet<EntryOhos>): boolean {
if (e == null)
return false;
let entryIndex = dataSet.getEntryIndexByEntry(e);
if (e == null || entryIndex >= dataSet.getEntryCount() * (this.mAnimator ? this.mAnimator.getPhaseX() : 1)) {
r... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets#L100-L112 | 20a0d3cadaf28c4cb08d39eb60dd18b7c4a4396c | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSource.ets | arkts | @file 商品相关数据源接口
定义商品模块所需的所有网络请求操作
@author Joker.X | export interface GoodsNetworkDataSource {
/**
* 查询商品分类列表
* @returns 商品分类列表响应
*/
getGoodsTypeList(): Promise<NetworkResponse<Category[]>>;
/**
* 查询商品规格列表
* @param {GoodsIdRequest} params - 商品 ID 请求参数
* @returns {Promise<NetworkResponse<GoodsSpec[]>>} 商品规格列表响应
*/
getGoodsSpecList(params: Goo... | AST#export_declaration#Left export AST#interface_declaration#Left interface GoodsNetworkDataSource AST#object_type#Left { /**
* 查询商品分类列表
* @returns 商品分类列表响应
*/ AST#type_member#Left getGoodsTypeList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | export interface GoodsNetworkDataSource {
getGoodsTypeList(): Promise<NetworkResponse<Category[]>>;
getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>>;
getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>>;
getGoodsPage(params: GoodsSearchRequest): Pr... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSource.ets#L20-L67 | 3d7799ce2e0925d4d2fe8cdccc67d59b07f39355 | github | |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/model/CommandEntryList.ets | arkts | updateAllFormBelongsToEntry | 以下为桌面卡片(Form)相关
仅更改持久化存储,不刷新卡片 UI
卡片 UI 在 ViewModel 刷新 | private async updateAllFormBelongsToEntry(commandEntry: CommandEntry): Promise<string[]> {
const updatedFormIDs = await this.pm.updateByShortcut(commandEntry);
Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`);
return updatedFormIDs;
} | AST#method_declaration#Left private async updateAllFormBelongsToEntry AST#parameter_list#Left ( AST#parameter#Left commandEntry : AST#type_annotation#Left AST#primary_type#Left CommandEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri... | private async updateAllFormBelongsToEntry(commandEntry: CommandEntry): Promise<string[]> {
const updatedFormIDs = await this.pm.updateByShortcut(commandEntry);
Logger.debug(this.LOG_TAG, `已更新 ${updatedFormIDs.length} 个相关卡片`);
return updatedFormIDs;
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/model/CommandEntryList.ets#L127-L131 | 58f290a162921bb13bd2984e2efd3048ec34b177 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringUtils.ets | arkts | removedPunctuations | 去除标点符号
@param str 输入字符串
@returns 处理后的字符串 | static removedPunctuations(str: string): string {
return Array.from(str)
.filter(c => !punkMarks.has(c))
.join('');
} | AST#method_declaration#Left static removedPunctuations AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static removedPunctuations(str: string): string {
return Array.from(str)
.filter(c => !punkMarks.has(c))
.join('');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L106-L110 | 7d81f608f1593c26805f245cc95166156c76fde1 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/huawei/HwSubscriber.ets | arkts | queryEnvironmentStatus | 检查 IAP 环境 | async queryEnvironmentStatus(): Promise<number> {
try {
await iap.queryEnvironmentStatus(this.context);
DebugLog.i('Succeeded in querying environment status.');
return 0;
} catch (err) {
const e = err as BusinessError;
DebugLog.e(`Failed to query environment status. Code: ${e.code}... | AST#method_declaration#Left async queryEnvironmentStatus 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 number AST#primary_type#Right AST#type_annotation#Right > ... | async queryEnvironmentStatus(): Promise<number> {
try {
await iap.queryEnvironmentStatus(this.context);
DebugLog.i('Succeeded in querying environment status.');
return 0;
} catch (err) {
const e = err as BusinessError;
DebugLog.e(`Failed to query environment status. Code: ${e.code}... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L38-L48 | ce242d09f2ccbb5ea34171d7d0f9cf2a0c943aa6 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | set | Sets the corresponding value of key, and save it in the sandbox.
@param key A string, the key of the setting.
@param value A string | boolean | number, the corresponding value of key to be set. | static set(key: string, value: string | boolean | number, save: boolean = true) {
let found = false;
// Sequential search to modify that value.
for (let index = 0; index < bunch_of_settings.settings_list.length; index++) {
if (bunch_of_settings.settings_list[index].key == key) {
bunch_of_setti... | AST#method_declaration#Left static set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#... | static set(key: string, value: string | boolean | number, save: boolean = true) {
let found = false;
for (let index = 0; index < bunch_of_settings.settings_list.length; index++) {
if (bunch_of_settings.settings_list[index].key == key) {
bunch_of_settings.settings_list[index].value = value;
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L144-L163 | d1311040d898f2044cc7423263a933a373ac770e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | detectUserPreferredLanguage | 检测用户偏好语言 | async detectUserPreferredLanguage(userPreference: UserLanguagePreference): Promise<LanguageDetectionResult> {
try {
const preferredLanguage = userPreference.preferredLanguages[0] || SupportedLanguage.ZH_CN;
const alternatives = userPreference.preferredLanguages.slice(1);
return {
de... | AST#method_declaration#Left async detectUserPreferredLanguage AST#parameter_list#Left ( AST#parameter#Left userPreference : AST#type_annotation#Left AST#primary_type#Left UserLanguagePreference AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST... | async detectUserPreferredLanguage(userPreference: UserLanguagePreference): Promise<LanguageDetectionResult> {
try {
const preferredLanguage = userPreference.preferredLanguages[0] || SupportedLanguage.ZH_CN;
const alternatives = userPreference.preferredLanguages.slice(1);
return {
de... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L285-L301 | 4e350185df2fb3cf0d9b09a718db60663ed56910 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/model/Step.ets | arkts | 日程步骤数据类型。 | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/Step.ets#L4-L4 | 681def3f5e864b6984e2543ee111652fa959dfca | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets | arkts | increment | 计数加一
@returns {void} 无返回值 | increment(): void {
this.counterState.increment();
} | AST#method_declaration#Left increment 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#Lef... | increment(): void {
this.counterState.increment();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets#L20-L22 | 645e793a158bdf2c004430289c3855297842a505 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | encode2048PKCS1Segment | 2048位加密-分段
@param str 待加密的字符串
@param pubKey 2048位RSA公钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false | static encode2048PKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, resultCoding,
isPem);
} | AST#method_declaration#Left static encode2048PKCS1Segment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#... | static encode2048PKCS1Segment(str: string, pubKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048, keyCoding, resultCoding,
isPem);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L96-L100 | fb3cd857743945af4dd7cabc3316a4e0a1f1cad4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | getNumber | 获取数字值
@param key 键
@param defaultValue 默认值
@returns 数字值 | async getNumber(key: string, defaultValue: number = 0): Promise<number> {
try {
this.checkInitialized();
return await this.dataPreferences!.get(key, defaultValue) as number;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.... | AST#method_declaration#Left async getNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | async getNumber(key: string, defaultValue: number = 0): Promise<number> {
try {
this.checkInitialized();
return await this.dataPreferences!.get(key, defaultValue) as number;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L116-L125 | 59bfaef4b3893ffd743f9c316d68974108e14cd2 | github |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/core/world.ets | arkts | 矿工世界运动一次 | export function playerActionOnce(world: WORLD): t.TWorldAction {
let exp = 0
// 创建深度
const perStep = calcPerStepVal(world)
exp = utils.getRandomInt(1,10) % 3 === 0 ? calcPlayerExpByActionOnce(perStep, world) : 0
// 创建事件
const event = createActionEvent(world, perStep)
// 创建消息
let message: string[] = []
... | AST#export_declaration#Left export AST#function_declaration#Left function playerActionOnce AST#parameter_list#Left ( AST#parameter#Left world : AST#type_annotation#Left AST#primary_type#Left WORLD AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | export function playerActionOnce(world: WORLD): t.TWorldAction {
let exp = 0
const perStep = calcPerStepVal(world)
exp = utils.getRandomInt(1,10) % 3 === 0 ? calcPlayerExpByActionOnce(perStep, world) : 0
const event = createActionEvent(world, perStep)
let message: string[] = []
if (world.per>=100... | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L120-L160 | ed41809fe5b5059ea08e446adb4f0c59c165e21f | github | |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/pages/customScan/view/ScanLine.ets | arkts | backAnimatorCreate | Scanning line animation. | async backAnimatorCreate(): Promise<void> {
if (this.backAnimator) {
this.backAnimator.onRepeat = () => {
this.reverse = !this.reverse;
if (this.reverse) {
this.allAngle = 0;
} else {
this.allAngle = 180;
}
}
this.backAnimator.onCancel = () => {
... | AST#method_declaration#Left async backAnimatorCreate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty... | async backAnimatorCreate(): Promise<void> {
if (this.backAnimator) {
this.backAnimator.onRepeat = () => {
this.reverse = !this.reverse;
if (this.reverse) {
this.allAngle = 0;
} else {
this.allAngle = 180;
}
}
this.backAnimator.onCancel = () => {
... | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/view/ScanLine.ets#L80-L109 | f59aa8b0e50f3b225541b55faa1aeb5af493fb10 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/NotificationUtil.ets | arkts | authorizeNotification | 请求通知授权,第一次调用会弹窗让用户选择。
@returns | static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> {
let isEnabled = await NotificationUtil.isNotificationEnabled(); //查询通知是否授权
if (!isEnabled) { //未授权,拉起授权
try {
await notificationManager.requestEnableNotification(AppUtil.getContext());
callBack?.(tr... | AST#method_declaration#Left static async authorizeNotification AST#parameter_list#Left ( AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left grant : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#... | static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> {
let isEnabled = await NotificationUtil.isNotificationEnabled();
if (!isEnabled) {
try {
await notificationManager.requestEnableNotification(AppUtil.getContext());
callBack?.(true);
return ... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NotificationUtil.ets#L79-L94 | f3773ebde6c2969642b222d4ca1aab53a38bd3be | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets | arkts | isSandboxFunc | 是否为沙箱应用 | async isSandboxFunc(): Promise<void> {
try {
this.inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内
Logger.info(TAG, 'inSandbox:' + this.inSandbox);
promptAction.showToast({ message: 'inSandbox:' + this.inSandbox, duration: 2000 });
} catch (err) {
Logger.error(TAG, 'error' + (err... | AST#method_declaration#Left async isSandboxFunc AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async isSandboxFunc(): Promise<void> {
try {
this.inSandbox = await dlpPermission.isInSandbox();
Logger.info(TAG, 'inSandbox:' + this.inSandbox);
promptAction.showToast({ message: 'inSandbox:' + this.inSandbox, duration: 2000 });
} catch (err) {
Logger.error(TAG, 'error' + (err as Busin... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L71-L79 | 55d8b68faac6110b65f935cc934bbce3adc07ee1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/todo/TodoService.ets | arkts | cancelTodo | 取消代办事项 | async cancelTodo(id: string): Promise<Todo | null> {
const todo = await this.updateTodo({
id,
status: TodoStatus.CANCELLED
});
if (todo) {
this.recordOperation('cancel', id, undefined, `取消代办事项: ${todo.title}`);
}
return todo;
} | AST#method_declaration#Left async cancelTodo 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 cancelTodo(id: string): Promise<Todo | null> {
const todo = await this.updateTodo({
id,
status: TodoStatus.CANCELLED
});
if (todo) {
this.recordOperation('cancel', id, undefined, `取消代办事项: ${todo.title}`);
}
return todo;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L305-L316 | 4e629ae4fa52d6bc8edec5cb0b67c3d9dbe38661 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | zoomIn | ################ ################ ################ ################
CODE BELOW THIS RELATED TO SCALING AND GESTURES
Zooms in by 1.4f, x and y are the coordinates (in pixels) of the zoom
center.
@param x
@param y | public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix;
save.reset();
save.set(this.mMatrixTouch);
save.postScale(1.4, 1.4, x, y);
return save;
} | AST#method_declaration#Left public zoomIn AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#... | public zoomIn(x: number, y: number, outputMatrix?: Matrix): Matrix {
let save: Matrix = (outputMatrix == null || outputMatrix == undefined) ? new Matrix() : outputMatrix;
save.reset();
save.set(this.mMatrixTouch);
save.postScale(1.4, 1.4, x, y);
return save;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ViewPortHandler.ets#L193-L199 | 8e88829f1890d954afda10447b0bfd1e5314320c | gitee |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/utils/PermissionsUtil.ets | arkts | reqPermissionsFromUser | 使用UIExtensionAbility:将common.UIAbilityContext 替换为common.UIExtensionContext | reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
... | AST#method_declaration#Left reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : 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 Permissions AST#primary_type#Right AST#type_annotation#Right >... | reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: Array<number> = data.authRes... | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/utils/PermissionsUtil.ets#L35-L57 | a0805251af60b98f5f7739e42d82bcd0d7d9b798 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取梦想详情
@param id 梦想ID
@returns 梦想详情 | export function getDreamById(id: number): Promise<Dream> {
console.info(`开始获取梦想详情, ID: ${id}`);
try {
return request<Dream>(RequestMethod.GET, `/dreams/${id}`)
.then(dreamDetail => {
// 处理图片URL
if (dreamDetail && dreamDetail.imageUrl) {
dreamDetail.imageUrl = processImageUrl(drea... | AST#export_declaration#Left export AST#function_declaration#Left function getDreamById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr... | export function getDreamById(id: number): Promise<Dream> {
console.info(`开始获取梦想详情, ID: ${id}`);
try {
return request<Dream>(RequestMethod.GET, `/dreams/${id}`)
.then(dreamDetail => {
if (dreamDetail && dreamDetail.imageUrl) {
dreamDetail.imageUrl = processImageUrl(dreamDetail.im... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L651-L669 | a9f0dd60ed7a4c23147ba2dca0dd48ceef6997c5 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/auth/src/main/ets/navigation/AuthGraph.ets | arkts | register | 注册认证模块导航路由
@returns {void} 无返回值 | register(): void {
RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav));
} | AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left... | register(): void {
RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/navigation/AuthGraph.ets#L14-L16 | 94cfac6ea40e6611e29917fd7373516f4b6aedf5 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/cs/src/main/ets/navigation/ChatNav.ets | arkts | ChatNav | @file 客服聊天页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function ChatNav(): void {
ChatPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ChatNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_compon... | @Builder
export function ChatNav(): void {
ChatPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/cs/src/main/ets/navigation/ChatNav.ets#L8-L11 | 460edd3df89f42c5cd3a1570bcb04955d6d59d35 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | 全局组件复用池 | export class NodePool {
private static instance: NodePool;
private idGen: number;
private nodePool: HashMap<string, Array<NodeItem>>;
private constructor() {
this.nodePool = new HashMap();
this.idGen = 0;
}
// 使用单例模式,用于全局管理组件复用池
public static getInstance() {
if (!NodePool.instance) {
N... | AST#export_declaration#Left export AST#class_declaration#Left class NodePool AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left NodePool AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Le... | export class NodePool {
private static instance: NodePool;
private idGen: number;
private nodePool: HashMap<string, Array<NodeItem>>;
private constructor() {
this.nodePool = new HashMap();
this.idGen = 0;
}
public static getInstance() {
if (!NodePool.instance) {
NodePool.instance = ne... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L53-L103 | 708a983a64b9a56b7cb4c070fe319239821e160c | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | getUserLevel | 获取用户等级信息 | getUserLevel(): UserLevel {
if (!this.userGameData) {
return this.levelConfig[0];
}
return this.userGameData.level;
} | AST#method_declaration#Left getUserLevel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserLevel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Lef... | getUserLevel(): UserLevel {
if (!this.userGameData) {
return this.levelConfig[0];
}
return this.userGameData.level;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L440-L445 | 5f5b673390e2cd619fd6da0a98d9529d36f7dbb3 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerComponent.ets | arkts | startTimer | 开始计时(从初始状态) | private startTimer() {
if (this.isRunning) return;
// 开始是从初始状态启动,需要重置当前时间
this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds;
this.resumeTimer();
} | AST#method_declaration#Left private startTimer 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#expression... | private startTimer() {
if (this.isRunning) return;
this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds;
this.resumeTimer();
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L92-L97 | 677232827ac25bcf4ee9c692df25b9b7749e2c3c | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/PickerUtils.ets | arkts | savePhoto | 通过保存模式拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入
@param newFileNames | static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
try {
let photoPicker = new picker.PhotoViewPicker();
if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) {
let photoSaveResult = await photoPicker.save()
if (photoSaveResult && ... | AST#method_declaration#Left static async savePhoto AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : 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 string AST#primary_type#Right AST#type_annotation#Right > A... | static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
try {
let photoPicker = new picker.PhotoViewPicker();
if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) {
let photoSaveResult = await photoPicker.save()
if (photoSaveResult && ... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L107-L132 | aff77f79184ed96d5eeb8477fac87046d40dc525 | gitee |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/views/CheckSurveyView.ets | arkts | itemEnd | 划出组件 —— 当前用于删除问题 | @Builder
itemEnd(questionIndex: number) {
Row({ space: 16 }) {
Button() {
SymbolGlyph($r('sys.symbol.trash_fill'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor(Color.Red)
.onClick(() => {
// 开启按钮触感反馈
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemEnd AST#parameter_list#Left ( AST#parameter#Left questionIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bod... | @Builder
itemEnd(questionIndex: number) {
Row({ space: 16 }) {
Button() {
SymbolGlyph($r('sys.symbol.trash_fill'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor(Color.Red)
.onClick(() => {
if (this... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/CheckSurveyView.ets#L189-L211 | 4d6c15c751f88582b54dd7a7e4722d13b6c3fd86 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceSearch.d.ets | arkts | AtomicServiceSearch | Defines AtomicServiceSearch.
@struct {AtomicServiceSearch}
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 18 | @Component
export declare struct AtomicServiceSearch {
/**
* Sets the search text content that is currently displayed.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Prop
value?: ResourceStr;
/**
* Indicates default prompt text di... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceSearch AST#component_body#Left { /**
* Sets the search text content that is currently displayed.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.A... | @Component
export declare struct AtomicServiceSearch {
@Prop
value?: ResourceStr;
@Prop
placeholder?: ResourceStr;
@Prop
search?: SearchParams;
@Prop
select?: SelectParams;
operation?: OperationParams;
controller?: SearchController;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L767-L828 | cbd847c033a5ad7d40307e1eb6b10619c6e2aab0 | gitee |
SeaEpoch/SepWeather.git | e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c | entry/src/main/ets/common/database/tables/LocationTable.ets | arkts | query | 查询 | query(locationName: string, callback: Function, isAll: boolean = true) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName);
if (!isAll) {
predicates.equalTo('locationName', locationName);
}
this.locationTable.query(predicates, (resultSet: relationalStore.... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left locationName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_typ... | query(locationName: string, callback: Function, isAll: boolean = true) {
let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName);
if (!isAll) {
predicates.equalTo('locationName', locationName);
}
this.locationTable.query(predicates, (resultSet: relationalStore.... | https://github.com/SeaEpoch/SepWeather.git/blob/e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c/entry/src/main/ets/common/database/tables/LocationTable.ets#L43-L71 | dd624930a30846711692918f45f7d2dc9e9daf23 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/MoodEntry.ets | arkts | Unix timestamp in milliseconds | constructor(
id: number = 0,
date: string = '',
emotion: string = 'neutral',
intensity: number = 3,
messageCount: number = 1,
timestamp: number = Date.now()
) {
this.id = id;
this.date = date;
this.emotion = emotion;
this.intensity = intensity;
this.messageCount = messageCo... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#... | constructor(
id: number = 0,
date: string = '',
emotion: string = 'neutral',
intensity: number = 3,
messageCount: number = 1,
timestamp: number = Date.now()
) {
this.id = id;
this.date = date;
this.emotion = emotion;
this.intensity = intensity;
this.messageCount = messageCo... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L39-L53 | 51c58cafc2ef74711992f21e94cd2712fcfce6f4 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/common/src/main/ets/mock/CityInfo.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 const cityData: CityInfo[] = [
{
"name": $r('app.string.Beijing'),
"temp": "32",
"weather": $r('app.string.Sunny')
},
{
"name": $r('app.string.Shanghai'),
"temp": "28",
"weather": $r('app.string.Cloudy')
},
{
"name": $r('app.string.Guangzhou'),
"temp": "35",
"weather... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left cityData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CityInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expressi... | export const cityData: CityInfo[] = [
{
"name": $r('app.string.Beijing'),
"temp": "32",
"weather": $r('app.string.Sunny')
},
{
"name": $r('app.string.Shanghai'),
"temp": "28",
"weather": $r('app.string.Cloudy')
},
{
"name": $r('app.string.Guangzhou'),
"temp": "35",
"weather... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/mock/CityInfo.ets#L16-L127 | 731a28488dfd4943cabdeaa950b027b67961d0b5 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@returns | static async decodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256);
} | AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async decodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L182-L184 | f467eaa8e02066766ee9002259a6323a0fac97e6 | gitee |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/dataModel/NoticeModel.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class NoticeModel {
id: number; //通知ID
uri: ResourceStr; //通知图标
title: ResourceStr; //通知主题
content: ResourceStr; //内容内容
collections: number; //收藏次数
isCollection: boolean; //当前收藏状态
type: number; //通知类型 "系统" | "互动" | "活动"
time: string; // 🆕 添加时间字段
isRead: boolean; ... | AST#export_declaration#Left export AST#class_declaration#Left class NoticeModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //通知ID AST#property_declaration#Left uri : AST#... | export class NoticeModel {
id: number;
uri: ResourceStr;
title: ResourceStr;
content: ResourceStr;
collections: number;
isCollection: boolean;
type: number;
time: string;
isRead: boolean;
constructor(id: number, uri: ResourceStr, title: ResourceStr, conte... | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/dataModel/NoticeModel.ets#L16-L43 | 0c4bdfd582dd9b1fdb0c9e2f28601ac85e284b79 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Category.ets | arkts | @file 商品类型
@author Joker.X | export class Category {
/**
* ID
*/
id: number = 0;
/**
* 名称
*/
name: string = "";
/**
* 父ID
*/
parentId?: number | null = null;
/**
* 排序
*/
sortNum: number = 0;
/**
* 图片
*/
pic?: string | null = null;
/**
* 状态 0-禁用 1-启用
*/
status: number = 1;
/**
* 子分类列表... | AST#export_declaration#Left export AST#class_declaration#Left class Category AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_decla... | export class Category {
id: number = 0;
name: string = "";
parentId?: number | null = null;
sortNum: number = 0;
pic?: string | null = null;
status: number = 1;
children?: Category[] = [];
createTime?: string | null = null;
updateTime?: string | null = null;
constructor(i... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Category.ets#L5-L57 | 07dcd51552d744a56aeed118b69866a573998919 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | initializeNotificationCenter | 初始化通知中心 | private async initializeNotificationCenter(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Initializing notification center...');
// 如果有今日生日,创建生日通知
if (this.todayBirthdays.length > 0) {
for (const contact of this.todayBirthdays) {
... | AST#method_declaration#Left private async initializeNotificationCenter 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_annotat... | private async initializeNotificationCenter(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Initializing notification center...');
if (this.todayBirthdays.length > 0) {
for (const contact of this.todayBirthdays) {
this.notificatio... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L850-L907 | 6471c68b209e68cc5e656cd9db86adda7ed6bd2f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | clearOldDatas | 清空旧日期的数据,只保留今天的(对应Swift的clearOldDatas) 清空旧日期的数据,只保留今天的 | private clearOldDatas(): void {
const prefs = this.getPrefs();
const dict = prefs.getAllSync() as Record<string, number>;
const newDict: Record<string, number> = {};
// 只保留今天的数据
EncourageTypeHelper.allCases().forEach((type: EncourageType) => {
const key = EncourageTypeHelper.getKeyWithToday(... | AST#method_declaration#Left private clearOldDatas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pre... | private clearOldDatas(): void {
const prefs = this.getPrefs();
const dict = prefs.getAllSync() as Record<string, number>;
const newDict: Record<string, number> = {};
EncourageTypeHelper.allCases().forEach((type: EncourageType) => {
const key = EncourageTypeHelper.getKeyWithToday(type);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L121-L148 | b2c23aea5f98d92dbbcde8fba1e3f51abc449c77 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets | arkts | decryptCBC | 解密(CBC模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@returns | static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7');
} | AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, params, '3DES192|CBC|PKCS7');
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L97-L100 | 4c9739c461753078dfcc7704ec3267f146ece7b5 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets | arkts | Get Module List Data in Stack | export function getStackModuleList(): Array<ContainerModuleItem> {
let stackModuleArray: Array<ContainerModuleItem> = []
STACK_MODULE.forEach((item:ContainerModuleItem) => {
stackModuleArray.push(item);
})
return stackModuleArray;
} | AST#export_declaration#Left export AST#function_declaration#Left function getStackModuleList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST#... | export function getStackModuleList(): Array<ContainerModuleItem> {
let stackModuleArray: Array<ContainerModuleItem> = []
STACK_MODULE.forEach((item:ContainerModuleItem) => {
stackModuleArray.push(item);
})
return stackModuleArray;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets#L55-L61 | 7813ec15c0bc0212d3b9ba44caac3fa2c29d8aa2 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | updateData | 更新数据函数 | public updateData(index: number, data: IChatMessage): void {
if (this.originDataArray.length <= index) {
this.originDataArray.push(data);
} else {
this.originDataArray[index].roleType = data.roleType;
this.originDataArray[index].name = data.name;
this.originDataArray[index].content = dat... | AST#method_declaration#Left public updateData 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 data : AST#type_annotation#Left AST#primary_type#Left IChatMessage AST#primar... | public updateData(index: number, data: IChatMessage): void {
if (this.originDataArray.length <= index) {
this.originDataArray.push(data);
} else {
this.originDataArray[index].roleType = data.roleType;
this.originDataArray[index].name = data.name;
this.originDataArray[index].content = dat... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L27-L37 | 784b09d656f21fc08d0b9cd31b0ad7e2b128fa58 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets | arkts | getNextPlanId | ====== 查询操作 ====== | async getNextPlanId(): Promise<number> {
const maxId = await this.db?.getMax(Tables.Plan.Col.planId, Tables.Plan.name);
return (maxId != null ? maxId + 1 : 1);
} | AST#method_declaration#Left async getNextPlanId 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_... | async getNextPlanId(): Promise<number> {
const maxId = await this.db?.getMax(Tables.Plan.Col.planId, Tables.Plan.name);
return (maxId != null ? maxId + 1 : 1);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L199-L202 | aab2ad53c9dd8fdac5d1c5a602d717a4d774f972 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesListener.ets | arkts | Preferences listener interface. | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/database/PreferencesListener.ets#L19-L19 | 13e7b79c88f1c4d402b08976f8f8cd4ad942e891 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | hideSoftInputMethod | 收起软键盘。
@param context 上下文对象 | static hideSoftInputMethod(context: UIContext) {
context.getFocusController().clearFocus();
} | AST#method_declaration#Left static hideSoftInputMethod AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement... | static hideSoftInputMethod(context: UIContext) {
context.getFocusController().clearFocus();
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L54-L56 | 0f1cdfca548567892b3130a402d398e37090e69a | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | 工作模式枚举 | export enum WorkMode {
ONSITE = 'onsite', // 现场办公
REMOTE = 'remote', // 远程办公
HYBRID = 'hybrid' // 混合办公
} | AST#export_declaration#Left export AST#enum_declaration#Left enum WorkMode AST#enum_body#Left { AST#enum_member#Left ONSITE = AST#expression#Left 'onsite' AST#expression#Right AST#enum_member#Right , // 现场办公 AST#enum_member#Left REMOTE = AST#expression#Left 'remote' AST#expression#Right AST#enum_member#Right , // 远程办公 ... | export enum WorkMode {
ONSITE = 'onsite',
REMOTE = 'remote',
HYBRID = 'hybrid'
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L25-L29 | 55ec8682ed07c815632a9b29636b43af233caf11 | github | |
azhuge233/Wake-HarmonyOS.git | 68c4e961f9cf5fab8699af99313dd5854ea313a1 | entry/src/main/ets/pages/Index.ets | arkts | goToSpecifyPage | 快捷方式跳转判断 | private async goToSpecifyPage(path: string): Promise<void> {
// 如果应用内已经进入其他页面,返回到主页面
if(this.pageStack.size() > 0) this.pageStack.clear();
try {
Logger.debug(this.LOG_TAG, `跳转至页面 ${path}`);
this.pageStack.pushPath({
name: path,
param: this... | AST#method_declaration#Left private async goToSpecifyPage AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | private async goToSpecifyPage(path: string): Promise<void> {
if(this.pageStack.size() > 0) this.pageStack.clear();
try {
Logger.debug(this.LOG_TAG, `跳转至页面 ${path}`);
this.pageStack.pushPath({
name: path,
param: this.deviceList,
... | https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/pages/Index.ets#L78-L95 | 7fcb91fbd7b008e8edce517f64acdec2ef05e314 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets | arkts | getCheckBoxUnClickImage | 多选-未点击提交答案按钮时的图标展示
@param option 当前选项
@param selected 已选择的选项集合
@returns 对应图标 | function getCheckBoxUnClickImage(option: string, selected: Array<string>): ResourceStr {
if (selected.includes(option)) {
return $r('app.media.checkbox_select');
}
return $r('app.media.no_select');
} | AST#function_declaration#Left function getCheckBoxUnClickImage AST#parameter_list#Left ( AST#parameter#Left option : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left selected : AST#type_annotation#Left AST#primary_type#Left A... | function getCheckBoxUnClickImage(option: string, selected: Array<string>): ResourceStr {
if (selected.includes(option)) {
return $r('app.media.checkbox_select');
}
return $r('app.media.no_select');
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets#L378-L383 | a4d0cf233c0365ce7940384cd6c3d1dfc8e0eb89 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CouponRepository.ets | arkts | @file 优惠券仓库,封装优惠券相关请求
@author Joker.X | export class CouponRepository {
/**
* 优惠券网络数据源
*/
private networkDataSource: CouponNetworkDataSource;
/**
* 构造函数
* @param networkDataSource 可选的数据源实例,便于注入测试替身
*/
constructor(networkDataSource?: CouponNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new CouponNetworkDataSourc... | AST#export_declaration#Left export AST#class_declaration#Left class CouponRepository AST#class_body#Left { /**
* 优惠券网络数据源
*/ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left CouponNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#prope... | export class CouponRepository {
private networkDataSource: CouponNetworkDataSource;
constructor(networkDataSource?: CouponNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new CouponNetworkDataSourceImpl();
}
async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResp... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CouponRepository.ets#L15-L55 | 135b8b813db8c3dc2e915d573e48fcfa5089afac | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseEntry.ets | arkts | getIcon | Returns the icon of this Entry.
@return | public getIcon(): ChartPixelMap | null {
return this.mIcon;
} | AST#method_declaration#Left public getIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement... | public getIcon(): ChartPixelMap | null {
return this.mIcon;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L61-L63 | 8279c58f770c4abfc73095fb023c195ecd1e72a0 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets | arkts | 应用约束61:使用ES模块语法代替module.exports | export default PartialGuild; | AST#export_declaration#Left export default AST#expression#Left PartialGuild AST#expression#Right ; AST#export_declaration#Right | export default PartialGuild; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuild.ets#L45-L45 | 4cdebb66cdcfcac3e865f48d404a325f02f45d9f | github | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/plan/plan.ets | arkts | getDaysBetweenDates | 获取总天数 返回dayDiff(注册总天数) | function getDaysBetweenDates(date1: string, date2: string): number {
// 将日期字符串转换为Date对象(支持格式:"YYYY-MM-DD"、"YYYY/MM/DD"等)
const d1 = new Date(date1);
const d2 = new Date(date2);
// 检查日期是否有效
if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
throw new Error("无效的日期格式");
}
// 计算时间差(毫秒),取绝对值
const timeD... | AST#function_declaration#Left function getDaysBetweenDates AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left string AS... | function getDaysBetweenDates(date1: string, date2: string): number {
const d1 = new Date(date1);
const d2 = new Date(date2);
if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
throw new Error("无效的日期格式");
}
const timeDiff = Math.abs(d1.getTime() - d2.getTime());
const dayDiff = Math.floor(t... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L47-L64 | f9b34c0dc185ad736313c5ce2ec287df392d770c | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/NetConnectionUtils.ets | arkts | unregister | 取消订阅默认网络状态变化的通知。 | static unregister() {
if (NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
}
} | AST#method_declaration#Left static unregister AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetConnectionUtils AST#expression#Right . netConnection AST#member... | static unregister() {
if (NetConnectionUtils.netConnection) {
NetConnectionUtils.netConnection.unregister((error: BusinessError) => {
if (error) {
LogUtils.error('NetworkUtil-', `unregister-异常 ~ code: ${error.code} -·- message: ${error.message}`);
}
});
}
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L118-L126 | 1fb32ee9c3c2f4b57313f6a3f4f7b4d142c1932f | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/data/ViewItem.ets | arkts | 瀑布流子组件数据结构 | export class ViewItem {
id: string = '';
// 名字
name: string = '';
// 描述
des: string = '';
// 类型
type: number = 0;
// 封面图片
image: string | Resource = '';
} | AST#export_declaration#Left export AST#class_declaration#Left class ViewItem 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#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 名... | export class ViewItem {
id: string = '';
name: string = '';
des: string = '';
type: number = 0;
image: string | Resource = '';
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/data/ViewItem.ets#L17-L27 | 1560a7cdaa65268acea40c117a7c00a60c7ef479 | gitee | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/KMP.ets | arkts | countMatches | 计算模式串在文本中的出现次数
@param text 文本字符串
@param pattern 模式串
@returns 出现次数 | static countMatches(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return 0;
}
const matches = KMP.findAllMatches(text, pattern);
return matches.length;
} | AST#method_declaration#Left static countMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | static countMatches(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return 0;
}
const matches = KMP.findAllMatches(text, pattern);
return matches.length;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L227-L234 | 5183c45610e6061c4c7ff081c894596c97614b85 | github |
jiwangyihao/FlameChase.git | 446275e6972bd5f92a3c5b7eba354ca83d504594 | entry/src/main/ets/pages/ChroniclePage.ets | arkts | aboutToAppear | aboutToAppear 生命周期钩子,在组件即将显示时执行一次 | aboutToAppear() {
// 初始化时,根据当前日期设置显示的字符串
this.currentDate = this.getFormattedDate(this.displayDate);
} | 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentDate A... | aboutToAppear() {
this.currentDate = this.getFormattedDate(this.displayDate);
} | https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/pages/ChroniclePage.ets#L518-L521 | 643305b5bf7c0c2e6fbb3f125a0a92a6cfd091bd | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/WebCookie/entry/src/main/ets/common/utils/DialogUtil.ets | arkts | Pop up a message box.
@param message Message. | export function showDialog(message: ResourceStr) {
let newMessage = message.toString();
if (newMessage.length > CommonConstants.SUB_LENGTH) {
message = newMessage.substring(0, CommonConstants.SUB_LENGTH);
}
AlertDialog.show(
{
title: $r('app.string.dialog_message'),
message: message,
c... | AST#export_declaration#Left export AST#function_declaration#Left function showDialog AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left ... | export function showDialog(message: ResourceStr) {
let newMessage = message.toString();
if (newMessage.length > CommonConstants.SUB_LENGTH) {
message = newMessage.substring(0, CommonConstants.SUB_LENGTH);
}
AlertDialog.show(
{
title: $r('app.string.dialog_message'),
message: message,
c... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebCookie/entry/src/main/ets/common/utils/DialogUtil.ets#L24-L44 | 2fc519097f7b0971771aa8bbbd3da1d4d0f23de0 | gitee | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/SystemCheckService.ets | arkts | checkCamera | 检查摄像头连接 | static async checkCamera(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查摄像头连接');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_CAM);
console.info('[SystemCheckService] 摄像头检查响应:', JSON.stringify(response));
return {
success: response.code ==... | AST#method_declaration#Left static async checkCamera 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 CheckResult AST#primary_type#Right AST#type_annotation#Right >... | static async checkCamera(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查摄像头连接');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_CAM);
console.info('[SystemCheckService] 摄像头检查响应:', JSON.stringify(response));
return {
success: response.code ==... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L95-L113 | 813d89a08c1f7fba7a33962b5033eb48df4e86d5 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/KvUtil.ets | arkts | deleteBackup | 根据指定名称删除备份文件
@param files 删除备份文件所指定的名称
@returns | static async deleteBackup(files: Array<string>): Promise<Array<[string, number]>> {
let kvStore = await KvUtil.getKvStore();
return kvStore.deleteBackup(files);
} | AST#method_declaration#Left static async deleteBackup AST#parameter_list#Left ( AST#parameter#Left files : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#typ... | static async deleteBackup(files: Array<string>): Promise<Array<[string, number]>> {
let kvStore = await KvUtil.getKvStore();
return kvStore.deleteBackup(files);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L189-L192 | 807e36cdaa659557286b55b57f5b0c29479fb854 | gitee |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/auth/UserSessionManager.ets | arkts | 表示用户信息是否已加载完成 | constructor() {
this.personModelLoaded = new Promise(resolve => {
this.personModelReady = resolve;
});
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . personModelLoaded AS... | constructor() {
this.personModelLoaded = new Promise(resolve => {
this.personModelReady = resolve;
});
} | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/auth/UserSessionManager.ets#L17-L21 | bad0a2c693afc4004d77076270beee310f422693 | github | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/AgvMovementService.ets | arkts | isOnline | 检查AGV是否在线
@returns 在线状态 | static async isOnline(): Promise<boolean> {
try {
const heartbeatResult = await AgvMovementService.heartbeat();
return heartbeatResult.success;
} catch (error) {
console.error('[AgvMovementService] ❌ 检查AGV在线状态失败:', error);
return false;
}
} | AST#method_declaration#Left static async isOnline AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#ty... | static async isOnline(): Promise<boolean> {
try {
const heartbeatResult = await AgvMovementService.heartbeat();
return heartbeatResult.success;
} catch (error) {
console.error('[AgvMovementService] ❌ 检查AGV在线状态失败:', error);
return false;
}
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L156-L164 | b6d95f1f21cb4abe447e773bf37ec1d9b4b9871e | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets | arkts | Waterfall sub component WrappedBuilder object | export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder); | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left flowItemWrapper : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_anno... | export const flowItemWrapper: WrappedBuilder<ESObject> = wrapBuilder<ESObject>(flowItemBuilder); | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/TabNode.ets#L26-L26 | aec5d5dc0be8b9c46123b5e989d4f80d19e3898a | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets | arkts | 好友数据结构 | export interface PersonData {
wid: string; // 用户wid
headImg: ResourceStr | image.PixelMap // 头像
name: string // 用户昵称
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PersonData AST#object_type#Left { AST#type_member#Left wid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 用户wid AST#type_member#Left headImg : AST#type_annotat... | export interface PersonData {
wid: string;
headImg: ResourceStr | image.PixelMap
name: string
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets#L29-L33 | ce8612ac3708330a74ee4613340aac2aec7b498c | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/greeting/GreetingService.ets | arkts | createGreeting | 创建祝福语
@param params 创建参数
@returns 创建的祝福语 | async createGreeting(params: CreateGreetingParams): Promise<Greeting> {
try {
// 验证数据
const validationResult = this.validateGreetingParams(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
// 检查祝福语数量限制
const tot... | AST#method_declaration#Left async createGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateGreetingParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async createGreeting(params: CreateGreetingParams): Promise<Greeting> {
try {
const validationResult = this.validateGreetingParams(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
const totalCount = await thi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/greeting/GreetingService.ets#L58-L100 | d1256e478226098ac1a4900d37d2b3e1fc31c763 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets | arkts | @file 用户信息相关数据源接口
@author Joker.X | export interface UserInfoNetworkDataSource {
/**
* 更新用户个人信息
* @param params 用户信息参数
* @returns 更新结果响应
*/
updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>;
/**
* 更新用户密码
* @param params 密码参数
* @returns 更新结果响应
*/
updatePassword(params: Record<string, stri... | AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfoNetworkDataSource AST#object_type#Left { /**
* 更新用户个人信息
* @param params 用户信息参数
* @returns 更新结果响应
*/ AST#type_member#Left updatePersonInfo AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#pri... | export interface UserInfoNetworkDataSource {
updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>;
updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>>;
logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>>;
bindPho... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets#L7-L41 | f8f5ef483b5c696b7a8d389a3b2142b0b461bee9 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getBundleInfoSync | 获取当前应用的BundleInfo | static getBundleInfoSync(): bundleManager.BundleInfo {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_H... | AST#method_declaration#Left static getBundleInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement... | static getBundleInfoSync(): bundleManager.BundleInfo {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_H... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L77-L90 | 9834fce4e22872612b296c940884d8d09456be7b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/PagesRouter/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export default class CommonConstants {
/**
* The index page message.
*/
static readonly INDEX_MESSAGE: string = 'Index Page';
/**
* The src msg.
*/
static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据';
/**
* The second page url.
*/
static readonly SECOND_URL: string = 'pages/SecondPag... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* The index page message.
*/ AST#property_declaration#Left static readonly INDEX_MESSAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = ... | export default class CommonConstants {
static readonly INDEX_MESSAGE: string = 'Index Page';
static readonly SECOND_SRC_MSG: string = 'Index页面传来的数据';
static readonly SECOND_URL: string = 'pages/SecondPage';
static readonly SECOND_MESSAGE: string = 'Second Page';
static readonly SECOND_SRC_P... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/PagesRouter/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L89 | 329ffaa77a0292e0e89b0d860fc45e5dc76bedb9 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isNumber | 判断是否是Number类型 | static isNumber(value: Any): boolean {
return typeof value === 'number';
} | AST#method_declaration#Left static isNumber AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri... | static isNumber(value: Any): boolean {
return typeof value === 'number';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L40-L42 | b087856409142be688b18ca27f0193a8d9ec7735 | gitee |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/core/index.ets | arkts | GameDB | class | export {
GameDB
} | AST#export_declaration#Left export { GameDB } AST#export_declaration#Right | export {
GameDB
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/index.ets#L15-L17 | 0d99985ea87b8884a2816d933daed65b860679ff | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets | arkts | MARK: - CMetaInfo 等价 ArkTS 实现 | export class CMetaInfo {
fileName : string | null = null; // fullFileName: "Book.sqlite.zip", "hsk_1.jpg"
sizeInBytes : number | null = null; // 多少M
updateDate : string | null = null; // 更新日期
constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null)... | AST#export_declaration#Left export AST#class_declaration#Left class CMetaInfo AST#class_body#Left { AST#property_declaration#Left fileName : 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_... | export class CMetaInfo {
fileName : string | null = null;
sizeInBytes : number | null = null;
updateDate : string | null = null;
constructor(fileName: string | null = null, sizeInBytes: number | null = null, updateDate: string | null = null) {
this.fileName = fileName;
this.sizeInBytes = s... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L2-L31 | cefdc82a57c926c5618288bb59d5bfd1ef161e70 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | decodePKCS1Segment | 解密-分段
@param decodeStr 待解密的字符串
@param priKey RSA私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false | static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding,
isPem);
} | AST#method_declaration#Left static decodePKCS1Segment 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string {
return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding,
isPem);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L123-L127 | 950c9c63af70079e1e9dc7b328fc80181497415c | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history.ets | arkts | open_month_from_disk_sync | Files and Saving
Opens a month of history using lite import, that is, assuming all of them are in time range one month.
@param path A string, the path of the file. | open_month_from_disk_sync(year: number, month: number) {
if (history_path_of_month(year, month) == this.current_opened_file_path) {
// Already opened
// console.log('already opened')
return;
}
console.log('[bunch_of_history] Called open_month_from_disk_sync Y: ' + year + ' M: ' + month + '... | AST#method_declaration#Left open_month_from_disk_sync AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | open_month_from_disk_sync(year: number, month: number) {
if (history_path_of_month(year, month) == this.current_opened_file_path) {
return;
}
console.log('[bunch_of_history] Called open_month_from_disk_sync Y: ' + year + ' M: ' + month + '.');
ensure_this_month_history_file();
le... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L440-L460 | 02f20e941057760db4cd13644f4aa7dcb9ce84ff | gitee |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/event/LoadingDialogEvent.ets | arkts | 展示Loading的Event
@param showLoading
@param "
@returns | export function LoadingDialogEvent(showLoading: boolean, loadingTips: string = "加载中...") {
return {
data: {
"showLoading": showLoading,
"loadingTips": loadingTips
}
}
} | AST#export_declaration#Left export AST#function_declaration#Left function LoadingDialogEvent AST#parameter_list#Left ( AST#parameter#Left showLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loadingTips : AST#type_... | export function LoadingDialogEvent(showLoading: boolean, loadingTips: string = "加载中...") {
return {
data: {
"showLoading": showLoading,
"loadingTips": loadingTips
}
}
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/event/LoadingDialogEvent.ets#L7-L14 | 650185614348d4bfb1da6d0df3762ada49ea1620 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | getRate | Get rate.
@returns | getRate(): number {
return (this.w / this.h);
} | AST#method_declaration#Left getRate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expressio... | getRate(): number {
return (this.w / this.h);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L67-L69 | 02623f4d63d7c2700947ff60f5d7e5c255066ae0 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets | arkts | getTransactionsWithPagination | 获取交易记录 | public async getTransactionsWithPagination(
conditions: UserTablePredicateParams[],
page: number,
pageSize: number,
): Promise<TableQueryWithPaginationRsp<TransactionTableBasis>> {
return this.queryWithPagination<TransactionTableBasis>(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
conditi... | AST#method_declaration#Left public async getTransactionsWithPagination AST#parameter_list#Left ( AST#parameter#Left conditions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserTablePredicateParams [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST... | public async getTransactionsWithPagination(
conditions: UserTablePredicateParams[],
page: number,
pageSize: number,
): Promise<TableQueryWithPaginationRsp<TransactionTableBasis>> {
return this.queryWithPagination<TransactionTableBasis>(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
conditi... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L206-L218 | de01e19b128b031c475aa9eea70f88867c3888e8 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_a.ets | arkts | Introduction export-default/import | export default function cross_file_004_F_a(taint_src : string) {
return taint_src;
} | AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_004_F_a AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | export default function cross_file_004_F_a(taint_src : string) {
return taint_src;
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_004_F/cross_file_004_F_a.ets#L6-L8 | 49054c54509e77ccd4a6156f43feab8271f574cb | github | |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/view/VideoPlaySlider.ets | arkts | VideoSlider | video slider component | @Component
export struct VideoSlider {
@Consume isOpacity: boolean;
private controller: VideoController = new VideoController();
@Consume currentStringTime: string;
@Consume currentTime: number;
@Consume durationTime: number;
@Consume durationStringTime: string;
@Consume isPlay: boolean;
@Consume flag: ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isOpacity : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a... | @Component
export struct VideoSlider {
@Consume isOpacity: boolean;
private controller: VideoController = new VideoController();
@Consume currentStringTime: string;
@Consume currentTime: number;
@Consume durationTime: number;
@Consume durationStringTime: string;
@Consume isPlay: boolean;
@Consume flag: ... | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/view/VideoPlaySlider.ets#L16-L121 | 9363babea3b4e760094713d9e2809d2ef7076797 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | deleteWordIds | /从plan中删除words | public static async deleteWordIds(wordIds: number[], plan: Plan): Promise<void> {
////删除内存 中的缓存
plan.getPieces().forEach(piece => {
wordIds.forEach(wordId => {
//删除wordId
piece.removeMem(wordId);
//删除此piece
if (piece.wordIds.length === 0) {
plan.removeMemPiece(pi... | AST#method_declaration#Left public static async deleteWordIds AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left plan : AST#typ... | public static async deleteWordIds(wordIds: number[], plan: Plan): Promise<void> {
plan.getPieces().forEach(piece => {
wordIds.forEach(wordId => {
piece.removeMem(wordId);
if (piece.wordIds.length === 0) {
plan.removeMemPiece(piece);
plan.... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L416-L449 | 42bb4c3171bde853c06b7f1c99073942eebaa79e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 定价信息接口 | export interface PricingInfo {
inputTokenPrice: number;
outputTokenPrice: number;
currency: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PricingInfo AST#object_type#Left { AST#type_member#Left inputTokenPrice : 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 outputTokenPrice : AST... | export interface PricingInfo {
inputTokenPrice: number;
outputTokenPrice: number;
currency: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L664-L668 | 8b89b05262029b0e0917a083a7e4da8bb849dd30 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SubHeader.d.ets | arkts | SubHeader | Declare struct SubHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare struct SubHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declare struct SubHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @Component
export declare struct SubHeader {
/**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SubHeader AST#component_body#Left { /**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
... | @Component
export declare struct SubHeader {
@Prop icon?: ResourceStr;
iconSymbolOptions?: SymbolOptions;
@Prop primaryTitle?: ResourceStr;
@Prop secondaryTitle?: ResourceStr;
select?: SelectOptions;
@Prop operationType?: OperationType;
op... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeader.d.ets#L479-L746 | 02a359142b0ba97f7a02cd58e14bbbe9fe0abd40 | gitee |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/common/conts.ets | arkts | 5s | export const ATL3_MAX_REUSE_DURATION = 5*1000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ATL3_MAX_REUSE_DURATION = AST#expression#Left AST#binary_expression#Left AST#expression#Left 5 AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#var... | export const ATL3_MAX_REUSE_DURATION = 5*1000; | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/common/conts.ets#L21-L21 | a40bc73a23325c2a21ef0da20c346ddeb15e53be | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | forward | Goes forward in the history of the web page.
@throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a
AtomicServiceWeb component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | forward(): void; | AST#method_declaration#Left forward AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | forward(): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L403-L403 | 0116f96315a1c3990f1d9b5ba08d05d5a622b6fa | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getDeviceType | 获取当前设备类型
resourceManager.DeviceType:
DEVICE_TYPE_PHONE手机。
DEVICE_TYPE_TABLET 平板。
DEVICE_TYPE_CAR 汽车。
DEVICE_TYPE_PC 电脑。
DEVICE_TYPE_TV 电视。
DEVICE_TYPE_WEARABLE 穿戴。
DEVICE_TYPE_2IN1 2IN1。
@returns | static getDeviceType(): number {
return DeviceUtil.getDeviceCapabilitySync().deviceType;
} | AST#method_declaration#Left static getDeviceType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | static getDeviceType(): number {
return DeviceUtil.getDeviceCapabilitySync().deviceType;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L255-L257 | 9a26585521e4f5ae3b233652dea95b9cc80b6313 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/constants/AppConstants.ets | arkts | 存储常量(兼容性) | export class StorageConstants {
static readonly CONTACTS: string = 'contacts';
static readonly GREETINGS: string = 'greetings';
static readonly SETTINGS: string = 'settings';
static readonly LUNAR_CACHE: string = 'lunar_cache';
static readonly AI_CONFIG: string = 'ai_config';
// 数据库相关
static readonly D... | AST#export_declaration#Left export AST#class_declaration#Left class StorageConstants AST#class_body#Left { AST#property_declaration#Left static readonly CONTACTS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'contacts' AST#expression#Right... | export class StorageConstants {
static readonly CONTACTS: string = 'contacts';
static readonly GREETINGS: string = 'greetings';
static readonly SETTINGS: string = 'settings';
static readonly LUNAR_CACHE: string = 'lunar_cache';
static readonly AI_CONFIG: string = 'ai_config';
static readonly DATABASE_... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L113-L133 | 0455a89c009f270415a63ecaedf69688b511e950 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/CsvParser.ets | arkts | parseCsvRow | 解析CSV行为字段数组 | private static parseCsvRow(line: string): string[] {
const fields: string[] = [];
let currentField = '';
let inQuotes = false;
for (let i = 0; i < line.length; i++) {
const char = line[i];
if (char === '"') {
if (inQuotes && line[i + 1] === '"') {
// 双引号转义
... | AST#method_declaration#Left private static parseCsvRow AST#parameter_list#Left ( AST#parameter#Left line : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type... | private static parseCsvRow(line: string): string[] {
const fields: string[] = [];
let currentField = '';
let inQuotes = false;
for (let i = 0; i < line.length; i++) {
const char = line[i];
if (char === '"') {
if (inQuotes && line[i + 1] === '"') {
cur... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/CsvParser.ets#L126-L152 | 03c5769e4f7d185f5e338800f5856f01092cef45 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/log/Logger.ets | arkts | log | 统一日志输出 | private log(level: LogLevel, tag: string, message: string, args: string[]): void {
const logMessage = `[${tag}] ${message}`;
switch (level) {
case LogLevel.DEBUG:
hilog.debug(this.DOMAIN, this.TAG, logMessage); | AST#method_declaration#Left private log AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left LogLevel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | private log(level: LogLevel, tag: string, message: string, args: string[]): void {
const logMessage = `[${tag}] ${message}`;
switch (level) {
case LogLevel.DEBUG:
hilog.debug(this.DOMAIN, this.TAG, logMessage); | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L87-L92 | 83fc796b33bf2adae71cb418d07e099011446be9 | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/DetailViewModel.ets | arkts | 详细页面视图模型描述 | export default class DetailViewModel {
static instant: DetailViewModel = new DetailViewModel();
private reminderService: ReminderService;
private alarms: Array<AlarmItem>;
private constructor() {
this.reminderService = new ReminderService();
this.alarms = new Array<AlarmItem>();
}
/**
* 转换闹钟重复日... | AST#export_declaration#Left export default AST#class_declaration#Left class DetailViewModel AST#class_body#Left { AST#property_declaration#Left static instant : AST#type_annotation#Left AST#primary_type#Left DetailViewModel AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left ... | export default class DetailViewModel {
static instant: DetailViewModel = new DetailViewModel();
private reminderService: ReminderService;
private alarms: Array<AlarmItem>;
private constructor() {
this.reminderService = new ReminderService();
this.alarms = new Array<AlarmItem>();
}
public transA... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/DetailViewModel.ets#L13-L55 | e8c93278c9c0349c301eee4f7830b4f4bd766733 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/sync/CloudStorageProvider.ets | arkts | 阿里云存储实现 | export class AliyunStorageProvider extends CloudStorageProvider {
async initialize(): Promise<void> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Aliyun Storage');
// TODO: 实现阿里云存储初始化
}
async upload(options: UploadOptions): Promise<string> {
// TODO: 实现阿里云上传
throw new ... | AST#export_declaration#Left export AST#class_declaration#Left class AliyunStorageProvider extends AST#type_annotation#Left AST#primary_type#Left CloudStorageProvider AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left async initialize AST#parameter_list#Left ( ) AST#parame... | export class AliyunStorageProvider extends CloudStorageProvider {
async initialize(): Promise<void> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Initializing Aliyun Storage');
}
async upload(options: UploadOptions): Promise<string> {
throw new Error('Aliyun storage not implement... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudStorageProvider.ets#L330-L365 | 0d74bb1e6f0fa0f7cb3a3f5dda5fe89ce2a97e0f | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/common/constant/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export class CommonConstants {
/**
* Adjust slider value.
*/
static readonly ADJUST_SLIDER_VALUE: number[] = [100, 100, 100];
static readonly PIXEL_STEP: number;
/**
* Slider step.
*/
static readonly SLIDER_MAX: number = 100;
} | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Adjust slider value.
*/ AST#property_declaration#Left static readonly ADJUST_SLIDER_VALUE : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary... | export class CommonConstants {
static readonly ADJUST_SLIDER_VALUE: number[] = [100, 100, 100];
static readonly PIXEL_STEP: number;
static readonly SLIDER_MAX: number = 100;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/common/constant/CommonConstants.ets#L16-L27 | 17fac96fae8337f474d13a1a7ecca558bf416cc2 | gitee | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets | arkts | sendTestMsg2Server | 发送测试消息到服务端 | async sendTestMsg2Server() {
//执行TCP通讯的对象
let tcpSocket = socket.constructTCPSocketInstance();
await this.bind2Port(tcpSocket)
await this.connect2Server(tcpSocket)
for (let i = 0;i < 100; i++) {
await tcpSocket.send({ data: i.toString() })
await sleep(1)
}
} | AST#method_declaration#Left async sendTestMsg2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //执行TCP通讯的对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tcpSocket = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expr... | async sendTestMsg2Server() {
let tcpSocket = socket.constructTCPSocketInstance();
await this.bind2Port(tcpSocket)
await this.connect2Server(tcpSocket)
for (let i = 0;i < 100; i++) {
await tcpSocket.send({ data: i.toString() })
await sleep(1)
}
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets#L106-L116 | dc481a0b135ea6488fc4e44e5c625c07364189a1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showConfirmDialog | 显示信息确认类弹出框
@param options | static showConfirmDialog(options: ConfirmOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initDialogDefault(options);
ActionParameter.initPrimarySecondaryButton(options);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ConfirmDialogBuilder), options... | AST#method_declaration#Left static showConfirmDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left strin... | static showConfirmDialog(options: ConfirmOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initDialogDefault(options);
ActionParameter.initPrimarySecondaryButton(options);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ConfirmDialogBuilder), options... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L152-L158 | 28a4bf4109d8a395045cbf1220becf01ef45be59 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.