nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets | arkts | cancelNotificationById | cancel notification by id | async cancelNotificationById(id: number) {
try {
await notification.cancel(id);
logger.info(TAG, `cancel success`);
} catch (err) {
if (err) {
logger.info(TAG, `cancel err ${JSON.stringify(err)}`);
}
}
} | AST#method_declaration#Left async cancelNotificationById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement... | async cancelNotificationById(id: number) {
try {
await notification.cancel(id);
logger.info(TAG, `cancel success`);
} catch (err) {
if (err) {
logger.info(TAG, `cancel err ${JSON.stringify(err)}`);
}
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationUtil.ets#L85-L94 | a9d3985f189829727b36ea7e8c3e88fca154289d | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets | arkts | shutDown | 释放ai语音转文字引擎 | static shutDown() {
SpeechRecognizerManager.asrEngine?.shutdown()
} | AST#method_declaration#Left static shutDown AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left S... | static shutDown() {
SpeechRecognizerManager.asrEngine?.shutdown()
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/SpeechRecognizerManager.ets#L122-L124 | c35ccfaffb8bf132c7a8cc1702bfb34648166602 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets | arkts | defaultDeductionView | ListItem自定义组件(默认) | @Builder
defaultDeductionView(listItemInfo: ListInfo) {
Row() {
Image(listItemInfo.icon)
.width($r('app.integer.list_exchange_icon_size'))
.height($r('app.integer.list_exchange_icon_size'))
.draggable(false) // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false
Text(listIt... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right defaultDeductionView AST#parameter_list#Left ( AST#parameter#Left listItemInfo : AST#type_annotation#Left AST#primary_type#Left ListInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builde... | @Builder
defaultDeductionView(listItemInfo: ListInfo) {
Row() {
Image(listItemInfo.icon)
.width($r('app.integer.list_exchange_icon_size'))
.height($r('app.integer.list_exchange_icon_size'))
.draggable(false)
Text(listItemInfo.name)
.margin({ left: $r('app.string.ohos_i... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L123-L146 | 57515a0a295e137ee9ded1ec363f47daa9749c19 | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getPriority | 获取Offer优先级(用于排序) | getPriority(): number {
switch (this.status) {
case OfferStatus.RECEIVED:
return this.isExpiringSoon() ? 5 : 4;
case OfferStatus.PENDING:
return 3;
case OfferStatus.ACCEPTED:
return 2;
case OfferStatus.REJECTED:
return 1;
case OfferStatus.EXPIRED:
... | AST#method_declaration#Left getPriority 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#expression_statement#Left AST#expression#Left switch AST#expression#Righ... | getPriority(): number {
switch (this.status) {
case OfferStatus.RECEIVED:
return this.isExpiringSoon() ? 5 : 4;
case OfferStatus.PENDING:
return 3;
case OfferStatus.ACCEPTED:
return 2;
case OfferStatus.REJECTED:
return 1;
case OfferStatus.EXPIRED:
... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L253-L267 | f154d2beafda6baca74d97e8bb6e62ff4f564f6a | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | getTasks | Get all tasks
@returns Array of Task objects | async getTasks(): Promise<Task[]> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS);
predicates.orderByDesc('due_time');
try {
const resultSet = await this.rdbStore.query(predicates);
... | AST#method_declaration#Left async getTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Task [ ] AST#array_type#Right AST#primary_type#Right... | async getTasks(): Promise<Task[]> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS);
predicates.orderByDesc('due_time');
try {
const resultSet = await this.rdbStore.query(predicates);
... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L195-L226 | 17d127b9ea9dc55f2f39b16fbb5fe2c67ab6f647 | github |
CQULeaf/HarmonyOS-App-Development.git | 91f6ab13be3dbf83f6c1c4d2958673f15faefe46 | Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets | arkts | startListening | 开始监听 | static startListening() {
// 设置开始识别的相关参数
let recognizerParams: speechRecognizer.StartParams = {
// 会话id
sessionId: SpeechRecognizerManager.sessionId,
// 音频配置信息。
audioInfo: {
// 音频类型。 当前仅支持“pcm”
audioType: 'pcm',
// 音频的采样率。 当前仅支持16000采样率
sampleRate: 16000,
... | AST#method_declaration#Left static startListening AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置开始识别的相关参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left recognizerParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left spe... | static startListening() {
let recognizerParams: speechRecognizer.StartParams = {
sessionId: SpeechRecognizerManager.sessionId,
audioInfo: {
audioType: 'pcm',
sampleRate: 16000,
soundChannel: 1,
sampleBit: 16
},
... | https://github.com/CQULeaf/HarmonyOS-App-Development.git/blob/91f6ab13be3dbf83f6c1c4d2958673f15faefe46/Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets#L84-L110 | ea021a54da0aec7e927b894b1d5b7ab4daef76e4 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets | arkts | ActionSectionView | 操作组合组件 | @Component
export struct ActionSectionView {
actionItems: ActionItem[] = []; // 操作项数组
onClickItem?: (id: string) => void; // 操作项点击处理
build() {
Column() {
ForEach(this.actionItems, (actionItem: ActionItem, index: number) => {
this.createActionItem(actionItem, this.onClickItem)
i... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ActionSectionView AST#component_body#Left { AST#property_declaration#Left actionItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] AST#array_type#Right AST#primary_type#Right AST... | @Component
export struct ActionSectionView {
actionItems: ActionItem[] = [];
onClickItem?: (id: string) => void;
build() {
Column() {
ForEach(this.actionItems, (actionItem: ActionItem, index: number) => {
this.createActionItem(actionItem, this.onClickItem)
if (index < this.ac... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/ActionSectionView.ets#L22-L105 | d5088a285bc0e1b6b5d36b330b8bf8df16ec872c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets | arkts | encode | 加密
@param encodeStr 待加密的字符串
@param pubKey SM2公钥 | static async encode(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256);
} | AST#method_declaration#Left static async encode 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#primary_ty... | static async encode(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L41-L43 | fa6a1242acbffa341ce42a0099953b86246d0a37 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 搜索任务
@param userId 用户ID
@param keyword 搜索关键词
@param page 页码
@param size 每页大小
@returns 任务列表分页结果 | export function searchTasks(userId: number, keyword: string, page: number = 0, size: number = 20): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { userId, keyword, page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/search`,
params
);
} catc... | AST#export_declaration#Left export AST#function_declaration#Left function searchTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyword : AST#type_annotation#Left A... | export function searchTasks(userId: number, keyword: string, page: number = 0, size: number = 20): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { userId, keyword, page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/search`,
params
);
} catc... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L310-L322 | 97396391f922fbc2dc2f636d02a5dd3c2eb37492 | github | |
Running-Turtle1/club-enroll-system.git | 341bee0399c08bf9a61282f69dcac70e97558d76 | clubhy/entry/src/main/ets/views/MyInput.ets | arkts | MyInput | struct 做组件或页面时,要使用struct关键字 class 做数据结构时用class | @Preview //可预览组件
@Component //这个结构体是一个Component组件,@State 具有数据双向绑定的功能,实时更新
export struct MyInput{
@State placeholder:string = '请输入'
@State text:string = ''
callback = (v:string)=>{} //callback是一个function(v:string)函数
build() {
TextInput({placeholder:this.placeholder,text:this.text})
.fontSize(25)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right //可预览组件 AST#decorator#Left @ Component AST#decorator#Right //这个结构体是一个Component组件,@State 具有数据双向绑定的功能,实时更新 export struct MyInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right pla... | @Preview
@Component
export struct MyInput{
@State placeholder:string = '请输入'
@State text:string = ''
callback = (v:string)=>{}
build() {
TextInput({placeholder:this.placeholder,text:this.text})
.fontSize(25)
.placeholderFont({size:25})
.backgroundColor(Color.Transparent)
.borderWi... | https://github.com/Running-Turtle1/club-enroll-system.git/blob/341bee0399c08bf9a61282f69dcac70e97558d76/clubhy/entry/src/main/ets/views/MyInput.ets#L3-L20 | 16860e87a7491ac02151db43800ab1cc505ee7ee | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets | arkts | getCurrentScreenWidth | 获取当前屏幕宽度 | getCurrentScreenWidth(): number {
let screenW: number = px2vp(display.getDefaultDisplaySync().width);
// 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。
if (screenW >= this.DEVICESIZE) {
return screenW / 2;
} else {
return screenW;
... | AST#method_declaration#Left getCurrentScreenWidth 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#variable_declaration#Left let AST#variable_declarator#Left scr... | getCurrentScreenWidth(): number {
let screenW: number = px2vp(display.getDefaultDisplaySync().width);
if (screenW >= this.DEVICESIZE) {
return screenW / 2;
} else {
return screenW;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets#L102-L110 | 5c88af6af2edd5b392108630c484cd5fad5ebd01 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets | arkts | 快截图标区域3 左右之间间隔 | build() {
if (this.isChange) {
Row() {
IconList3({ marginSpace: this.marginSpace })
}
.backgroundColor($r('app.color.component_stack_product_background'))
.width('100%')
.height($r("app.integer.component_stack_icon_list_height3"))
.opacity(this.opacity1)
// TODO: 知识... | AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isChange AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifier... | build() {
if (this.isChange) {
Row() {
IconList3({ marginSpace: this.marginSpace })
}
.backgroundColor($r('app.color.component_stack_product_background'))
.width('100%')
.height($r("app.integer.component_stack_icon_list_height3"))
.opacity(this.opacity1)
.zIn... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/view/ComponentStack.ets#L228-L247 | 90ad581511a26344798f443f03df94bb9b811b20 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | ToolBar | Declare Component ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare Component ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declare Component ToolBar
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @Component
export declare struct ToolBar {
/**
* Define toolbar list array.
* @type { ToolBarOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define toolbar list array.
* @type { ToolBarOptions }.
* @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 ToolBar AST#component_body#Left { /**
* Define toolbar list array.
* @type { ToolBarOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* ... | @Component
export declare struct ToolBar {
@ObjectLink toolBarList: ToolBarOptions;
@Prop activateIndex?: number;
controller: TabsController;
@Prop dividerModifier?: DividerModifier;
@Prop toolBarModifier?: ToolBarModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L517-L617 | 7b7d0f8eb6ef028067e435591a9083d9b8d85eeb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | encryptECB | 加密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|ECB|PKCS7、SM4_128|ECB|PKCS5、等)。
@returns | static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.encrypt(data, symKey, null, transformation);
} | AST#method_declaration#Left static async encryptECB 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 encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'SM4_128|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.encrypt(data, symKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L163-L166 | fdda1b6656797e52edf5d42cd973679008841ab1 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/StateManagementPage.ets | arkts | StateManagementContent | 状态管理示例页内容视图
@returns {void} 无返回值 | @Builder
private StateManagementContent() {
MediumPaddingVerticalScroll() {
Column() {
Column() {
Column() {
Text($r("app.string.demo_state_management_count_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private StateManagementContent 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 MediumPaddingVerticalScroll ( ) AST#contain... | @Builder
private StateManagementContent() {
MediumPaddingVerticalScroll() {
Column() {
Column() {
Column() {
Text($r("app.string.demo_state_management_count_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/StateManagementPage.ets#L37-L98 | 427373cc088a622451334087bba2af5a79dacd16 | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | deleteAccount | Delete account method | async deleteAccount(accountId: string) {
const success = await AccountDataManager.deleteAccount(accountId);
if (success) {
// Reload account data after deletion
await this.loadAccountData();
promptAction.showToast({
message: '删除成功',
duration: 2000
});
} else {
p... | AST#method_declaration#Left async deleteAccount AST#parameter_list#Left ( AST#parameter#Left accountId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar... | async deleteAccount(accountId: string) {
const success = await AccountDataManager.deleteAccount(accountId);
if (success) {
await this.loadAccountData();
promptAction.showToast({
message: '删除成功',
duration: 2000
});
} else {
promptAction.showToast({
messa... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1580-L1595 | cc66d5403e3b2f627d581157db3a13c61399e708 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/FavoritesService.ets | arkts | updateGenerationRating | 更新生成历史评分 | async updateGenerationRating(historyId: string, rating: number): Promise<boolean> {
const history = this.generationHistory.find(h => h.id === historyId);
if (!history) {
return false;
}
history.rating = rating;
await this.saveData();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_A... | AST#method_declaration#Left async updateGenerationRating AST#parameter_list#Left ( AST#parameter#Left historyId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rating : AST#type_annotation#Left AST#primary_type#Left number... | async updateGenerationRating(historyId: string, rating: number): Promise<boolean> {
const history = this.generationHistory.find(h => h.id === historyId);
if (!history) {
return false;
}
history.rating = rating;
await this.saveData();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_A... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L147-L158 | 82a6f9f34a2a72fbb07ee0a2909b273eb9c63853 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/Renderer.ets | arkts | Abstract baseclass of all Renderers. | export default abstract class Renderer {
/**
* the component that handles the drawing area of the chart and it's offsets
*/
protected mViewPortHandler: ViewPortHandler | null = null;
constructor(viewPortHandler: ViewPortHandler) {
if (viewPortHandler) {
this.mViewPortHandler = viewPortHandler;
... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class Renderer AST#class_body#Left { /**
* the component that handles the drawing area of the chart and it's offsets
*/ AST#property_declaration#Left protected mViewPortHandler : AST#type_annotation#Left AST#union_type#Left AST#primary... | export default abstract class Renderer {
protected mViewPortHandler: ViewPortHandler | null = null;
constructor(viewPortHandler: ViewPortHandler) {
if (viewPortHandler) {
this.mViewPortHandler = viewPortHandler;
}
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/Renderer.ets#L23-L34 | ed9cfbd66b01df5ca1623b9b218b6a9e025860ee | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/pages/Index.ets | arkts | judgeHasNet | 获取网络是否开启,返回布尔值 | judgeHasNet(): boolean {
try { // Get current network connection
let netHandle = connection.getDefaultNetSync();
// 0-100 Reserved connections for the system
if (!netHandle || netHandle.netId < 100) {
return false;
}
// Get the properties of the connection
let netCapabi... | AST#method_declaration#Left judgeHasNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // Get current networ... | judgeHasNet(): boolean {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId < 100) {
return false;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
let cap = netCapability.networkCap;
if (!cap) {
... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L477-L503 | e60f6626035e0fbe48a65c43cb2e7929061a58a5 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Ready.ets | arkts | handle | 应用约束:45. 需要显式标注函数返回类型 | handle(packet: any): void {
const client = this.packetManager.client;
const data = packet.d;
client.ws.heartbeat();
// 应用约束:2. 禁止在运行时变更对象布局
data.user.user_settings = data.user_settings;
data.user.user_guild_settings = data.user_guild_settings;
// 应用约束:10. 使用具体的... | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : 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 void AST#primary_type#Right AST#typ... | handle(packet: any): void {
const client = this.packetManager.client;
const data = packet.d;
client.ws.heartbeat();
data.user.user_settings = data.user_settings;
data.user.user_guild_settings = data.user_guild_settings;
const clientUser = new ClientUs... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Ready.ets#L12-L101 | 1ff60d6278a56fe80b780e273add3df61ec7ae7e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/ReminderScheduler.ets | arkts | createPreparationReminder | 创建准备提醒 | async createPreparationReminder(contact: Contact, reminderTime: Date, message: string): Promise<string> {
try {
const reminderId = this.generateReminderId(ReminderType.PREPARATION_REMINDER, contact.id);
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderA... | AST#method_declaration#Left async createPreparationReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reminderTime : AST#type_annotation#Left AST#primary_type#Lef... | async createPreparationReminder(contact: Contact, reminderTime: Date, message: string): Promise<string> {
try {
const reminderId = this.generateReminderId(ReminderType.PREPARATION_REMINDER, contact.id);
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderA... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L228-L267 | 5ec26197ec77a5fe995bd7abc42bb3bb764fc38d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/FunctionalScenes.ets | arkts | FunctionalScenes | 主页瀑布流列表 | @Component
export struct FunctionalScenes {
@Link listData: SceneModuleInfo[];
dataSource: WaterFlowDataSource = new WaterFlowDataSource(this.listData);
@State tabsIndex: number = 0;
@State tabColumns: string = '1fr 1fr';
tabsController: TabsController = new TabsController();
private scrollController: Scrol... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FunctionalScenes AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right listData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SceneModuleInfo [ ] ... | @Component
export struct FunctionalScenes {
@Link listData: SceneModuleInfo[];
dataSource: WaterFlowDataSource = new WaterFlowDataSource(this.listData);
@State tabsIndex: number = 0;
@State tabColumns: string = '1fr 1fr';
tabsController: TabsController = new TabsController();
private scrollController: Scrol... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/FunctionalScenes.ets#L28-L42 | 8790474afca2995573f89bc3339f327420a1ae59 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/mine/mine.ets | arkts | 获取账号头像 | export function getAvatar(name:string) : string{
switch (name){
case '瘦成一道闪电':
return '/image/mine/pho.png'
default:
return '/image/mine/head.png';
} | AST#export_declaration#Left export AST#function_declaration#Left function getAvatar AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri... | export function getAvatar(name:string) : string{
switch (name){
case '瘦成一道闪电':
return '/image/mine/pho.png'
default:
return '/image/mine/head.png';
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/mine/mine.ets#L8-L14 | 1461231461cbc931cf6c466161d4d4ba6ed1cbc9 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_link | Link of this bookmark object.
@returns The link if is a bookmark, empty string if is a folder. | get_link() {
return this.link;
} | AST#method_declaration#Left get_link AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . link AST#member_expression#Right AST#expression#Right ; ... | get_link() {
return this.link;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L733-L735 | b8e210d9bf426bbd9b075d2eea71178522f3e1fe | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/demo/DemoNavigator.ets | arkts | toDatabase | 跳转到数据库示例页
@returns {void} 无返回值 | static toDatabase(): void {
navigateTo(DemoRoutes.Database);
} | AST#method_declaration#Left static toDatabase 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_component_statement#Left navigateTo ( AST#expression#Left AST#member_ex... | static toDatabase(): void {
navigateTo(DemoRoutes.Database);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L31-L33 | 0f0f22e26b9a85bed4a5390166088047c13705d8 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/anarchy/0.0.1/package/install.ets | arkts | 应用规则18 | constructor(x: number, y: number) { // 显式类型标注
this.x = x;
this.y = y;
} | AST#constructor_declaration#Left constructor 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 A... | constructor(x: number, y: number) {
this.x = x;
this.y = y;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/anarchy/0.0.1/package/install.ets#L14-L17 | a70e676d7b131a133245a6e7833ef818b7cd74ba | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets | arkts | setCircleRadius | Sets the radius of the drawn circles.
Default radius = 4f, Min = 1f
@param radius | public setCircleRadius(radius: number): void {
if (radius >= 1) {
this.mCircleRadius = radius;
} else {
console.log('LineDataSet', 'Circle radius cannot be < 1');
}
} | AST#method_declaration#Left public setCircleRadius AST#parameter_list#Left ( AST#parameter#Left radius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary... | public setCircleRadius(radius: number): void {
if (radius >= 1) {
this.mCircleRadius = radius;
} else {
console.log('LineDataSet', 'Circle radius cannot be < 1');
}
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L155-L161 | a318bd3fc4dff45849cec4c5789cb4e89c263d2f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets | arkts | addHar1 | [Start export_add_har1] | export { addHar1 } from './src/main/ets/utils/Calc'; | AST#export_declaration#Left export { addHar1 } from './src/main/ets/utils/Calc' ; AST#export_declaration#Right | export { addHar1 } from './src/main/ets/utils/Calc'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/har1/Index.ets#L19-L19 | 1ae52014bff963fdf7b863d79193ba1e31df48f6 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/CommemorationDAO.ets | arkts | 纪念日数据访问对象
负责纪念日表的所有CRUD操作 | export class CommemorationDAO {
private dbManager: DatabaseManager;
constructor() {
this.dbManager = DatabaseManager.getInstance();
}
/**
* 插入新纪念日
* @param commemoration 纪念日实体
* @returns 插入的记录ID
*/
async insertCommemoration(commemoration: CommemorationEntity): Promise<number> {
const rdb... | AST#export_declaration#Left export AST#class_declaration#Left class CommemorationDAO AST#class_body#Left { AST#property_declaration#Left private dbManager : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_de... | export class CommemorationDAO {
private dbManager: DatabaseManager;
constructor() {
this.dbManager = DatabaseManager.getInstance();
}
async insertCommemoration(commemoration: CommemorationEntity): Promise<number> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/CommemorationDAO.ets#L42-L144 | 31e2af5b50909be127ea58cd4322929cfa44890e | github | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 分页信息 | export interface PageInfo {
total: string;
current: string;
hitCount: boolean;
size: string;
optimizeCountSql: boolean;
records: MessageItem[];
//orders: any[]; // 文档中未定义具体结构
isSearchCount: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PageInfo AST#object_type#Left { AST#type_member#Left total : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left current : AST#type_annotation#Left ... | export interface PageInfo {
total: string;
current: string;
hitCount: boolean;
size: string;
optimizeCountSql: boolean;
records: MessageItem[];
isSearchCount: boolean;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L154-L163 | d7039bbcdefc3f0f957c1f2d4a3287058666452a | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets | arkts | 将十六进制颜色字符串转换为 RGB 对象。
@param {string} hex - 十六进制颜色字符串,可以以 "#" 开头或不带 "#"。
@returns {RgbType | null} - 返回一个 RgbType 对象,如果输入无效则返回 null。 | export function hexToRgb(hex: string): RgbType | null {
// 使用正则表达式匹配十六进制颜色字符串
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if (result) {
// 将匹配的十六进制值转换为十进制 RGB 值
return {
red: parseInt(result[1], 16),
green: parseInt(result[2], 16),
blue: parseInt(result[3], 16)
... | AST#export_declaration#Left export AST#function_declaration#Left function hexToRgb AST#parameter_list#Left ( AST#parameter#Left hex : 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#union... | export function hexToRgb(hex: string): RgbType | null {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if (result) {
return {
red: parseInt(result[1], 16),
green: parseInt(result[2], 16),
blue: parseInt(result[3], 16)
}
} else {
return null;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L129-L143 | 63fb7c298c6da373961aad1dcae2842fa18349e2 | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | getInstance | 单例实现FileUtils类 | public static getInstance(): FileUtils {
if (!FileUtils.sInstance) {
FileUtils.sInstance = new FileUtils();
}
return FileUtils.sInstance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FileUtils AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Le... | public static getInstance(): FileUtils {
if (!FileUtils.sInstance) {
FileUtils.sInstance = new FileUtils();
}
return FileUtils.sInstance;
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L30-L35 | fde18926caac47c7dd630605253259f9fd3c32a0 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | needsOffset | Returns true if this axis needs horizontal offset, false if no offset is needed.
@return | public needsOffset(): boolean {
if (super.isEnabled() && super.isDrawLabelsEnabled() && this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART)
return true;
else
return false;
} | AST#method_declaration#Left public needsOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression... | public needsOffset(): boolean {
if (super.isEnabled() && super.isDrawLabelsEnabled() && this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART)
return true;
else
return false;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L452-L457 | fca5abb2e16ec37e187f4214c4d944337b0fd295 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/RegisterPage.ets | arkts | validateContact | 验证联系方式 | private validateContact(): boolean {
if (this.contactType === 'phone') {
// 简单的手机号验证
const phoneRegex = /^(\+86)?1[3-9]\d{9}$/ // 允许带+86
if (!phoneRegex.test(this.contactValue)) {
this.showMessage('请输入正确的手机号码', 'error')
return false
}
} else {
// 简单的邮箱验证
cons... | AST#method_declaration#Left private validateContact AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expre... | private validateContact(): boolean {
if (this.contactType === 'phone') {
const phoneRegex = /^(\+86)?1[3-9]\d{9}$/
if (!phoneRegex.test(this.contactValue)) {
this.showMessage('请输入正确的手机号码', 'error')
return false
}
} else {
const emailRegex = /^[^\s@]+@[^\s@... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/RegisterPage.ets#L73-L128 | 751b2c3411dba2b1d44fa05255102de404570016 | github |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/model/ItemModel.ets | arkts | list | 提供接口,查询全部的食物清单或者运动清单 | list(isFood: boolean = true): RecordItem[]{
return isFood ? foods : workouts
}
//按类型查询
listItemGroupByCategory(isFood: boolean = true){
// 1.判断要处理的是食物还是运动
let categories = isFood ? FoodCategories:WorkoutCategories
let items = isFood ? foods:workouts
// 2.创建空的分组
let groups = categories.map... | AST#method_declaration#Left list AST#parameter_list#Left ( AST#parameter#Left isFood : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#para... | list(isFood: boolean = true): RecordItem[]{
return isFood ? foods : workouts
}
listItemGroupByCategory(isFood: boolean = true){
let categories = isFood ? FoodCategories:WorkoutCategories
let items = isFood ? foods:workouts
let groups = categories.map(itemCategory => new GroupInfo(itemC... | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/ItemModel.ets#L60-L75 | 516746815a510cb09afe48814640b985a7c16dbf | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets | arkts | [Start sourcecode_router_module] | export class RouterModule {
// [StartExclude sourcecode_router_module]
// WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储
static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>();
// [EndExclude sourcecode_router_module]
// 初始化路由栈,需要关联Navigation组件
static routerMap: Ma... | AST#export_declaration#Left export AST#class_declaration#Left class RouterModule AST#class_body#Left { // [StartExclude sourcecode_router_module] // WrappedBuilder支持@Builder描述的组件以参数的形式进行封装存储 AST#property_declaration#Left static builderMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#ty... | export class RouterModule {
static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>();
static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>();
public static createRouter(routerName: string, router: NavPathStack): void {
Router... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L20-L76 | 53021295829f6034221dcde3142e909e438e94fb | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | initializePage | 初始化页面 | private async initializePage(): Promise<void> {
try {
this.loading = true;
// 加载联系人信息
this.contact = await this.contactService.getContactById(this.contactId);
if (!this.contact) {
throw new Error('联系人不存在');
}
// 如果指定了祝福语ID,加载祝福语
if (this.greetingId) {... | AST#method_declaration#Left private async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | private async initializePage(): Promise<void> {
try {
this.loading = true;
this.contact = await this.contactService.getContactById(this.contactId);
if (!this.contact) {
throw new Error('联系人不存在');
}
if (this.greetingId) {
this.selectedGreetin... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L61-L95 | 8ca6c77eaa7295fe5ce173e60ca51cb2cd88e666 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/model/Table.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/Table.ets#L4-L4 | e6d4dddb295718d027db3923b56d5469d30616ab | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets | arkts | [Start test] somePackage.ets | export class Test {
foo(){}
} | AST#export_declaration#Left export AST#class_declaration#Left class Test AST#class_body#Left { AST#method_declaration#Left foo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration... | export class Test {
foo(){}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets#L22-L24 | 3ea29be50ecefc456a374286f6328a5bbbdf23a6 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment1.ets | arkts | example | [Start Custom_Components] | @Component
export struct example {
build() {
Column(){
Text('Custom Component Sample Code')
// ...
}
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct example AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { A... | @Component
export struct example {
build() {
Column(){
Text('Custom Component Sample Code')
}
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment1.ets#L2-L10 | 30a71e3a26fed74d603a0ee6b9c610ede9c367a5 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookHistoryType.ets | arkts | @author 2008
@datetime 2024/7/24 22:03
@className: BookGroupType | export interface BookHistoryTypeParams {
//类型 0 小说;1 漫画;2 有声书;
type?: number,
//排序
sort?: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BookHistoryTypeParams AST#object_type#Left { //类型 0 小说;1 漫画;2 有声书; AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , //排序 AST#type_member... | export interface BookHistoryTypeParams {
type?: number,
sort?: number
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/BookHistoryType.ets#L6-L11 | 27c27842fcabe9ad944522e53635ee6353f1fb1c | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/LocalStoragePage.ets | arkts | ActionSection | 操作区域
@returns {void} 无返回值 | @Builder
private ActionSection(): void {
IBestButton({
text: $r("app.string.demo_local_storage_action_save"),
round: true,
type: "primary",
buttonSize: "normal",
btnWidth: P100,
onBtnClick: (): void => {
void this.vm.saveAccount();
}
});
SpaceVerticalLarg... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ActionSection 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_component_statemen... | @Builder
private ActionSection(): void {
IBestButton({
text: $r("app.string.demo_local_storage_action_save"),
round: true,
type: "primary",
buttonSize: "normal",
btnWidth: P100,
onBtnClick: (): void => {
void this.vm.saveAccount();
}
});
SpaceVerticalLarg... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/LocalStoragePage.ets#L72-L96 | d2030aed7f278b70035f8c68ca41e1353b875e12 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets | arkts | getAesEncryptProperties | AES加密密钥属性信息 | function getAesEncryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
... | AST#function_declaration#Left function getAesEncryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | function getAesEncryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L136-L163 | a824bb886f76411e00f356fcba54ed07c8de08ba | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | TODO 通知工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class NotificationUtil {
private static defaultConfig: NotificationConfig = new NotificationConfig(); //默认配置
/**
* 设置通知的默认统一配置
* @param configs
*/
static setDefaultConfig(configs: (config: NotificationConfig) => void): void {
configs(NotificationUtil.defaultConfig);
}
/**
* 查询通知是否授... | AST#export_declaration#Left export AST#class_declaration#Left class NotificationUtil AST#class_body#Left { AST#property_declaration#Left private static defaultConfig : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expres... | export class NotificationUtil {
private static defaultConfig: NotificationConfig = new NotificationConfig();
static setDefaultConfig(configs: (config: NotificationConfig) => void): void {
configs(NotificationUtil.defaultConfig);
}
static async isNotificationEnabled(): Promise<boolean> {
retu... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L41-L596 | 44782dfaf5337333ed01c604694f410e8809619e | gitee | |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/ext/UIExt.ets | arkts | 显示软键盘
@param id 需要focus的输入控件key | export function extUIShowKeybroad(key: string) {
sendEventByKey(key, 10, "弹出键盘")
} | AST#export_declaration#Left export AST#function_declaration#Left function extUIShowKeybroad AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ... | export function extUIShowKeybroad(key: string) {
sendEventByKey(key, 10, "弹出键盘")
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ext/UIExt.ets#L21-L23 | 29afdd2a8fe28a21f29070ab5c2e2c447c251351 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/views/FlashingLightPage.ets | arkts | getImageDefault | Return to selected image | getImageDefault() {
if (this.flashingNum == 0) {
return this.flashIcon.iconOff;
}
if (this.flashingNum == 1) {
return this.flashIcon.iconOn;
}
if (this.flashingNum == 2) {
return this.flashIcon.iconAuto;
}
if (this.flashingNum == 3) {
return this.flashIcon.iconAlwaysO... | AST#method_declaration#Left getImageDefault AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flashing... | getImageDefault() {
if (this.flashingNum == 0) {
return this.flashIcon.iconOff;
}
if (this.flashingNum == 1) {
return this.flashIcon.iconOn;
}
if (this.flashingNum == 2) {
return this.flashIcon.iconAuto;
}
if (this.flashingNum == 3) {
return this.flashIcon.iconAlwaysO... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/FlashingLightPage.ets#L40-L54 | 89694bdd8fae38e1bca3ed7d24a606ecb066d7b2 | gitee |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | waitSync | eglWaitSync
https://registry.khronos.org/EGL/sdk/docs/man/html/eglWaitSync.xhtml
@param flag must be 0? | waitSync(sync: EGLSync, flags: number): boolean; | AST#method_declaration#Left waitSync AST#parameter_list#Left ( AST#parameter#Left sync : AST#type_annotation#Left AST#primary_type#Left EGLSync AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left flags : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | waitSync(sync: EGLSync, flags: number): boolean; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L213-L213 | 633ee6296ce7c019bbddba14be7ec20777670bed | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | products/entry/src/main/ets/pages/anim/card/ResourceString.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 function getResourceString(resource: Resource, __this: object): string {
let resourceString = getContext(__this).resourceManager.getStringSync(resource.id);
return resourceString;
} | AST#export_declaration#Left export AST#function_declaration#Left function getResourceString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left __this : AST#type_annotati... | export function getResourceString(resource: Resource, __this: object): string {
let resourceString = getContext(__this).resourceManager.getStringSync(resource.id);
return resourceString;
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/anim/card/ResourceString.ets#L16-L19 | 2703e58b1f78c012a05de26e5c23be6d712cf664 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/Utils.ets | arkts | open | 打开文件,支持使用URI打开文件。使用Promise异步回调。
@param path string 文件的应用沙箱路径或URI。
@param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。
@returns | static open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> {
return fs.open(path, mode);
} | AST#method_declaration#Left static open 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#Left mode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ... | static open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> {
return fs.open(path, mode);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L105-L107 | 0f05b70bf034a3052dbd9a427671d8f1cbc7c531 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/@xvideos_alerts/581.2.14/package/app.ets | arkts | 应用约束26:使用箭头函数而非函数表达式 | export const printMsg = () => {}; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left printMsg = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_funct... | export const printMsg = () => {}; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@xvideos_alerts/581.2.14/package/app.ets#L2-L2 | e1b9827a55987d33fe303f751d65eec149e160ed | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData2025.ets | arkts | searchFestivals | 搜索节日 | public static searchFestivals(keyword: string): FestivalInfo[] {
const lowerKeyword = keyword.toLowerCase();
return FestivalData2025.getAllFestivals().filter(festival =>
festival.name.toLowerCase().includes(lowerKeyword) ||
festival.englishName?.toLowerCase().includes(lowerKeyword) ||
festiva... | AST#method_declaration#Left public static searchFestivals AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#arra... | public static searchFestivals(keyword: string): FestivalInfo[] {
const lowerKeyword = keyword.toLowerCase();
return FestivalData2025.getAllFestivals().filter(festival =>
festival.name.toLowerCase().includes(lowerKeyword) ||
festival.englishName?.toLowerCase().includes(lowerKeyword) ||
festiva... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L327-L334 | d137d748ab966a14f948098eacb2245996d6f665 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets | arkts | reset | 重置 | reset(): void {
this.currentRotate = 0;
this.lastRotate = 0;
} | AST#method_declaration#Left reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expre... | reset(): void {
this.currentRotate = 0;
this.lastRotate = 0;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets#L31-L34 | 0b67c739679cd367c36de0786e83c02c3448f188 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/web/src/main/ets/WebView.ets | arkts | WebView | @author open_9527
@date 2025/5/16
@desc web 包装层 | @ComponentV2
export struct WebView {
@Require @Param webviewController: webview.WebviewController
@Require @Param webviewSrc: ResourceStr
@Param webViewOptions: WebViewOptions = new WebViewOptions()
@Param webViewProxy: WebViewProxy = new BaseWebViewProxyImp()
build() {
Column() {
Web({ src: this.w... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct WebView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right webviewController : AST#type_annotation#Left AST#primar... | @ComponentV2
export struct WebView {
@Require @Param webviewController: webview.WebviewController
@Require @Param webviewSrc: ResourceStr
@Param webViewOptions: WebViewOptions = new WebViewOptions()
@Param webViewProxy: WebViewProxy = new BaseWebViewProxyImp()
build() {
Column() {
Web({ src: this.w... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebView.ets#L13-L344 | 435abc774b71ea12dd7d7c87c6ff4fff2fffaf43 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleNotificationManager.ets | arkts | initializeAllReminders | 初始化所有提醒 | async initializeAllReminders(): Promise<void> {
try {
hilog.info(0x0000, 'SimpleNotificationManager', 'All reminders initialized (simplified version)');
} catch (error) {
hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize reminders');
}
} | AST#method_declaration#Left async initializeAllReminders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | async initializeAllReminders(): Promise<void> {
try {
hilog.info(0x0000, 'SimpleNotificationManager', 'All reminders initialized (simplified version)');
} catch (error) {
hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to initialize reminders');
}
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L177-L183 | be5bfda2fcb1398ab28787aa8aba543adb6e2d6b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets | arkts | 歌词数据类,待扩展 | export class LyricsDataSource implements IDataSource {
private lyricsTimeArr: Array<number> = [];
private lyricsDataArr: Array<string> = [];
constructor(lrcRes: string) {
this.initLyricsDataArr(lrcRes);
}
async initLyricsDataArr(lrcRes: string) {
const resourceManager = getContext().resourceManager;... | AST#export_declaration#Left export AST#class_declaration#Left class LyricsDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private lyricsTimeArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#ty... | export class LyricsDataSource implements IDataSource {
private lyricsTimeArr: Array<number> = [];
private lyricsDataArr: Array<string> = [];
constructor(lrcRes: string) {
this.initLyricsDataArr(lrcRes);
}
async initLyricsDataArr(lrcRes: string) {
const resourceManager = getContext().resourceManager;... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/MusicModel.ets#L22-L82 | 7de98708402dbcb49200e3b650bf4b2a9e679dba | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/DateHelper.ets | arkts | getDays | 获取指定月份的天数 | static getDays(year: number, month: number): number {
if (month == 2) {
if (DateHelper.isLeapYear(year)) {
return 29;
} else {
return 28;
}
} else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
} else... | AST#method_declaration#Left static getDays 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#primary_type#Ri... | static getDays(year: number, month: number): number {
if (month == 2) {
if (DateHelper.isLeapYear(year)) {
return 29;
} else {
return 28;
}
} else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
return 31;
} else... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L19-L31 | ea9d509e9485a1f4166d6c8c35258e3271d27e59 | github |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/pages/Index.ets | arkts | saveCurrentCity | 保存当前城市到存储 | async saveCurrentCity() {
try {
await StorageUtil.saveSelectedCity(this.currentCity, this.cityId);
console.log('城市已保存到存储');
} catch (error) {
console.error('保存城市失败:', JSON.stringify(error));
}
} | AST#method_declaration#Left async saveCurrentCity AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST... | async saveCurrentCity() {
try {
await StorageUtil.saveSelectedCity(this.currentCity, this.cityId);
console.log('城市已保存到存储');
} catch (error) {
console.error('保存城市失败:', JSON.stringify(error));
}
} | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L121-L128 | 41ebcd43f5f2c4486a3f8128a79704902123c6b6 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | parseSelectedGoodsList | 解析已选商品列表
@param {SelectedGoodsJson[]} jsonList JSON 数据列表
@returns {SelectedGoods[]} 已选商品列表 | private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] {
const result: SelectedGoods[] = [];
for (const item of jsonList) {
const selectedGoods = new SelectedGoods();
selectedGoods.goodsId = item.goodsId ?? 0;
selectedGoods.count = item.count ?? 0;
// 解析商品信息
... | AST#method_declaration#Left private parseSelectedGoodsList AST#parameter_list#Left ( AST#parameter#Left jsonList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoodsJson [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right... | private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] {
const result: SelectedGoods[] = [];
for (const item of jsonList) {
const selectedGoods = new SelectedGoods();
selectedGoods.goodsId = item.goodsId ?? 0;
selectedGoods.count = item.count ?? 0;
if (it... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L199-L232 | fbc5c4fd82ab6d5dfbcd5075a9407dc13b6af213 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/RowAttribute.ets | arkts | 获取横向两端分布 + 垂直底部的 Row 对齐修饰器
@returns {AttributeModifier<RowAttribute>} Row 对齐修饰器
@example
Row() { Text("A"); Text("B"); }.attributeModifier(rowSpaceBetweenBottom()); | export function rowSpaceBetweenBottom(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(VerticalAlign.Bottom);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function rowSpaceBetweenBottom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttrib... | export function rowSpaceBetweenBottom(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(VerticalAlign.Bottom);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L177-L184 | d23ac9979cb607bb55b5c3ec342ba7724e72a6c5 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DESSync.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey 3DES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64
@returns | static encodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding);
} | AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L60-L63 | a31399424be2917ae1c4d41037b416d331e0cd83 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/SkeletonLayout.ets | arkts | SkeletonLayout | 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... | @Component
@Reusable
export struct SkeletonLayout {
isMine: boolean = false;
aboutToReuse(params: Record<string, object>): void {
}
build() {
Row() {
Column() {
Column({ space: 4 }) {
// 标题
textArea($r('app.float.custom_animation_tab_ske_card_title_height'))
// ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Reusable AST#decorator#Right export struct SkeletonLayout AST#component_body#Left { AST#property_declaration#Left isMine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_... | @Component
@Reusable
export struct SkeletonLayout {
isMine: boolean = false;
aboutToReuse(params: Record<string, object>): void {
}
build() {
Row() {
Column() {
Column({ space: 4 }) {
textArea($r('app.float.custom_animation_tab_ske_card_title_height'))
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/SkeletonLayout.ets#L16-L85 | 6074b90093df4440392d9944cee2061d0fc3ae26 | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getStatusColor | 获取状态颜色 | getStatusColor(): string {
switch (this.status) {
case OfferStatus.PENDING:
return '#faad14';
case OfferStatus.RECEIVED:
return '#1890ff';
case OfferStatus.ACCEPTED:
return '#52c41a';
case OfferStatus.REJECTED:
return '#ff4d4f';
case OfferStatus.EXPIRED:... | AST#method_declaration#Left getStatusColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swi... | getStatusColor(): string {
switch (this.status) {
case OfferStatus.PENDING:
return '#faad14';
case OfferStatus.RECEIVED:
return '#1890ff';
case OfferStatus.ACCEPTED:
return '#52c41a';
case OfferStatus.REJECTED:
return '#ff4d4f';
case OfferStatus.EXPIRED:... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L142-L157 | 5118d128af3d157ed6e387ef17aee5221d39e4d0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets | arkts | onFocusIndexChange | toast弹窗时长
更新中间变量 | onFocusIndexChange() {
this.middleIndex = this.focusIndex;
} | AST#method_declaration#Left onFocusIndexChange 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 . middleIndex AST#member_expressi... | onFocusIndexChange() {
this.middleIndex = this.focusIndex;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets#L33-L35 | f9552296f7a393ebbd4ce9f39c0f4f7eaad580d6 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/tabs_actions.ets | arkts | Web and Tabs
Returns true if the current tab is doing in-page searching.
@param storage The LocalStorage.
@returns True if is searching, false otherwise. | export function is_current_in_page_searching(storage: LocalStorage) {
return storage.get('current_in_page_searching_stats_total') as number > 0;
} | AST#export_declaration#Left export AST#function_declaration#Left function is_current_in_page_searching AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bl... | export function is_current_in_page_searching(storage: LocalStorage) {
return storage.get('current_in_page_searching_stats_total') as number > 0;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L140-L142 | a0d87e7deab0126bb21c9bb33ebeeacd59b6f4b9 | gitee | |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | common/component.ets | arkts | AppGrid | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export {
AppGrid,
AppName,
AppIcon,
AppMenu,
AppBubble,
ScrollerComponent,
RemoveFormDialog,
UninstallDialog,
FolderComponent,
FormManagerDialog,
FormItemComponent,
RemoteWindowWrapper
} from './src/main/ets/default/uicomponents'; | AST#export_declaration#Left export { AppGrid , AppName , AppIcon , AppMenu , AppBubble , ScrollerComponent , RemoveFormDialog , UninstallDialog , FolderComponent , FormManagerDialog , FormItemComponent , RemoteWindowWrapper } from './src/main/ets/default/uicomponents' ; AST#export_declaration#Right | export {
AppGrid,
AppName,
AppIcon,
AppMenu,
AppBubble,
ScrollerComponent,
RemoveFormDialog,
UninstallDialog,
FolderComponent,
FormManagerDialog,
FormItemComponent,
RemoteWindowWrapper
} from './src/main/ets/default/uicomponents'; | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/component.ets#L16-L29 | 05f77a8bfe2cf65302acd5627e89c3a4252d5b31 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | buildUserMessage | 构建用户消息 | @Builder
buildUserMessage(message: ChatMessage) {
Column({ space: 8 }) {
Column() {
Text(message.content)
.fontSize(14)
.fontColor(Color.White)
.lineHeight(20)
.maxLines(10)
}
.padding(12)
.backgroundColor($r('app.color.primary'))
.bord... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_func... | @Builder
buildUserMessage(message: ChatMessage) {
Column({ space: 8 }) {
Column() {
Text(message.content)
.fontSize(14)
.fontColor(Color.White)
.lineHeight(20)
.maxLines(10)
}
.padding(12)
.backgroundColor($r('app.color.primary'))
.bord... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L192-L214 | 6ef6be8cd89f917f0121b80c0cdeaf46f549e4d9 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | getWidth | 获取设备的屏幕宽度,单位为px。
@returns | static getWidth(): number {
return DisplayUtil.getDefaultDisplaySync().width;
} | AST#method_declaration#Left static getWidth 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_expressi... | static getWidth(): number {
return DisplayUtil.getDefaultDisplaySync().width;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L63-L65 | 7dd0c091b607ebed5e28c27461449652d910464e | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets | arkts | PowerManager | Copyright (c) 2023-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,... | export { PowerManager } from './src/main/ets/capabilities/PowerManager'; | AST#export_declaration#Left export { PowerManager } from './src/main/ets/capabilities/PowerManager' ; AST#export_declaration#Right | export { PowerManager } from './src/main/ets/capabilities/PowerManager'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/index.ets#L16-L16 | c3cea8899471e447d774a3591d0f5666dfe38014 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets | arkts | getAddressJson | 获取省市区信息的json文件数据
@param mockFileDir 要传入的json文件。这里指存放在rawfile下的address.json
@returns 返回json中省信息数组 | static getAddressJson(mockFileDir: string): Array<Province> {
const jsonObj: JsonObject = new JsonObject(mockFileDir);
const modelMockData: Array<Province> = jsonObj.getAddressData();
return modelMockData;
} | AST#method_declaration#Left static getAddressJson AST#parameter_list#Left ( AST#parameter#Left mockFileDir : 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_... | static getAddressJson(mockFileDir: string): Array<Province> {
const jsonObj: JsonObject = new JsonObject(mockFileDir);
const modelMockData: Array<Province> = jsonObj.getAddressData();
return modelMockData;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets#L28-L32 | 8b89d42fb3b8e4826f30e97443d608c10b0451a9 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets | arkts | sendHttpRequest | [Start request_interface_development] 封装普通的 HTTP 请求逻辑 | private sendHttpRequest(): void {
this.normalReqResult = $r('app.string.testing');
let httpRequest = http.createHttp();
// 订阅HTTP响应头
httpRequest.on('headersReceive', (header) => {
Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`);
});
httpRequest.request(
// 填写HTTP请求的URL地... | AST#method_declaration#Left private sendHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_e... | private sendHttpRequest(): void {
this.normalReqResult = $r('app.string.testing');
let httpRequest = http.createHttp();
httpRequest.on('headersReceive', (header) => {
Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`);
});
httpRequest.request(
TARGET_URL,
{
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets#L74-L154 | 5819ffb1709560785a60d9af0b05195be9aee346 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets | arkts | GridSceneView | 示例Grid中子组件数目
实现Grid场景,拖拽交换子组件位置: 通过editMode()打开编辑模式、通过onItemDragStart()
指定拖拽时样式、通过onItemDrop()指定拖拽释放时的行为 | @Component
export struct GridSceneView {
@State movedItem: AppInfo = new AppInfo();
@State dataSource: DataSource = new DataSource();
aboutToAppear() {
for (let index = 1; index <= ICON_NUM_IN_GRID; index++) {
this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`),... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right movedItem : AST#type_annotation#Left AST#primary_type#Left AppInfo AST#primary_type#Right AST#type_a... | @Component
export struct GridSceneView {
@State movedItem: AppInfo = new AppInfo();
@State dataSource: DataSource = new DataSource();
aboutToAppear() {
for (let index = 1; index <= ICON_NUM_IN_GRID; index++) {
this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_app${index}`),... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/GridSceneView.ets#L25-L97 | 471c5354ee671560788ed085fd4935ab227bd69a | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/pages/StatisticPage.ets | arkts | refreshClassifiedStatistics | 刷新分类统计信息 | private refreshClassifiedStatistics() {
this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
this.totalAmount = this.classifiedStatistics
.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
this.r... | AST#method_declaration#Left private refreshClassifiedStatistics 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 . classifiedStat... | private refreshClassifiedStatistics() {
this.classifiedStatistics = statisticByType(this.accounts, this.accountType, this.beginDate, this.endDate);
this.totalAmount = this.classifiedStatistics
.map(classifiedStatistic => classifiedStatistic.amount)
.reduce((total, cur) => total + cur, 0);
this.r... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/StatisticPage.ets#L30-L36 | 83088671cc5e0de426743c701ab136446b3ea5a6 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloadable.ets | arkts | MARK: - CFileDownloadable 等价 ArkTS 接口 | export interface CFileDownloadable { //extends CDownloadable {
/// 获取元数据
/// @param fileName 文件名
/// @param finished 回调 (meta: CMetaInfo | null, error: string | null)
getFileMeta(
fileName : string,
finished : (meta: CMetaInfo | null, error: string | null) => void
) : void;
/// 下载文件
/// @pa... | AST#export_declaration#Left export AST#interface_declaration#Left interface CFileDownloadable AST#object_type#Left { //extends CDownloadable { /// 获取元数据 /// @param fileName 文件名 /// @param finished 回调 (meta: CMetaInfo | null, error: string | null) AST#type_member#Left getFileMeta AST#parameter_list#Left ( AST#paramete... | export interface CFileDownloadable {
getFileMeta(
fileName : string,
finished : (meta: CMetaInfo | null, error: string | null) => void
) : void;
downloadFile(
fileName : string,
proccessing : (bytes: number) => void,
finished : (url: string | null, meta: CMe... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloadable.ets#L4-L24 | cfea7407ac08871536ab395cc2df408ad0d62fbe | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets | arkts | BarCharts | 场景描述:当前组件为柱状图组件 BarChartModel。
构造新的对象模型后通过模型的方法设置属性。
具体实现见aboutToAppear内注释。 | @Component
export struct BarCharts {
@Prop calorieData: Array<number | null> = [233, 285, 458, 268, 237, 278, 407]; // 卡路里数据
model: BarChartModel | null = null; // 柱状图模型
private leftAxis: YAxis | null = null; // 左侧Y轴数据
private rightAxis: YAxis | null = null; // 右侧Y轴数据
private xAxis: XAxis | null = null; // X轴... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BarCharts AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right calorieData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argumen... | @Component
export struct BarCharts {
@Prop calorieData: Array<number | null> = [233, 285, 458, 268, 237, 278, 407];
model: BarChartModel | null = null;
private leftAxis: YAxis | null = null;
private rightAxis: YAxis | null = null;
private xAxis: XAxis | null = null;
data: BarData | null = null;
limi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/view/BarCharts.ets#L53-L171 | 715858b56e74c8a272e07c9bdbb78645b75ea90b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/SocialShareService.ets | arkts | shareGreeting | 分享祝福语 | async shareGreeting(greeting: Greeting, contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> {
try {
const shareConfig: ShareConfig = {
platform: config.platform || SharePlatform.SYSTEM,
contentType: ShareContentType.TEXT,
title: `给${contact.name}的生日祝福`,
c... | AST#method_declaration#Left async shareGreeting AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#p... | async shareGreeting(greeting: Greeting, contact: Contact, config: Partial<ShareConfig> = {}): Promise<ShareResult> {
try {
const shareConfig: ShareConfig = {
platform: config.platform || SharePlatform.SYSTEM,
contentType: ShareContentType.TEXT,
title: `给${contact.name}的生日祝福`,
c... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L120-L150 | e184d9112a425e52d6414855098b386883e5cd6a | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/exception_throw/exception_catch_002_F.ets | arkts | Introduction 异常抛出-catch块 | export function exception_catch_002_F(taint_src : string) {
try {
throw new Error();
} catch (e) {
let _t = taint_src;
let clean = "_";
taint.Sink(clean);
}
} | AST#export_declaration#Left export AST#function_declaration#Left function exception_catch_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function exception_catch_002_F(taint_src : string) {
try {
throw new Error();
} catch (e) {
let _t = taint_src;
let clean = "_";
taint.Sink(clean);
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_catch_002_F.ets#L6-L14 | baa28057f5c417c08a936c295b019d44f4ff1efb | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getData | 网络获取README数据并利用formProvider.updateForm更新到卡片 | async getData(formId: string) {
let detail: CASES[] = [];
let httpRequest = http.createHttp();
let webData: http.HttpResponse = await httpRequest.request(URL);
if (webData?.responseCode === http.ResponseCode.OK) {
try {
detail = CaseCardUtils.formatData(webData.result.toString());
... | AST#method_declaration#Left async getData AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | async getData(formId: string) {
let detail: CASES[] = [];
let httpRequest = http.createHttp();
let webData: http.HttpResponse = await httpRequest.request(URL);
if (webData?.responseCode === http.ResponseCode.OK) {
try {
detail = CaseCardUtils.formatData(webData.result.toString());
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/entryformability/EntryFormAbility.ets#L48-L75 | c7fac8405aad9942b616dad7d41d98ac430fc451 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/BottomDialogView.ets | arkts | aboutToAppear | 弹框右侧按钮。 | aboutToAppear(): void {
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | aboutToAppear(): void {
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/BottomDialogView.ets#L16-L18 | 1abe2108e2dd344154b71a95c2a4cfb415a7f351 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | buildWelcomeBanner | 构建欢迎横幅 | @Builder
buildWelcomeBanner() {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Text(`今天是${new Date().toLocaleDateString()}`)
.fontSize(14)
.fontColor('#666666')
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWelcomeBanner AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | @Builder
buildWelcomeBanner() {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Text(`今天是${new Date().toLocaleDateString()}`)
.fontSize(14)
.fontColor('#666666')
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L157-L188 | 6a9a3edb139fc0f630a7183e0fb714802058dd25 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/hiDumper/Index.ets | arkts | ConditionView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ConditionView } from './src/main/ets/view/ConditionView'; | AST#export_declaration#Left export { ConditionView } from './src/main/ets/view/ConditionView' ; AST#export_declaration#Right | export { ConditionView } from './src/main/ets/view/ConditionView'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/hiDumper/Index.ets#L16-L16 | 26839b6d8b3459383b59aeccafdd1505c7cea393 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/ReminderSetting.ets | arkts | TimePickerDialog | 时间选择器弹窗 | @Builder
TimePickerDialog() {
Stack() {
// 半透明背景遮罩
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showTimePicker = false; // 点击遮罩关闭
})
// 时间选择器内容
Column() {
Text('设置提醒时间')... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TimePickerDialog 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 Stack ( ) AST#container_content_body#Left { // 半透明背景遮罩 AS... | @Builder
TimePickerDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showTimePicker = false;
})
Column() {
Text('设置提醒时间')
.fontSize(18)
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/ReminderSetting.ets#L140-L264 | 0b74f3d53ce44c4c1c617b507fa27f9a58ab01d5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets | arkts | getTime | 时分 | getTime() {
const DATETIME = new Date()
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes())
} | 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_declarator#Left DATETIME = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#L... | getTime() {
const DATETIME = new Date()
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes())
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L24-L27 | deda70eecd907c67ec2c8e23689a11ca1d53de37 | gitee |
openharmony/communication_wifi | 387ba7fa8f98578629a6148635a4d630b2b99aa1 | wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets | arkts | delObjData | 删除指定键数据 | delObjData(key) {
LogUtil.info('delObjData key == ' + key);
mPreferences.delete(key);
} | AST#method_declaration#Left delObjData AST#parameter_list#Left ( AST#parameter#Left key AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AS... | delObjData(key) {
LogUtil.info('delObjData key == ' + key);
mPreferences.delete(key);
} | https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets#L59-L62 | f809241a363023c72ef1d6e00817b110e24466e4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/CacheHelper.ets | arkts | isEmpty | 判断lruCache缓存是否为空
@returns | public static isEmpty(): boolean {
return CacheHelper.lruCache.isEmpty();
} | AST#method_declaration#Left public static isEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_exp... | public static isEmpty(): boolean {
return CacheHelper.lruCache.isEmpty();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L64-L66 | 18d6c6fd22e2741b48f0179252359e5d736c1a8b | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | RowStartBottom | 横向起始 + 垂直底部 | @ComponentV2
export struct RowStartBottom {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
si... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowStartBottom AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#L... | @ComponentV2
export struct RowStartBottom {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Leng... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L865-L940 | 07e847122915b9d1bc99d3ab7d0d9c3b7b396575 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets | arkts | Enumeration of PhotoSource type
@enum { number } PhotoSource
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum PhotoSource {
/**
* all resource
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
ALL = 0,
/**
* camera resource
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomi... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoSource AST#enum_body#Left { /**
* all resource
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_member#Left ALL = AST#exp... | export declare enum PhotoSource {
ALL = 0,
CAMERA = 1,
SCREENSHOT = 2
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets#L169-L194 | 7167861b8b5a566291cdefcc2e199275def2021d | github | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | cancelAll | 取消所有任务 | public cancelAll(): void {
FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...');
// 取消队列中的任务
this.taskQueue.forEach(task => {
task.cancel();
this.dispatchCallback(task, 'cancelled');
});
this.taskQueue = [];
// 取消当前执行的任务
if (this.currentTask) {
this.currentTask... | AST#method_declaration#Left public cancelAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | public cancelAll(): void {
FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...');
this.taskQueue.forEach(task => {
task.cancel();
this.dispatchCallback(task, 'cancelled');
});
this.taskQueue = [];
if (this.currentTask) {
this.currentTask.cancel();
}
... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L137-L153 | 82a9095deb2f4686030902bb63c9d698b2cded07 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | onCancel | Subscribe the cancel event of current task.
@returns { Promise<string> } Return the result of the cancel event.
@throws { BusinessError } 13900004 - Interrupted system call
@throws { BusinessError } 13900008 - Bad file descriptor
@throws { BusinessError } 13900042 - Unknown error
@syscap SystemCapability.FileManagemen... | onCancel(): Promise<string>; | AST#method_declaration#Left onCancel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#R... | onCancel(): Promise<string>; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L2967-L2967 | e268ebd36618ec0f18b22c1ba9522986a341f3c1 | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets | arkts | stringToHexNumber | 将颜色字符串转换为数字(十六进制整数)。
颜色字符串可以是 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA" 格式。
如果缺少 alpha 通道,默认设置为完全不透明(0xFF)。
@param colorString 颜色字符串,格式为 "#RRGGBB"、"#AARRGGBB" 或 "#RRGGBBAA"。
@param format 可选参数。指定 'ARGB' 表示 alpha 在前,或 'RGBA' 表示 alpha 在后。默认值为 'RGBA'。
@returns 表示颜色的数字值。 | static stringToHexNumber(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): number {
if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) {
throw new Error(`无效的颜色格式: ${colorString}`);
}
let hex = '';
if (colorString.length === 7) {
// "#RRGGBB" 格式,在前面添加 "FF" 作为 alpha。
he... | AST#method_declaration#Left static stringToHexNumber AST#parameter_list#Left ( AST#parameter#Left colorString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format AST#ERROR#Left : 'ARGB' | 'RGBA' AST#ERROR#Right = AST#ex... | static stringToHexNumber(colorString: string, format: 'ARGB' | 'RGBA' = 'RGBA'): number {
if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(colorString)) {
throw new Error(`无效的颜色格式: ${colorString}`);
}
let hex = '';
if (colorString.length === 7) {
hex = `FF${colorString.slice(1)}`;
... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPColorUtils.ets#L48-L81 | 449ddd6f70b98fd376e054ab4f98ada6645bea7c | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/web/WebViewManager.ets | arkts | createConfig | 创建 WebView 配置 | createConfig(url: string, options?: Partial<WebViewConfig>): WebViewConfig {
return {
url,
enableJavaScript: options?.enableJavaScript ?? true,
enableCache: options?.enableCache ?? true,
userAgent: options?.userAgent
};
} | AST#method_declaration#Left createConfig AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Par... | createConfig(url: string, options?: Partial<WebViewConfig>): WebViewConfig {
return {
url,
enableJavaScript: options?.enableJavaScript ?? true,
enableCache: options?.enableCache ?? true,
userAgent: options?.userAgent
};
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/web/WebViewManager.ets#L31-L38 | d81482492ed2d4816a8f27323fab02214a507d1c | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SimpleChatList/entry/src/main/ets/pages/MaintainVisibleAreaContent.ets | arkts | addData | [Start Add_delete data] | public addData(index: number, data: TextClass): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData 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 TextClass AST#primary_type... | public addData(index: number, data: TextClass): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/MaintainVisibleAreaContent.ets#L86-L89 | 0eb3cda3e12123d4b209124df3c77c2ca14a6354 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/Index.ets | arkts | DecompressFileViewComponent | 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 { DecompressFileViewComponent } from './src/main/ets/view/MainPage'; | AST#export_declaration#Left export { DecompressFileViewComponent } from './src/main/ets/view/MainPage' ; AST#export_declaration#Right | export { DecompressFileViewComponent } from './src/main/ets/view/MainPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/Index.ets#L15-L15 | d4c6d669a8a1ec604d7d4cd57c20dc00674e31ef | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | addTag | 添加标签 | addTag(tag: string): Contact {
const trimmedTag = tag.trim();
if (trimmedTag && !this.contact.tags.includes(trimmedTag)) {
this.contact.tags.push(trimmedTag);
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | AST#method_declaration#Left addTag AST#parameter_list#Left ( AST#parameter#Left tag : 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 Contact AST#primary_type#Right AST#... | addTag(tag: string): Contact {
const trimmedTag = tag.trim();
if (trimmedTag && !this.contact.tags.includes(trimmedTag)) {
this.contact.tags.push(trimmedTag);
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L239-L246 | c8a2bd675da3b93cc288abb9b82e12ec0b925d9f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | toggleDarkMode | 切换深色模式 | private toggleDarkMode(enabled: boolean): void {
this.isDarkModeEnabled = enabled;
// 立即更新颜色系统
const newColors = this.createColorSystem(this.selectedThemeColor, enabled);
this.COLORS = newColors;
} | AST#method_declaration#Left private toggleDarkMode AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima... | private toggleDarkMode(enabled: boolean): void {
this.isDarkModeEnabled = enabled;
const newColors = this.createColorSystem(this.selectedThemeColor, enabled);
this.COLORS = newColors;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5999-L6004 | 783d619411a5454dd445135026b1a1af260720c6 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/TextToSpeechService.ets | arkts | processQueue | 处理播放队列 | private async processQueue(options?: TTSOptions): Promise<void> {
if (this.speakQueue.length === 0 || this.isSpeaking || !this.ttsEngine) {
return;
}
const text = this.speakQueue.shift();
if (!text) {
return;
}
try {
this.isSpeaking = true;
// 手动合并选项(ArkTS不支持展开运算符)
... | AST#method_declaration#Left private async processQueue AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left TTSOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | private async processQueue(options?: TTSOptions): Promise<void> {
if (this.speakQueue.length === 0 || this.isSpeaking || !this.ttsEngine) {
return;
}
const text = this.speakQueue.shift();
if (!text) {
return;
}
try {
this.isSpeaking = true;
const mergedOptions: T... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L224-L270 | 8f1347ff9984b6d41168664061afe56e81988871 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | asyncAdd | / (异步)向db中添加新的wordIds | asyncAdd(wordIds: number[]): void {
setTimeout(async () => {
await this.add(wordIds);
}, 0);
} | AST#method_declaration#Left asyncAdd 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_list#Right : AST#type_annotation#Left AST#pr... | asyncAdd(wordIds: number[]): void {
setTimeout(async () => {
await this.add(wordIds);
}, 0);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L489-L493 | 99885b686845cdf899ee5666c56cfb77d0080890 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
} | AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L72-L75 | 0ff761c93fed639e5539af615feb2a36ae75c487 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Standard popup notice duration for intervals of 1 millisecond, 2 seconds.
@returns 2000 | export function animation_popup_duration() {
return 1000;
} | AST#export_declaration#Left export AST#function_declaration#Left function animation_popup_duration AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 1000 AST#expression#Right ; AST#return_statement#Right AST#statement#... | export function animation_popup_duration() {
return 1000;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L77-L79 | 3222abfa415e7b9b5b98c96a2d22b0aaf6a59e83 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/view/CommBackgroundIcon.ets | arkts | CommBackgroundIcon | 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... | @Component
export struct CommBackgroundIcon {
@Prop icon: Resource;
onClickImage: () => void = () => {
};
build() {
Row() {
Image(this.icon)
.width(24)
.height(24)
}
.onClick(() => {
this.onClickImage();
})
.alignItems(VerticalAlign.Center)
.justifyContent(Fl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommBackgroundIcon AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_a... | @Component
export struct CommBackgroundIcon {
@Prop icon: Resource;
onClickImage: () => void = () => {
};
build() {
Row() {
Image(this.icon)
.width(24)
.height(24)
}
.onClick(() => {
this.onClickImage();
})
.alignItems(VerticalAlign.Center)
.justifyContent(Fl... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/CommBackgroundIcon.ets#L16-L38 | be5d966952c96159adb0026e67ed450fbfdb0084 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getNewVersion | 从due数据库取新版本信息
@return resolve 新版本信息/reject 错误信息 | async getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>> {
return new Promise((resolve, reject) => {
this.updateManager.getNewVersion().then((result: UpgradeData<update.NewVersionInfo>) => {
if (result?.callResult === UpgradeCallResult.OK) {
globalThis.cachedNewVersionInfo = result... | AST#method_declaration#Left async getNewVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Left < AST#typ... | async getNewVersion(): Promise<UpgradeData<update.NewVersionInfo>> {
return new Promise((resolve, reject) => {
this.updateManager.getNewVersion().then((result: UpgradeData<update.NewVersionInfo>) => {
if (result?.callResult === UpgradeCallResult.OK) {
globalThis.cachedNewVersionInfo = result... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L92-L103 | 0a1c44ba53db975f363ab82d674bc6a1f22defd6 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.