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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/constants/StorageKeys.ets | arkts | 项目通用存储Key | export class StorageKeys {
static readonly APP_KEY = "app_key";
static readonly USER_INFO_KEY = "user_info_key";
static readonly USER_LOGIN = "user_login";
} | AST#export_declaration#Left export AST#class_declaration#Left class StorageKeys AST#class_body#Left { AST#property_declaration#Left static readonly APP_KEY = AST#expression#Left "app_key" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly USER_INFO_KEY = AST#expression#L... | export class StorageKeys {
static readonly APP_KEY = "app_key";
static readonly USER_INFO_KEY = "user_info_key";
static readonly USER_LOGIN = "user_login";
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/constants/StorageKeys.ets#L4-L8 | 9ec217d443b63964d691ef4595efa03935db4e66 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildTestSection | 构建测试连接区域 | @Builder
buildTestSection() {
Column({ space: 16 }) {
Text('测试连接')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
// 测试结果
if (this.testResult) {
Text(this.testResult)
.fontSize(14)
.fontC... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTestSection 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#component_parameters#Left { AST#component_pa... | @Builder
buildTestSection() {
Column({ space: 16 }) {
Text('测试连接')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
if (this.testResult) {
Text(this.testResult)
.fontSize(14)
.fontColor(th... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L458-L494 | 89b36621f69446494e7fdad1ea426ee9a05127d0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangSeekBarListener.ets | arkts | 视频剪辑长度侦听接口 | export interface RangSeekBarListener {
// 视频剪辑范围发生变动
onRangeSeekBarValuesChanged: (minValue: number, maxValue: number) => void
onRangeSeekBarScrollChanged: (startPosition: number, endPosition: number) => void
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RangSeekBarListener AST#object_type#Left { // 视频剪辑范围发生变动 AST#type_member#Left onRangeSeekBarValuesChanged : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left minValue : AST#type_annotation#Left AST#pri... | export interface RangSeekBarListener {
onRangeSeekBarValuesChanged: (minValue: number, maxValue: number) => void
onRangeSeekBarScrollChanged: (startPosition: number, endPosition: number) => void
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangSeekBarListener.ets#L20-L24 | e57a40c070cbe398cd35fbf90d49f1c0b1d48482 | gitee | |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/DateUtils.ets | arkts | 获取本年的第一天的日期 | export function getFirstDateOfThisYear(date: Date | number): Date {
// 如果输入的日期是数字,将其转换为日期对象
if (typeof date === 'number') {
date = new Date(date)
}
// 返回本年的第一天的日期
return new Date(date.getFullYear(), 0)
} | AST#export_declaration#Left export AST#function_declaration#Left function getFirstDateOfThisYear AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right A... | export function getFirstDateOfThisYear(date: Date | number): Date {
if (typeof date === 'number') {
date = new Date(date)
}
return new Date(date.getFullYear(), 0)
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L106-L113 | 8ec4acb85d249f2c855ba1209e6b0ad5f2ea1a5f | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/richEditor/SetAttributes.ets | arkts | 自定义SelectionMenuTheme接口 | export interface SelectionMenuTheme {
imageSize: number;
buttonSize: number;
menuSpacing: number;
editorOptionMargin: number;
expandedOptionPadding: number;
defaultMenuWidth: number;
imageFillColor: Resource;
backGroundColor: Resource;
iconBorderRadius: Resource;
containerBorderRadius: Resource;
c... | AST#export_declaration#Left export AST#interface_declaration#Left interface SelectionMenuTheme AST#object_type#Left { AST#type_member#Left imageSize : 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 buttonSize : AST#type... | export interface SelectionMenuTheme {
imageSize: number;
buttonSize: number;
menuSpacing: number;
editorOptionMargin: number;
expandedOptionPadding: number;
defaultMenuWidth: number;
imageFillColor: Resource;
backGroundColor: Resource;
iconBorderRadius: Resource;
containerBorderRadius: Resource;
c... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/richEditor/SetAttributes.ets#L20-L41 | 81c85ccb57cd30c7891ccee121b3d1ca2a12ac6e | gitee | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/LoginPage.ets | arkts | handleSubmit | 处理提交 | async handleSubmit() {
if (this.isLoading) {
return;
}
// 验证输入
if (!this.username.trim()) {
this.errorMessage = '请输入用户名';
return;
}
if (!this.password.trim()) {
this.errorMessage = '请输入密码';
return;
}
this.isLoading = true;
this.errorMessage = '';
... | AST#method_declaration#Left async handleSubmit AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right AST#expression... | async handleSubmit() {
if (this.isLoading) {
return;
}
if (!this.username.trim()) {
this.errorMessage = '请输入用户名';
return;
}
if (!this.password.trim()) {
this.errorMessage = '请输入密码';
return;
}
this.isLoading = true;
this.errorMessage = '';
try {
... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/LoginPage.ets#L168-L210 | 2e736939d59031ce7502cd84fd7604c6c5cf9f6a | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | getXMax | Returns the maximum x-value this data object contains.
@return | public getXMax(): number {
return this.mXMax;
} | AST#method_declaration#Left public getXMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressio... | public getXMax(): number {
return this.mXMax;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L261-L263 | fbdbb64517bac5ffaf01eca5c1d58032cd4e3d72 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@returns | static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets#L73-L75 | f9f675f8d3d3730e623d0e73fcf92027027cafa7 | gitee |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/Index.ets | arkts | SwipeCardStack | ArkSwipeDeck 滑动卡片组件库
对外导出的主要API
遵循ArkTS严格语法规范
@since 1.0.0
@syscap SystemCapability.ArkUI.ArkUI.Full
导出主要组件 | export { SwipeCardStack } from './src/main/ets/components/SwipeCardStack'; | AST#export_declaration#Left export { SwipeCardStack } from './src/main/ets/components/SwipeCardStack' ; AST#export_declaration#Right | export { SwipeCardStack } from './src/main/ets/components/SwipeCardStack'; | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/Index.ets#L12-L12 | 3977319361f693a84ce79c98ec4790756f3d0788 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | earnedEncourageCount | 获取已获得的每日奖励次数(对应Swift的earnedEncourageCount方法) | public earnedEncourageCount(type: EncourageType): number {
const prefs = this.getPrefs();
const key = EncourageTypeHelper.getKeyWithToday(type);
const value = prefs.getSync(key, 0) as number;
return value ?? 0;
} | AST#method_declaration#Left public earnedEncourageCount AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left EncourageType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number... | public earnedEncourageCount(type: EncourageType): number {
const prefs = this.getPrefs();
const key = EncourageTypeHelper.getKeyWithToday(type);
const value = prefs.getSync(key, 0) as number;
return value ?? 0;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L185-L191 | 942513907aea3f729109504c0855188e1745a67d | github |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/StorageUtil.ets | arkts | getStorageInfo | 获取存储统计信息(用于调试) | static async getStorageInfo(): Promise<StorageInfo> {
try {
const lastCity = await StorageUtil.getLastCity();
const favorites = await StorageUtil.getFavoriteCities();
return {
lastCity,
favorites,
favoritesCount: favorites.length
};
} catch (error) {
consol... | AST#method_declaration#Left static async getStorageInfo 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 StorageInfo AST#primary_type#Right AST#type_annotation#Righ... | static async getStorageInfo(): Promise<StorageInfo> {
try {
const lastCity = await StorageUtil.getLastCity();
const favorites = await StorageUtil.getFavoriteCities();
return {
lastCity,
favorites,
favoritesCount: favorites.length
};
} catch (error) {
consol... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L143-L161 | b3ee58ea0de45c57c0a89a43120a8d16d3edc392 | github |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/common/utils/HttpUtil.ets | arkts | post | POST 请求 | static async post<T>(url: string, data: Record<string, string | number | boolean>): Promise<T> {
return HttpUtil.request<T>(url, http.RequestMethod.POST, data);
} | AST#method_declaration#Left static async post AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#... | static async post<T>(url: string, data: Record<string, string | number | boolean>): Promise<T> {
return HttpUtil.request<T>(url, http.RequestMethod.POST, data);
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/HttpUtil.ets#L11-L13 | 20784b85fce4b55ead9d8f9dace798b68543c47f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | getTrendStats | 获取趋势统计 | async getTrendStats(): Promise<TrendStats> {
// 联系人增长趋势(最近12个月)
const contactsGrowth = await this.calculateContactsGrowth(12);
// 祝福语增长趋势
const greetingsGrowth = await this.calculateGreetingsGrowth(12);
// 使用量增长趋势
const usageGrowth = await this.calculateUsageGrowth(12);
// 月度活... | AST#method_declaration#Left async getTrendStats 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 TrendStats AST#primary_type#Right AST#type_annotation#Right > AST#t... | async getTrendStats(): Promise<TrendStats> {
const contactsGrowth = await this.calculateContactsGrowth(12);
const greetingsGrowth = await this.calculateGreetingsGrowth(12);
const usageGrowth = await this.calculateUsageGrowth(12);
const monthlyActivity = await this.calc... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L564-L583 | 29a9b964c0fcf34bdf810e38bf53bcd8b0bf9e11 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets | arkts | pushIndex | 跳转至Index页面 | pushIndex(): void {
router.pushUrl({
url: 'pages/NewIndex',
params: {
'userId': this.userId,
'socketType': this.socketType[this.selectAgreementIndex]
}
});
} | AST#method_declaration#Left pushIndex AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Lef... | pushIndex(): void {
router.pushUrl({
url: 'pages/NewIndex',
params: {
'userId': this.userId,
'socketType': this.socketType[this.selectAgreementIndex]
}
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L192-L200 | 55602a0feaa08233ab5214215b7dce84a1642137 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/util/MosaicTaskUtil.ets | arkts | genPixelMap | 根据输入的像素图生成马赛克像素图
@param pixelMap 输入像素图
@returns Promise<PixelMap | undefined> | static async genPixelMap(pixelMap: PixelMap): Promise<PixelMap | undefined> {
Logger.i(MODULE, TAG, 'genPixelMap...');
try {
// 子线程处理马赛克图会对输入参数做序列化导致业务持有的原始像素图发生变化,这里不能直接给子线程传输入的像素图,需要压缩生成一个合理尺寸新像素图用于马赛克图处理
let compressPixelMap = await MosaicPixelMapHelper.compress(pixelMap);
if (compressPixel... | AST#method_declaration#Left static async genPixelMap AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi... | static async genPixelMap(pixelMap: PixelMap): Promise<PixelMap | undefined> {
Logger.i(MODULE, TAG, 'genPixelMap...');
try {
let compressPixelMap = await MosaicPixelMapHelper.compress(pixelMap);
if (compressPixelMap) {
let longTask: taskPool.LongTask =
new taskPool.... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/MosaicTaskUtil.ets#L36-L62 | 0ba5e9f5735cb1d771d3f2e6f9d55881ac0fb691 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/BarLineChartTouchListener.ets | arkts | TouchListener for Bar-, Line-, Scatter- and CandleStickChart with handles all
touch interaction. Longpress == Zoom out. Double-Tap == Zoom in. | export default class BarLineChartTouchListener extends ChartTouchListener<BarLineChartBase<BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>>>> {
/**
* the original touch-matrix from the chart
*/
private mMatrix: Matrix = new Matrix();
/**
* matrix for saving the original matri... | AST#export_declaration#Left export default AST#class_declaration#Left class BarLineChartTouchListener extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ChartTouchListener AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BarLineChartBase AST#type_a... | export default class BarLineChartTouchListener extends ChartTouchListener<BarLineChartBase<BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>>>> {
private mMatrix: Matrix = new Matrix();
private mSavedMatrix: Matrix = new Matrix();
private mTouchStartPoint: MPPointF = MPPointF.g... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/BarLineChartTouchListener.ets#L40-L123 | d87b2cf365e72047e34b73fd86ff031f44bc8401 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets | arkts | Declaration of the GridObjectSortComponent item.
@interface GridObjectSortComponentIteml
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Declaration of the GridObjectSortComponent item.
@interface GridObjectSortComponentIteml
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@... | export interface GridObjectSortComponentItem {
/**
* id of GridObjectSortComponent item.
* @type { number | string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* id of GridObjectSortComponent item.
* @type { number | string }
* @syscap SystemCapabilit... | AST#export_declaration#Left export AST#interface_declaration#Left interface GridObjectSortComponentItem AST#object_type#Left { /**
* id of GridObjectSortComponent item.
* @type { number | string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* id of GridObjectSort... | export interface GridObjectSortComponentItem {
id: number | string;
text: ResourceStr;
selected: boolean;
order: number;
url?: ResourceStr;
symbolStyle?: SymbolGlyphModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L85-L179 | f0e2d3368e4eb37eb835d6e87027f2dd183c3e8e | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets | arkts | hslToRgb | 将 HSL 颜色值转换为 RGB 颜色格式。
@param {number} hue - 色相,范围为 0-360。
@param {number} saturation - 饱和度,范围为 0-100,表示颜色的强度。
@param {number} lightness - 亮度,范围为 0-100,表示颜色的明暗程度。
@returns {rgbType} - 返回一个包含 RGB 值的对象,格式为 { red, green, blue },每个值的范围为 0-255。 | function hslToRgb(hue: number, saturation: number, lightness: number): RgbType {
let red: number, green: number, blue: number;
// 将饱和度和亮度从百分比转换为小数
saturation /= 100;
lightness /= 100;
if (saturation === 0) {
// 无饱和度,返回灰色
red = Math.round(lightness * 255); // 灰色的 Red 值
green = Math.round(lightnes... | AST#function_declaration#Left function hslToRgb AST#parameter_list#Left ( AST#parameter#Left hue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left saturation : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | function hslToRgb(hue: number, saturation: number, lightness: number): RgbType {
let red: number, green: number, blue: number;
saturation /= 100;
lightness /= 100;
if (saturation === 0) {
red = Math.round(lightness * 255);
green = Math.round(lightness * 255);
blue = Math.round(lightness ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L41-L93 | 9d812172d20bab6ebb4043f0fc581c2f9f62757f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/Constants.ets | arkts | 翻译分隔符 (Android版暂时只考虑全角;) | export const wordsSubSperator : string = ","; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left wordsSubSperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "," AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const wordsSubSperator : string = ","; | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/Constants.ets#L7-L7 | 182705579c2b2caf9cc9237925bbb6e142b0283b | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/SignatureVerification/SigningSignatureVerificationArkTs/entry/src/main/ets/pages/rsa_pss_signature_verification/rsa_pss_signature_verification_asynchronous.ets | arkts | genRsaKeyPairSpec | 根据密钥参数属性构造RSA非对称密钥对密钥参数 | function genRsaKeyPairSpec(nIn: bigint, eIn: bigint, dIn: bigint) {
let rsaCommSpec: cryptoFramework.RSACommonParamsSpec = {
n: nIn,
algName: 'RSA',
specType: cryptoFramework.AsyKeySpecType.COMMON_PARAMS_SPEC
};
let rsaKeyPairSpec: cryptoFramework.RSAKeyPairSpec = {
params: rsaCommSpec,
sk: dI... | AST#function_declaration#Left function genRsaKeyPairSpec AST#parameter_list#Left ( AST#parameter#Left nIn : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eIn : AST#type_annotation#Left AST#primary_type#Left bigint AST#prim... | function genRsaKeyPairSpec(nIn: bigint, eIn: bigint, dIn: bigint) {
let rsaCommSpec: cryptoFramework.RSACommonParamsSpec = {
n: nIn,
algName: 'RSA',
specType: cryptoFramework.AsyKeySpecType.COMMON_PARAMS_SPEC
};
let rsaKeyPairSpec: cryptoFramework.RSAKeyPairSpec = {
params: rsaCommSpec,
sk: dI... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/SignatureVerification/SigningSignatureVerificationArkTs/entry/src/main/ets/pages/rsa_pss_signature_verification/rsa_pss_signature_verification_asynchronous.ets#L20-L34 | 5cc0b2766a0cb1cefaa535b8789c6f1034badebc | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Defines position of moved data.
@interface MoveIndex
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface MoveIndex {
/**
* Index of moved data.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
from: number;
/**
* Destination of moved data.
*
* @type { number }
* @syscap ... | AST#export_declaration#Left export AST#interface_declaration#Left interface MoveIndex AST#object_type#Left { /**
* Index of moved data.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#type_member#Left from : AS... | export interface MoveIndex {
from: number;
to: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L242-L263 | fad3d6bd02ebc020a300e5eb281ab94b6c4a2838 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets | arkts | BookFolderGridManage | 文件夹宫格_管理页 | @Component
export default struct BookFolderGridManage {
@Prop group:BookGroups
@Link checkGroup:Record<number, boolean>
@Prop isManage:boolean
onSelect:Function = () => {}
// 主题颜色
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem
build() {
Column() {
Stack() {
Stack(... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct BookFolderGridManage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right group : AST#type_annotation#Left AST#primary_type#Left BookGroups AST#primary_type#Rig... | @Component
export default struct BookFolderGridManage {
@Prop group:BookGroups
@Link checkGroup:Record<number, boolean>
@Prop isManage:boolean
onSelect:Function = () => {}
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeItem
build() {
Column() {
Stack() {
Stack(){
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Manage/bookManage/BookFolderGridManage.ets#L8-L79 | df2a87102444d2f04ff324e49f8115024e5632a0 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | removeSearchHistory | 根据关键词删除搜索历史记录
@param {string} keyword 搜索关键词
@returns {Promise<void>} Promise<void> | async removeSearchHistory(keyword: string): Promise<void> {
this.orm.query(SearchHistoryEntity).where("keyword", keyword).delete();
} | AST#method_declaration#Left async removeSearchHistory AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_... | async removeSearchHistory(keyword: string): Promise<void> {
this.orm.query(SearchHistoryEntity).where("keyword", keyword).delete();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L53-L55 | 73e839e7ead42bef7233780fec0ce73e3d5d8280 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | isToday | 判断是否是今天 | private isToday(dateStr: string): boolean {
const today = new Date();
const birthday = new Date(dateStr);
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
return thisYearBirthday.toDateString() === today.toDateString();
... | AST#method_declaration#Left private isToday 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#primary_type#Left boolean AST#primary_ty... | private isToday(dateStr: string): boolean {
const today = new Date();
const birthday = new Date(dateStr);
const thisYear = today.getFullYear();
const thisYearBirthday = new Date(thisYear, birthday.getMonth(), birthday.getDate());
return thisYearBirthday.toDateString() === today.toDateString();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L422-L429 | e10451dad604a03e336f43889d1dd78810bb6b3b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decodeheifimage/src/main/ets/model/WaterFlowData.ets | arkts | 实现IDataSource接口的对象,用于瀑布流组件加载数据 | export class WaterFlowDataSource implements IDataSource {
private dataArray: ImageInfo[] = [];
private listeners: DataChangeListener[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): ImageInfo {
return this.dataArray[index];
}
public addData(in... | AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ImageInfo [ ] A... | export class WaterFlowDataSource implements IDataSource {
private dataArray: ImageInfo[] = [];
private listeners: DataChangeListener[] = [];
public totalCount(): number {
return this.dataArray.length;
}
public getData(index: number): ImageInfo {
return this.dataArray[index];
}
public addData(in... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decodeheifimage/src/main/ets/model/WaterFlowData.ets#L48-L126 | 2d221ca0c7444417d5c6ee05c7442309bee674ef | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | hideCouponModal | 隐藏优惠券弹出层
@returns {void} 无返回值 | hideCouponModal(): void {
this.couponModalVisible = false;
} | AST#method_declaration#Left hideCouponModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#me... | hideCouponModal(): void {
this.couponModalVisible = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L221-L223 | 5634a8d7630760d4b0d06947b948186ae17afac0 | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | A simple helper class managing touch pointer objects. This class is designed to hold
at most 'capacity' pointers at once. It tries to reduce the need to recreate objects and to resize
arrays by creating a fixed-size list and by reusing pointers. This map supports iterating
over all active pointers. | export class PointerMap<P extends Pointer> implements Iterable<P> {
private pointers: P[];
/**
* Creates a new PointerMap with the specified capacity.
* @param capacity The capacity of this map, determining the maximum number of pointers this
* map can hold at once. This value must be greater than or equa... | AST#export_declaration#Left export AST#class_declaration#Left class PointerMap AST#type_parameters#Left < AST#type_parameter#Left P extends AST#type_annotation#Left AST#primary_type#Left Pointer AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#L... | export class PointerMap<P extends Pointer> implements Iterable<P> {
private pointers: P[];
constructor(private capacity: number = 4, init: (index: number) => P) {
this.pointers = new Array<P>(Math.max(1, capacity));
for (let i = 0; i < this.pointers.length; i++) {
this.pointers[i] = init(i);
... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L9-L118 | 30b6c840ee2090c93ed3ed7a399e4dc4acbc0abd | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | saveTasks | 保存任务数据 | async saveTasks() {
try {
await StorageUtils.putObject(AppConstants.STORAGE_KEY_TASKS, this.tasks);
} catch (error) {
console.error('Failed to save tasks:', error);
}
} | AST#method_declaration#Left async saveTasks AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#membe... | async saveTasks() {
try {
await StorageUtils.putObject(AppConstants.STORAGE_KEY_TASKS, this.tasks);
} catch (error) {
console.error('Failed to save tasks:', error);
}
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L70-L76 | 4fff3fccf894f1ab3fdb008db6f18075f9c9a3aa | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | disableAxisLineDashedLine | Disables the axis line to be drawn in dashed mode. | public disableAxisLineDashedLine(): void {
this.mAxisLineDashPathEffect = null;
} | AST#method_declaration#Left public disableAxisLineDashedLine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expre... | public disableAxisLineDashedLine(): void {
this.mAxisLineDashPathEffect = null;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L654-L656 | 5527849be3610ea44425f14fd1c47168e1f2093a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语搜索参数接口 | export interface GreetingSearchParams {
keyword?: string;
style?: GreetingStyle;
occasion?: GreetingOccasion;
contactId?: string;
method?: GreetingMethod;
status?: GreetingStatus;
dateRange?: DateRange;
isCustom?: boolean;
minRating?: number;
tags?: string[];
sortBy?: GreetingSortField;
sortOrde... | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingSearchParams AST#object_type#Left { AST#type_member#Left keyword ? : 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 style ? : AST#type_... | export interface GreetingSearchParams {
keyword?: string;
style?: GreetingStyle;
occasion?: GreetingOccasion;
contactId?: string;
method?: GreetingMethod;
status?: GreetingStatus;
dateRange?: DateRange;
isCustom?: boolean;
minRating?: number;
tags?: string[];
sortBy?: GreetingSortField;
sortOrde... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/GreetingTypes.ets#L216-L229 | 5c39d16e2c2e5c2f8ddbfd81fd46f9be8d18deb4 | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets | arkts | @file
@kit ArkUI
Control margin status of ExceptionPrompt.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Control margin status of ExceptionPrompt.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export declare enum MarginType {
/**
* Default margin of MarginType,Margin 1: references ohos_id_card_margin_start, margin 2: references ohos_id_card_margin_end.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Default margin of MarginType,Margin 1: ... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum MarginType AST#enum_body#Left { /**
* Default margin of MarginType,Margin 1: references ohos_id_card_margin_start, margin 2: references ohos_id_card_margin_end.
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | export declare enum MarginType {
DEFAULT_MARGIN = 0,
FIT_MARGIN = 1
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L34-L63 | add4d6136ec87a523c35180a37b735571f7f8282 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | move | Move by current offset.
@param offsetX
@param offsetY | move(offsetX: number, offsetY: number): void {
this.left += offsetX;
this.right += offsetX;
this.top += offsetY;
this.bottom += offsetY;
} | AST#method_declaration#Left move AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | move(offsetX: number, offsetY: number): void {
this.left += offsetX;
this.right += offsetX;
this.top += offsetY;
this.bottom += offsetY;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L128-L133 | 08aa1f5e581540f318e3cdca7db3295b1616be11 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowScratchingBoard.ets | arkts | download_url | Call the webViews to download something from a link
@param link the link of file to be downloaded | download_url(url: string) {
try {
(this.storage.get('bunch_of_tabs') as bunch_of_tabs).workingMainTab().controller!.startDownload(url);
} catch (e) {
console.error('[meowScratchingBoard] Download Url failed! ' + e);
}
} | AST#method_declaration#Left download_url AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#b... | download_url(url: string) {
try {
(this.storage.get('bunch_of_tabs') as bunch_of_tabs).workingMainTab().controller!.startDownload(url);
} catch (e) {
console.error('[meowScratchingBoard] Download Url failed! ' + e);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowScratchingBoard.ets#L402-L408 | ab4c75726473bb257006c30850599cf42246a74e | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets | arkts | blue | from Color blue()
@param color | public static blue(color: number): number {
return color & 0xff;
} | AST#method_declaration#Left public static blue AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | public static blue(color: number): number {
return color & 0xff;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets#L284-L286 | 958129c7cbf257ba164f27166834b811877aba4d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/components/ImageText.ets | arkts | ImageText | 图片&文字组合 | @Component
export struct ImageText {
@Prop imageStr: Resource;
private text: string | Resource = '';
build() {
Row() {
Image(this.imageStr)
.height($r('app.integer.list_slide_to_history_handler_icon_height'))
.width($r('app.integer.list_slide_to_history_handler_icon_width'))
.ob... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right imageStr : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annota... | @Component
export struct ImageText {
@Prop imageStr: Resource;
private text: string | Resource = '';
build() {
Row() {
Image(this.imageStr)
.height($r('app.integer.list_slide_to_history_handler_icon_height'))
.width($r('app.integer.list_slide_to_history_handler_icon_width'))
.ob... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/components/ImageText.ets#L19-L40 | a628dfecdda2a94ef40ddf306c21c3eb0d5e3511 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera_js/entry/src/main/ets/views/FocusAreaPage.ets | arkts | FocusAreaPage | 对焦区域 | @Component
export struct FocusAreaPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
// 刻度、焦距值 和 对焦框不能共存的显示
@Link exposureBol: boolean;
// 曝光值
@Link exposureNum: number;
@Prop xComponentWidth: number;
@Prop xComponentHeight: number;
// 对焦区域显示框定时器
private areaTimer: number = -1;... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FocusAreaPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#typ... | @Component
export struct FocusAreaPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
@Link exposureBol: boolean;
@Link exposureNum: number;
@Prop xComponentWidth: number;
@Prop xComponentHeight: number;
private areaTimer: number = -1;
private panOption: PanGestureOption... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera_js/entry/src/main/ets/views/FocusAreaPage.ets#L22-L104 | 377e26966c8ea7fcb88ae2d12fd7767ae6823ae4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/PopupPosition.ets | arkts | 计算全模态弹窗位置类 | export class PopupPosition {
/**
* 设置弹窗居中。
* @param displayWidth
* @param displayHeight
* @param snapPopupWidth
* @param snapPopupHeight
* @returns
*/
static calculatePopupCenter(displayWidth: number, displayHeight: number, snapPopupWidth: number,
snapPopupHeight: number): Position {
r... | AST#export_declaration#Left export AST#class_declaration#Left class PopupPosition AST#class_body#Left { /**
* 设置弹窗居中。
* @param displayWidth
* @param displayHeight
* @param snapPopupWidth
* @param snapPopupHeight
* @returns
*/ AST#method_declaration#Left static calculatePopupCenter AST#parameter_lis... | export class PopupPosition {
static calculatePopupCenter(displayWidth: number, displayHeight: number, snapPopupWidth: number,
snapPopupHeight: number): Position {
return {
x: (displayWidth - snapPopupWidth) / 2,
y: (displayHeight - snapPopupHeight) / 2
}
}
static calculatePopupBott... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/PopupPosition.ets#L20-L51 | 47c282e46d0cd27dbd454bc6dd9fd35492eae3bc | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestUpload.ets | arkts | uploadFiles | 失败回调
上传文件 | async uploadFiles(fileUris: Array<string>, callback: (progress: number, isSucceed: boolean) => void): Promise<void> {
logger.info(TAG, `uploadFiles begin, ${JSON.stringify(fileUris)}`);
if (fileUris.length === 0) {
return;
}
// Found an ongoing upload task, prompted and returned.
let tasks = a... | AST#method_declaration#Left async uploadFiles AST#parameter_list#Left ( AST#parameter#Left fileUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | async uploadFiles(fileUris: Array<string>, callback: (progress: number, isSucceed: boolean) => void): Promise<void> {
logger.info(TAG, `uploadFiles begin, ${JSON.stringify(fileUris)}`);
if (fileUris.length === 0) {
return;
}
let tasks = await request.agent.search({
state: request.agent.... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestUpload.ets#L48-L107 | 864b5c96f3e5b37e51d1ac813655e04e68f41466 | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/http/Api.ets | arkts | 获取验证码 | export function sendCode(phone: string) {
// promise
return instance.get('/word/user/code', { params: { phone: phone } });
} | AST#export_declaration#Left export AST#function_declaration#Left function sendCode AST#parameter_list#Left ( AST#parameter#Left phone : 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 { // prom... | export function sendCode(phone: string) {
return instance.get('/word/user/code', { params: { phone: phone } });
} | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/http/Api.ets#L4-L7 | 77ea9f1a202684d19d1e50ceb5caed2fade2f345 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/image/SmallAvatar.ets | arkts | SmallAvatar | @file 小尺寸头像组件
@author Joker.X | @ComponentV2
export struct SmallAvatar {
/**
* 头像地址
*/
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建小尺寸头像
* @returns {void} 无返回值
*/
build(): void {
Avatar({
src: this.src,
ava... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SmallAvatar AST#component_body#Left { /**
* 头像地址
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resourc... | @ComponentV2
export struct SmallAvatar {
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
Avatar({
src: this.src,
avatarSize: 36,
onTap: this.onTap
});
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/SmallAvatar.ets#L7-L31 | 8cba54012ae6fef1610b3ce25b1a2c4ae173c202 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | toDecimal | 构造Decimal
@param value
@returns | static toDecimal(value: Value): Decimal {
return new Decimal(value);
} | AST#method_declaration#Left static toDecimal AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Decimal AST#primary_type... | static toDecimal(value: Value): Decimal {
return new Decimal(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L208-L210 | 18411990b3e3c11bf3938e15874986a99da8d223 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | createPlanFromPlan | / 主要用于更新plan中的某个pieceNo的wordCnt / / pieceCount: 具体为某天(某个pieceNo)指定学习个数(新字),如果为空,则使用countPerDay / isRepeatPieceCount:后面的每天,是否重复执行新的pieceCount。false: 使用全局的countPerDay, true:使用peiceCount | public static createPlanFromPlan(
plan: Plan,
pieceCount?: PieceCount,
isRepeatPieceCount: boolean = false
): Plan {
// 获取 wordIds (所有此 plan 中的未删除的 wordIds)
const wordIds: number[] = plan.wordIds;
const wordIdsSet: Set<number> = new Set(wordIds);
/////////////////////////////////////////... | AST#method_declaration#Left public static createPlanFromPlan AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pieceCount ? : AST#type_annotation#Left AST#primary_type#Left Pie... | public static createPlanFromPlan(
plan: Plan,
pieceCount?: PieceCount,
isRepeatPieceCount: boolean = false
): Plan {
const wordIds: number[] = plan.wordIds;
const wordIdsSet: Set<number> = new Set(wordIds);
/ 因为切分 pieces 时是从 0 开始的,pieceNo 也是从 0 开始的,所以,最大的 pieceNo 就是最... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L295-L369 | 6ad74d22f31eb32b21f0ec367bffeefdd9fcd273 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/ActionUtil.ets | arkts | showMenu | 显示操作菜单
@param options:
{
title:标题,
btn:菜单字符串数组,
clickCallBack:点击菜单回调函数,默认传回当前点击菜单项
showInSubWindow:某弹框需要显示在主窗口之外时,是否在子窗口显示此弹窗
isModal:弹窗是否为模态窗口,模态窗口有蒙层,非模态窗口无蒙层
} | static showMenu(options: ActionBtnsOptions) {
if (!options) {
options = new ActionBtnsOptions();
}
if (!options.title) {
options.title = Const.ACTION_TITLE;
}
if (options.isModal == undefined) {
options.isModal = true;
}
if (options.showInSubWindow == undefined) {
opt... | AST#method_declaration#Left static showMenu AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ActionBtnsOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_stateme... | static showMenu(options: ActionBtnsOptions) {
if (!options) {
options = new ActionBtnsOptions();
}
if (!options.title) {
options.title = Const.ACTION_TITLE;
}
if (options.isModal == undefined) {
options.isModal = true;
}
if (options.showInSubWindow == undefined) {
opt... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/ActionUtil.ets#L96-L127 | 9346354a8577beed7509ebc54830ffe735e89920 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getStringArrayByNameSync | 获取指定资源名称对应的字符串数组
@param resName 资源名称 | static getStringArrayByNameSync(resName: string): Array<string> {
return ResUtil.getResourceManager().getStringArrayByNameSync(resName);
} | AST#method_declaration#Left static getStringArrayByNameSync AST#parameter_list#Left ( AST#parameter#Left resName : 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#ge... | static getStringArrayByNameSync(resName: string): Array<string> {
return ResUtil.getResourceManager().getStringArrayByNameSync(resName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L174-L176 | d81acca568071284e7ef884a4139f312ad1bddc1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ar/ARCardCreatorPage.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ar/ARCardCreatorPage.ets#L73-L109 | d236d3c8b531c7b22bcd138362d251dc13f71195 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets | arkts | getData | 获取指定数据项 | getData(index: number): MemoInfo {
return this.memoData[index];
} | AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MemoInfo AST#primary_type#Right ... | getData(index: number): MemoInfo {
return this.memoData[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L94-L96 | 73ea9a0be1c7ce41de1e1c5c22f43167682c159f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | getRecentFootprints | 获取指定数量的最新足迹记录
@param {number} limit 限制数量
@returns {Promise<Footprint[]>} 足迹列表 | getRecentFootprints(limit: number): Promise<Footprint[]> {
return this.dataSource.getRecentFootprints(limit);
} | AST#method_declaration#Left getRecentFootprints AST#parameter_list#Left ( AST#parameter#Left limit : 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_type#Lef... | getRecentFootprints(limit: number): Promise<Footprint[]> {
return this.dataSource.getRecentFootprints(limit);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L69-L71 | e920fcf11cfcc9352e49702d15983044298be6a8 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/hdr_capability/ets/@ohos.graphics.hdrCapability.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 namespace hdrCapability {
export enum HDRFormat {
NONE = 0,
VIDEO_HLG = 1,
VIDEO_HDR10 = 2,
VIDEO_HDR_VIVID = 3,
IMAGE_HDR_VIVID_DUAL = 4,
IMAGE_HDR_VIVID_SINGLE = 5,
IMAGE_HDR_ISO_DUAL = 6,
IMAGE_HDR_ISO_SINGLE = 7
} | AST#export_declaration#Left export AST#ERROR#Left namespace hdrCapability { export AST#ERROR#Right AST#enum_declaration#Left enum HDRFormat AST#enum_body#Left { AST#enum_member#Left NONE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left VIDEO_HLG = AST#expression#Left 1 AST#expre... | export namespace hdrCapability {
export enum HDRFormat {
NONE = 0,
VIDEO_HLG = 1,
VIDEO_HDR10 = 2,
VIDEO_HDR_VIVID = 3,
IMAGE_HDR_VIVID_DUAL = 4,
IMAGE_HDR_VIVID_SINGLE = 5,
IMAGE_HDR_ISO_DUAL = 6,
IMAGE_HDR_ISO_SINGLE = 7
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/hdr_capability/ets/@ohos.graphics.hdrCapability.ets#L16-L26 | 0484bc54c456c2f3de352324f6a6b9c91ba89e5d | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | LoadingDialogV2 | Declare CustomDialog LoadingDialogV2
@struct { LoadingDialogV2 }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ComponentV2
export declare struct LoadingDialogV2 {
/**
* Sets the LoadingDialogV2 content.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Param
content?: ResourceStr;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct LoadingDialogV2 AST#component_body#Left { /**
* Sets the LoadingDialogV2 content.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @cros... | @ComponentV2
export declare struct LoadingDialogV2 {
@Param
content?: ResourceStr;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L627-L640 | 355d869f45a6c4900988286b671b9e250c8e132b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@returns | static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<string> {
return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | AST#method_declaration#Left static async encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<string> {
return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L62-L64 | 51e9f11ee5fe79b1713ceeb782fbd06111dcc5f5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextExpandView.ets | arkts | expandText | 展开文字 | expandText(): void {
if (this.textModifier.needProcess) {
this.textModifier.title = this.textSectionAttribute.title;
this.expanded = true;
this.textModifier.exceedOneLine = true;
}
} | AST#method_declaration#Left expandText 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expres... | expandText(): void {
if (this.textModifier.needProcess) {
this.textModifier.title = this.textSectionAttribute.title;
this.expanded = true;
this.textModifier.exceedOneLine = true;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/utils/TextExpandView.ets#L108-L114 | 042f84559480d6dc36e8ee1dc984259434363cb6 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets | arkts | getDataSetIndex | returns the index of the DataSet the highlighted value is in
@return | public getDataSetIndex(): number {
return this.mDataSetIndex;
} | AST#method_declaration#Left public getDataSetIndex AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e... | public getDataSetIndex(): number {
return this.mDataSetIndex;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L150-L152 | b37ae1c09e888e64f85f0ffc165e52d8feec6fe8 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | playEpisode | 播放单集 | playEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Play: ${this.episode.title}`);
this.playerService.playEpisode(this.episode);
// 跳转到播放页面
const params = new RouteParams();
params.episodeId = this.episode.id;
UIUtils.pushUrl('pages/PlayerPage', params);
... | AST#method_declaration#Left playEpisode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expr... | playEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Play: ${this.episode.title}`);
this.playerService.playEpisode(this.episode);
const params = new RouteParams();
params.episodeId = this.episode.id;
UIUtils.pushUrl('pages/PlayerPage', params);
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L66-L76 | 8cec4b199ebbdfcbfca7bc376ea8941abcfdedd4 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DbFileUtility.ets | arkts | copyDatabaseFromAssetsIfNeeds | 同步方式从资源目录拷贝数据库文件到指定位置
@param context Ability上下文 - 提供资源访问能力
@param fromPath 源文件路径(相对于resources/rawfile目录)
@param toPath 目标文件绝对路径
static async copyDatabaseFromAssetsIfNeeds(context: common.Context, fromPath: string, toPath: string) { await DbFileUtility.copyDatabaseFromAssetsIfNeeds(context, fromPath, toPath, false, nul... | static async copyDatabaseFromAssetsIfNeeds(context: common.Context, fromPath: string, toPath: string) {
// 检查目标文件是否已存在
const dbExist = DbFileUtility.checkDataBaseExists(toPath);
if (!dbExist) {
// 定义拷贝操作
// const copyAction = async () => {
// try {
// await DbFileUtility.doCop... | AST#method_declaration#Left static async copyDatabaseFromAssetsIfNeeds AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parame... | static async copyDatabaseFromAssetsIfNeeds(context: common.Context, fromPath: string, toPath: string) {
const dbExist = DbFileUtility.checkDataBaseExists(toPath);
if (!dbExist) {
await DbFileUtility.doCopy(c... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L42-L70 | 53fa53baf903a75003eab0062ac314de42874cdb | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets | arkts | distanceAndTypeString | 返回 distance + 类型字符串:学习 或 复习(+1天)
@param distance 天数
@returns 学习 或 复习(+1天) | static distanceAndTypeString(distance: DistanceFromBase): string {
if (distance === BoxType.New) {
return DistanceHelper.typeString(distance);
} else {
return `${DistanceHelper.typeString(distance)}(${DistanceHelper.distanceString(distance)})`;
}
} | AST#method_declaration#Left static distanceAndTypeString AST#parameter_list#Left ( AST#parameter#Left distance : AST#type_annotation#Left AST#primary_type#Left DistanceFromBase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | static distanceAndTypeString(distance: DistanceFromBase): string {
if (distance === BoxType.New) {
return DistanceHelper.typeString(distance);
} else {
return `${DistanceHelper.typeString(distance)}(${DistanceHelper.distanceString(distance)})`;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets#L52-L58 | 8e1440e750480ef8df3cceebc6d60b397aa343ef | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_chart/src/main/ets/components/BillPieChart.ets | arkts | _setData | 初始化饼状图数据 | private async _setData(): Promise<void> {
let entries: JArrayList<PieEntry> = new JArrayList<PieEntry>();
for (let i = 0; i < this.chartData.length; i++) {
entries.add(new PieEntry(this.chartData[i].value, this.chartData[i].label));
}
let dataSet: PieDataSet = new PieDataSet(entries, 'Election R... | AST#method_declaration#Left private async _setData 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... | private async _setData(): Promise<void> {
let entries: JArrayList<PieEntry> = new JArrayList<PieEntry>();
for (let i = 0; i < this.chartData.length; i++) {
entries.add(new PieEntry(this.chartData[i].value, this.chartData[i].label));
}
let dataSet: PieDataSet = new PieDataSet(entries, 'Election R... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_chart/src/main/ets/components/BillPieChart.ets#L69-L108 | 277875b844bc42bd6740609a57560baa6e831c70 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | createItem | 新增一条 Demo 记录
@param {string} title - 标题
@param {string} description - 描述
@returns {Promise<number>} 新建记录主键 | async createItem(title: string, description: string = ""): Promise<number> {
const entity: DemoEntity = new DemoEntity();
entity.title = title;
entity.description = description;
return this.orm.insert(entity);
} | AST#method_declaration#Left async createItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | async createItem(title: string, description: string = ""): Promise<number> {
const entity: DemoEntity = new DemoEntity();
entity.title = title;
entity.description = description;
return this.orm.insert(entity);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L41-L46 | 10d1a78c44efa374c8a954a03e99bfc25cc5e074 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ValidationUtils.ets | arkts | validatePassword | 验证密码强度 | static validatePassword(password: string): {
valid: boolean;
strength: 'weak' | 'medium' | 'strong';
message: string;
} | AST#method_declaration#Left static validatePassword AST#parameter_list#Left ( AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#builder_function_body#Lef... | static validatePassword(password: string): {
valid: boolean;
strength: 'weak' | 'medium' | 'strong';
message: string;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L45-L49 | 50a91859b509f7b8ccd2588217e54cca8f685f7f | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/StoreChannel.ets | arkts | 应用约束61: 使用ES模块导出语法 | export default StoreChannel; | AST#export_declaration#Left export default AST#expression#Left StoreChannel AST#expression#Right ; AST#export_declaration#Right | export default StoreChannel; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/StoreChannel.ets#L32-L32 | 7a28e911152b8fe57ab16dd16eaffda0242e8d00 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets | arkts | onWindowStageDestroy | [End create_main_window] | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement... | onWindowStageDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L49-L52 | 3016c187edaabe18fcd3fcc2c3a3194824c0520d | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets | arkts | set | 存储数据
@param key 键
@param value 值 | public async set(key: string, value: string | number | boolean | object): Promise<void> {
try {
await this.ensureInitialized();
if (typeof value === 'object') {
await this.preferences?.put(key, JSON.stringify(value));
} else {
await this.preferences?.put(key, value);
}
... | AST#method_declaration#Left public async set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left strin... | public async set(key: string, value: string | number | boolean | object): Promise<void> {
try {
await this.ensureInitialized();
if (typeof value === 'object') {
await this.preferences?.put(key, JSON.stringify(value));
} else {
await this.preferences?.put(key, value);
}
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L32-L48 | 2ac91c1962d34978026f90dbc2b64a72ea230d0a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PhotoHelper.ets | arkts | TODO 相册选择和保存,工具类
需要权限:
ohos.permission.READ_IMAGEVIDEO
ohos.permission.WRITE_IMAGEVIDEO
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class PhotoHelper {
/**
* 通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。
* @param options
* MIMEType 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
* maxSelectNumber 选择媒体文件数量的最大值(最大可设置的值为500,若不设置则默认为50或9)。
* isPhotoTakingSupported 是否支持拍照,true表示支持,false表示不支持,默认为true。
* isSearchSupported 是否支持搜索,true表示支持,fals... | AST#export_declaration#Left export AST#class_declaration#Left class PhotoHelper AST#class_body#Left { /**
* 通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。
* @param options
* MIMEType 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
* maxSelectNumber 选择媒体文件数量的最大值(最大可设置的值为500,若不设置则默认为50或9)。
* isPhotoTakingSupported 是否支持拍照,tru... | export class PhotoHelper {
static async select(options?: photoAccessHelper.PhotoSelectOptions): Promise<photoAccessHelper.PhotoSelectResult> {
if (options === undefined) {
options = new photoAccessHelper.PhotoSelectOptions();
options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L32-L207 | e657bfd7a154a0b198799e5c5466fe13ffd035cf | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets | arkts | News list item info. | export class NewsData {
/**
* News list item title.
*/
title: string = '';
/**
* News list item content.
*/
content: string = '';
/**
* News list item imagesUrl.
*/
imagesUrl: Array<NewsFile> = [new NewsFile()];
/**
* News list item source.
*/
source: string = '';
} | AST#export_declaration#Left export AST#class_declaration#Left class NewsData AST#class_body#Left { /**
* News list item title.
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Rig... | export class NewsData {
title: string = '';
content: string = '';
imagesUrl: Array<NewsFile> = [new NewsFile()];
source: string = '';
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets#L81-L101 | 958e915ad113e956cfc94775667742ef96b86256 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/utils/StatusBarManager.ets | arkts | immerseFullScreenAsync | 沉浸式全屏(全屏屏幕,且显示状态栏、导航栏)
异步方法:适合动态监听状态栏,导航栏并做相应调整的方式。这种方案比较麻烦,但是用户体验和性能更好。
仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行 | static async immerseFullScreenAsync(windowStage: window.WindowStage) {
let windowClass: window.Window = await windowStage.getMainWindow()
// 获取状态栏和导航栏的高度
windowClass.on("avoidAreaChange", async data => {
if (data.type == window.AvoidAreaType.TYPE_SYSTEM) {
// 将状态栏和导航栏的高度保存在AppStorage中
... | AST#method_declaration#Left static async immerseFullScreenAsync 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#param... | static async immerseFullScreenAsync(windowStage: window.WindowStage) {
let windowClass: window.Window = await windowStage.getMainWindow()
windowClass.on("avoidAreaChange", async data => {
if (data.type == window.AvoidAreaType.TYPE_SYSTEM) {
AppStorage.setOrCreate<number>(STATUS_BAR_H... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/utils/StatusBarManager.ets#L32-L56 | ddaba63384129257fcf72af66c958cb83a45d6b9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarData.ets | arkts | groupBars | Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries.
Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified
by the parameters.
Do not forget to call notifyDataSetChanged() on your BarChart object after calling this me... | public groupBars(fromX: number, groupSpace: number, barSpace: number): void {
let dataSets = this.mDataSets;
if (dataSets) {
let setCount: number = dataSets.size();
if (setCount <= 1) {
throw new Error("BarData needs to hold at least 2 BarDataSets to allow grouping.");
}
let max... | AST#method_declaration#Left public groupBars AST#parameter_list#Left ( AST#parameter#Left fromX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left groupSpace : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | public groupBars(fromX: number, groupSpace: number, barSpace: number): void {
let dataSets = this.mDataSets;
if (dataSets) {
let setCount: number = dataSets.size();
if (setCount <= 1) {
throw new Error("BarData needs to hold at least 2 BarDataSets to allow grouping.");
}
let max... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarData.ets#L79-L138 | ecbccb4c42c56b19f93681d0a20ea401acf25f90 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/SettingsStorage.ets | arkts | 按钮位置设置 | export async function getButtonPosition(): Promise<boolean> {
const settings = getSettingsInstance();
// false = 左, true = 右
return (await settings.get("buttonPositionRIGHT", false)) as boolean;
} | AST#export_declaration#Left export AST#function_declaration#Left async function getButtonPosition 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#prima... | export async function getButtonPosition(): Promise<boolean> {
const settings = getSettingsInstance();
return (await settings.get("buttonPositionRIGHT", false)) as boolean;
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L59-L63 | 7d745e8a9d8f035fb99d489eaad7052e222c0726 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the hardware model represented by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get hardwareProfile(): string; | AST#method_declaration#Left static get AST#ERROR#Left hardwareProfile AST#ERROR#Right 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#method_declaration#Right | static get hardwareProfile(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L142-L142 | 7cc3fbce280100079c6b702124f01f9b08d34ca0 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | PriceValue | 构建价格值
@param {number} price - 价格(单位:分)
@returns {void} 无返回值 | @Builder
private PriceValue(price: number) {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PriceValue AST#parameter_list#Left ( AST#parameter#Left price : 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_... | @Builder
private PriceValue(price: number) {
IBestPrice({
value: price,
integerFontSize: 14,
decimalFontSize: 12,
symbolFontSize: 12
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L410-L418 | 422cbe5e28b0a820a8e8f91c92aeba23d5f242b3 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarData.ets | arkts | setTopRadius | 设置顶部圆角半径
@param radius 顶部圆角半径 | public setTopRadius(radius: number): void{
if(radius < 0){
radius = 0;
}
this.topRadius = radius;
} | AST#method_declaration#Left public setTopRadius AST#parameter_list#Left ( AST#parameter#Left radius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty... | public setTopRadius(radius: number): void{
if(radius < 0){
radius = 0;
}
this.topRadius = radius;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarData.ets#L58-L63 | c5dbd9248a67a4d9f3b7b857f19ab29e44a2bb99 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SyncTypes.ets | arkts | 数据冲突相关 | export interface DataConflict {
id: string;
dataType: DataType;
localData: Record<string, string | number | boolean>;
remoteData: Record<string, string | number | boolean>;
conflictType: ConflictType;
localModified: string;
remoteModified: string;
resolved?: boolean;
resolution?: ConflictResolution;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataConflict AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dataType : AST#type_annotation#Lef... | export interface DataConflict {
id: string;
dataType: DataType;
localData: Record<string, string | number | boolean>;
remoteData: Record<string, string | number | boolean>;
conflictType: ConflictType;
localModified: string;
remoteModified: string;
resolved?: boolean;
resolution?: ConflictResolution;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L101-L111 | 359c27d566368867d1038c64b10670c84c355e86 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | sign | 签名
@param str 需要签名的字符串
@param priKey 给定秘钥规格私钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@returns OutDTO<string> 签名对象 | static async sign(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
//将私钥转换
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
//创建签名器
let signer = crypto.createSign(symEncryptName);
//初始化签名器
await ... | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static async sign(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
let signer = crypto.createSign(symEncryptName);
await signer.init(priPair.pr... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L352-L366 | b395f548675d036446447ae10347147042c2a01b | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CartRepository.ets | arkts | 构造函数
@param {CartLocalDataSource} dataSource 可选的数据源实例 | constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource : AST#type_annotation#Left AST#primary_type#Left CartLocalDataSource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#ex... | constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L18-L20 | 42210ff82b6c1b1e6664f8e9199654703fd94f1a | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | getFilesDirPath | 获取文件目录下的文件夹路径或文件路径。
@param relativePath 文件路径;相对路径(download/wps/doc);传空表示根目录
@param fileName 文件名(test.text);传空表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getFilesDirPath(relativePath: string | undefined = undefined,
fileName: string | undefined = undefined, blHap: boolean = true): string {
let filePath = blHap ? AppUtil.getContext().filesDir : AppUtil.getApplicationContext().filesDir; //根目录
if (StrUtil.isNotEmpty(relativePath)) {
if (StrUtil.sta... | AST#method_declaration#Left static getFilesDirPath AST#parameter_list#Left ( AST#parameter#Left relativePath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#ex... | static getFilesDirPath(relativePath: string | undefined = undefined,
fileName: string | undefined = undefined, blHap: boolean = true): string {
let filePath = blHap ? AppUtil.getContext().filesDir : AppUtil.getApplicationContext().filesDir;
if (StrUtil.isNotEmpty(relativePath)) {
if (StrUtil.startsWi... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L40-L57 | 3ce8a531fe7d8a6a3c93a03d88b5b9d0243719fc | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/viewmodel/TaskItemViewModel.ets | arkts | Task item entity class. | export default class TaskItemViewModel {
/**
* Progress value of task item.
*/
taskName: string;
/**
* Update time of task item.
*/
updateDate: string;
/**
* progress value of task item.
*/
progressValue: number;
/**
* Construction method.
*
* @param progressValue progress v... | AST#export_declaration#Left export default AST#class_declaration#Left class TaskItemViewModel AST#class_body#Left { /**
* Progress value of task item.
*/ AST#property_declaration#Left taskName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_d... | export default class TaskItemViewModel {
taskName: string;
updateDate: string;
progressValue: number;
constructor(taskName: string, progressValue: number, updateDate: string) {
this.taskName = taskName;
this.progressValue = progressValue;
this.updateDate = updateDate;
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/TaskItemViewModel.ets#L19-L47 | ba7ec7e9c85b8e57f5ff615083920f2678c980ad | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDHSync.ets | arkts | @Author csx
@DateTime 2024/3/20 20:21
@TODO ECDHSync 动态协商共享密钥-同步 | export class ECDHSync {
/**
* ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @... | AST#export_declaration#Left export AST#class_declaration#Left class ECDHSync AST#class_body#Left { /**
* ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择u... | export class ECDHSync {
static ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'ECC256', 256, keyCoding, resultCoding);
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDHSync.ets#L26-L39 | fa975e5da06a8c2b795733c1967fa1d9d98510ea | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toWebBrowser | 拉起系统浏览器
@param url
@param showDefaultPicker true-如果设备上存在多个浏览器应用,用户能够选择要使用的浏览器,false-默认浏览器
@returns | static async toWebBrowser(url: string, showDefaultPicker: boolean = false): Promise<void> {
const context = AppUtil.getContext();
const want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
// abilityName: 'MainAbility',
uri: url,
parameters: {
... | AST#method_declaration#Left static async toWebBrowser AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left showDefaultPicker : AST#type_annotation#Left AST#primary_type#Left bool... | static async toWebBrowser(url: string, showDefaultPicker: boolean = false): Promise<void> {
const context = AppUtil.getContext();
const want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri: url,
parameters: {
'ohos.ability... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L190-L203 | b7b3e49c056e9c153845afcc04891ecef9dd0dcf | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | getWeeksData | 获取周数据(用于渲染) | private getWeeksData(): CalendarDay[][] {
const weeks: CalendarDay[][] = [];
for (let i = 0; i < this.calendarDays.length; i += 7) {
weeks.push(this.calendarDays.slice(i, i + 7));
}
return weeks;
} | AST#method_declaration#Left private getWeeksData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CalendarDay [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_... | private getWeeksData(): CalendarDay[][] {
const weeks: CalendarDay[][] = [];
for (let i = 0; i < this.calendarDays.length; i += 7) {
weeks.push(this.calendarDays.slice(i, i + 7));
}
return weeks;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L541-L547 | fd94914fb001db4167921e4f2617f258a2ee914a | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets | arkts | StackAlignRadioList | Set Alignment in Stack | @Component
export struct StackAlignRadioList {
private stackModuleList: ContainerModuleItem[] = getStackModuleList();
private groupName: string = this.stackModuleList[0].groupName;
private moduleName: Resource = this.stackModuleList[0].moduleName;
private radioList: Array<string> = this.stackModuleList[0].attri... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct StackAlignRadioList AST#component_body#Left { AST#property_declaration#Left private stackModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Right AST... | @Component
export struct StackAlignRadioList {
private stackModuleList: ContainerModuleItem[] = getStackModuleList();
private groupName: string = this.stackModuleList[0].groupName;
private moduleName: Resource = this.stackModuleList[0].moduleName;
private radioList: Array<string> = this.stackModuleList[0].attri... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/StackAlignRadioList.ets#L23-L55 | 8dde3d43c10146f89c34488a610e8e0302582fd3 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | calculatePrices | 计算价格(包括优惠券折扣)
@returns {void} 无返回值 | private calculatePrices(): void {
let discountValue = 0;
if (this.selectedCoupon && this.selectedCoupon.condition) {
// 检查是否满足使用条件
if (this.originalPrice >= this.selectedCoupon.condition.fullAmount) {
discountValue = this.selectedCoupon.amount ?? 0;
}
}
this.discountAmount = ... | AST#method_declaration#Left private calculatePrices AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dis... | private calculatePrices(): void {
let discountValue = 0;
if (this.selectedCoupon && this.selectedCoupon.condition) {
if (this.originalPrice >= this.selectedCoupon.condition.fullAmount) {
discountValue = this.selectedCoupon.amount ?? 0;
}
}
this.discountAmount = discountValue... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L255-L267 | 6d3e56ea5f9d9dd2e2cb352badcc62a19c699844 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | offFoldAngleChange | 关闭折叠设备折叠角度变化的监听。
@param callback 需要取消注册的回调函数。表示折叠设备屏幕折叠角度值(0度~180度)。若无此参数,则取消注册折叠角度变化监听的所有回调函数。 | static offFoldAngleChange(callback?: Callback<Array<number>>) {
display.off('foldAngleChange', callback);
} | AST#method_declaration#Left static offFoldAngleChange AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST... | static offFoldAngleChange(callback?: Callback<Array<number>>) {
display.off('foldAngleChange', callback);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L197-L199 | ddd9878dd988de4fa9733e169a30659c897a5280 | gitee |
Puiching-Memory/HOMOAPP_Q5.git | 53e36a21984de7bf41b6fafc840fde013236b9d2 | entry/src/main/ets/model/AudioModel.ets | arkts | 音频项 | export class AudioItem {
id: number = 0;
name: string = '';
url: string = '';
artist: string = '未知艺术家';
cover_url: string = '';
waveform?: number[];
} | AST#export_declaration#Left export AST#class_declaration#Left class AudioItem 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#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#... | export class AudioItem {
id: number = 0;
name: string = '';
url: string = '';
artist: string = '未知艺术家';
cover_url: string = '';
waveform?: number[];
} | https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/model/AudioModel.ets#L4-L11 | e2bf64c988f1b5b11138321548fe6cbe7a5927e8 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/RowAttribute.ets | arkts | 获取横向两端分布 + 垂直顶部的 Row 对齐修饰器
@returns {AttributeModifier<RowAttribute>} Row 对齐修饰器
@example
Row() { Text("A"); Text("B"); }.attributeModifier(rowSpaceBetweenTop()); | export function rowSpaceBetweenTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(VerticalAlign.Top);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function rowSpaceBetweenTop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute... | export function rowSpaceBetweenTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(VerticalAlign.Top);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L162-L169 | de7f8a66ac40a1a02e54643a10274d123a560ad8 | github | |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/schedule/common/models/deviceScheduleModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export class DeviceScheduleModel {
parseCommandFunction: (commandStr: string) => string
constructor | AST#export_declaration#Left export AST#ERROR#Left class DeviceScheduleModel { parseCommandFunction : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left commandStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parame... | export class DeviceScheduleModel {
parseCommandFunction: (commandStr: string) => string
constructor | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/common/models/deviceScheduleModel.ets#L16-L19 | 9f02d92a2528153bd06fd6a893d8eca99287de59 | gitee | |
tang01611/Mobile-Internet-job.git | 3b570970f9a742f89ea3b170483cb34f48c17e7d | entry/src/main/ets/model/Utils.ets | arkts | 拉起远程新闻详情页 | export function startRemoteAbilities(deviceIds, newsId) {
for (var i = 0; i < deviceIds.length; i++) {
var want = {
"want": {
"deviceId": deviceIds[i],
"bundleName": "com.huawei.codelab",
"abilityName": "com.huawei.codelab.MainAbility",
// 分布式任务flag
"flags": wantConst... | AST#export_declaration#Left export AST#function_declaration#Left function startRemoteAbilities AST#parameter_list#Left ( AST#parameter#Left deviceIds AST#parameter#Right , AST#parameter#Left newsId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( ... | export function startRemoteAbilities(deviceIds, newsId) {
for (var i = 0; i < deviceIds.length; i++) {
var want = {
"want": {
"deviceId": deviceIds[i],
"bundleName": "com.huawei.codelab",
"abilityName": "com.huawei.codelab.MainAbility",
"flags": wantConstant.Flags.FL... | https://github.com/tang01611/Mobile-Internet-job.git/blob/3b570970f9a742f89ea3b170483cb34f48c17e7d/entry/src/main/ets/model/Utils.ets#L22-L47 | e8d65b07d83cd2c947299ed75a8d43675ac38693 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets | arkts | 样式工具类 | export class StyleUtils {
/**
* 获取公历日期字体颜色(仅用于月视图和周视图)
* @param day 日期信息
* @param month 月份
* @param currentSelectDay 当前选择的日期
* @param calendarViewType 日历视图类型
* @param calendarStyle 自定义日历样式
* @returns 返回颜色
*/
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType... | AST#export_declaration#Left export AST#class_declaration#Left class StyleUtils AST#class_body#Left { /**
* 获取公历日期字体颜色(仅用于月视图和周视图)
* @param day 日期信息
* @param month 月份
* @param currentSelectDay 当前选择的日期
* @param calendarViewType 日历视图类型
* @param calendarStyle 自定义日历样式
* @returns 返回颜色
*/ AST#method_de... | export class StyleUtils {
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
calendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month ===... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L23-L133 | 7893354f3a05269f7675a0968637ac8df4d81153 | gitee | |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | 房间项接口 | export interface RoomItem {
id: number,
name: string,
isSelected: boolean
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RoomItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left name : AST#type_annotation#Left AST#pr... | export interface RoomItem {
id: number,
name: string,
isSelected: boolean
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L31-L35 | 306ab1337d02af1aab9ebfeda93e3fb942b8273a | github | |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/screenAndBrightness.ets | arkts | ScreenModelComponent | Sub-Page Entry Component with EndText | @Component
export struct ScreenModelComponent {
@State isTouched: boolean = false;
@StorageLink('sysScreenModeText') sysScreenModeText: string = '';
@State screenModeModel: ScreenModeModel = new ScreenModeModel();
build() {
Navigator({ target: "pages/screenMode" }) {
Flex({ justifyContent: FlexAlign.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScreenModelComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isTouched : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | @Component
export struct ScreenModelComponent {
@State isTouched: boolean = false;
@StorageLink('sysScreenModeText') sysScreenModeText: string = '';
@State screenModeModel: ScreenModeModel = new ScreenModeModel();
build() {
Navigator({ target: "pages/screenMode" }) {
Flex({ justifyContent: FlexAlign.... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/screenAndBrightness.ets#L117-L179 | ba69dfb98a473b9258f42f203fea6f1b0ed691c6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets | arkts | CloudBook 的路径 | export class CBookDbPath {
baseName : string; // 如:HONGEN_1
constructor(baseName: string) {
this.baseName = baseName;
}
/// CloudBook 的 sqlite 下载后的位置
get sqlite() : string | null {
if (dAppCBookDbFolderPath == null) {
return null;
}
return dAppCBookDbFolderPath + "/" + this.baseName... | AST#export_declaration#Left export AST#class_declaration#Left class CBookDbPath AST#class_body#Left { AST#property_declaration#Left baseName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 如:HONGEN_1 AST#constructor_declaration... | export class CBookDbPath {
baseName : string;
constructor(baseName: string) {
this.baseName = baseName;
}
get sqlite() : string | null {
if (dAppCBookDbFolderPath == null) {
return null;
}
return dAppCBookDbFolderPath + "/" + this.baseName + ".sqlite";
}
get fileName() : s... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets#L4-L24 | 5021c6b916f3b63fe90ff9cf7e81b6e01a2551e4 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/Constants.ets | arkts | Copyright (c) Huawei Technologies Co., Ltd. 2024-2025. All rights reserved. | export enum ErrorCode {
// No HUAWEI ID has been signed in.
ERROR_CODE_LOGIN_OUT = 1001502001,
// A network exception occurs in the authorization API.
ERROR_CODE_NETWORK_ERROR = 1001502005,
// Internal error.
ERROR_CODE_INTERNAL_ERROR = 1001502009,
// Authorization revoking is performed.
ERROR_CODE_USER... | AST#export_declaration#Left export AST#enum_declaration#Left enum ErrorCode AST#enum_body#Left { // No HUAWEI ID has been signed in. AST#enum_member#Left ERROR_CODE_LOGIN_OUT = AST#expression#Left 1001502001 AST#expression#Right AST#enum_member#Right , // A network exception occurs in the authorization API. AST#enum_me... | export enum ErrorCode {
ERROR_CODE_LOGIN_OUT = 1001502001,
ERROR_CODE_NETWORK_ERROR = 1001502005,
ERROR_CODE_INTERNAL_ERROR = 1001502009,
ERROR_CODE_USER_CANCEL = 1001502012,
ERROR_CODE_SYSTEM_SERVICE = 12300001,
ERROR_CODE_AGREEMENT_STATUS_NOT_ACCEPTED = 1005300001,
ERROR_CODE_REQUES... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/constants/Constants.ets#L6-L21 | 9e53de1c35658523d80cd9cd632e163db7041cdd | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | createLottieControllers | 创建 Lottie 控制器列表
@returns {Array<LottieController>} 控制器列表 | private createLottieControllers(): Array<LottieController> {
return this.tabItems.map(() => new LottieController());
} | AST#method_declaration#Left private createLottieControllers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LottieController AST#primary_type#Right AST#type_annotati... | private createLottieControllers(): Array<LottieController> {
return this.tabItems.map(() => new LottieController());
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L108-L110 | 94c4261ad8573c7c0b6d733146a3ba284a52ff72 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x2.ets | arkts | buildEmptyView | 构建空状态视图 | @Builder
buildEmptyView() {
Column({ space: 8 }) {
Image($r('app.media.ic_birthday_empty'))
.width('32vp')
.height('32vp')
.fillColor($r('app.color.text_secondary'))
Text(this.widgetData.emptyText || '暂无生日')
.fontSize(12)
.fontColor($r('app.color.text_primary')... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyView 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#component_parameters#Left { AST#component_para... | @Builder
buildEmptyView() {
Column({ space: 8 }) {
Image($r('app.media.ic_birthday_empty'))
.width('32vp')
.height('32vp')
.fillColor($r('app.color.text_secondary'))
Text(this.widgetData.emptyText || '暂无生日')
.fontSize(12)
.fontColor($r('app.color.text_primary')... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L117-L141 | 3791de1bbfba1b2ea3ada5d1518717ebc28778d0 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/model/ScopeNumber.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ScopeNumber {
temp: number;
constructor(value: number) {
this.temp = value;
}
compareTo(value: ScopeNumber) {
return this.temp >= value.getTemp();
}
getTemp() {
return this.temp;
}
toString() {
return this.temp.toString();
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ScopeNumber AST#class_body#Left { AST#property_declaration#Left temp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor ... | export class ScopeNumber {
temp: number;
constructor(value: number) {
this.temp = value;
}
compareTo(value: ScopeNumber) {
return this.temp >= value.getTemp();
}
getTemp() {
return this.temp;
}
toString() {
return this.temp.toString();
}
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/model/ScopeNumber.ets#L16-L34 | 33a05376186bd9afc29e0b041cd0dbd48b0539a7 | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/io/FsFile.ets | arkts | deleteContentsRecursively | Function to delete all contents of a directory recursively. | function deleteContentsRecursively(dir: FsDir): void {
fs.rmdirSync(dir, { recursive: true });
} | AST#function_declaration#Left function deleteContentsRecursively AST#parameter_list#Left ( AST#parameter#Left dir : AST#type_annotation#Left AST#primary_type#Left FsDir AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void A... | function deleteContentsRecursively(dir: FsDir): void {
fs.rmdirSync(dir, { recursive: true });
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/io/FsFile.ets#L34-L36 | db21995d81d01f30d20476d6b7be8a657d1972e7 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/subheaderv2/source/subheaderv2.ets | arkts | isSymbolResource | 是否symbol资源
@param resourceStr 资源
@returns true:symbol资源;false:非symbol资源 | public static isSymbolResource(resourceStr: SubHeaderV2IconType | undefined): boolean {
if (!Util.isResourceType(resourceStr)) {
return false;
}
if (resourceStr instanceof SymbolGlyphModifier) {
return resourceStr instanceof SymbolGlyphModifier;
}
let resource = resourceStr as Resource;
... | AST#method_declaration#Left public static isSymbolResource AST#parameter_list#Left ( AST#parameter#Left resourceStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SubHeaderV2IconType AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annot... | public static isSymbolResource(resourceStr: SubHeaderV2IconType | undefined): boolean {
if (!Util.isResourceType(resourceStr)) {
return false;
}
if (resourceStr instanceof SymbolGlyphModifier) {
return resourceStr instanceof SymbolGlyphModifier;
}
let resource = resourceStr as Resource;
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/subheaderv2/source/subheaderv2.ets#L1236-L1245 | f1731a426184801e3c7324e269fead2fce88925f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/EnterpriseAdminExtensionAbility/EnterpriseAdminExtensionAbility/entry/src/main/ets/pages/component/normalButtonComponent.ets | arkts | NormalButtonComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NormalButtonComponent {
btnText: string | Resource = $r('app.string.app_name');
build() {
Row() {
Flex({ alignItems: ItemAlign.Center }) {
Button(this.btnText, {buttonStyle: ButtonStyleMode.NORMAL})
.width('100%')
.fontSize(14)
}
.width('10... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NormalButtonComponent AST#component_body#Left { AST#property_declaration#Left btnText : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource... | @Component
export struct NormalButtonComponent {
btnText: string | Resource = $r('app.string.app_name');
build() {
Row() {
Flex({ alignItems: ItemAlign.Center }) {
Button(this.btnText, {buttonStyle: ButtonStyleMode.NORMAL})
.width('100%')
.fontSize(14)
}
.width('10... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/EnterpriseAdminExtensionAbility/EnterpriseAdminExtensionAbility/entry/src/main/ets/pages/component/normalButtonComponent.ets#L16-L32 | 0258ed51a233ae48a3de8638ed043e07590f754c | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | getSupportedCamerasFn | Gets the camera device object that supports the specified | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length... | AST#method_declaration#Left getSupportedCamerasFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.length... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L247-L256 | 93f263a901dc5f5f7ac9a7d22ec0027d2a6cd8c0 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | get_settings_boolean | THIS IS LEGACY CODE FOR MIGRATION ONLY
Gets the string value of a setting.
@param key A string, the key of the setting.
@param default_404_fall_back A string, who will be returned if this key is not found in KvStore.
@returns A number, the value of this key.
@returns A boolean, string_to_boolean(default_404_fall_back)... | private static async get_settings_boolean(key: string, default_404_fall_back: string): Promise<boolean> {
let value = await kv_store_get(key);
if (value == ('undefined')) {
value = default_404_fall_back;
}
console.log('[bunch_of_settings][Uni] Got settings for ' + key + ': ' + value)
return st... | AST#method_declaration#Left private static async get_settings_boolean AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left default_404_fall_back : AST#type_annotation#Left AST#pr... | private static async get_settings_boolean(key: string, default_404_fall_back: string): Promise<boolean> {
let value = await kv_store_get(key);
if (value == ('undefined')) {
value = default_404_fall_back;
}
console.log('[bunch_of_settings][Uni] Got settings for ' + key + ': ' + value)
return st... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L409-L416 | 72385d151ee14c8994b584a79174b6c78044d030 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | buildCsvImportSection | 构建CSV导入区域 | @Builder
buildCsvImportSection() {
Column({ space: 16 }) {
// 说明和模板下载
this.buildCsvInstructions()
// CSV内容输入
this.buildCsvInput()
// 解析预览
if (this.csvParseResult) {
this.buildCsvPreview()
}
// 导入按钮
this.buildImportButton('CSV')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCsvImportSection 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#component_parameters#Left { AST#compone... | @Builder
buildCsvImportSection() {
Column({ space: 16 }) {
this.buildCsvInstructions()
this.buildCsvInput()
if (this.csvParseResult) {
this.buildCsvPreview()
}
this.buildImportButton('CSV')
}
.width('100%')
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L115-L133 | 2635c78b93600bc83cb70f76eecaabdf53116fe3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/common/TitleBar.ets | arkts | TitleBar | Page title bar | @Component
export struct TitleBar {
private title: ResourceStr = ''
build() {
Column() {
Row() {
Row() {
Image($r('app.media.ic_back'))
.width(20)
.height(20)
.margin({ left: 26 })
.objectFit(ImageFit.Contain)
}
.size({ wid... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST... | @Component
export struct TitleBar {
private title: ResourceStr = ''
build() {
Column() {
Row() {
Row() {
Image($r('app.media.ic_back'))
.width(20)
.height(20)
.margin({ left: 26 })
.objectFit(ImageFit.Contain)
}
.size({ wid... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/StorageStatistic/entry/src/main/ets/common/TitleBar.ets#L19-L51 | 42873a995d054e6058fc3350cd65aa53f74dbe78 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | DataType represents the type of the data set to picker component
@enum { number } DataType
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum DataType {
/**
* DataType: set selected uris to picker component, the data should be a array of uri
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
SET_SELECTED_URIS = 1,
/**
* SET_ALBUM_URI. set select... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DataType AST#enum_body#Left { /**
* DataType: set selected uris to picker component, the data should be a array of uri
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomic... | export declare enum DataType {
SET_SELECTED_URIS = 1,
SET_ALBUM_URI = 2
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L507-L524 | 7de5b8b5136639230ef1d2530237f15da93985e0 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.