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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/SystemCheckService.ets | arkts | checkAgv | 检查AGV连接 | static async checkAgv(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查AGV连接');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_AGV);
console.info('[SystemCheckService] AGV检查响应:', JSON.stringify(response));
return {
success: response.code === 2... | AST#method_declaration#Left static async checkAgv AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CheckResult AST#primary_type#Right AST#type_annotation#Right > AS... | static async checkAgv(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查AGV连接');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_AGV);
console.info('[SystemCheckService] AGV检查响应:', JSON.stringify(response));
return {
success: response.code === 2... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L72-L90 | b2d0717d8638cea92677b354bac982128ec28a5f | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/DateUtil.ets | arkts | getFormatDate | 获取格式化日期,将传入的日期格式化为Date
@param date
@returns | static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) { //无参数
date = new Date();
} else if (typeof date == "string") { //字符串日期
if (date.length == 0) {
date = new Date();
} else {
if (date.toString().length == 10 || date.toString().le... | AST#method_declaration#Left static getFormatDate 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... | static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) {
date = new Date();
} else if (typeof date == "string") {
if (date.length == 0) {
date = new Date();
} else {
if (date.toString().length == 10 || date.toString().length == 13) ... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L33-L72 | 22beaae2965218db4968ac722b3501d942d285fe | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/UpgradeAdapter.ets | arkts | getInstance | 取单例对象
@return 适配器对象 | static getInstance(): UpgradeAdapter {
return (globalThis.upgradeAdapter as UpgradeAdapter) ?? new UpgradeAdapter();
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UpgradeAdapter AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call... | static getInstance(): UpgradeAdapter {
return (globalThis.upgradeAdapter as UpgradeAdapter) ?? new UpgradeAdapter();
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/UpgradeAdapter.ets#L39-L41 | f8d7673f1777a30170add46319b093e6687be83e | gitee |
linhanlove/hormany-os-notion | a65f47bfc1a2bbce531b9af97831eb1ba934c2f8 | entry/src/main/ets/pages/auth/Register.ets | arkts | inputStyle | 输入框样式 | @Extend(TextInput) function inputStyle() {
.fontColor(StyleConstants.BASE_STYLE.fontColor)
.caretColor(StyleConstants.BASE_STYLE.fontColor)
.placeholderColor(StyleConstants.BASE_STYLE.fontColor)
.width(StyleConstants.FULL_WIDTH)
.height(StyleConstants.INPUT_HEIGHT)
.fontSize($r('app.float.font_size_18fp'))
... | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function inputStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST... | @Extend(TextInput) function inputStyle() {
.fontColor(StyleConstants.BASE_STYLE.fontColor)
.caretColor(StyleConstants.BASE_STYLE.fontColor)
.placeholderColor(StyleConstants.BASE_STYLE.fontColor)
.width(StyleConstants.FULL_WIDTH)
.height(StyleConstants.INPUT_HEIGHT)
.fontSize($r('app.float.font_size_18fp'))
... | https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/pages/auth/Register.ets#L279-L288 | 1949a48228d26878c9eb53b3393f5b4a8474c4c3 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getNewVersionDescription | 获取新版本描述文件
@return 新版本描述文件 | async getNewVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
return this.updateManager.getNewVersionDescription(versionDigest, update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
} | AST#method_declaration#Left async getNewVersionDescription AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Lef... | async getNewVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
return this.updateManager.getNewVersionDescription(versionDigest, update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L110-L114 | 19b2d5e37fb7036bf3d1fd01405f3817f311cada | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/utils/DateUtil.ets | arkts | isSameDay | 判断两个日期是否是同一天 | static isSameDay(date1: Date, date2: Date): boolean {
return date1.getDate() === date2.getDate() &&
date1.getMonth() === date2.getMonth() &&
date1.getFullYear() === date2.getFullYear()
} | AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Rig... | static isSameDay(date1: Date, date2: Date): boolean {
return date1.getDate() === date2.getDate() &&
date1.getMonth() === date2.getMonth() &&
date1.getFullYear() === date2.getFullYear()
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L122-L126 | 2c59e726f440a7ecfe2fb5c1b76a9f9aaed92bb6 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Default user agents in a specified string format.
@returns Firefox, Chrome and Edge.
@example 'Firefox Windows 132\nMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0' | export function default_user_agents() {
let result = [
"Huawei Browser 132\nMozilla/5.0 (PC; OpenHarmony 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 ArkWeb/6.0.0.107 HuaweiBrowser/233.1.9.311",
"Firefox Windows 132\nMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100... | AST#export_declaration#Left export AST#function_declaration#Left function default_user_agents AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#array_literal#Left [ AST#expres... | export function default_user_agents() {
let result = [
"Huawei Browser 132\nMozilla/5.0 (PC; OpenHarmony 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 ArkWeb/6.0.0.107 HuaweiBrowser/233.1.9.311",
"Firefox Windows 132\nMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L124-L133 | 2d81c539cca932ff0a99eb70fe45ee65079620e7 | gitee | |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/Index.ets | arkts | APIs | / http | export { APIs } from '../JhCommon/src/main/ets/JhCommon/http/APIs' | AST#export_declaration#Left export { APIs } from '../JhCommon/src/main/ets/JhCommon/http/APIs' AST#export_declaration#Right | export { APIs } from '../JhCommon/src/main/ets/JhCommon/http/APIs' | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/Index.ets#L20-L20 | d6887c4f56f2b01b578fc90da88b5d9a4d59543c | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Link | Called when a link is set.
@since 7
@deprecated since 10 | static Link<T>(propName: string): SubscribedAbstractProperty<T> | undefined {
return AppStorage.link<T>(propName)
} | AST#method_declaration#Left static Link AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | static Link<T>(propName: string): SubscribedAbstractProperty<T> | undefined {
return AppStorage.link<T>(propName)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L53-L55 | 0009f2ac7cd158471af780a21d61f9a70c5b0e32 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/social/SearchPage.ets | arkts | buildSearchSuggestions | 构建搜索建议 | @Builder
buildSearchSuggestions() {
Scroll() {
Column({ space: 24 }) {
// 最近搜索
if (this.recentSearches.length > 0) {
Column({ space: 12 }) {
Row() {
Text('最近搜索')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchSuggestions 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#ar... | @Builder
buildSearchSuggestions() {
Scroll() {
Column({ space: 24 }) {
if (this.recentSearches.length > 0) {
Column({ space: 12 }) {
Row() {
Text('最近搜索')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L222-L335 | 6f2bd956c461cf1acfc19f1a7fc1d3927a854e6b | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowTabsHost.ets | arkts | preprocessing | Tab controls | preprocessing(storage: LocalStorage) {
let t0 = Date.now();
// Start
let start_up_option = bunch_of_tabs.start_up;
// Want
let want_uri = storage.get('want_uri') as string;
let want_source = storage.get('want_source') as string;
let want_action = storage.get('want_action') as string;
le... | AST#method_declaration#Left preprocessing AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarat... | preprocessing(storage: LocalStorage) {
let t0 = Date.now();
let start_up_option = bunch_of_tabs.start_up;
let want_uri = storage.get('want_uri') as string;
let want_source = storage.get('want_source') as string;
let want_action = storage.get('want_action') as string;
let want_type = s... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsHost.ets#L62-L157 | fbde649e0ae1bdf51e36b0c6d763ad65d529e169 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/view/UserProfileComponent.ets | arkts | UserProfile | 用户中心组件
User Profile Component - 支持编辑功能
Source: 溪村园区用户中心模块 | @Component
export struct UserProfile {
@StorageLink('username') username: string = '用户';
@StorageLink('auth_token') token: string = '';
@State avatarUrl: string = '';
@State userInfo: UserInfo | null = null;
@State profileItems: ProfileItem[] = [];
@State isLoading: boolean = false;
// 编辑弹窗相关
@State sho... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UserProfile AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'username' AST#expression#Right ) AST#decorator#Right username : AST#type_annotation#Left AST#... | @Component
export struct UserProfile {
@StorageLink('username') username: string = '用户';
@StorageLink('auth_token') token: string = '';
@State avatarUrl: string = '';
@State userInfo: UserInfo | null = null;
@State profileItems: ProfileItem[] = [];
@State isLoading: boolean = false;
@State showEditDial... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L79-L514 | 9afbbe32559180d49125c07e1c9ce54a29b1805e | github |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | time_bar/src/main/ets/utils/CommonUtils.ets | arkts | Parse ISO-like string to Date; normalize timezone colon when possible.
@param formatTime ISO-like time string.
@returns Parsed Date (falls back to current time when invalid). | export function parseTimeString(formatTime: string): Date {
if (!formatTime || formatTime.length === 0) {
return new Date(Date.now());
}
// Normalize tail timezone '+08:00' -> '+0800'
const normalized = formatTime.replace(/([+-]\d{2}):?(\d{2})$/, '$1$2');
const d = new Date(normalized);
if (!isNaN(d.get... | AST#export_declaration#Left export AST#function_declaration#Left function parseTimeString AST#parameter_list#Left ( AST#parameter#Left formatTime : 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#... | export function parseTimeString(formatTime: string): Date {
if (!formatTime || formatTime.length === 0) {
return new Date(Date.now());
}
const normalized = formatTime.replace(/([+-]\d{2}):?(\d{2})$/, '$1$2');
const d = new Date(normalized);
if (!isNaN(d.getTime())) {
return d;
}
return new Date... | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/utils/CommonUtils.ets#L21-L32 | fd03e1e9be9c20891ee214fd9373528116f73f85 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets | arkts | 应用约束18: 构造函数参数不能声明类字段 | constructor(client: Client, data?: ChannelData) {
this.client = client; // 直接赋值替代Object.defineProperty
if (data) this.setup(data);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left Client AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left ChannelData AST#prima... | constructor(client: Client, data?: ChannelData) {
this.client = client;
if (data) this.setup(data);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets#L14-L17 | 873778a080bd8a801c52c46a752ffd907ee152ba | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | setCircleSize | sets the size (radius) of the circle shpaed value indicators,
default size = 4f
<p/>
This method is deprecated because of unclarity. Use setCircleRadius instead.
@param size
@Deprecated | public setCircleSize(size: number): void {
this.setCircleRadius(size);
} | AST#method_declaration#Left public setCircleSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ... | public setCircleSize(size: number): void {
this.setCircleRadius(size);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L198-L200 | e17d7c762c4ae660e8614d823a533cf1c198c2c2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/WindowModel.ets | arkts | updateMainWinPreferredOrientation | 根据折叠屏的折叠状态,更新主窗口显示方向属性
@param curFoldStatus 当前折叠屏折叠状态
@returns {void} | updateMainWinPreferredOrientation(curFoldStatus: display.FoldStatus = display.getFoldStatus()): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow(async (err: BusinessError, mainWindow: window.Window) => {
let c... | AST#method_declaration#Left updateMainWinPreferredOrientation AST#parameter_list#Left ( AST#parameter#Left curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_... | updateMainWinPreferredOrientation(curFoldStatus: display.FoldStatus = display.getFoldStatus()): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow(async (err: BusinessError, mainWindow: window.Window) => {
let c... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/WindowModel.ets#L67-L82 | 22dc374794eb1fbb44fe577781d570534d8c03f7 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/dialog/DialogHelper.ets | arkts | 网络弹框
@param operator 回调 | export function displayNetworkDialog(operator: DialogOperator): void {
AlertDialog.show(
{
title: $r('app.string.software_update'),
message: $r('app.string.network_request'),
primaryButton: {
value: FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.cancel')),
... | AST#export_declaration#Left export AST#function_declaration#Left function displayNetworkDialog AST#parameter_list#Left ( AST#parameter#Left operator : AST#type_annotation#Left AST#primary_type#Left DialogOperator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_... | export function displayNetworkDialog(operator: DialogOperator): void {
AlertDialog.show(
{
title: $r('app.string.software_update'),
message: $r('app.string.network_request'),
primaryButton: {
value: FormatUtils.toUpperCase(globalThis.abilityContext, $r('app.string.cancel')),
... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L48-L80 | 2548ca298922dd147881dba5c911986283b9dde0 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | getThemeColorName | 获取主题颜色名称 | private getThemeColorName(): string {
const themeMap: Record<string, string> = {
'#4ECDC4': '清新蓝绿',
'#FF6B9D': '温馨粉红',
'#9B59B6': '紫罗兰',
'#27AE60': '森林绿',
'#F39C12': '阳光橙',
'#34495E': '深空灰',
'#3498DB': '天空蓝',
'#1ABC9C': '薄荷绿',
'#FFB6C1': '樱花粉',
'#F1C40F': ... | AST#method_declaration#Left private getThemeColorName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Le... | private getThemeColorName(): string {
const themeMap: Record<string, string> = {
'#4ECDC4': '清新蓝绿',
'#FF6B9D': '温馨粉红',
'#9B59B6': '紫罗兰',
'#27AE60': '森林绿',
'#F39C12': '阳光橙',
'#34495E': '深空灰',
'#3498DB': '天空蓝',
'#1ABC9C': '薄荷绿',
'#FFB6C1': '樱花粉',
'#F1C40F': ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6257-L6276 | a7debd89f75ef8a4e8f861fc3497d87e49dda6c7 | github |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/SettingsPage.ets | arkts | getAvatarIcon | 获取头像对应的 emoji 图标 | private getAvatarIcon(avatar: string): string {
const index = PRESET_AVATARS.indexOf(avatar);
if (index >= 0 && index < AVATAR_ICONS.length) {
return AVATAR_ICONS[index];
}
return '👤';
} | AST#method_declaration#Left private getAvatarIcon AST#parameter_list#Left ( AST#parameter#Left avatar : 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#primar... | private getAvatarIcon(avatar: string): string {
const index = PRESET_AVATARS.indexOf(avatar);
if (index >= 0 && index < AVATAR_ICONS.length) {
return AVATAR_ICONS[index];
}
return '👤';
} | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/SettingsPage.ets#L55-L61 | 1a5aec4052e74a19ebbf7101f470731208525052 | github |
RicardoWesleyli/ArkUI-Animations.git | a85f94156d3fde1439bfb68a2108dbc3eb4a1dca | ScrollViewAnimation/entry/src/main/ets/pages/Index.ets | arkts | Range | 创建数组 | function Range(start: number, end: number): number[] {
const result: number[] = [];
for (let i = start; i <= end; i++) {
result.push(i);
}
return result;
} | AST#function_declaration#Left function Range AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left end : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | function Range(start: number, end: number): number[] {
const result: number[] = [];
for (let i = start; i <= end; i++) {
result.push(i);
}
return result;
} | https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/ScrollViewAnimation/entry/src/main/ets/pages/Index.ets#L57-L63 | cf0a79187fa668ac3125b14ef8a3334f0ccb0e81 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/GridSegmentedPicker.ets | arkts | 定义选项类型 | export interface GridPickerItem {
value: number;
label: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GridPickerItem AST#object_type#Left { AST#type_member#Left value : 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 label : AST#type_annotation#L... | export interface GridPickerItem {
value: number;
label: string;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/GridSegmentedPicker.ets#L8-L11 | 49b66de0be4f43178e9e9108fe8c5b08f9e483e0 | github | |
Zairgs/ArKTSMovie.git | 1586c977f12722333eee7d74a71f006ba0606ade | ets/pages/TicketInfo.ets | arkts | TicketInfo.ets (配套的数据模型类) | export class TicketInfo {
id: string = ''
title: string = ''
location: string = ''
showTime: string = ''
price: string = ''
saleTime: number = 0
constructor | AST#export_declaration#Left export AST#ERROR#Left class TicketInfo { id AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right title : string = '' location : AST#type_annotation#Left AST#primary_type#Left stri... | export class TicketInfo {
id: string = ''
title: string = ''
location: string = ''
showTime: string = ''
price: string = ''
saleTime: number = 0
constructor | https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/TicketInfo.ets#L2-L10 | 8f4c3c3e8990aabf5bf11b4ff7c86f9e76938521 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 验证规则接口 | export interface ValidationRule {
pattern?: RegExp;
min?: number;
max?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ValidationRule AST#object_type#Left { AST#type_member#Left pattern ? : AST#type_annotation#Left AST#primary_type#Left RegExp AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left min ? : AST#type_annotati... | export interface ValidationRule {
pattern?: RegExp;
min?: number;
max?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L29-L33 | 571d1c055cf9e323fbaf2137ea8d082f97c2da56 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | truncate | 截断文件,使用Promise异步回调。
@param file string|number 文件的应用沙箱路径或已打开的文件描述符fd。
@param len number 文件截断后的长度,以字节为单位。默认为0。
@returns | static truncate(file: string | number, len: number = 0): Promise<void> {
return fs.truncate(file, len)
} | AST#method_declaration#Left static truncate AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#... | static truncate(file: string | number, len: number = 0): Promise<void> {
return fs.truncate(file, len)
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L697-L699 | 8bea06349761e5c5dc72b112fc3c94932c2231f7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadCommunication/src/main/ets/pages/IconItemSource.ets | arkts | 图片显示类,用于存储图片和对应的文字数据 | export class IconItemSource {
image: string | Resource = '';
text: string | Resource = '';
constructor(image: string | Resource = '', text: string | Resource = '') {
this.image = image;
this.text = text;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class IconItemSource AST#class_body#Left { AST#property_declaration#Left image : 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 AST... | export class IconItemSource {
image: string | Resource = '';
text: string | Resource = '';
constructor(image: string | Resource = '', text: string | Resource = '') {
this.image = image;
this.text = text;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadCommunication/src/main/ets/pages/IconItemSource.ets#L17-L25 | 26379bc3b090bc6ef16670eb0ea1a28a40ba6473 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DeviceUtils.ets | arkts | isVivoDevice | 判断是否为vivo设备 | static isVivoDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'vivo';
} | AST#method_declaration#Left static isVivoDevice AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_exp... | static isVivoDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'vivo';
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L88-L90 | 25cf9385566e6608a0bd8198b7262c87643a3830 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | clearDelayRefresh | Clear delay refresh. | private clearDelayRefresh(): void {
clearTimeout(this.timeoutId);
this.isWaitingRefresh = false;
} | AST#method_declaration#Left private clearDelayRefresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left clearTimeout ( AST#expression#Left AST... | private clearDelayRefresh(): void {
clearTimeout(this.timeoutId);
this.isWaitingRefresh = false;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L455-L458 | cc4d6d7f27b43ba75184fc07c75c6973ccdaf360 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_asynchronous.ets | arkts | encryptMessagePromise | 加密消息 | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = await cipher.update(plainText);
// gcm模式加密... | AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = await cipher.update(plainText);
gcmPara... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_asynchronous.ets#L49-L56 | d05699af2f484fb3cf3b1a2f70d83f6327b5be2f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets | arkts | getEntityPathInfo | 获取实体路径配置
@returns {Promise<NetworkResponse<Unknown>>} 路径配置 | async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.get("base/comm/eps");
return resp.data;
} | AST#method_declaration#Left async getEntityPathInfo 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 NetworkResponse AST#type_arguments#Left <... | async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.get("base/comm/eps");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets#L26-L30 | a84ba07a894373f284c1a7c0d2de9fcd275e329d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dynamicattributes/Index.ets | arkts | ShoppingCart | 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 { ShoppingCart } from './src/main/ets/view/ShoppingCart'; | AST#export_declaration#Left export { ShoppingCart } from './src/main/ets/view/ShoppingCart' ; AST#export_declaration#Right | export { ShoppingCart } from './src/main/ets/view/ShoppingCart'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/Index.ets#L16-L16 | b82333afb5665fcc4c3646a4fa94b732b8c3a2f7 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/CameraUtil.ets | arkts | picker | 调起照相和录屏
@returns | static async picker(): Promise<picker.PickerResult> {
let mContext = getContext() as common.Context;
let pickerProfile: picker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK
};
let pickerResult: picker.PickerResult =
await picker.pick(mContext, [picker.PickerMed... | AST#method_declaration#Left static async picker 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#qualified_type#Left picker . PickerResult AST#qualified_type#Ri... | static async picker(): Promise<picker.PickerResult> {
let mContext = getContext() as common.Context;
let pickerProfile: picker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK
};
let pickerResult: picker.PickerResult =
await picker.pick(mContext, [picker.PickerMed... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/CameraUtil.ets#L33-L41 | 108bc417b4ded3a9013ae2bbdfa886df57c44e08 | gitee |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | projectModule/src/main/ets/components/ProjectDetailView.ets | arkts | ProjectDetailView | @desc:项目详情页
@author:hxy
@time:2024/3/19 | @Component
export struct ProjectDetailView {
@State
item: ProjectItemModel = {} as ProjectItemModel
// 0 默认 21 降序 20 升序
@State
sort: number = 0
// 可选排序
sortArr: number[] = [0, 21, 20]
aboutToAppear() {
const params = router.getParams() as ProjectItemModel
if (params) {
this.item = params
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ProjectDetailView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right item : AST#type_annotation#Left AST#primary_type#Left ProjectItemModel AST#primary_type#Right AS... | @Component
export struct ProjectDetailView {
@State
item: ProjectItemModel = {} as ProjectItemModel
@State
sort: number = 0
sortArr: number[] = [0, 21, 20]
aboutToAppear() {
const params = router.getParams() as ProjectItemModel
if (params) {
this.item = params
}
}
build() {
... | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/projectModule/src/main/ets/components/ProjectDetailView.ets#L14-L143 | bc17aec1cf2f7f7ef4336f74693b495450f24dd6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | buildActionSheet | 构建操作菜单 | @Builder
buildActionSheet() {
Column() {
// 背景遮罩
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showActionSheet = false;
})
// 操作菜单
Column({ space: 1 }) {
Button(this.contact!.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildActionSheet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 背景遮罩 AST#... | @Builder
buildActionSheet() {
Column() {
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showActionSheet = false;
})
Column({ space: 1 }) {
Button(this.contact!.isFavorite ? '... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L562-L627 | 0d4f4f27705b38ed04e2b4d748792ebdef9808b9 | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/player/PlayerViewModel.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/20 22:01
@Version V1.0
@Description | export class PlayerViewModel extends AppViewModel {
private readonly args: PlayerArgs
/**
* 目标媒体
*/
itemDto?: FinItem
/**
* 媒体列表,剧集才有
*/
itemDtoArray?: Array<FinItem>
constructor | AST#export_declaration#Left export AST#ERROR#Left class PlayerViewModel extends AST#type_annotation#Left AST#primary_type#Left AppViewModel AST#primary_type#Right AST#type_annotation#Right { private readonly args AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left PlayerArgs AST#primary_type#Right AST#type_... | export class PlayerViewModel extends AppViewModel {
private readonly args: PlayerArgs
itemDto?: FinItem
itemDtoArray?: Array<FinItem>
constructor | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/player/PlayerViewModel.ets#L12-L26 | 4c73602d1c1da7454c822977ffae2fefeb712f15 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toComment | 跳转到订单评价
@param {number} orderId - 订单 ID
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | static toComment(orderId: number, goodsId: number): void {
const params: OrderCommentParam = { orderId, goodsId };
navigateTo(OrderRoutes.Comment, params);
} | AST#method_declaration#Left static toComment AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | static toComment(orderId: number, goodsId: number): void {
const params: OrderCommentParam = { orderId, goodsId };
navigateTo(OrderRoutes.Comment, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L76-L79 | b116aadd3db074102c4d92240f1828e5a686dfda | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | packToFileFromPixelMap | 将PixelMap图片源编码后直接打包进文件。
@param source PixelMap-打包的PixelMap资源。
@param fd 文件描述符。
@param option 设置打包参数:
format 目标格式。当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。
quality JPEG编码中设定输出图片质量的参数,取值范围为0-100。
bufferSize 接收编码数据的缓冲区大小,单位为Byte。默认为10MB。bufferSize需大于编码后图片大小。
@returns | static packToFileFromPixelMap(source: image.PixelMap, fd: number, options: image.PackingOption): Promise<void> {
const imagePacker: image.ImagePacker = image.createImagePacker();
return imagePacker.packToFile(source, fd, options).finally(() => {
imagePacker.release(); //释放
});
} | AST#method_declaration#Left static packToFileFromPixelMap AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fd : ... | static packToFileFromPixelMap(source: image.PixelMap, fd: number, options: image.PackingOption): Promise<void> {
const imagePacker: image.ImagePacker = image.createImagePacker();
return imagePacker.packToFile(source, fd, options).finally(() => {
imagePacker.release();
});
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L218-L223 | 53ccab34db33817f053e4d4a91ef8b9ed70d0900 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/CombinedChartRenderer.ets | arkts | createRenderers | Creates the renderers needed for this combined-renderer in the required order. Also takes the DrawOrder into
consideration. | public createRenderers(): void {
this.mRenderers.clear();
let chart: CombinedChartModel = this.mChart as CombinedChartModel;
if (chart == null) {
return;
}
let orders: DrawOrder[] = chart.getDrawOrder();
for (let index = 0; index < orders.length; index++) {
if (!this.mAnimator ||... | AST#method_declaration#Left public createRenderers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expressi... | public createRenderers(): void {
this.mRenderers.clear();
let chart: CombinedChartModel = this.mChart as CombinedChartModel;
if (chart == null) {
return;
}
let orders: DrawOrder[] = chart.getDrawOrder();
for (let index = 0; index < orders.length; index++) {
if (!this.mAnimator ||... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/CombinedChartRenderer.ets#L48-L97 | ac9f429acf441ade96187ae6dc7b357d48e99c77 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | MaxCountType. include TOTAL_MAX_COUNT, PHOTO_MAX_COUNT and VIDEO_MAX_COUNT
@enum { number } MaxCountType
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum MaxCountType {
/**
* TOTAL_MAX_COUNT. total max count
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
TOTAL_MAX_COUNT = 0,
/**
* PHOTO_MAX_COUNT. photo max count
*
* @syscap SystemCapability.F... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum MaxCountType AST#enum_body#Left { /**
* TOTAL_MAX_COUNT. total max count
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_memb... | export declare enum MaxCountType {
TOTAL_MAX_COUNT = 0,
PHOTO_MAX_COUNT = 1,
VIDEO_MAX_COUNT = 2
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L705-L730 | 526a3fe71c699e6dd75446524d289cfe6f1e2cb1 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | fromString | 解析日期字符串 YYYY-MM-DD | static fromString(dateStr: string): CustomDate | null {
try {
const parts = dateStr.split('-');
if (parts.length !== 3) return null;
const year = parseInt(parts[0], 10);
const month = parseInt(parts[1], 10);
const day = parseInt(parts[2], 10);
if (isNaN(year) || isN... | AST#method_declaration#Left static fromString AST#parameter_list#Left ( AST#parameter#Left dateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ... | static fromString(dateStr: string): CustomDate | null {
try {
const parts = dateStr.split('-');
if (parts.length !== 3) return null;
const year = parseInt(parts[0], 10);
const month = parseInt(parts[1], 10);
const day = parseInt(parts[2], 10);
if (isNaN(year) || isN... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L201-L216 | 0579e244a11dc03e8b2e8f23ac6213bb505efd63 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | [Start stage_creat] | onWindowStageCreate(windowStage: window.WindowStage): void {
// [StartExclude stage_creat]
// Main window is created, set main page for this ability
Logger.info(TAG, `Ability onWindowStageCreate`);
try {
let windowClass: window.Window = windowStage.getMainWindowSync();
AppStorage.setOrCreate... | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage): void {
Logger.info(TAG, `Ability onWindowStageCreate`);
try {
let windowClass: window.Window = windowStage.getMainWindowSync();
AppStorage.setOrCreate('windowStage', windowStage);
windowClass.setWindowLayoutFullScreen(true).catch(... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/entryability/EntryAbility.ets#L35-L63 | 07f93714b150378d89a8602e50f7eb43ac452acd | gitee |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/viewmodel/SettingData.ets | arkts | 编辑屏保图片列表 | export const screenProPicList: ScreenProPicItemData[] = [
new ScreenProPicItemData(1, false, $r('app.media.screen_pro_pic1')),
new ScreenProPicItemData(2, false, $r('app.media.screen_pro_pic2')),
new ScreenProPicItemData(3, false, $r('app.media.screen_pro_pic3')),
new ScreenProPicItemData(4, false, $r('app.medi... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left screenProPicList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ScreenProPicItemData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal... | export const screenProPicList: ScreenProPicItemData[] = [
new ScreenProPicItemData(1, false, $r('app.media.screen_pro_pic1')),
new ScreenProPicItemData(2, false, $r('app.media.screen_pro_pic2')),
new ScreenProPicItemData(3, false, $r('app.media.screen_pro_pic3')),
new ScreenProPicItemData(4, false, $r('app.medi... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/SettingData.ets#L99-L109 | 6f8ed030d64bc5ebae5ec2ddab07362edca3c31f | github | |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/model/WeatherData.ets | arkts | 城市信息接口 | export interface CityInfo {
name: string;
id: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CityInfo AST#object_type#Left { AST#type_member#Left name : 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 id : AST#type_annotation#Left AST#pr... | export interface CityInfo {
name: string;
id: string;
} | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/model/WeatherData.ets#L12-L15 | 1e9ce291852327975af01e0c145ad57a6dd0b98a | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | allCases | 获取所有激励类型(类似Swift的CaseIterable协议) | static allCases(): EncourageType[] {
return [EncourageType.wordPronRewardAd, EncourageType.wordPronShareApp];
} | AST#method_declaration#Left static allCases AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EncourageType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement... | static allCases(): EncourageType[] {
return [EncourageType.wordPronRewardAd, EncourageType.wordPronShareApp];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L55-L57 | 2a7d3b4b1d5ee708dd44cb2ed67c8ac3a20c2dc1 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | clear_all_web_state | Web states
Clears all web states. | clear_all_web_state() {
// Clear extra files
try {
sandbox_rmdir_sync('continue');
sandbox_mkdir_sync('continue');
console.info(`[re_save_web_state] Clear web state (continue) directory OK!`);
} catch (e) {
console.error(`[re_save_web_state] Clear web state (continue) directory faile... | AST#method_declaration#Left clear_all_web_state AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // Clear extra files AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#... | clear_all_web_state() {
try {
sandbox_rmdir_sync('continue');
sandbox_mkdir_sync('continue');
console.info(`[re_save_web_state] Clear web state (continue) directory OK!`);
} catch (e) {
console.error(`[re_save_web_state] Clear web state (continue) directory failed!`);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L598-L607 | e9be7cbb2b9dd3c35022b182c096f8378bbe48bb | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets | arkts | @file 重置密码页面 ViewModel
@author Joker.X | @ObservedV2
export default class ResetPasswordViewModel extends BaseViewModel {
/**
* 更新手机号
* @param {string} value - 手机号
* @returns {void} 无返回值
*/
updatePhone(value: string): void {
}
/**
* 更新验证码
* @param {string} value - 验证码
* @returns {void} 无返回值
*/
updateVerificationCode(value: st... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class ResetPasswordViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 更新手机号
*... | @ObservedV2
export default class ResetPasswordViewModel extends BaseViewModel {
updatePhone(value: string): void {
}
updateVerificationCode(value: string): void {
}
updateNewPassword(value: string): void {
}
updateConfirmPassword(value: string): void {
}
onSendVerificationCode(): vo... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets#L7-L54 | 793ca03c4dd5e4314326a40f3f7ee74b27ec28a1 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets | arkts | addAssetAccount | 新增资产账户 | public async addAssetAccount(userData: UserAsset) {
const data: AssetTableBasis = {
assetId: new Date().getTime(),
name: userData.name,
type: userData.type,
subType: userData.subType,
category: userData.category,
amount: userData.amount,
note: userData.note ?? '',
};
... | AST#method_declaration#Left public async addAssetAccount AST#parameter_list#Left ( AST#parameter#Left userData : AST#type_annotation#Left AST#primary_type#Left UserAsset AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#vari... | public async addAssetAccount(userData: UserAsset) {
const data: AssetTableBasis = {
assetId: new Date().getTime(),
name: userData.name,
type: userData.type,
subType: userData.subType,
category: userData.category,
amount: userData.amount,
note: userData.note ?? '',
};
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L271-L299 | f4b3ccb2f5a5cebec72f125fa1a6e5c7ec03fb06 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | RowCenterBottom | 横向居中 + 垂直底部 | @ComponentV2
export struct RowCenterBottom {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
s... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowCenterBottom AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#... | @ComponentV2
export struct RowCenterBottom {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Len... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L705-L780 | f1d4f1f18acda6f928bb1931afb8152bc2e3de45 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/skeletondiagram/src/main/ets/model/Model.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class Model {
id: number;
uri: ResourceStr;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: ResourceStr, title: ResourceStr, content: ResourceStr, views: number, ... | AST#export_declaration#Left export AST#class_declaration#Left class Model AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#type_annotati... | export class Model {
id: number;
uri: ResourceStr;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: ResourceStr, title: ResourceStr, content: ResourceStr, views: number, ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/model/Model.ets#L16-L45 | 982e54ba9b91c1c439c96e746cf6248cddc24715 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/runtime-api/@koalaui.runtime.common.d.ets | arkts | @file
@kit ArkUI
@arkts 1.2 | export type KoalaCallsiteKey = int | AST#export_declaration#Left export AST#type_declaration#Left type KoalaCallsiteKey = AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right AST#type_declaration#Right AST#export_declaration#Right | export type KoalaCallsiteKey = int | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/runtime-api/@koalaui.runtime.common.d.ets#L21-L21 | 4b53bbe4e83c1b243b7e40235fb35591e5bcb18a | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | customContentDialog | 自定义内容区弹出框 | customContentDialog(index: number) {
if (index == 0) {
//简单使用,局部 @Builder
DialogHelper.showCustomContentDialog({
contentBuilder: () => {
this.customTextBuilder("我是一个自定义文本内的弹框!")
},
onAction: (action) => {
ToastUtil.showToast(`${action}`);
}
})
... | AST#method_declaration#Left customContentDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_s... | customContentDialog(index: number) {
if (index == 0) {
DialogHelper.showCustomContentDialog({
contentBuilder: () => {
this.customTextBuilder("我是一个自定义文本内的弹框!")
},
onAction: (action) => {
ToastUtil.showToast(`${action}`);
}
})
} else if (index... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L617-L660 | 43f06b9b82b94b9768b7f96f93f634e49429da67 | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 收藏文章
@param date
@returns | export function collectArticle(id: number) {
return axiosClient.post<any>({
url: `lg/collect/${id}/json`,
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | AST#export_declaration#Left export AST#function_declaration#Left function collectArticle AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#... | export function collectArticle(id: number) {
return axiosClient.post<any>({
url: `lg/collect/${id}/json`,
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L64-L71 | 0a87a638f3862c868db4d4e8bbdab68f7a2d6f09 | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/detail/GallerySwiper.ets | arkts | GallerySwiper | 商家详情页图片轮播组件
显示商家封面图
验收标准:需求 5.1
- 显示商家封面图 | @Component
export struct GallerySwiper {
@Prop coverUrl: string;
build() {
// 使用单张图片展示封面
Image(this.coverUrl)
.width('100%')
.height(300)
.objectFit(ImageFit.Cover)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GallerySwiper AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right coverUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_anno... | @Component
export struct GallerySwiper {
@Prop coverUrl: string;
build() {
Image(this.coverUrl)
.width('100%')
.height(300)
.objectFit(ImageFit.Cover)
}
} | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/detail/GallerySwiper.ets#L9-L20 | 2d3c288b26cc0713c137859452807369d5459502 | github |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/pages/HomePage.ets | arkts | SysStatusCard | 系统状态卡片构建起 | @Builder SysStatusCard() {
Column() {
// 卡片标题
Row({ space: 5 }) {
Image($r("app.media.icon_heartbeat"))
.width(20)
.height(20)
Text("系统状态")
.width(150)
.fontSize(13)
.fontWeight('bold')
}
.width('100%')
.height('25%')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SysStatusCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 卡片标题 AST#ark... | @Builder SysStatusCard() {
Column() {
Row({ space: 5 }) {
Image($r("app.media.icon_heartbeat"))
.width(20)
.height(20)
Text("系统状态")
.width(150)
.fontSize(13)
.fontWeight('bold')
}
.width('100%')
.height('25%')
... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/HomePage.ets#L119-L165 | c560c0de79015249e6d7ebcc1496b848c10118ee | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets | arkts | exists | 添加exists方法声明 | private async exists(path: string): Promise<boolean> {
// 实现文件存在检查
return fs.access(path).then(() => true).catch(() => false);
} | AST#method_declaration#Left private async exists AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | private async exists(path: string): Promise<boolean> {
return fs.access(path).then(() => true).catch(() => false);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets#L52-L55 | 52abb8c56c5851adfce45affa099f671dcbf8767 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | getFaultSign | 获取数据异常信息 | public static async getFaultSign(): Promise<void> {
logger.info(`getFaultMessage start`);
let faultSign: boolean = false;
try {
// TODO:知识点:通过dataPreferencesManager.get方法获取异常标识
const data: dataPreferences.ValueType = await dataPreferencesManager.get('faultSign', faultSign);
if (typeof data... | AST#method_declaration#Left public static async getFaultSign 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 ... | public static async getFaultSign(): Promise<void> {
logger.info(`getFaultMessage start`);
let faultSign: boolean = false;
try {
const data: dataPreferences.ValueType = await dataPreferencesManager.get('faultSign', faultSign);
if (typeof data === 'string') {
faultSign = JSON.parse(... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets#L111-L124 | a2809f2c27ffa29565d677f31e795ff5bb1d297d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Box.ets | arkts | compare | 比较两个Box对象的大小
@param lhs - 左侧Box对象
@param rhs - 右侧Box对象 | static compare(lhs: Box, rhs: Box): number {
return lhs.compareTo(rhs);
} | AST#method_declaration#Left static compare AST#parameter_list#Left ( AST#parameter#Left lhs : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rhs : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#t... | static compare(lhs: Box, rhs: Box): number {
return lhs.compareTo(rhs);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L137-L139 | b6a7f83b90d91ef42d009304e1427777c49adbcf | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/NotificationUtil.ets | arkts | clearNotice | 清理所所有通知 | static async clearNotice() {
await notificationManager.cancelAll();
} | AST#method_declaration#Left static async clearNotice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#exp... | static async clearNotice() {
await notificationManager.cancelAll();
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L403-L405 | 83f0f4d07439e298ca18931bc1bc7b5a4a58904d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/SearchPage.ets | arkts | aboutToAppear | 页面生命周期 - 即将出现 | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SearchPage aboutToAppear');
this.loadSearchHistory();
// 获取路由参数
const params = appRouter.getCurrentParams();
const searchType = params['searchType'] as string;
if (searchType) {
this.activeTab = searchType;
... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expre... | aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SearchPage aboutToAppear');
this.loadSearchHistory();
const params = appRouter.getCurrentParams();
const searchType = params['searchType'] as string;
if (searchType) {
this.activeTab = searchType;
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L42-L52 | 86faacfcaabc7296d499b1c2c275e359289216f2 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/LoadingView.ets | arkts | LoadingView | loading加载中组件 | @ComponentV2
export struct LoadingView {
@Require @Param options: ILoadingOptions;
@Local progressLocal?: LoadingObserved | undefined = undefined
aboutToAppear(): void {
this.progressLocal = this.options?.observedData as LoadingObserved;
// 改版hub后注释了 该缓存
// LRUCacheHelper.put(`${LRUCacheHelper.PRE_K... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#primary_type... | @ComponentV2
export struct LoadingView {
@Require @Param options: ILoadingOptions;
@Local progressLocal?: LoadingObserved | undefined = undefined
aboutToAppear(): void {
this.progressLocal = this.options?.observedData as LoadingObserved;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/LoadingView.ets#L8-L18 | a41a6c037b8cc8317cfe2ec0f6cdf92f82a146ae | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/flow_sensitive/loop_stmt/for_001_T.ets | arkts | Introduction 循环结构-for | export function for_001_T(taint_src : string) {
let res = ""
for (let i = 0; i < 1; i++) {
res = taint_src
taint.Sink(res)
}
} | AST#export_declaration#Left export AST#function_declaration#Left function for_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | export function for_001_T(taint_src : string) {
let res = ""
for (let i = 0; i < 1; i++) {
res = taint_src
taint.Sink(res)
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/for_001_T.ets#L6-L12 | f2f0b4a5078f3a4fe8fa202404d9a05759ffa3ed | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Rect.ets | arkts | set | Set the rectangle's coordinates to the specified values. Note: no range
checking is performed, so it is up to the caller to ensure that
left <= right and top <= bottom.
@param left The X coordinate of the left side of the rectangle
@param top The Y coordinate of the top of the rectangle
@param right The X coordi... | public set(left: number, top: number, right: number, bottom: number) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
} | AST#method_declaration#Left public set AST#parameter_list#Left ( AST#parameter#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left top : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS... | public set(left: number, top: number, right: number, bottom: number) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Rect.ets#L155-L160 | 29a5eb97223b8ea43941a562a17455c9c47091c8 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/pages/Index.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export async function withinHspTest( ): Promise<boolean> {
let lib = await import('../utils/Calc')
let res: boolean = false
if (lib.add(3, 5) == 8) {
res = true;
}
return res;
} | AST#export_declaration#Left export AST#function_declaration#Left async function withinHspTest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_t... | export async function withinHspTest( ): Promise<boolean> {
let lib = await import('../utils/Calc')
let res: boolean = false
if (lib.add(3, 5) == 8) {
res = true;
}
return res;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/src/main/ets/pages/Index.ets#L16-L23 | c017e6433797e3567d918d4258d225eea15648ae | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets | arkts | @file Token 本地存储数据源实现,基于 Preferences 封装
@author Joker.X | export class TokenStoreDataSourceImpl implements TokenStoreDataSource {
/**
* Preferences 工具实例
*/
private prefs: PreferencesUtil;
/**
* Preferences 文件名,用于存储 Token
*/
private static readonly PREFS_NAME: string = "token_store";
/**
* Token 键名
*/
private static readonly KEY_TOKEN: string = "t... | AST#export_declaration#Left export AST#class_declaration#Left class TokenStoreDataSourceImpl AST#implements_clause#Left implements TokenStoreDataSource AST#implements_clause#Right AST#class_body#Left { /**
* Preferences 工具实例
*/ AST#property_declaration#Left private prefs : AST#type_annotation#Left AST#primary_typ... | export class TokenStoreDataSourceImpl implements TokenStoreDataSource {
private prefs: PreferencesUtil;
private static readonly PREFS_NAME: string = "token_store";
private static readonly KEY_TOKEN: string = "token";
constructor(context?: common.Context) {
const resolvedContext: common.Context ... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets#L10-L58 | df5838a63359de6737a28d5774eef5ce742c016f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TabNode.ets | arkts | TabNode | 自定义组件复用池Swiper页面 | @Component
export struct TabNode {
minSize: number = 80;
maxSize: number = 180;
fontSize: number = 24;
@State index: number = 0;
scroller: Scroller = new Scroller();
dataSource: WaterFlowDataSource = new WaterFlowDataSource();
// FlowItem组件高度列表
private itemHeightArray: number[] = [];
// FlowItem组件宽度列表... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabNode AST#component_body#Left { AST#property_declaration#Left minSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#... | @Component
export struct TabNode {
minSize: number = 80;
maxSize: number = 180;
fontSize: number = 24;
@State index: number = 0;
scroller: Scroller = new Scroller();
dataSource: WaterFlowDataSource = new WaterFlowDataSource();
private itemHeightArray: number[] = [];
private itemWidthArray: number[... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TabNode.ets#L32-L58 | 41cbe823731fed0fd58f93f1d22385faef028071 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | common/src/main/ets/util/DeviceUtils.ets | arkts | 获取显示版本号
@return 显示版本号 | export function getDisplayVersion(): string {
return deviceInfo.displayVersion;
} | AST#export_declaration#Left export AST#function_declaration#Left function getDisplayVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Lef... | export function getDisplayVersion(): string {
return deviceInfo.displayVersion;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/DeviceUtils.ets#L39-L41 | 93c3bbd8b8954d53d58df0fca7bae3ebdf182348 | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/transform/MaskTransformation.ets | arkts | MaskTransformation | 图片变换:遮罩效果 | @Sendable
export class MaskTransformation extends PixelMapTransformation {
private mResourceId: number;
private mResourceModuleName: string;
constructor(resource: Resource) {
super();
this.mResourceId = resource.id;
this.mResourceModuleName = resource.moduleName;
}
getName(): string {
return... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class MaskTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private mResourceId :... | @Sendable
export class MaskTransformation extends PixelMapTransformation {
private mResourceId: number;
private mResourceModuleName: string;
constructor(resource: Resource) {
super();
this.mResourceId = resource.id;
this.mResourceModuleName = resource.moduleName;
}
getName(): string {
return... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/MaskTransformation.ets#L26-L199 | a83edabd4b9fc62df88ff23807f561872201b4ae | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets | arkts | SplitLayout | @file
@kit ArkUI
Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct SplitLayout {
/**
* Container in the user-defined splitlayout display area.
* @type { container: () => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Container in the user-defined splitlayout display area.
* @type { co... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SplitLayout AST#component_body#Left { /**
* Container in the user-defined splitlayout display area.
* @type { container: () => void }.
* @syscap SystemCapability.A... | @Component
export declare struct SplitLayout {
@BuilderParam
container: () => void;
@State
mainImage: ResourceStr;
@Prop
primaryText: ResourceStr;
@Prop
secondaryText?: ResourceStr;
@Prop
tertiaryText?: ResourceStr;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets#L30-L107 | 0f2638a3bfbfd7edfee2885af67906da5160a60b | github |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/common/EmptyState.ets | arkts | EmptyState | 空状态组件
显示空状态提示和引导文案 | @Component
export struct EmptyState {
@Prop message: string = '暂无内容';
@Prop hint: string = '';
private iconSize: number = 80;
build() {
Column() {
// 空状态图标(使用文本符号代替图片)
Text('📭')
.fontSize(this.iconSize)
.margin({ bottom: 16 })
// 主提示文案
Text(this.message)
.f... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmptyState AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati... | @Component
export struct EmptyState {
@Prop message: string = '暂无内容';
@Prop hint: string = '';
private iconSize: number = 80;
build() {
Column() {
Text('📭')
.fontSize(this.iconSize)
.margin({ bottom: 16 })
Text(this.message)
.fontSize(16)
.fontCol... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/EmptyState.ets#L6-L38 | 9c850fb6b972f51dedebbdfe9b56921b68cbdaa9 | github |
Million-mo/tree-sitter-arkts.git | 2fd0ad75e2d848709edcf4be038f27b178114ef6 | examples/decorators_complete.ets | arkts | ExportedBuilder | @Builder export - 导出的构建函数 | @Builder
export function ExportedBuilder(content: string) {
Row() {
Text(content)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ExportedBuilder AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | @Builder
export function ExportedBuilder(content: string) {
Row() {
Text(content)
}
} | https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/decorators_complete.ets#L141-L146 | 9915ea3ffef0d6beafd977cfa155c3e372c2d45e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/AVCodec/entry/src/main/ets/common/utils/DateTimeUtils.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class DateTimeUtil {
getTime(): string {
const DATETIME = new Date();
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds());
}
getDate(): string {
const DATETIME = new Date();
return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1... | AST#export_declaration#Left export default AST#class_declaration#Left class DateTimeUtil AST#class_body#Left { AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_state... | export default class DateTimeUtil {
getTime(): string {
const DATETIME = new Date();
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds());
}
getDate(): string {
const DATETIME = new Date();
return this.concatDate(DATETIME.getFullYear(), DATETIME.getMonth() + 1... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVCodec/entry/src/main/ets/common/utils/DateTimeUtils.ets#L16-L38 | 1d40430cc7e39ecfc05937870d83e9a6d017ffbd | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets | arkts | Folder type enum. | export enum FolderType {
All = 'all',
Work = 'work',
Personal = 'personal'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum FolderType AST#enum_body#Left { AST#enum_member#Left All = AST#expression#Left 'all' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Work = AST#expression#Left 'work' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Per... | export enum FolderType {
All = 'all',
Work = 'work',
Personal = 'personal'
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets#L27-L31 | 02259f0cea9d1fa84cd0b06c27b20e24219a306f | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/model/Contact.ets | arkts | Contact | 单个通讯录所有字段信息
TODO:知识点:Sendable对象可以在不同并发实例间通过引用传递,相比序列化方式更加高效。 | @Sendable
export class Contact {
id: number; // 序号
name: string; // 名字
phone: string; // 电话号码
email: string; // 邮箱
address: string; // 地址
avatar: string; // 头像
category: string; // 分类
constructor(id: number = -1, name: string = '', phone: string = '', email: string = '', address: string = '',
avatar... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class Contact AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 序号 AST#property... | @Sendable
export class Contact {
id: number;
name: string;
phone: string;
email: string;
address: string;
avatar: string;
category: string;
constructor(id: number = -1, name: string = '', phone: string = '', email: string = '', address: string = '',
avatar: string = '', category: string = '')... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/model/Contact.ets#L21-L40 | 7d9a7640b08774bc819300352a68323b19feec8b | gitee |
kaikaiGit/chatAI.git | 2a9244d932d3463125dc9f83bf424a1e1153cb2c | entry/src/main/models/XunFeiAI.ets | arkts | AI对话API的请求体类型 | export interface XunFeiRequest {
model: string,
messages: Array<Message>,
top_k: number,
stream: boolean
} | AST#export_declaration#Left export AST#interface_declaration#Left interface XunFeiRequest AST#object_type#Left { AST#type_member#Left model : 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 messages : AST#type_annotation... | export interface XunFeiRequest {
model: string,
messages: Array<Message>,
top_k: number,
stream: boolean
} | https://github.com/kaikaiGit/chatAI.git/blob/2a9244d932d3463125dc9f83bf424a1e1153cb2c/entry/src/main/models/XunFeiAI.ets#L2-L7 | 1947048e509afa7afafc866e3446c318280ebd6b | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets | arkts | decodingImage | 图片解码
@param decodingType 解码类型(0:AUTO,1:SDR,2:HDR)
@returns | async decodingImage(decodingType:number):Promise<void>{
logger.info(TAG, 'decodingImage start');
let decodingOptions: image.DecodingOptions = {
editable: true,
desiredDynamicRange: decodingType
};
logger.debug(TAG, `decoding Type = ${decodingType}`);
this.pixelMap = await readImage(this.... | AST#method_declaration#Left async decodingImage AST#parameter_list#Left ( AST#parameter#Left decodingType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async decodingImage(decodingType:number):Promise<void>{
logger.info(TAG, 'decodingImage start');
let decodingOptions: image.DecodingOptions = {
editable: true,
desiredDynamicRange: decodingType
};
logger.debug(TAG, `decoding Type = ${decodingType}`);
this.pixelMap = await readImage(this.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L268-L289 | 94f609fa67ff9ef4b42012ef2827bd7ad8df6008 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets | arkts | aboutToAppear | 拼接完成进行展示的属性字符串 | aboutToAppear(): void {
// 处理文本
this.handleStyledString();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 处理文本 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#ex... | aboutToAppear(): void {
this.handleStyledString();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L54-L57 | cb4fb14165daaadbda8cdd03213f52274cf61029 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/SQL/sqloperate.ets | arkts | usersOP | export function insertdata(name:string,account:string,password:string,email:string,url:string,backurl:string){
//实现数据库保存
const STORE_CONFIG :relationalStore.StoreConfig= {
name: 'campus.db', // 数据库文件名
securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别
};
const valueBucket1: relationalStore.Val... | AST#export_declaration#Left export AST#function_declaration#Left function insertdata AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left account : AST#type_annotation#Left AST#... | export function insertdata(name:string,account:string,password:string,email:string,url:string,backurl:string){
const STORE_CONFIG :relationalStore.StoreConfig= {
name: 'campus.db',
securityLevel: relationalStore.SecurityLevel.S3,
};
const valueBucket1: relationalStore.ValuesBucket = {
'NAME':nam... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/SQL/sqloperate.ets#L51-L77 | 4da2df2c639ee0d2ab17306cbf3254013460c36d | gitee | |
HunZiLei/ArtTs_PokeAccountBook.git | 3d91db931f5dd6cea3c6cd414fad7c28942a58ac | entry/src/main/ets/pages/sumPage.ets | arkts | /*页面跳转动画 pageTransition() { PageTransitionEnter({ duration: 400, curve: Curve.Ease }) .slide(SlideEffect.Left) PageTransitionExit({ duration: 400, curve: Curve.Ease }) } | build() {
Stack() {
Column() {
//标题 & 编辑按钮
Row() {
Text($r('app.string.mainPage_title'))
.fontColor(Color.White)
.height(30)
.fontSize(30)
.margin({ left: 24,bottom:'50vp' })
}
.sharedTransition('title', { duration: 500,... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { //标题 & 编辑按钮... | build() {
Stack() {
Column() {
Row() {
Text($r('app.string.mainPage_title'))
.fontColor(Color.White)
.height(30)
.fontSize(30)
.margin({ left: 24,bottom:'50vp' })
}
.sharedTransition('title', { duration: 500, curve: Cur... | https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/pages/sumPage.ets#L70-L246 | 5d168c69fddb64f31f54f4094b8ce12e6857bd2b | github | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/pages/Advertising.ets | arkts | onPageShow | 生命周期函数 | onPageShow() {
this.endTime = setInterval(async () => {
if (this.countDownSeconds === CommonConstant.ADVERTISING_END_TIME) {
// 清除定时器
clearInterval(this.endTime);
// 获取对应的token等数据
const token = PreferencesUtil.getData(CommonConstant.PREFERENCES_NAME, CommonConstant.TOKEN_NAME, ... | AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right = A... | onPageShow() {
this.endTime = setInterval(async () => {
if (this.countDownSeconds === CommonConstant.ADVERTISING_END_TIME) {
clearInterval(this.endTime);
const token = PreferencesUtil.getData(CommonConstant.PREFERENCES_NAME, CommonConstant.TOKEN_NAME, '')
const userIn... | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/pages/Advertising.ets#L17-L35 | 7680365bc4f613f01eb3c99f29dc24c4168fe53d | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets | arkts | drawCornerButton | Draw corner line.
@param ctx
@param crop
@param vp3
@param padding
@param cornerLength | private static drawCornerButton(ctx: CanvasRenderingContext2D, crop: RectF,
vp3: number, padding: number, cornerLength: number) {
// left top conner button
vp3 = vp3 / 2;
let startX = crop.left - vp3 - padding;
let startY = crop.top - vp3;
let stopX = startX + corne... | AST#method_declaration#Left private static drawCornerButton AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left crop : AST#type_annotation#Left AST#primary_typ... | private static drawCornerButton(ctx: CanvasRenderingContext2D, crop: RectF,
vp3: number, padding: number, cornerLength: number) {
vp3 = vp3 / 2;
let startX = crop.left - vp3 - padding;
let startY = crop.top - vp3;
let stopX = startX + cornerLength;
let stopY = ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets#L118-L168 | c8b142c4919d103fbac4e0d78d9fd4e7a21e115b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets | arkts | showToast | 弹窗函数 | showToast() {
promptAction.showToast({
message: $r('app.string.citysearch_only_show_for_ux')
})
} | AST#method_declaration#Left showToast AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#memb... | showToast() {
promptAction.showToast({
message: $r('app.string.citysearch_only_show_for_ux')
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/view/CitySearch.ets#L85-L89 | fe28cc3b647b7644b75954b3ea734ef734e2d831 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets | arkts | onSave | 保存图片 | async onSave(): Promise<void> {
if (this.pixelMapDst !== undefined && this.pixelMapDst !== null) {
try {
promptAction.showDialog({
alignment: DialogAlignment.Center,
isModal: false,
message: $r('app.string.image_depthcopy_save_confirm'),
buttons: [
{... | AST#method_declaration#Left async onSave 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_arguments... | async onSave(): Promise<void> {
if (this.pixelMapDst !== undefined && this.pixelMapDst !== null) {
try {
promptAction.showDialog({
alignment: DialogAlignment.Center,
isModal: false,
message: $r('app.string.image_depthcopy_save_confirm'),
buttons: [
{... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets#L71-L113 | fd25972ac7b72bd793bd0baa78227affbea72cf3 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageTV.ets | arkts | PageTV | Tab content of TV. | @Component
export struct PageTV {
build() {
Column() {
Text($r('app.string.TV'))
.height(CommonConstants.FULL_HEIGHT)
.fontSize(CommonConstants.FONT_SIZE_PAGE_CONTENT)
.fontWeight(CommonConstants.FONT_WEIGHT_LIGHT)
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConsta... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageTV AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AS... | @Component
export struct PageTV {
build() {
Column() {
Text($r('app.string.TV'))
.height(CommonConstants.FULL_HEIGHT)
.fontSize(CommonConstants.FONT_SIZE_PAGE_CONTENT)
.fontWeight(CommonConstants.FONT_WEIGHT_LIGHT)
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConsta... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/tabcontent/PageTV.ets#L21-L33 | 1458baf7a7beb1392f7a547e346d668f6be1ed62 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | hwaccel | 启用硬件加速(硬解+硬编) | public hwaccel(): FFmpegCommandBuilder {
this.useHwDecode = true;
this.useHwEncode = true;
return this;
} | AST#method_declaration#Left public hwaccel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_express... | public hwaccel(): FFmpegCommandBuilder {
this.useHwDecode = true;
this.useHwEncode = true;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L56-L60 | ecc811da033be7c171c9a4291719dff0963b2672 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getRawFileContentSync | 获取resources/rawfile目录下对应的rawfile文件内容
@param path rawfile文件路径
@returns | static getRawFileContentSync(path: string): Uint8Array {
return ResUtil.getResourceManager().getRawFileContentSync(path);
} | AST#method_declaration#Left static getRawFileContentSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array A... | static getRawFileContentSync(path: string): Uint8Array {
return ResUtil.getResourceManager().getRawFileContentSync(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L428-L430 | 8324caef7972f4956109c5e8d75490df6866c5fd | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | private background: Color | string | number | Resource | null = null; private workerInstance = new worker.ThreadWorker("workers/worker.js", { name: "chart worker" });
default constructor for initialization in code | constructor() {
// this.init();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // this.init(); } AST#block_statement#Right AST#constructor_declaration#Right | constructor() {
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L169-L171 | e092a40a7b72a0aaa400c594606067209a9d1888 | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | update | 根据动画转场参数播放动画转场效果 | private update(modifier: NavAnimationModifier, param: INavSingleAnimationParam | undefined) {
const proxy = NavAnimationStore.getInstance().getProxy()
if (param) {
if (param.startCallback) {
param.startCallback(modifier, proxy)
}
if (param.endCallback) {
// 直接调用param?.animatePa... | AST#method_declaration#Left private update AST#parameter_list#Left ( AST#parameter#Left modifier : AST#type_annotation#Left AST#primary_type#Left NavAnimationModifier AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#union_type#Left AST#primar... | private update(modifier: NavAnimationModifier, param: INavSingleAnimationParam | undefined) {
const proxy = NavAnimationStore.getInstance().getProxy()
if (param) {
if (param.startCallback) {
param.startCallback(modifier, proxy)
}
if (param.endCallback) {
const expected... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L465-L501 | b39e2178215fbd00c0caae004328bcae12044650 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets | arkts | deleteReminder | Adding and modifying alarm reminders
@param reminderId number | public deleteReminder(reminderId: number) {
reminderAgent.cancelReminder(reminderId);
} | AST#method_declaration#Left public deleteReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left... | public deleteReminder(reminderId: number) {
reminderAgent.cancelReminder(reminderId);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/model/ReminderService.ets#L56-L58 | 166273139aaac55e8b695f1a5d33d5f999353f15 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/view/TabsWaterFlowView.ets | arkts | 通过瀑布流和LazyForeach加载
WaterFlow+LazyForEach详细用法可参考性能范例:
https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/waterflow_optimization.md/ | build() {
Column() {
Tabs({ controller: this.tabsController }) {
ForEach(TAB_DATA, (tabItem: TabDataModel) => {
TabContent() {
this.dragWaterFlow();
}
.tabBar(SubTabBarStyle.of(tabItem.navData)
.indicator({ color: Color.Black })
.paddin... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tabs ( AST#component_parameters#Left { AST#component_pa... | build() {
Column() {
Tabs({ controller: this.tabsController }) {
ForEach(TAB_DATA, (tabItem: TabDataModel) => {
TabContent() {
this.dragWaterFlow();
}
.tabBar(SubTabBarStyle.of(tabItem.navData)
.indicator({ color: Color.Black })
.paddin... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/view/TabsWaterFlowView.ets#L155-L184 | d299c8f0b32b49520c7fb594083d974e09e5da1e | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 上下文因子接口 | export interface ContextualFactors {
currentSeason: string;
currentWeather: string;
timeOfDay: string;
dayOfWeek: string;
isHoliday: boolean;
culturalEvents: string[];
trendingTopics: string[];
socialContext: string[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ContextualFactors AST#object_type#Left { AST#type_member#Left currentSeason : 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 currentWeather : A... | export interface ContextualFactors {
currentSeason: string;
currentWeather: string;
timeOfDay: string;
dayOfWeek: string;
isHoliday: boolean;
culturalEvents: string[];
trendingTopics: string[];
socialContext: string[];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L170-L179 | 6f52fe99297e3e6488bb9dc332beda736dc9280b | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | query | 查询数据
@param tableName 表名
@param columns 查询列
@param whereClause 条件子句
@param whereArgs 条件参数
@param orderBy 排序
@param limit 限制条数
@param offset 偏移量
@returns 查询结果 | async query(
tableName: string,
columns?: Array<string>,
whereClause?: string,
whereArgs?: Array<string>,
orderBy?: string,
limit?: number,
offset?: number
): Promise<Record<string, relationalStore.ValueType>[]> {
try {
this.checkInitialized();
const predicates = new... | AST#method_declaration#Left async query AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | async query(
tableName: string,
columns?: Array<string>,
whereClause?: string,
whereArgs?: Array<string>,
orderBy?: string,
limit?: number,
offset?: number
): Promise<Record<string, relationalStore.ValueType>[]> {
try {
this.checkInitialized();
const predicates = new... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L334-L437 | 4e1fc56af44d0202bf8654120ca13e1edbba95e0 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/TimerPage.ets | arkts | StopwatchContent | 秒表内容 | @Builder
StopwatchContent() {
Column() {
// 大数字显示
Column() {
Text(this.formatStopwatchTime())
.fontSize(64)
.fontWeight(FontWeight.Bold)
.fontFamily('monospace')
.fontColor('#1A1A1A')
.letterSpacing(4)
}
.width('100%')
.paddin... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StopwatchContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 大数字显示 AST... | @Builder
StopwatchContent() {
Column() {
Column() {
Text(this.formatStopwatchTime())
.fontSize(64)
.fontWeight(FontWeight.Bold)
.fontFamily('monospace')
.fontColor('#1A1A1A')
.letterSpacing(4)
}
.width('100%')
.padding({ top:... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TimerPage.ets#L126-L268 | 960fdbfb69291ad38da4b2e4de87aa507c3bbc37 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/TodoTypes.ets | arkts | 代办事项相关类型定义
代办事项优先级枚举 | export enum TodoPriority {
LOW = 'low',
MEDIUM = 'medium',
HIGH = 'high',
URGENT = 'urgent'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TodoPriority AST#enum_body#Left { AST#enum_member#Left LOW = AST#expression#Left 'low' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MEDIUM = AST#expression#Left 'medium' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le... | export enum TodoPriority {
LOW = 'low',
MEDIUM = 'medium',
HIGH = 'high',
URGENT = 'urgent'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L6-L11 | 4f88cc868d0f57c88cc587cbe0a67dceaf5af9c6 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileSample/entry/src/main/ets/entryability/EntryAbility.ets | arkts | 日志标签 | export default class EntryAbility extends UIAbility {
async onNewWant(want: Want): Promise<void> {
Logger.info('Received want object:' + JSON.stringify(want));
// 获取分享文件的 URI
let uri: string | undefined = want.uri;
await AppStorage.setOrCreate('URI', uri);
if (uri === '') {
Logger.info('uri ... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left async onNewWant AST#parameter_list#Left ( AST#parameter#Left want :... | export default class EntryAbility extends UIAbility {
async onNewWant(want: Want): Promise<void> {
Logger.info('Received want object:' + JSON.stringify(want));
let uri: string | undefined = want.uri;
await AppStorage.setOrCreate('URI', uri);
if (uri === '') {
Logger.info('uri is invalid');
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/entryability/EntryAbility.ets#L23-L70 | ee8d8993e99e5d293d40e763d804a966488245d4 | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/UserService.ets | arkts | getPlayHistory | 获取播放历史 | async getPlayHistory(): Promise<PlayHistory[]> {
if (!this.currentUser) {
return [];
}
try {
const historyData = await this.cloudDBService.getUserPlayHistory(this.currentUser.id);
return historyData.map(data => PlayHistory.fromCloudObject(data));
} catch (error) {
console.er... | AST#method_declaration#Left async getPlayHistory 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 PlayHistory [ ] AST#array_type#Right AST#prima... | async getPlayHistory(): Promise<PlayHistory[]> {
if (!this.currentUser) {
return [];
}
try {
const historyData = await this.cloudDBService.getUserPlayHistory(this.currentUser.id);
return historyData.map(data => PlayHistory.fromCloudObject(data));
} catch (error) {
console.er... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L144-L156 | f2aab9628cbd88b23477d277419dad5bc35549b6 | github |
dividez/harmonyos-games.git | 78482622646cb5294d06c0aab1571f31b308b24c | features/number/src/main/ets/services/PreferencesUtil.ets | arkts | getPreference | 使用Preferences的get方法读取数据 | async getPreference(key: string) {
let result: dataPreferences.ValueType = '';
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.get(key, '').then((data) => {
result = data;
console.info(`Succeeded in getting value`);
}).catch((err: ... | AST#method_declaration#Left async getPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | async getPreference(key: string) {
let result: dataPreferences.ValueType = '';
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.get(key, '').then((data) => {
result = data;
console.info(`Succeeded in getting value`);
}).catch((err: ... | https://github.com/dividez/harmonyos-games.git/blob/78482622646cb5294d06c0aab1571f31b308b24c/features/number/src/main/ets/services/PreferencesUtil.ets#L43-L56 | c49ae74b4d464055fa1c30bbbd368e0c36c72dce | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/Index.ets | arkts | AddressPickerSamplePage | 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 { AddressPickerSamplePage } from './src/main/ets/pages/AddressPickerSample'; | AST#export_declaration#Left export { AddressPickerSamplePage } from './src/main/ets/pages/AddressPickerSample' ; AST#export_declaration#Right | export { AddressPickerSamplePage } from './src/main/ets/pages/AddressPickerSample'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/Index.ets#L16-L16 | 4fdd072b879498932f08705ac927c3327c7c569f | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets | arkts | handleCollected | 6.Handling interface like interaction logic: when the state collectedIds received using the @StorageLink decorator are modified, the new values are synchronized to AppStorage | handleCollected(): void {
// [StartExclude Case5]
const resourceId = this.articleItem.id;
// [EndExclude Case5]
const index = this.collectedIds.findIndex((id: string) => id === this.articleItem.id);
if (index === -1) {
this.collectedIds.push(resourceId);
} else {
this.collectedIds.sp... | AST#method_declaration#Left handleCollected AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // [StartExclude Case5] AST#statement#Left AST#variable_declaration#Left const AST#variable_d... | handleCollected(): void {
const resourceId = this.articleItem.id;
const index = this.collectedIds.findIndex((id: string) => id === this.articleItem.id);
if (index === -1) {
this.collectedIds.push(resourceId);
} else {
this.collectedIds.splice(index, 1);
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets#L83-L94 | 464514804c44ef0afe41d97163ee57a84118a2ef | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/view/IndexModule.ets | arkts | VideoModule | The modules in index | @Component
export struct VideoModule {
private moduleName: string = '';
build() {
Column() {
Flex({ direction: FlexDirection.Row }) {
Text(this.moduleName)
.fontSize(MARGIN_FONT_SIZE.THIRD_MARGIN)
.fontWeight(FontWeight.Bolder)
}
.margin({
left: STRING_PERC... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoModule AST#component_body#Left { AST#property_declaration#Left private moduleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' ... | @Component
export struct VideoModule {
private moduleName: string = '';
build() {
Column() {
Flex({ direction: FlexDirection.Row }) {
Text(this.moduleName)
.fontSize(MARGIN_FONT_SIZE.THIRD_MARGIN)
.fontWeight(FontWeight.Bolder)
}
.margin({
left: STRING_PERC... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/IndexModule.ets#L30-L72 | f8a48f987d4186b025b0d608150982de2a61fdbb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ObjectUtil.ets | arkts | isEmpty | 判断属性内容是否为空
@param property
@returns | static isEmpty(property: CommonAllType): boolean {
if (ObjectUtil.isNull(property)) {
return true
} else if (Array.isArray(property) || property instanceof Array) {
return property.length === 0
} else if (property instanceof List) {
return property.isEmpty()
} else if (property instanc... | AST#method_declaration#Left static isEmpty AST#parameter_list#Left ( AST#parameter#Left property : AST#type_annotation#Left AST#primary_type#Left CommonAllType 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#pri... | static isEmpty(property: CommonAllType): boolean {
if (ObjectUtil.isNull(property)) {
return true
} else if (Array.isArray(property) || property instanceof Array) {
return property.length === 0
} else if (property instanceof List) {
return property.isEmpty()
} else if (property instanc... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L85-L98 | 73de14cdffa6c39fedc84b67ab35a9a4ffa1092c | gitee |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/StorageUtil.ets | arkts | saveSelectedCity | 保存选择的城市 | static async saveSelectedCity(cityName: string, cityId: string): Promise<boolean> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return false;
}
await StorageUtil.prefs.put(StorageKeys.LAST_CITY_NAME, cityName);
await StorageUti... | AST#method_declaration#Left static async saveSelectedCity AST#parameter_list#Left ( AST#parameter#Left cityName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cityId : AST#type_annotation#Left AST#primary_type#Left string... | static async saveSelectedCity(cityName: string, cityId: string): Promise<boolean> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return false;
}
await StorageUtil.prefs.put(StorageKeys.LAST_CITY_NAME, cityName);
await StorageUti... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L43-L60 | abfac01b83f96d884fe844ddf94fc2716129d352 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.