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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets | arkts | 华为数字藏品网址 | export const DacUrl = 'https://www.huaweicloud.com/product/bcs/dac.html'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DacUrl = AST#expression#Left 'https://www.huaweicloud.com/product/bcs/dac.html' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const DacUrl = 'https://www.huaweicloud.com/product/bcs/dac.html'; | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets#L23-L23 | 8b6f3de20a6d2e8957e5c33488d49553d251c5e9 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/MonthDataSource.ets | arkts | Basic implementation of IDataSource to handle data listener
@class
@implements {IDataSource} | export class MonthDataSource implements IDataSource {
private listeners: DataChangeListener[] = [];
private dataArray: Month[] = [];
/**
* 获取数组长度。
* @returns {number} 返回数组长度。
*/
public totalCount(): number {
return this.dataArray.length;
}
/**
* 获取指定索引数据。
* @param {number} index - 索引值。
... | AST#export_declaration#Left export AST#class_declaration#Left class MonthDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener ... | export class MonthDataSource implements IDataSource {
private listeners: DataChangeListener[] = [];
private dataArray: Month[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): Month {
return this.dataArray[index];
}
public setData(index: n... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/MonthDataSource.ets#L30-L151 | b4ad0cd3e9fd9f27ee306c0b422a3a50b01411cc | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/design/DesignSystem.ets | arkts | UI设计系统
统一的设计规范和组件样式配置 | export class DesignSystem {
// 颜色系统
static readonly COLORS = {
// 主题色
primary: '#4ECDC4',
primaryLight: '#7DD3C0',
primaryDark: '#2BB0B0',
// 辅助色
secondary: '#FF6B6B',
success: '#4CAF50',
warning: '#FF9800',
error: '#F44336',
info: '#2196F3',
// 中性色
background: '#FA... | AST#export_declaration#Left export AST#class_declaration#Left class DesignSystem AST#class_body#Left { // 颜色系统 AST#property_declaration#Left static readonly COLORS = AST#expression#Left AST#object_literal#Left { // 主题色 AST#property_assignment#Left AST#property_name#Left primary AST#property_name#Right : AST#expression#... | export class DesignSystem {
static readonly COLORS = {
primary: '#4ECDC4',
primaryLight: '#7DD3C0',
primaryDark: '#2BB0B0',
secondary: '#FF6B6B',
success: '#4CAF50',
warning: '#FF9800',
error: '#F44336',
info: '#2196F3',
background: '#FAFAFA',
surface: '#FFF... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/design/DesignSystem.ets#L6-L226 | eb1604cfe4b33d6055e953b1c71a51cff2362b8c | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | getDefaultStats | 获取默认统计数据 | private getDefaultStats(): OverallStats {
const achievementsProgress = new Map<string, AchievementProgress>();
achievementsProgress.set('first_task', { current: 0, target: 1 });
achievementsProgress.set('daily_goal', { current: 0, target: 5 });
achievementsProgress.set('week_streak', { current: 0, targe... | AST#method_declaration#Left private getDefaultStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left OverallStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarato... | private getDefaultStats(): OverallStats {
const achievementsProgress = new Map<string, AchievementProgress>();
achievementsProgress.set('first_task', { current: 0, target: 1 });
achievementsProgress.set('daily_goal', { current: 0, target: 5 });
achievementsProgress.set('week_streak', { current: 0, targe... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L71-L93 | 1e0602c6cd1ffbe88228cdc45081607f75b8210f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | putBatch | 批量设置值
@param data 键值对对象 | async putBatch(data: Record<string, preferences.ValueType>): Promise<void> {
try {
this.checkInitialized();
const promises: Promise<void>[] = [];
const dataEntries: [string, preferences.ValueType][] = Object.entries(data);
for (let i = 0; i < dataEntries.length; i++) {
const k... | AST#method_declaration#Left async putBatch AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio... | async putBatch(data: Record<string, preferences.ValueType>): Promise<void> {
try {
this.checkInitialized();
const promises: Promise<void>[] = [];
const dataEntries: [string, preferences.ValueType][] = Object.entries(data);
for (let i = 0; i < dataEntries.length; i++) {
const k... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L300-L319 | fe70cee641f0351823e1b5d584549c3eb0a55adf | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/DialogOptions.ets | arkts | AlertDialog按钮参数类 | export class ButtonOptions {
value: ResourceStr = ''; //Button的文本内容,若值为null,则该按钮不显示。
action: VoidCallback = () => {}; //Button选中时的回调。
enabled?: boolean; //点击Button是否响应,默认值true。
defaultFocus?: boolean; //设置Button是否是默认焦点,默认值false。
style?: DialogButtonStyle; //设置Button的风格样式,默认值DialogButtonStyle.DEFAULT。
fontCo... | AST#export_declaration#Left export AST#class_declaration#Left class ButtonOptions AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declarati... | export class ButtonOptions {
value: ResourceStr = '';
action: VoidCallback = () => {};
enabled?: boolean;
defaultFocus?: boolean;
style?: DialogButtonStyle;
fontColor?: ResourceColor;
backgroundColor?: ResourceColor;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L123-L131 | a479900d3a26bd202633215ba376606d9365b92f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets | arkts | VideoDes | 展示视频相关信息,比如视频作者的昵称、视频文案、搭配的音乐以及发布时间 | @Component
export struct VideoDes {
@State name: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_NAME; // 昵称
@State description: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_DESCRIPTION; // 文案
@State hotspot: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_HOTSPOT; // 上升热点
@S... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoDes AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#R... | @Component
export struct VideoDes {
@State name: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_NAME;
@State description: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_DESCRIPTION;
@State hotspot: string = STRINGCONFIGURATION.TABCONTENT_OVERFLOW_VIDEO_DES_HOTSPOT;
@State time: string... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets#L206-L350 | 979a1b968c6165f4a2d84def4f09e3270e400c4e | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/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/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/NotificationUtil.ets#L46-L575 | d2dca565fef28c972c8e32baec3538cdf86e9142 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onPlayerError | 播放器播放失败事件 | onPlayerError(error: VHErrorInfo) {
if (error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED) {
//没有可用的清晰度,重新进行播放。
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
this.vodPlayer?.startPlayWithRecordId(this.webinars?.reco... | AST#method_declaration#Left onPlayerError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left VHErrorInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_st... | onPlayerError(error: VHErrorInfo) {
if (error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED) {
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
this.vodPlayer?.startPlayWithRecordId(this.webinars?.record?.preview_paas_r... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L197-L217 | 81db1a70f192f40cecf51c764dd1cb96cfbfe6bc | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | distance | returns the distance between two points
@param eventX
@param startX
@param eventY
@param startY
@return | protected static distance(eventX: number, startX: number, eventY: number, startY: number): number {
let dx: number = eventX - startX;
let dy: number = eventY - startY;
return Math.sqrt(dx * dx + dy * dy);
} | AST#method_declaration#Left protected static distance AST#parameter_list#Left ( AST#parameter#Left eventX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left startX : AST#type_annotation#Left AST#primary_type#Left number AST#p... | protected static distance(eventX: number, startX: number, eventY: number, startY: number): number {
let dx: number = eventX - startX;
let dy: number = eventY - startY;
return Math.sqrt(dx * dx + dy * dy);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L152-L156 | 8bfbe72d8829d8020c699c0dbb384bd5126c9a6f | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/ConfigService.ets | arkts | getConfig | 获取系统配置
@returns 系统配置信息 | static async getConfig(): Promise<AgvConfig> {
try {
console.info('[ConfigService] 🔧 获取系统配置');
const response = await HttpUtil.get('/agv/config');
console.info('[ConfigService] ✅ 系统配置获取成功');
return response.data as AgvConfig;
} catch (error) {
console.error('[ConfigService] ❌ 获取系统... | AST#method_declaration#Left static async getConfig 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 AgvConfig AST#primary_type#Right AST#type_annotation#Right > AST... | static async getConfig(): Promise<AgvConfig> {
try {
console.info('[ConfigService] 🔧 获取系统配置');
const response = await HttpUtil.get('/agv/config');
console.info('[ConfigService] ✅ 系统配置获取成功');
return response.data as AgvConfig;
} catch (error) {
console.error('[ConfigService] ❌ 获取系统... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L62-L72 | d97d419773843104cc48136253c0e926f29c09a2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | updateDataSettings | 更新数据设置
@param dataSettings 数据设置
@returns 更新后的数据设置 | async updateDataSettings(dataSettings: Partial<DataSettings>): Promise<DataSettings> {
const updatedSettings = await this.updateSettings({ data: dataSettings });
return updatedSettings.data;
} | AST#method_declaration#Left async updateDataSettings AST#parameter_list#Left ( AST#parameter#Left dataSettings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DataSettings AST#primary_type#Right AST#type_annotation#R... | async updateDataSettings(dataSettings: Partial<DataSettings>): Promise<DataSettings> {
const updatedSettings = await this.updateSettings({ data: dataSettings });
return updatedSettings.data;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L277-L280 | 3654db217846365804f9de8a2e53f77eb5efc85f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/Server_Routes.ets | arkts | 安全相关配置 | export class Secure {
static readonly appKey: string = "kkaGFybW9ueQ==" //已加密 鸿蒙
static readonly appSecret: string = "hmaGFybW9ueS49M2tmbXNzOTQzbGhnIyVGRyUkNnlkc2RnZ3czNDI4OTM0amdpYWFybW9ueQ=="//已加密, WordTree, dcs和dict的密钥保持一样,以便使用
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Secure AST#class_body#Left { AST#property_declaration#Left static readonly appKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "kkaGFybW9ueQ==" AST#expression#Right //已加密... | export class Secure {
static readonly appKey: string = "kkaGFybW9ueQ=="
static readonly appSecret: string = "hmaGFybW9ueS49M2tmbXNzOTQzbGhnIyVGRyUkNnlkc2RnZ3czNDI4OTM0amdpYWFybW9ueQ=="
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Server_Routes.ets#L71-L75 | 49565d126165b9129d5460a182bd1b90ea4f3b62 | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/SettingsPage.ets | arkts | openNameEditor | 打开昵称编辑器 | private openNameEditor(): void {
this.editingName = this.userName;
this.showNameEditor = true;
} | AST#method_declaration#Left private openNameEditor 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... | private openNameEditor(): void {
this.editingName = this.userName;
this.showNameEditor = true;
} | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/SettingsPage.ets#L118-L121 | 0c866c8f32627742552133e9e0179f9a37f4fcf6 | github |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/models/index.ets | arkts | 单个面试题类型 | export interface QuestionItem {
id: string;
/* 题干 */
stem: string;
/* 难度 */
difficulty: number;
/* 点赞数 */
likeCount: number;
/* 浏览数 */
views: number;
/* 是否已看 */
readFlag: 0 | 1;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface QuestionItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /* 题干 */ AST#type_member#Left stem : AST#type_annotatio... | export interface QuestionItem {
id: string;
stem: string;
difficulty: number;
likeCount: number;
views: number;
readFlag: 0 | 1;
} | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/models/index.ets#L18-L35 | 795e7af0430f994ee9a810b958e72ff926b5a0d6 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets | arkts | HandWritingToImageView | 组件NodeContainer的id
功能描述: 本示例使用drawing库的Pen和Path结合NodeContainer组件实现手写绘制功能。手写板上完成绘制后,通过调用image库的
packToFile和packing接口将手写板的绘制内容保存为图片,并将图片文件保存在应用沙箱路径中
推荐场景: 手写签名、绘画
核心组件:
1. MyNodeController
实现步骤:
1. 创建NodeController的子类MyNodeController,用于获取根节点的RenderNode和绑定的NodeContainer组件宽高
2. 创建RenderNode的子类MyRenderNode,初始化画笔和绘制path路... | @Component
export struct HandWritingToImageView {
@State filePath: string = ''; // 保存图片后的文件路径
@State nodeCount: number = 0; // 已挂载到根节点的子节点数量
private myNodeController: MyNodeController = new MyNodeController();
private currentNode: MyRenderNode | null = null; // 当前正在绘制的节点
build() {
Column() {
// 画布
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HandWritingToImageView AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann... | @Component
export struct HandWritingToImageView {
@State filePath: string = '';
@State nodeCount: number = 0;
private myNodeController: MyNodeController = new MyNodeController();
private currentNode: MyRenderNode | null = null;
build() {
Column() {
Row() {
NodeContainer(t... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/view/HandWritingToImage.ets#L46-L178 | c228ac582c01190824dd0de439022bf89aa40b08 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDeleteBulk.ets | arkts | Emitted whenever messages are deleted in bulk.
@event Client#messageDeleteBulk
@param {Collection<Snowflake, Message>} messages The deleted messages, mapped by their ID
应用约束60:使用ES模块导出语法 | export default MessageDeleteBulkHandler; | AST#export_declaration#Left export default AST#expression#Left MessageDeleteBulkHandler AST#expression#Right ; AST#export_declaration#Right | export default MessageDeleteBulkHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/MessageDeleteBulk.ets#L22-L22 | c315263ec1bfcac41ac3b05a1f6f838d08db4bcf | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | get | ============================================================ MARK: - Member ability 限制属性 | private get maxWordPronCountDaily() : number { return this.isActive ? BeMember.maxCount : this.nonMember.maxWordPronCountDaily } | AST#method_declaration#Left private get AST#ERROR#Left maxWordPronCountDaily AST#ERROR#Right 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#Le... | private get maxWordPronCountDaily() : number { return this.isActive ? BeMember.maxCount : this.nonMember.maxWordPronCountDaily } | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L163-L163 | f41b866522cc8b348df8efdd7995a704d208d43c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | 大模型配置接口 | export interface LLMConfig {
provider: LLMProvider;
apiKey: string;
baseUrl?: string;
model: string;
maxTokens?: number;
temperature?: number;
enabled?: boolean;
personalization?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LLMConfig AST#object_type#Left { AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left LLMProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiKey : AST#type_annotati... | export interface LLMConfig {
provider: LLMProvider;
apiKey: string;
baseUrl?: string;
model: string;
maxTokens?: number;
temperature?: number;
enabled?: boolean;
personalization?: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L19-L28 | fa8a758cc12ea70911df0948cb5576dc670e33b9 | github | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/GlobalLoading.ets | arkts | showLoading | 显示/隐藏方法 | public showLoading(message?: string) {
this.isShow = true
if (message) this.message = message
} | AST#method_declaration#Left public showLoading AST#parameter_list#Left ( AST#parameter#Left message ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_state... | public showLoading(message?: string) {
this.isShow = true
if (message) this.message = message
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/GlobalLoading.ets#L18-L21 | 99248a7f4dd08376496605d80501e7896fe536e1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | checkInitialNotificationPermission | 检查初始通知权限(不显示提示) | private async checkInitialNotificationPermission(): Promise<void> {
try {
const isEnabled = await notificationManager.isNotificationEnabled();
this.hasNotificationPermission = isEnabled;
console.log('[Settings] Initial notification permission status:', isEnabled);
} catch (error) {
conso... | AST#method_declaration#Left private async checkInitialNotificationPermission 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_a... | private async checkInitialNotificationPermission(): Promise<void> {
try {
const isEnabled = await notificationManager.isNotificationEnabled();
this.hasNotificationPermission = isEnabled;
console.log('[Settings] Initial notification permission status:', isEnabled);
} catch (error) {
conso... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1422-L1431 | c7b32d7af30a50dbea6d3aa98ebbb37837e3e3d5 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | deleteData | Delete data to picker component
@param { DataType } dataType - data type
@param { Object } data - data
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 21 | deleteData(dataType: DataType, data: Object): void; | AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#R... | deleteData(dataType: DataType, data: Object): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L258-L258 | 3eaaa8134e7207b32c92dd6f7e38bb2d77583e51 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets | arkts | setIcon | Sets the icon drawable
@param icon | public setIcon(icon: ImagePaint): void {
this.mIcon = icon;
} | AST#method_declaration#Left public setIcon AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ImagePaint 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#... | public setIcon(icon: ImagePaint): void {
this.mIcon = icon;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseEntry.ets#L51-L53 | 8e4885fc49bf6d002b8e6121984980e74e596de5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ExpandTitle/entry/src/main/ets/pages/MemoInfo.ets | arkts | 笔记信息类型 | export class MemoInfo {
public memoId: string;
public title: string;
public time: string;
public imageSrc: string;
public content: string;
constructor(memoId: string, title: string, time: string, imageSrc: string, content: string) {
this.memoId = memoId;
this.title = title;
this.time = time;
... | AST#export_declaration#Left export AST#class_declaration#Left class MemoInfo AST#class_body#Left { AST#property_declaration#Left public memoId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public ti... | export class MemoInfo {
public memoId: string;
public title: string;
public time: string;
public imageSrc: string;
public content: string;
constructor(memoId: string, title: string, time: string, imageSrc: string, content: string) {
this.memoId = memoId;
this.title = title;
this.time = time;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/pages/MemoInfo.ets#L19-L33 | 5dbafdb482b64fbf8f744d674f416aecac165ac9 | gitee | |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | Convert seconds to milliseconds (floored).
@param sec Seconds.
@returns Milliseconds. | export function secToMs(sec: number): number {
return Math.floor((sec || 0) * 1000);
} | AST#export_declaration#Left export AST#function_declaration#Left function secToMs AST#parameter_list#Left ( AST#parameter#Left sec : 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#primar... | export function secToMs(sec: number): number {
return Math.floor((sec || 0) * 1000);
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L54-L56 | 674967b949c9d56f6aff50619694233742960a54 | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/pages/LoginPage.ets | arkts | handleRegister | 处理注册 | async handleRegister(): Promise<void> {
// 基本验证
if (!this.registerUsername || !this.registerPassword || !this.registerConfirmPassword) {
prompt.showToast({
message: '请输入所有必填信息'
});
return;
}
if (this.registerPassword !== this.registerConfirmPassword) {
prompt.showToast({... | AST#method_declaration#Left async handleRegister AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async handleRegister(): Promise<void> {
if (!this.registerUsername || !this.registerPassword || !this.registerConfirmPassword) {
prompt.showToast({
message: '请输入所有必填信息'
});
return;
}
if (this.registerPassword !== this.registerConfirmPassword) {
prompt.showToast({
... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/LoginPage.ets#L57-L106 | 9e2fe4893f62adf2d27cd5a239ffb300cc1d305f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/router/AppRouter.ets | arkts | 路由路径常量 | export class RoutePaths {
// 主要页面
static readonly INDEX = 'pages/Index';
static readonly CONTACTS = 'pages/ContactsPage';
static readonly CALENDAR = 'pages/CalendarPage';
static readonly GREETINGS = 'pages/GreetingsPage';
static readonly SETTINGS = 'pages/SettingsPage';
// 联系人相关页面
static readonly CON... | AST#export_declaration#Left export AST#class_declaration#Left class RoutePaths AST#class_body#Left { // 主要页面 AST#property_declaration#Left static readonly INDEX = AST#expression#Left 'pages/Index' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CONTACTS = AST#expressi... | export class RoutePaths {
static readonly INDEX = 'pages/Index';
static readonly CONTACTS = 'pages/ContactsPage';
static readonly CALENDAR = 'pages/CalendarPage';
static readonly GREETINGS = 'pages/GreetingsPage';
static readonly SETTINGS = 'pages/SettingsPage';
static readonly CONTACT_DETAIL = 'pa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L22-L55 | a3f446d9c6a7ced3e86c30c4aa7d337f5a36e1db | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets | arkts | BannerSwiper | 轮播图 | @Builder
BannerSwiper() {
Swiper() {
ForEach(this.banners, (banner: Banner) => {
Image(banner.pic)
.width('100%')
.aspectRatio(2)
.borderRadius(AppDimensions.radiusMedium)
.objectFit(ImageFit.Cover)
})
}
.autoPlay(true)
.interval(3000)
.i... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BannerSwiper 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 Swiper ( ) AST#container_content_body#Left { AST#ui_control_f... | @Builder
BannerSwiper() {
Swiper() {
ForEach(this.banners, (banner: Banner) => {
Image(banner.pic)
.width('100%')
.aspectRatio(2)
.borderRadius(AppDimensions.radiusMedium)
.objectFit(ImageFit.Cover)
})
}
.autoPlay(true)
.interval(3000)
.i... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/HomePage.ets#L96-L114 | 2fd871980a32c62df0d495728c901a4401e94646 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService.ets | arkts | searchContacts | 搜索联系人 | async searchContacts(params: ContactSearchParams): Promise<Contact[]> {
let results = [...this.contacts];
// 按关键词搜索
if (params.keyword) {
const keyword = params.keyword.toLowerCase();
results = results.filter(contact =>
contact.name.toLowerCase().includes(keyword) ||
contact.pho... | AST#method_declaration#Left async searchContacts AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ContactSearchParams 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... | async searchContacts(params: ContactSearchParams): Promise<Contact[]> {
let results = [...this.contacts];
if (params.keyword) {
const keyword = params.keyword.toLowerCase();
results = results.filter(contact =>
contact.name.toLowerCase().includes(keyword) ||
contact.phone?.toLow... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L329-L357 | 473068482fce92f821ef6bd339cc35a3fd178a06 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/RemoteExcelViewer.ets | arkts | RemoteExcelViewer | 指定进度总长,进度条总长度为100 | @Component
export struct RemoteExcelViewer {
@State remoteProgressValue: number = 0; // 设置加载网络进度,进度条初始值为0
@State isHiddenRemoteProgress: Boolean = true; // 记录加载网络进度条显隐,进入页面默认加载
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Stack() {
if (this.isH... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RemoteExcelViewer AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right remoteProgressValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig... | @Component
export struct RemoteExcelViewer {
@State remoteProgressValue: number = 0;
@State isHiddenRemoteProgress: Boolean = true;
controller: webview.WebviewController = new webview.WebviewController();
build() {
Column() {
Stack() {
if (this.isHiddenRemoteProgress) {
Progress({... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpdfviewer/src/main/ets/view/RemoteExcelViewer.ets#L22-L60 | 9d334e4a1558527c1dac3076b9d4eaf2061cbfbf | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppContext.ets | arkts | --------------------------------------------------------------------- 导出函数式封装(更方便使用) --------------------------------------------------------------------- 获取 ApplicationContext(推荐方式) | export function getAppContext(): common.UIAbilityContext {
return AppContext.appContext
} | AST#export_declaration#Left export AST#function_declaration#Left function getAppContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#bl... | export function getAppContext(): common.UIAbilityContext {
return AppContext.appContext
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppContext.ets#L73-L75 | 348402642ec8be02bee12b450fb90b9a64f43ec5 | github | |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/pages/community/follow/FlowAutoPlayCard.ets | arkts | videoPlayer | videoPlayer | @Builder
videoPlayer(item: Item, index: number) {
Column() {
if (this.playIndex == index) {
VideoComponent({
showControls: $showControls,
playUrl: $playUrl,
isAutoPlay: this.isAutoPlay
})
.width('100%')
.height($r('app.float.size_210'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoPlayer AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Item AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#... | @Builder
videoPlayer(item: Item, index: number) {
Column() {
if (this.playIndex == index) {
VideoComponent({
showControls: $showControls,
playUrl: $playUrl,
isAutoPlay: this.isAutoPlay
})
.width('100%')
.height($r('app.float.size_210'))
... | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/pages/community/follow/FlowAutoPlayCard.ets#L122-L156 | f4d4ad322f255bdbee5145b704a4dec36471d7c8 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/InteractAwardBuilder.ets | arkts | 自定义参数类型 | export class InteractAwardParams {
gift: VHInteractRewardWinning;
webinar: VHWebinarData;
constructor(id: VHInteractRewardWinning, webinar: VHWebinarData) {
this.gift = id;
this.webinar = webinar;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class InteractAwardParams AST#class_body#Left { AST#property_declaration#Left gift : AST#type_annotation#Left AST#primary_type#Left VHInteractRewardWinning AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declara... | export class InteractAwardParams {
gift: VHInteractRewardWinning;
webinar: VHWebinarData;
constructor(id: VHInteractRewardWinning, webinar: VHWebinarData) {
this.gift = id;
this.webinar = webinar;
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/InteractAwardBuilder.ets#L30-L38 | bda4e448cfdad56360b6efd9a30b98ba49d8191f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressrecognize/src/main/ets/utils/WindowUtil.ets | arkts | 获取窗口对象
@returns | export function getScreenWidth(): number{
let displayClass: display.Display | null = display.getDefaultDisplaySync();
return displayClass.width;
} | AST#export_declaration#Left export AST#function_declaration#Left function getScreenWidth 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#Le... | export function getScreenWidth(): number{
let displayClass: display.Display | null = display.getDefaultDisplaySync();
return displayClass.width;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/utils/WindowUtil.ets#L31-L34 | 00899c9789b5aeab36ae633490dc3aa49a78146c | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureViewModel.ets | arkts | Initialize picture data according to type.
@param initType Init type. | export function initializePictures(initType: string): Array<PictureItem> {
let imageDataArray: Array<PictureItem> = [];
switch (initType) {
case PictureType.BANNER:
PICTURE_BANNER.forEach((item) => {
imageDataArray.push(item);
})
break;
case PictureType.RECENTLY:
PICTURE_RECE... | AST#export_declaration#Left export AST#function_declaration#Left function initializePictures AST#parameter_list#Left ( AST#parameter#Left initType : 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#ERROR#Left : AST#... | export function initializePictures(initType: string): Array<PictureItem> {
let imageDataArray: Array<PictureItem> = [];
switch (initType) {
case PictureType.BANNER:
PICTURE_BANNER.forEach((item) => {
imageDataArray.push(item);
})
break;
case PictureType.RECENTLY:
PICTURE_RECE... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/PictureViewModel.ets#L26-L38 | 4b29c4f0ddadcdc635e1435f67d96d20ff6d8806 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets | arkts | getCrossByPoint | 获取交点(根据四点) // | private getCrossByPoint(p1: Offset, p2: Offset, p3: Offset, p4: Offset): Offset {
let line1Info = this.getLineInfo(p1, p2);
let line2Info = this.getLineInfo(p3, p4);
return this.getCrossByLine(
line1Info.dx, line1Info.dy, line2Info.dx, line2Info.dy);
} | AST#method_declaration#Left private getCrossByPoint AST#parameter_list#Left ( AST#parameter#Left p1 : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p2 : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_typ... | private getCrossByPoint(p1: Offset, p2: Offset, p3: Offset, p4: Offset): Offset {
let line1Info = this.getLineInfo(p1, p2);
let line2Info = this.getLineInfo(p3, p4);
return this.getCrossByLine(
line1Info.dx, line1Info.dy, line2Info.dx, line2Info.dy);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/Reader.ets#L661-L667 | ffadc08cafe3e3e646ae798379e26925c8198784 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/BannerRepository.ets | arkts | getBannerList | 查询轮播图列表
@param params 查询条件
@returns 轮播图列表响应 | async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.getBannerList(params);
} | AST#method_declaration#Left async getBannerList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_an... | async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.getBannerList(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/BannerRepository.ets#L27-L29 | 3183bab1a7b6209ec588f4198e6e9081873119ca | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ChipGroup.d.ets | arkts | ChipGroup | Defines chipGroup.
@struct ChipGroup
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | @Component
export declare struct ChipGroup {
/**
* Chip item.
*
* @type { ChipGroupItemOptions[] }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
@Require @Prop
items: ChipGroupItemOptions[];
/**
* Chip item sty... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ChipGroup AST#component_body#Left { /**
* Chip item.
*
* @type { ChipGroupItemOptions[] }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
... | @Component
export declare struct ChipGroup {
@Require @Prop
items: ChipGroupItemOptions[];
@Prop
itemStyle?: ChipItemStyle;
@Prop
selectedIndexes?: Array<number>;
@Prop
multiple?: boolean;
@Prop
chipGroupSpace?: ChipGroupSpaceOptions;
@Pro... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L595-L692 | 3a3aa67be5830b22dc7542ab8f865e85420c8b50 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/router/Routes.ets | arkts | 路由路径接口 | export interface RoutesType {
SPLASH: string;
LOGIN: string;
REGISTER: string;
MAIN_TAB: string;
HOME: string;
PROFILE: string;
SETTINGS: string;
ABOUT: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RoutesType AST#object_type#Left { AST#type_member#Left SPLASH : 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 LOGIN : AST#type_annotation#Left... | export interface RoutesType {
SPLASH: string;
LOGIN: string;
REGISTER: string;
MAIN_TAB: string;
HOME: string;
PROFILE: string;
SETTINGS: string;
ABOUT: string;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Routes.ets#L7-L16 | 7963a36b7d8153ea07b118313a23c0be42572b52 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/MorseCode.ets | arkts | 摩斯密码实现
摩斯密码是一种将字母、数字和标点符号转换为点和划的编码方式 | export class MorseCode {
private static readonly MORSE_CODE_MAP: Map<string, string> = new Map([
['A', '.-'], ['B', '-...'], ['C', '-.-.'], ['D', '-..'], ['E', '.'],
['F', '..-.'], ['G', '--.'], ['H', '....'], ['I', '..'], ['J', '.---'],
['K', '-.-'], ['L', '.-..'], ['M', '--'], ['N', '-.'], ['O', '---'],... | AST#export_declaration#Left export AST#class_declaration#Left class MorseCode AST#class_body#Left { AST#property_declaration#Left private static readonly MORSE_CODE_MAP : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left str... | export class MorseCode {
private static readonly MORSE_CODE_MAP: Map<string, string> = new Map([
['A', '.-'], ['B', '-...'], ['C', '-.-.'], ['D', '-..'], ['E', '.'],
['F', '..-.'], ['G', '--.'], ['H', '....'], ['I', '..'], ['J', '.---'],
['K', '-.-'], ['L', '.-..'], ['M', '--'], ['N', '-.'], ['O', '---'],... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/MorseCode.ets#L5-L55 | 3bb414c8b5e3f377d11db04003bac18a195047db | github | |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/model/DeviceModel.ets | arkts | getDeviceList | 获取设备列表 | static async getDeviceList(): Promise<DeviceItem[]> {
const list = await Request.get<DeviceItem[]>(CommonConstants.DEVICE_URL);
return list.map((item: DeviceItem) => {
item.status = DeviceService.determineStatus(item.value, item.threshold);
return item;
});
} | AST#method_declaration#Left static async getDeviceList 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 DeviceItem [ ] AST#array_type#Right AST#... | static async getDeviceList(): Promise<DeviceItem[]> {
const list = await Request.get<DeviceItem[]>(CommonConstants.DEVICE_URL);
return list.map((item: DeviceItem) => {
item.status = DeviceService.determineStatus(item.value, item.threshold);
return item;
});
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/model/DeviceModel.ets#L36-L42 | 54550788630e501a4c16cbf0c291ef1a627430a4 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/GiftComponent.ets | arkts | toggleGiftSelection | 切换礼物选中状态 | private toggleGiftSelection(giftId: string) {
this.selectedGiftId = this.selectedGiftId === giftId ? '-1' : giftId;
} | AST#method_declaration#Left private toggleGiftSelection AST#parameter_list#Left ( AST#parameter#Left giftId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Le... | private toggleGiftSelection(giftId: string) {
this.selectedGiftId = this.selectedGiftId === giftId ? '-1' : giftId;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/GiftComponent.ets#L59-L61 | 2b71212991ecfb302871de171b525671818a21a5 | gitee |
batiluoxuanwan/MomentFlow.git | e57aa461223abca74f48893afc2ccf7c2d73e9b8 | frontend/entry/src/main/ets/api/UserApi.ets | arkts | sendEmailCode | 发送验证码 | static async sendEmailCode(email: string): Promise<boolean> {
// 后端返回 R<String>,泛型传 string
const res = await request<string>(`${BASE_URL}/sendCode`, {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify({ email: email })
})
return ... | AST#method_declaration#Left static async sendEmailCode AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | static async sendEmailCode(email: string): Promise<boolean> {
const res = await request<string>(`${BASE_URL}/sendCode`, {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify({ email: email })
})
return res !== null;
} | https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/UserApi.ets#L49-L57 | 8f5c23e242041bcc37a6b4d26cfe732e9f22aaa6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AuthUtil.ets | arkts | getErrorMsg | 获取错误msg
@param code
@param defaultMsg | static getErrorMsg(code: number, defaultMsg: string = ''): string {
if (201 == code) {
return '权限校验失败!'
} else if (202 == code) {
return '系统API权限校验失败!'
} else if (401 == code) {
return '参数检查失败!'
} else if (801 == code) {
return '该设备不支持此API!'
} else if (12500001 == code) {
... | AST#method_declaration#Left static getErrorMsg AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultMsg : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getErrorMsg(code: number, defaultMsg: string = ''): string {
if (201 == code) {
return '权限校验失败!'
} else if (202 == code) {
return '系统API权限校验失败!'
} else if (401 == code) {
return '参数检查失败!'
} else if (801 == code) {
return '该设备不支持此API!'
} else if (12500001 == code) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AuthUtil.ets#L154-L188 | 912cdf8fb24b7a1483210b0d0af65a725438270c | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/FileListDataSource.ets | arkts | 文件夹 文件列表 数据懒加载对象 | export default class FolderFileDataSource extends BasicDataSource<FolderAndFileItem> {
private dataArray: FolderAndFileItem[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): FolderAndFileItem{
return this.dataArray[index];
}
p... | AST#export_declaration#Left export default AST#class_declaration#Left class FolderFileDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FolderAndFileItem AST#primary_type#Right AST#type_annotat... | export default class FolderFileDataSource extends BasicDataSource<FolderAndFileItem> {
private dataArray: FolderAndFileItem[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): FolderAndFileItem{
return this.dataArray[index];
}
p... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/FileListDataSource.ets#L11-L48 | f96f8bdb3b75fa3c2b889612d32487fc5607f17e | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | handleConfirm | 处理确认按钮点击
@returns {void} 无返回值 | private handleConfirm(): void {
this.onConfirm(this.selectedItem);
this.onDismiss();
} | AST#method_declaration#Left private handleConfirm 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#ex... | private handleConfirm(): void {
this.onConfirm(this.selectedItem);
this.onDismiss();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L199-L202 | c245252d10e6459086d7a0edffcee691ae18f931 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets | arkts | createKeyOptions | 构建组合键选项
@param preKeys 前置按键集合,数量范围[0, 4],前置按键无顺序要求
@param finalKey 最终按键,此项必填,最终按键触发上报回调函数 | private createKeyOptions(preKeys: Array<number>, finalKey: number): inputConsumer.KeyOptions {
return {
preKeys: preKeys,
finalKey: finalKey,
isFinalKeyDown: true,
finalKeyDownDuration: 0
}
} | AST#method_declaration#Left private createKeyOptions AST#parameter_list#Left ( AST#parameter#Left preKeys : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#ty... | private createKeyOptions(preKeys: Array<number>, finalKey: number): inputConsumer.KeyOptions {
return {
preKeys: preKeys,
finalKey: finalKey,
isFinalKeyDown: true,
finalKeyDownDuration: 0
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets#L64-L71 | 3d4ed276a0f7bad7e8d16164b014ae2eb2cc3261 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getTasksByStatus | 根据状态获取任务 | getTasksByStatus(status: string): TaskItem[] {
return this.tasks.filter(task => task.status === status);
} | AST#method_declaration#Left getTasksByStatus AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Ta... | getTasksByStatus(status: string): TaskItem[] {
return this.tasks.filter(task => task.status === status);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L449-L451 | 38434dcfc7f8f2f34a8d09291dfae9a5480461f7 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 用户动作接口 | export interface UserAction {
id: string;
type: ActionType;
targetId: string; // 操作对象ID
timestamp: string;
duration?: number; // 操作持续时间
rating?: number; // 用户评分
context: Record<string, string | number | boolean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserAction AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left AST#... | export interface UserAction {
id: string;
type: ActionType;
targetId: string;
timestamp: string;
duration?: number;
rating?: number;
context: Record<string, string | number | boolean>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L81-L89 | d4624dd5293fbf611f05b36a5361c04fa1bb2abe | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | decrypt | 解密,异步
@param data 加密或者解密的数据。data不能为null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
@param priKey 指定解密私钥。 | static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
} | AST#method_declaration#Left static async decrypt 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 priKey... | static async decrypt(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, priKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L64-L67 | 17e1f3f9d2e1063570db4b1d609387bf6dac1562 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Landmark type. | export enum PositionType {
TRAIN_STATION = 1,
MOTHER_CHILD_ROOM = 2,
CAR_ROAD = 3,
CAFE = 4,
SMOKING_AREA = 5,
CONVENIENCE_STORE = 6,
GYMNASIUM = 7,
RESTAURANT = 8,
SIDE_WALK = 9,
LIBRARY = 10
} | AST#export_declaration#Left export AST#enum_declaration#Left enum PositionType AST#enum_body#Left { AST#enum_member#Left TRAIN_STATION = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MOTHER_CHILD_ROOM = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , AST#enum... | export enum PositionType {
TRAIN_STATION = 1,
MOTHER_CHILD_ROOM = 2,
CAR_ROAD = 3,
CAFE = 4,
SMOKING_AREA = 5,
CONVENIENCE_STORE = 6,
GYMNASIUM = 7,
RESTAURANT = 8,
SIDE_WALK = 9,
LIBRARY = 10
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/CommonConstants.ets#L548-L559 | b9c940d0672046d4adaf6ed4056693519ab65354 | github | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/views/CheckSurveyView.ets | arkts | createMenu | 创建问题菜单 | @Builder
createMenu() {
Menu() {
// 单选
MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.single_choice_text') })
.onClick(() => {
// 开启菜单项触动反馈
if (this.appGeneralData.isHapticMenu) {
StartVibrator()
}
// 跳转到内容页面
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createMenu 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 Menu ( ) AST#container_content_body#Left { // 单选 AST#arkts_ui_e... | @Builder
createMenu() {
Menu() {
MenuItem({ symbolStartIcon: this.menuIconModifier1, content: $r('app.string.single_choice_text') })
.onClick(() => {
if (this.appGeneralData.isHapticMenu) {
StartVibrator()
}
if (this.attributeSh... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/CheckSurveyView.ets#L104-L186 | 9115d73f7a98023d55f136b475570380ce887c7e | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/VideoShow/VideoComponent/src/main/ets/components/model/LiveDataModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface ILiveInfoDataModel {
uri: string | Resource;
name: string | Resource;
peopleNum: string | Resource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ILiveInfoDataModel AST#object_type#Left { AST#type_member#Left uri : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right A... | export interface ILiveInfoDataModel {
uri: string | Resource;
name: string | Resource;
peopleNum: string | Resource;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoShow/VideoComponent/src/main/ets/components/model/LiveDataModel.ets#L16-L20 | 175a41f96ef100c80b0136499c430d13f1164f8e | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pulltorefreshnews/src/main/ets/pages/PullToRefreshNews.ets | arkts | PullToRefreshNewsComponent | 列表ID | @Component
export struct PullToRefreshNewsComponent {
// 创建用于懒加载的数据对象
@State newsData: NewsDataSource = new NewsDataSource();
private mockFlag: boolean = true;
// 需绑定列表或宫格组件
private scroller: Scroller = new Scroller();
// 模拟数据列表页
@State newsDataListIndex: number = 1;
private refreshConfigurator: PullToR... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PullToRefreshNewsComponent AST#component_body#Left { // 创建用于懒加载的数据对象 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newsData : AST#type_annotation#Left AST#primary_type#Left NewsDataSourc... | @Component
export struct PullToRefreshNewsComponent {
@State newsData: NewsDataSource = new NewsDataSource();
private mockFlag: boolean = true;
private scroller: Scroller = new Scroller();
@State newsDataListIndex: number = 1;
private refreshConfigurator: PullToRefreshConfigurator = new PullToRefresh... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pulltorefreshnews/src/main/ets/pages/PullToRefreshNews.ets#L49-L267 | 1fafc75bd1f6dace4ad878eeb8d3f1ab118f1f9f | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | updateAccountingInfoList | 当用户添加或修改记录时,更新内存中的数据 | public updateAccountingInfoList(addAccountingStr: string) {
let addAccountingInfo:AccountingInfo = JSON.parse(addAccountingStr);
let filterAccountingList = this.selectedDayInfo.accountingList.filter((item: AccountingInfo) => item.id === addAccountingInfo.id);
if (filterAccountingList.length > 0) { // 确认是否是... | AST#method_declaration#Left public updateAccountingInfoList AST#parameter_list#Left ( AST#parameter#Left addAccountingStr : 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 ... | public updateAccountingInfoList(addAccountingStr: string) {
let addAccountingInfo:AccountingInfo = JSON.parse(addAccountingStr);
let filterAccountingList = this.selectedDayInfo.accountingList.filter((item: AccountingInfo) => item.id === addAccountingInfo.id);
if (filterAccountingList.length > 0) {
i... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L204-L299 | 240ca273d313badf59aa15aba511557d05636d25 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/OssUpload.ets | arkts | 腾讯云上传凭证模型 | export class TencentCredentials {
/**
* 临时密钥ID
*/
tmpSecretId?: string | null = null;
/**
* 临时密钥Key
*/
tmpSecretKey?: string | null = null;
/**
* 会话令牌
*/
sessionToken?: string | null = null;
constructor(init?: Partial<TencentCredentials>) {
if (!init) {
return;
}
this.... | AST#export_declaration#Left export AST#class_declaration#Left class TencentCredentials AST#class_body#Left { /**
* 临时密钥ID
*/ AST#property_declaration#Left tmpSecretId ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#... | export class TencentCredentials {
tmpSecretId?: string | null = null;
tmpSecretKey?: string | null = null;
sessionToken?: string | null = null;
constructor(init?: Partial<TencentCredentials>) {
if (!init) {
return;
}
this.tmpSecretId = init.tmpSecretId ?? this.tmpSecretId;
this.t... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OssUpload.ets#L47-L69 | 3472d8feaefc68ae93dafa8018e19bd4875a0c63 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | setThemeMode | 设置主题模式 | async setThemeMode(mode: ThemeMode): Promise<void> {
try {
if (this.currentTheme) {
const oldMode = this.currentTheme.mode;
this.currentTheme.mode = mode;
// 如果是自动模式,根据系统时间选择主题
if (mode === ThemeMode.AUTO) {
const isDark = this.isSystemDarkMode();
c... | AST#method_declaration#Left async setThemeMode AST#parameter_list#Left ( AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | async setThemeMode(mode: ThemeMode): Promise<void> {
try {
if (this.currentTheme) {
const oldMode = this.currentTheme.mode;
this.currentTheme.mode = mode;
if (mode === ThemeMode.AUTO) {
const isDark = this.isSystemDarkMode();
const autoTheme = isDa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L176-L206 | a68e641826264fd3643bab178885022ddc0be017 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/AboutSample/entry/src/main/ets/viewmodel/AboutViewModel.ets | arkts | getContactInfo | Get contact information.
@return {Array<ListItemData>} contactInfo | getContactInfo() {
let contactInfo: Array<ListItemData> = [];
let serviceHotline: ListItemData = new ListItemData();
serviceHotline.title = $r('app.string.service_hotline');
serviceHotline.summary = $r("app.string.hotline_number");
contactInfo.push(serviceHotline);
let emailAddress: ListItemData... | AST#method_declaration#Left getContactInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left contactInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < ... | getContactInfo() {
let contactInfo: Array<ListItemData> = [];
let serviceHotline: ListItemData = new ListItemData();
serviceHotline.title = $r('app.string.service_hotline');
serviceHotline.summary = $r("app.string.hotline_number");
contactInfo.push(serviceHotline);
let emailAddress: ListItemData... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/viewmodel/AboutViewModel.ets#L51-L62 | 0c5fcfd53a035f9cf248b2f204f4477a9639336e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/EmptyPage.ets | arkts | EmptyPage | 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... | @Component
export default struct EmptyPage {
private img: string | PixelMap | Resource = $r('app.media.bg_empty_page');
private message: ResourceStr = $r('app.string.ble_tv_no_device');
build() {
Column() {
Image(this.img)
.width($r('app.integer.ble_empty_image_width'))
.aspectRatio(1)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct EmptyPage AST#component_body#Left { AST#property_declaration#Left private img : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left PixelMap... | @Component
export default struct EmptyPage {
private img: string | PixelMap | Resource = $r('app.media.bg_empty_page');
private message: ResourceStr = $r('app.string.ble_tv_no_device');
build() {
Column() {
Image(this.img)
.width($r('app.integer.ble_empty_image_width'))
.aspectRatio(1)
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/EmptyPage.ets#L16-L37 | 99ff7f20424c5916951299c31ca0c1b52e465c66 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets | arkts | loadUrl | This function is a user-defined function and can be used as an initialization function. | loadUrl(url: string): void {
if (this.rootWebviewController !== null) {
try {
// Reuse the pre-created components and reload the url.
this.rootWebviewController.loadUrl(url);
} catch (error) {
hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail');
}
}
} | AST#method_declaration#Left loadUrl 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_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#ty... | loadUrl(url: string): void {
if (this.rootWebviewController !== null) {
try {
this.rootWebviewController.loadUrl(url);
} catch (error) {
hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail');
}
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L93-L102 | e738fb9eb0c5912463236407a162a1b241453fe0 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Resumed.ets | arkts | Emitted whenever a WebSocket resumes.
@event Client#resume
@param {number} replayed The number of events that were replayed
应用约束60:使用ES模块导出 | export default ResumedHandler; | AST#export_declaration#Left export default AST#expression#Left ResumedHandler AST#expression#Right ; AST#export_declaration#Right | export default ResumedHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/Resumed.ets#L39-L39 | 7bb80617a1d46d4c92c92df0cddc1be4a8543218 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TempUtil.ets | arkts | F2K | 华氏度转开尔文
@param f - 华氏度温度值
@returns 开尔文温度值 | static F2K(f: number): number {
return (f - 32) * 5 / 9 + 273.15;
} | AST#method_declaration#Left static F2K AST#parameter_list#Left ( AST#parameter#Left f : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST... | static F2K(f: number): number {
return (f - 32) * 5 / 9 + 273.15;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L68-L70 | 7d25805f69542b8f8938cd8409cc64a464b52c86 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getSettingListData | Get data of the setting list.
@return {Array<PageResource>} settingListData. | getSettingListData(): Array<ItemData> {
let settingListData: ItemData[] = [
new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")),
new ItemData($r('app.string.setting_list_data'), $r("app.media.data")),
new ItemData($r('app.string.setting_list_menu... | AST#method_declaration#Left getSettingListData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | getSettingListData(): Array<ItemData> {
let settingListData: ItemData[] = [
new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")),
new ItemData($r('app.string.setting_list_data'), $r("app.media.data")),
new ItemData($r('app.string.setting_list_menu... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets#L79-L89 | bc396a3f0dfd3836d977a19caddbb29e62e0cd89 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets | arkts | verifySync | 对数据进行验签,同步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。
@returns | static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let res = verifier.verifySync(dataBlob, signDataBlob);
return res... | AST#method_declaration#Left static verifySync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signD... | static verifySync(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
let res = verifier.verifySync(dataBlob, signDataBlob);
return res... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L336-L342 | 7ee5346bb8953919a9a0e180178e4e0492460c81 | github |
IceTeacher/DrawingBook.git | c101a1b904388fcfa72de1ff402307bb9036b68b | entry/src/main/ets/pages/BookDetailPage.ets | arkts | getRecommendGoodsList | 获取更多绘本或推荐书单 | async getRecommendGoodsList() {
let httpObject = http.createHttp();
let url =
`https://van.mama.cn/hb/api/goods/getRecommendGoodsList?goods_type=1&goods_position=${this.recommendGoodsListPage}&goods_own_type=${this.recommendGoodsListState}&attr_age_val_ids=671,672&perpage=10&sign=&uid=`
let res = awai... | AST#method_declaration#Left async getRecommendGoodsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpObject = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Le... | async getRecommendGoodsList() {
let httpObject = http.createHttp();
let url =
`https://van.mama.cn/hb/api/goods/getRecommendGoodsList?goods_type=1&goods_position=${this.recommendGoodsListPage}&goods_own_type=${this.recommendGoodsListState}&attr_age_val_ids=671,672&perpage=10&sign=&uid=`
let res = awai... | https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookDetailPage.ets#L77-L91 | 68a8a1f0b5614fcb4831a71a60d0fad241ff25af | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/HealthyDiet/entry/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export let CIRCLE_RADIUS: number = 80 | AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left CIRCLE_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#R... | export let CIRCLE_RADIUS: number = 80 | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/HealthyDiet/entry/src/main/ets/common/Constants.ets#L16-L16 | a1459fdddab2b3a3de48ef80f9700c74744ef34f | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | containsHour | 是否包含时 | static containsHour(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Hms || type == DateType.Hm;
} | AST#method_declaration#Left static containsHour AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static containsHour(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Hms || type == DateType.Hm;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L92-L95 | f1c9a8b4cb9639c49eed2e4b85cfc99adc3702d9 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets | arkts | Control style of operation element
@enum { OperationStyle }
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Control style of operation element
@enum { OperationStyle }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare enum OperationType {
/**
* The TextArrow style.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The TextArrow style.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
TEXT_ARROW = 0,
/**
* The But... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum OperationType AST#enum_body#Left { /**
* The TextArrow style.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The TextArrow style.
* @syscap SystemCapability.ArkUI.ArkU... | export declare enum OperationType {
TEXT_ARROW = 0,
BUTTON = 1,
ICON_GROUP = 2,
LOADING = 3
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L33-L82 | 243856d08a682222c776befe405c35bbbf4e7e22 | github | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/components/msg_view/NormalMsgView.ets | arkts | MsgView_normal | 普通聊天消息UI组件。
@author Jack Jiang(http://www.52im.net/thread-2792-1-1.html) | @Component
export struct MsgView_normal {
message?: Message;
build() {
Row() {
if (this.message) {
// 如果是收到的消息,则头像在最左边显示
if(this.message.isOutgoing() === false) {
this.AvatarImage(false)
}
// 消息气泡外层父布局
Column() {
// 昵称显示
this.Nickname... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MsgView_normal AST#component_body#Left { AST#property_declaration#Left message ? : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Rig... | @Component
export struct MsgView_normal {
message?: Message;
build() {
Row() {
if (this.message) {
if(this.message.isOutgoing() === false) {
this.AvatarImage(false)
}
Column() {
this.NicknameText(this.message.senderDisplayName, thi... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/components/msg_view/NormalMsgView.ets#L22-L118 | 2c45e5a6e5b6a05fbfb8adb2416bb03c9b8285ec | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | buildContent | 构建内容 | @Builder
buildContent() {
Scroll() {
Column({ space: 20 }) {
// 当前语言信息
this.buildCurrentLanguageCard()
// 智能检测语言
this.buildLanguageDetectionCard()
// 语言列表
this.buildLanguageList()
// 高级设置
this.buildAdvancedSettings()
}
.width('10... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_ele... | @Builder
buildContent() {
Scroll() {
Column({ space: 20 }) {
this.buildCurrentLanguageCard()
this.buildLanguageDetectionCard()
this.buildLanguageList()
this.buildAdvancedSettings()
}
.width('100%')
.padding(16)
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L117-L138 | 3117846c8e2a3b8be8654ce6ea1df161f7372042 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreviewUtil.ets | arkts | canIUsePreview | 判断当前设备是否支持文件预览能力
@returns | static canIUsePreview() {
return canIUse("SystemCapability.FileManagement.FilePreview.Core")
} | AST#method_declaration#Left static canIUsePreview AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#Left... | static canIUsePreview() {
return canIUse("SystemCapability.FileManagement.FilePreview.Core")
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L166-L168 | 4382da78a332329227666262fa87774255019684 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | export | 通知发送(支持多种类型) | export namespace Sender {
/**
* 发布普通文本通知
* @param {NotificationBasicOptions} options 通知消息配置项
* @returns {Promise<number>} number 返回通知ID
*/
export async | AST#export_declaration#Left export AST#ERROR#Left namespace Sender AST#ERROR#Right { /**
* 发布普通文本通知
* @param {NotificationBasicOptions} options 通知消息配置项
* @returns {Promise<number>} number 返回通知ID
*/ export as ync AST#export_declaration#Right | export namespace Sender {
export async | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L59-L65 | 93f7f3cba5b96fc1c7dbdfedca1d3b5563d72742 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getWeekDay | 获取给定的日期是星期几
@returns 周几 | static getWeekDay(date: number | string | Date): number {
return DateUtils.getFormatDate(date).getDay();
} | AST#method_declaration#Left static getWeekDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Righ... | static getWeekDay(date: number | string | Date): number {
return DateUtils.getFormatDate(date).getDay();
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L320-L322 | 9605adc555da3f8487b02053f2df2af884b8e77d | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets | arkts | encryptData | 模拟使用HUKS生成的新密钥进行加密 | async encryptData(plainText: string, resultCallback: Function): Promise<void> {
let aesKeyAlias = 'test_aesKeyAlias';
let handle: number = 0;
let generateKeyProperties: HuksProperties[] = new Array();
getAesGenerateProperties(generateKeyProperties);
let generateKeyOptions: huks.HuksOptions = {
... | AST#method_declaration#Left async encryptData AST#parameter_list#Left ( AST#parameter#Left plainText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCallback : AST#type_annotation#Left AST#primary_type#Left Function ... | async encryptData(plainText: string, resultCallback: Function): Promise<void> {
let aesKeyAlias = 'test_aesKeyAlias';
let handle: number = 0;
let generateKeyProperties: HuksProperties[] = new Array();
getAesGenerateProperties(generateKeyProperties);
let generateKeyOptions: huks.HuksOptions = {
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L298-L336 | cb7371afa5fc05d501c3984154d8157b47b509f3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | getMediaContent | 用户获取指定资源ID对应的媒体文件内容/获取指定资源ID对应的默认或指定的屏幕密度媒体文件内容
@param resId 资源ID值/资源信息。
@param density 资源获取需要的屏幕密度,0或缺省表示默认屏幕密度。
@returns | static async getMediaContent(resId: number | Resource, density?: number): Promise<Uint8Array> {
if (density !== undefined) {
if (typeof resId === 'number') {
return ArkWebHelper.getContext().resourceManager.getMediaContent(resId, density);
} else {
return ArkWebHelper.getContext().resour... | AST#method_declaration#Left static async getMediaContent AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parame... | static async getMediaContent(resId: number | Resource, density?: number): Promise<Uint8Array> {
if (density !== undefined) {
if (typeof resId === 'number') {
return ArkWebHelper.getContext().resourceManager.getMediaContent(resId, density);
} else {
return ArkWebHelper.getContext().resour... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L105-L119 | 14776ee5a43ef8d6a13bf36b5ae8b3cf174c3eb2 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets | arkts | 分类树数据模型 | export interface CategoryTree {
id: number;
name: string;
children: CategoryChild[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CategoryTree AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AS... | export interface CategoryTree {
id: number;
name: string;
children: CategoryChild[];
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L39-L43 | bc79f67d0e409a3937cc82c702969d074b42ec0a | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomEmitter/entry/src/main/ets/model/GoodsModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface GoodResponse {
code: number
data: Records
error: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GoodResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left data : AST#type_annotation#Left AS... | export interface GoodResponse {
code: number
data: Records
error: string
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomEmitter/entry/src/main/ets/model/GoodsModel.ets#L16-L20 | 894130fa22d8ad09012a4d2a9d52bbb6418819c4 | gitee | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | getNextUp | 获取接下来播放的媒体列表
注:主页和剧集中用
@param seriesId
@returns | public getNextUp(): Promise<Array<FinItem>> {
return this.requireApi().getNextUp()
} | AST#method_declaration#Left public getNextUp 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 Array AST#type_arguments#Left < AST#type_annotat... | public getNextUp(): Promise<Array<FinItem>> {
return this.requireApi().getNextUp()
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L42-L44 | faf8a78a4226b8da900e889ffa896c9d2eb8d627 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets | arkts | writeData | 2-写入数据 | writeData(key: string, sports: Sport) {
if (dataPreferences) { //Preferences实例是否存在
//检查缓存的Preferences实例中是否包含名为给定Key的存储键值对
let isExit = dataPreferences.has(key);
isExit.then((val: boolean) => {
if (val) { //如果key存在,写入数据等同修改
let writeResult = dataPreferences.put(key, sports);
... | AST#method_declaration#Left writeData AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sports : AST#type_annotation#Left AST#primary_type#Left Sport AST#primary_type#Right AS... | writeData(key: string, sports: Sport) {
if (dataPreferences) {
let isExit = dataPreferences.has(key);
isExit.then((val: boolean) => {
if (val) {
let writeResult = dataPreferences.put(key, sports);
writeResult.then(() => {
this.showToastMessage($r('app.str... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets#L33-L63 | f0c816cf978fcc7d83a82c5ab2aa6c3390b4cbed | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | 定时器ID | constructor(intervalMs: number = 0) {
this.setTotalInterval(intervalMs);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left intervalMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le... | constructor(intervalMs: number = 0) {
this.setTotalInterval(intervalMs);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L11-L13 | 9797bd353dceee7626e0cde257e6d03c667ecfdb | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets | arkts | setKey | 设置缓存文件key值
@param key 键值 | setKey(key: string) {
this.key = key;
} | AST#method_declaration#Left setKey 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left A... | setKey(key: string) {
this.key = key;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets#L33-L35 | 5909b2f35514e35628853d01952efef0048ae0be | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/word/WordDetail.ets | arkts | getDiscriminateRemovedDuplications | ============================================================ MARK: - Discriminate 处理 ============================================================
获取去重后的辨析说明(带缓存) | getDiscriminateRemovedDuplications(): string | null {
if (!this.discriminate2) {
this.discriminate2 = this.removedDuplicationsForDiscriminate();
}
return this.discriminate2;
} | AST#method_declaration#Left getDiscriminateRemovedDuplications AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#bu... | getDiscriminateRemovedDuplications(): string | null {
if (!this.discriminate2) {
this.discriminate2 = this.removedDuplicationsForDiscriminate();
}
return this.discriminate2;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/word/WordDetail.ets#L102-L107 | d79f8dd251b2ff5127ce5b01a0095db7c583e81f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets | arkts | addLastItem | 在数据尾部增加一个元素 | public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public addLastItem 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#expre... | public addLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray[this.dataArray.length]);
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L130-L133 | bd966f694c78789066bb27061d66588cc5f55aeb | gitee |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/MqttUtil.ets | arkts | extractContent | 解析Content | public extractContent<T>(payload: string): T {
return JSON.parse(payload).notify_data.body.content as T;
} | AST#method_declaration#Left public extractContent AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left payload : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#pa... | public extractContent<T>(payload: string): T {
return JSON.parse(payload).notify_data.body.content as T;
} | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L143-L145 | c2bac0ca4e55d50bf6dd7a8224f2d6dca4f6a066 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SimpleChatList/entry/src/main/ets/pages/ScrollToTheBottom.ets | arkts | ScrollToTheBottom | 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
export struct ScrollToTheBottom {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
// [Start Scroller]
private scroller: Scroller = new Scroller();
@StorageProp('topRectHeight') topRectHeight: number = 0;
// [StartExclude Scroller]
build() {
NavDestination() {
// [EndExclude Sc... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScrollToTheBottom AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#typ... | @Component
export struct ScrollToTheBottom {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
private scroller: Scroller = new Scroller();
@StorageProp('topRectHeight') topRectHeight: number = 0;
build() {
NavDestination() {
List({ space: 20, initialIndex: this.arr.length ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/ScrollToTheBottom.ets#L16-L68 | 5e4658a84637335e4f62744d0c47da233351162a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | hmacSync | 消息认证码计算,同步
@param data 传入的消息
@param algName 指定摘要算法(SHA1、SHA224、SHA256、SHA384、SHA512、MD5、SM3)。
@param symKey 共享对称密钥(SymKey)。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 | static hmacSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): string {
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey); //使用对称密钥初始化Mac计算
//数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
mac.updateSync({ data: CryptoHelper.strToUint... | AST#method_declaration#Left static hmacSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static hmacSync(data: string, algName: string, symKey: cryptoFramework.SymKey,
resultCoding: crypto.BhCoding = 'hex'): string {
let mac = cryptoFramework.createMac(algName);
mac.initSync(symKey);
mac.updateSync({ data: CryptoHelper.strToUint8Array(data, 'utf-8') });
let dataBlob = mac.doFinal... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L589-L598 | 403f74b020cd40aeca040ad4b4bb5d000c73801b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/Index.ets | arkts | MusicPlayerPage | 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 { MusicPlayerPage } from './src/main/ets/pages/MusicPlayerPage'; | AST#export_declaration#Left export { MusicPlayerPage } from './src/main/ets/pages/MusicPlayerPage' ; AST#export_declaration#Right | export { MusicPlayerPage } from './src/main/ets/pages/MusicPlayerPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/Index.ets#L16-L16 | 8db194c2b21462d09851c5e794b9ca2333919dc1 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets | arkts | reset | 重置计数
@returns {void} 无返回值 | reset(): void {
this.counterState.reset();
} | 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#call_expression#Left AST#expression#Left AS... | reset(): void {
this.counterState.reset();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets#L36-L38 | b52c103b7bab4fc687963fc585051c3145bd524d | github |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/common/utils/SPUtil.ets | arkts | clear | 清空
@param preferenceName
@returns | static async clear(preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.clear()
} | AST#method_declaration#Left static async clear AST#parameter_list#Left ( AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left defaultPreferenceName AST#expression#Right AST#parameter#Right ) AST#parameter_list#Ri... | static async clear(preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.clear()
} | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/SPUtil.ets#L61-L64 | 9c19418b2b2ab0c4975de9665ff58772695875f5 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/Model.ets | arkts | calAccuracyRate | 计算正确率
@returns | calAccuracyRate(): number {
if (this.examManger.total === 0) {
return 0;
}
return Math.ceil(this.examManger.correctNumber / this.examManger.total * 100);
} | AST#method_declaration#Left calAccuracyRate 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Lef... | calAccuracyRate(): number {
if (this.examManger.total === 0) {
return 0;
}
return Math.ceil(this.examManger.correctNumber / this.examManger.total * 100);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/Model.ets#L91-L96 | f84051b0e7413e2ee1de8ac906dbc844943f2598 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/view/UserProfileComponent.ets | arkts | ProfileItemBuilder | 构建资料项 | @Builder
ProfileItemBuilder(item: ProfileItem, index: number) {
Row() {
// 图标容器
Column() {
Image(item.icon)
.width(22)
.height(22)
.fillColor('#007AFF')
}
.width(40)
.height(40)
.backgroundColor('#F0F7FF')
.borderRadius(20)
.jus... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ProfileItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ProfileItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annota... | @Builder
ProfileItemBuilder(item: ProfileItem, index: number) {
Row() {
Column() {
Image(item.icon)
.width(22)
.height(22)
.fillColor('#007AFF')
}
.width(40)
.height(40)
.backgroundColor('#F0F7FF')
.borderRadius(20)
.justifyCon... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L252-L302 | a52a486a9b1056b9b104ea2838e7f4cb3a03bcbc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets | arkts | getDisplay | 获取屏幕Display
@returns | public getDisplay(): display.Display | null {
let displayClass: display.Display | null = null;
try {
displayClass = display.getDefaultDisplaySync();
} catch (error) {
logger.error(`Failed to getDefaultDisplaySync. Code: ` + error.code);
}
return displayClass;
} | AST#method_declaration#Left public getDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_... | public getDisplay(): display.Display | null {
let displayClass: display.Display | null = null;
try {
displayClass = display.getDefaultDisplaySync();
} catch (error) {
logger.error(`Failed to getDefaultDisplaySync. Code: ` + error.code);
}
return displayClass;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L92-L100 | 8fec1927b79a82b3498008efb5936769d87674b2 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | updateMovieCardData | Update movie data show in to the card.
@param {relationalStore.RdbStore} rdbStore RDB database | updateMovieCardData(rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
rdbStore.query(... | AST#method_declaration#Left updateMovieCardData AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig... | updateMovieCardData(rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
rdbStore.query(... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets#L73-L95 | dbafcec98d0bad31580a083b9634f310d00b1807 | gitee |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/utils/MoodDB.ets | arkts | clearUserData | ★ 新增功能:清空当前用户的所有日记数据 | static async clearUserData(): Promise<void> {
if (!MoodDB.rdbStore) return Promise.reject(new Error('DB not init'));
let predicates = new relationalStore.RdbPredicates('MOOD_TABLE');
predicates.equalTo('userId', MoodDB.currentUserId); // 只删自己的,别删别人的
// 删除符合条件的行
await MoodDB.rdbStore.delete(predica... | AST#method_declaration#Left static async clearUserData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | static async clearUserData(): Promise<void> {
if (!MoodDB.rdbStore) return Promise.reject(new Error('DB not init'));
let predicates = new relationalStore.RdbPredicates('MOOD_TABLE');
predicates.equalTo('userId', MoodDB.currentUserId);
await MoodDB.rdbStore.delete(predicates);
} | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/utils/MoodDB.ets#L174-L182 | 95af3322bd0844463e13d3a8bfaee0ea5562fba0 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets | arkts | getJSAppDir | 小程序根目录 | public getJSAppDir(appId: string): string {
return this.sandboxPath + '/' + appId;
} | AST#method_declaration#Left public getJSAppDir AST#parameter_list#Left ( AST#parameter#Left appId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | public getJSAppDir(appId: string): string {
return this.sandboxPath + '/' + appId;
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L81-L83 | 8874797191f369317d8a2c97edc230d60ea22abf | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets | arkts | init | 初始化表盘和表针对应的变量,并首次绘制。 | private init() {
const clockBgSource = image.createImageSource(this.resourceDir + '/' + CLOCK_BG_PATH);
const hourSource = image.createImageSource(this.resourceDir + '/' + CLOCK_HOUR_PATH);
const minuteSource = image.createImageSource(this.resourceDir + '/' + CLOCK_MINUTE_PATH);
const secondSource = ima... | AST#method_declaration#Left private init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left clockBgSource = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | private init() {
const clockBgSource = image.createImageSource(this.resourceDir + '/' + CLOCK_BG_PATH);
const hourSource = image.createImageSource(this.resourceDir + '/' + CLOCK_HOUR_PATH);
const minuteSource = image.createImageSource(this.resourceDir + '/' + CLOCK_MINUTE_PATH);
const secondSource = ima... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets#L107-L155 | 5c6836f7bf79ed8b85057111044713b9e2af4782 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/BuildProfile.ets | arkts | Use these variables when you tailor your ArkTS code. They must be of the const type. | export const HAR_VERSION = '1.0.6'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.0.6' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const HAR_VERSION = '1.0.6'; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/BuildProfile.ets#L4-L4 | 591a0b409130d31b61a5608c9ffa50e8ae356905 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | getGridAlpha | 返回GridLine的不透明度
@returns | public getGridAlpha(): number {
return this.mGridAlpha;
} | AST#method_declaration#Left public getGridAlpha 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_expr... | public getGridAlpha(): number {
return this.mGridAlpha;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L266-L268 | a063dab0db31ad9eb5c0c188c2726809e30cf425 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/DateHelper.ets | arkts | hasYear | 是否含有年 | static hasYear(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd
|| type == DateType.Ym || type == DateType.Y;
} | AST#method_declaration#Left static hasYear AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | static hasYear(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd
|| type == DateType.Ym || type == DateType.Y;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L45-L49 | 498904591d3e819cc360d370c0d79b9807b081eb | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets | arkts | createDbIfNeeds | 获取单例实例 MARK: - 数据库初始化 | createDbIfNeeds() {
if (!this.db) return;
// 创建录音表
const sql = `CREATE TABLE IF NOT EXISTS "${Tables.Record.name}" (
"${Tables.Record.Col.text}" TEXT PRIMARY KEY NOT NULL,
"${Tables.Record.Col.sound}" BLOB
)`;
// 执行创建表语句
this.db.updateDb(sql);
} | AST#method_declaration#Left createDbIfNeeds AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary... | createDbIfNeeds() {
if (!this.db) return;
const sql = `CREATE TABLE IF NOT EXISTS "${Tables.Record.name}" (
"${Tables.Record.Col.text}" TEXT PRIMARY KEY NOT NULL,
"${Tables.Record.Col.sound}" BLOB
)`;
this.db.updateDb(sql);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L71-L82 | 15213f3f42d9a6f8514f319157cf59e6fdad75c2 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.