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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/utils.ets | arkts | 将storage中的用户存档初始化 | export function initData() {
const avhieveDefaultData = core.initWorldData()
} | AST#export_declaration#Left export AST#function_declaration#Left function initData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avhieveDefaultData = AST#expression#Left AST#call_expression#Left AST#exp... | export function initData() {
const avhieveDefaultData = core.initWorldData()
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L109-L111 | 627d65a20f855ba5a03e5960e091110ac25f4b32 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets | arkts | convertImageToBase64 | 图片转Base64 | private async convertImageToBase64(imageUri: string): Promise<string | null> {
try {
// 直接文件路径读取
if (imageUri.startsWith('file://') && !imageUri.startsWith('file://media/')) {
try {
const realPath: string = imageUri.replace('file://', '');
await fileIo.access(realPath);
... | AST#method_declaration#Left private async convertImageToBase64 AST#parameter_list#Left ( AST#parameter#Left imageUri : 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 AS... | private async convertImageToBase64(imageUri: string): Promise<string | null> {
try {
if (imageUri.startsWith('file://') && !imageUri.startsWith('file://media/')) {
try {
const realPath: string = imageUri.replace('file://', '');
await fileIo.access(realPath);
const ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets#L291-L671 | 7fd21c3f0f2c8b65ee645cab1c66c3f2224e2ad0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | mkdirSync | 创建目录以同步方法,当recursion指定为true,可多层级创建目录。
@param path 目录的应用沙箱路径。
@param recursion 是否多层级创建目录。recursion指定为true时,可多层级创建目录。recursion指定为false时,仅可创建单层目录。 | static mkdirSync(path: string, recursion: boolean = true) {
if (recursion) {
fs.mkdirSync(path, recursion);
} else {
fs.mkdirSync(path);
}
} | AST#method_declaration#Left static mkdirSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left recursion : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static mkdirSync(path: string, recursion: boolean = true) {
if (recursion) {
fs.mkdirSync(path, recursion);
} else {
fs.mkdirSync(path);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L330-L336 | 0bfa1268a50c662e5b82437ce9619975856c57cb | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/SplashPage.ets | arkts | checkAgreedPrivacy | 检查是否已确认过隐私提示(就是在SafePage中确认过的)。 | checkAgreedPrivacy(): void {
if (this.isAgreedPrivacy) {
this.preferenceManager.setValue('isAgreedPrivacy', true).then(() => {
ClientCoreSDK.Log.info(TAG+ 'Put the value of isAgreedPrivacy Successfully.');
this.init();
}).catch((err: BusinessError) => {
ClientCoreSDK.Log.error(TA... | AST#method_declaration#Left checkAgreedPrivacy 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#membe... | checkAgreedPrivacy(): void {
if (this.isAgreedPrivacy) {
this.preferenceManager.setValue('isAgreedPrivacy', true).then(() => {
ClientCoreSDK.Log.info(TAG+ 'Put the value of isAgreedPrivacy Successfully.');
this.init();
}).catch((err: BusinessError) => {
ClientCoreSDK.Log.error(TA... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/SplashPage.ets#L52-L71 | 2e11d5a8e3021d87b39ade84c1a867a63f7d2957 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/BottomDialogView.ets | arkts | BottomDialogView | 底部滑出弹窗组件 TODO
@author pll
@create 2025-05-20
@modify 2025-05-28 | @ComponentV2
export struct BottomDialogView {
@Require @Param options: IBaseDialogOptions;
@Local primaryButton?: ButtonOptions = undefined; //弹框左侧按钮。
@Local secondaryButton?: ButtonOptions = undefined; //弹框右侧按钮。
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
List() {
}
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct BottomDialogView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#primary... | @ComponentV2
export struct BottomDialogView {
@Require @Param options: IBaseDialogOptions;
@Local primaryButton?: ButtonOptions = undefined;
@Local secondaryButton?: ButtonOptions = undefined;
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
List() {
}
.sticky(StickyS... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/BottomDialogView.ets#L9-L51 | a99c1334348117de7a076e773f2b30a13b65da77 | github |
shubai-xixi/DistributeNewsArkts.git | 7a527c5f4121612c8070d809824b0f2615d1b238 | entry/src/main/ets/utils/HttpSyncService.ets | arkts | 从服务器获取当前选中的新闻ID | export async function fetchRemoteNewsId(): Promise<string> {
const req = http.createHttp(); // 创建HTTP实例
try {
const res = await req.request(SERVER_URL);
// 新增:打印 res.result 的原始值和类型(关键!确认是否为字符串)
console.log(`[拉取响应] 状态码:${res.responseCode},result原始值:${res.result},result类型:${typeof res.result}`);
// ... | AST#export_declaration#Left export AST#function_declaration#Left async function fetchRemoteNewsId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primar... | export async function fetchRemoteNewsId(): Promise<string> {
const req = http.createHttp();
try {
const res = await req.request(SERVER_URL);
console.log(`[拉取响应] 状态码:${res.responseCode},result原始值:${res.result},result类型:${typeof res.result}`);
if (res.responseCode === 200) {
let remoteS... | https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/utils/HttpSyncService.ets#L8-L52 | 74dae83a8456291f5a014d97e89a93a4ce04ed2e | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets | arkts | initButtonNotificationRequest | init NotificationRequest width buttons
@param notificationContent
@param notificationActionButtons
@return return the created NotificationRequest | initButtonNotificationRequest(notificationContent: notification.NotificationContent, notificationActionButtons: notification.NotificationActionButton[]): notification.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) { // 当前通知接口最大允许有两个按钮,超过两个按钮不展示
... | AST#method_declaration#Left initButtonNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | initButtonNotificationRequest(notificationContent: notification.NotificationContent, notificationActionButtons: notification.NotificationActionButton[]): notification.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) {
actionButtons = notificati... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/NotificationRequestUtil.ets#L56-L67 | ee464061c275484f247d1b1c6812b8c6fdc9003a | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/voice/util/SecretKey.ets | arkts | 应用约束1:为参数添加明确类型注解 | constructor(key: number[]) {
// 应用约束2:显式初始化类属性
this.key = new Uint8Array(new ArrayBuffer(key.length));
// 应用约束37:将for-in循环改为常规for循环
for (let i = 0; i < key.length; i++) {
this.key[i] = key[i];
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //... | constructor(key: number[]) {
this.key = new Uint8Array(new ArrayBuffer(key.length));
for (let i = 0; i < key.length; i++) {
this.key[i] = key[i];
}
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/util/SecretKey.ets#L10-L18 | 0de7e22b00f83b3b0ba35f6c8b4f871121d653e7 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setWindowFocusable | 设置点击时是否支持切换焦点窗口。该方法已过时,推荐使用:WindowUtil.setWindowFocusable() | static async setWindowFocusable(isFocusable: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setWindowFocusable(isFocusable, windowClass);
} | AST#method_declaration#Left static async setWindowFocusable AST#parameter_list#Left ( AST#parameter#Left isFocusable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#... | static async setWindowFocusable(isFocusable: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setWindowFocusable(isFocusable, windowClass);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L613-L615 | d46d44cbe28cd772c02f5c1998313919ee337c6b | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets | arkts | NavRouterView | 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... | @Component
export struct NavRouterView {
@State isActive: boolean = false;
@State indexDev: number = 0;
@Link _offset: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon'))
.width(30)
.height(30)
.borderRadius(30)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct NavRouterView {
@State isActive: boolean = false;
@State indexDev: number = 0;
@Link _offset: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon'))
.width(30)
.height(30)
.borderRadius(30)
... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/offset/NavRouterView.ets#L16-L62 | c59390d0699a427e2df0d39da6a7d37a66b71adc | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets | arkts | showBarProgressLoadingText | / 下载中 - 水平进度条 | public static showBarProgressLoadingText(progress: number, loadingText = '正在下载...') {
JhProgressHUD._showBarProgress(progress, loadingText)
} | AST#method_declaration#Left public static showBarProgressLoadingText AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left loadingText = AST#expression#Left '正在下载...' AST#exp... | public static showBarProgressLoadingText(progress: number, loadingText = '正在下载...') {
JhProgressHUD._showBarProgress(progress, loadingText)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L84-L86 | 152a42f5e6d0629362fc0422462721936c06a90e | github |
FantasyWind/fwrouter | eea785a7bf728862de1f88de487ef3857dee3364 | router/src/main/ets/RouterManagerForNavigation.ets | arkts | Navigation模式的路由管理类。 | export class RouterManagerForNavigation implements RouterHandler {
private static sInstance: RouterManagerForNavigation
public static getInstance(): RouterManagerForNavigation {
if (!RouterManagerForNavigation.sInstance) {
RouterManagerForNavigation.sInstance = new RouterManagerForNavigation()
}
... | AST#export_declaration#Left export AST#class_declaration#Left class RouterManagerForNavigation AST#implements_clause#Left implements RouterHandler AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private static sInstance : AST#type_annotation#Left AST#primary_type#Left RouterManagerForNav... | export class RouterManagerForNavigation implements RouterHandler {
private static sInstance: RouterManagerForNavigation
public static getInstance(): RouterManagerForNavigation {
if (!RouterManagerForNavigation.sInstance) {
RouterManagerForNavigation.sInstance = new RouterManagerForNavigation()
}
... | https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterManagerForNavigation.ets#L48-L143 | c6e308b8fb0421d2fb4dcf3b3a81c6172ac06008 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppAspectProgrammingDesign/entry/src/main/ets/pages/Index2.ets | arkts | addTimePrinter | Print the time before and after the insertion, and encapsulate the insertion action into an interface | function addTimePrinter(targetClass: Object, methodName: string, isStatic: boolean) {
let t1 = 0;
let t2 = 0;
util.Aspect.addBefore(targetClass, methodName, isStatic, () => {
t1 = new Date().getTime();
});
util.Aspect.addAfter(targetClass, methodName, isStatic, () => {
t2 = new Date().getTime();
c... | AST#function_declaration#Left function addTimePrinter AST#parameter_list#Left ( AST#parameter#Left targetClass : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left methodName : AST#type_annotation#Left AST#primary_type#Left str... | function addTimePrinter(targetClass: Object, methodName: string, isStatic: boolean) {
let t1 = 0;
let t2 = 0;
util.Aspect.addBefore(targetClass, methodName, isStatic, () => {
t1 = new Date().getTime();
});
util.Aspect.addAfter(targetClass, methodName, isStatic, () => {
t2 = new Date().getTime();
c... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/pages/Index2.ets#L33-L43 | 3fc3f59e8cebb522a310b8b416e804a1c9c5cc77 | gitee |
sbyder/MyChat.git | 4f4a34156092458cc44614cb45f70af6f0ed2fd8 | entry/src/main/ets/view/Avatar/Avatar.ets | arkts | Avatar | 使用时需在外面包一层正方形盒子 | @Component
export struct Avatar{
@Prop content:string|Resource
build() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){
if(typeof this.content==='string'){
Text(this.content[0])
.fontSize(18)
.fontColor('#fff')
}else {
Image(this.content)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Avatar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right |... | @Component
export struct Avatar{
@Prop content:string|Resource
build() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){
if(typeof this.content==='string'){
Text(this.content[0])
.fontSize(18)
.fontColor('#fff')
}else {
Image(this.content)
... | https://github.com/sbyder/MyChat.git/blob/4f4a34156092458cc44614cb45f70af6f0ed2fd8/entry/src/main/ets/view/Avatar/Avatar.ets#L3-L23 | 71d56a4fab62874982e3dff97c47063f3e96a37f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Home.ets | arkts | @file 首页模型
@author Joker.X | export class Home {
/**
* 轮播图
*/
banner?: Banner[] | null = null;
/**
* 分类
*/
category?: Category[] | null = null;
/**
* 全部分类
*/
categoryAll?: Category[] | null = null;
/**
* 限时精选商品
*/
flashSale?: Goods[] | null = null;
/**
* 推荐商品
*/
recommend?: Goods[] | null = null;
... | AST#export_declaration#Left export AST#class_declaration#Left class Home AST#class_body#Left { /**
* 轮播图
*/ AST#property_declaration#Left banner ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Banner [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left... | export class Home {
banner?: Banner[] | null = null;
category?: Category[] | null = null;
categoryAll?: Category[] | null = null;
flashSale?: Goods[] | null = null;
recommend?: Goods[] | null = null;
coupon?: Coupon[] | null = null;
goods?: Goods[] | null = null;
constructor(init?:... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Home.ets#L10-L52 | 4c9ae72681b3a46fb5696a9b8066e0ad73c183f3 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/MultiLevelSubMenu.ets | arkts | MultiLevelSubMenuBuilder | 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... | @Builder
export function MultiLevelSubMenuBuilder(name: string, param: Object) {
MultiLevelSubMenuExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MultiLevelSubMenuBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L... | @Builder
export function MultiLevelSubMenuBuilder(name: string, param: Object) {
MultiLevelSubMenuExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/MultiLevelSubMenu.ets#L16-L19 | 02f39726a05730bd9e08fca949c2717c632f8a2d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | getRecentGreetingHistory | 获取最近的祝福记录
@param limit 数量限制 | async getRecentGreetingHistory(limit: number = 10): Promise<GreetingHistoryWithContact[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryWithContactInfo(limit);
} | AST#method_declaration#Left async getRecentGreetingHistory 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#expression#Left 10 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | async getRecentGreetingHistory(limit: number = 10): Promise<GreetingHistoryWithContact[]> {
this.checkInitialization();
return await this.greetingHistoryDAO.getGreetingHistoryWithContactInfo(limit);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L231-L234 | 550492cbf8b91464214befec56987defe5b34a92 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | clearAll | 清除所有订单缓存
@returns {Promise<void>} Promise<void> | async clearAll(): Promise<void> {
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_CARTS);
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST);
} | AST#method_declaration#Left async clearAll 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_argumen... | async clearAll(): Promise<void> {
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_CARTS);
await this.prefs.remove(OrderCacheStoreDataSourceImpl.KEY_SELECTED_GOODS_LIST);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L152-L155 | 3259feb3d5e5275fd985a16dc0e2e39a1fb0a4ee | github |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 最早的创建窗口的钩子 提前将后续使用的上下文context放到appstorage 共享给整个应用 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
// hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
logger.info('生命周期', 'Ability onCreate')
// AppStorage.setOrCr... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
logger.info('生命周期', 'Ability onCreate')
AppStorage.setOrCreate('context', this.context)
} | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/entryability/EntryAbility.ets#L46-L53 | 1c463493be6ef5b685ce52a8bd5ee4d7106d57ad | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getBundleInfoSync | 获取当前应用的BundleInfo | static getBundleInfoSync(): bundleManager.BundleInfo {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_H... | AST#method_declaration#Left static getBundleInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement... | static getBundleInfoSync(): bundleManager.BundleInfo {
const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY |
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_H... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L454-L467 | 2ed3d0f7f5b42384e9cc37ef714227ffe8b690de | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets | arkts | get | 获取单例实例 | public static get shared(): CSoundDbAccessor {
if (!CSoundDbAccessor.instance) {
CSoundDbAccessor.instance = new CSoundDbAccessor();
}
return CSoundDbAccessor.instance;
} | AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CSoundDbAccessor AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_... | public static get shared(): CSoundDbAccessor {
if (!CSoundDbAccessor.instance) {
CSoundDbAccessor.instance = new CSoundDbAccessor();
}
return CSoundDbAccessor.instance;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L45-L50 | ff2d8949ad5235d3f0697020b9c354bb1535c563 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets | arkts | FileDownloadItem | 单个下载任务 | @Component
export struct FileDownloadItem {
// 文件下载配置
@State downloadConfig: request.agent.Config = { action: request.agent.Action.DOWNLOAD, url: '' };
// 下载文件名
@State fileName: string = '';
// 下载任务状态
@State state: string = "";
// 监听是否全部开始下载
@Link @Watch('onDownLoadUpdated') isStartAllDownload: boolean;... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FileDownloadItem AST#component_body#Left { // 文件下载配置 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right downloadConfig : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left... | @Component
export struct FileDownloadItem {
@State downloadConfig: request.agent.Config = { action: request.agent.Action.DOWNLOAD, url: '' };
@State fileName: string = '';
@State state: string = "";
@Link @Watch('onDownLoadUpdated') isStartAllDownload: boolean;
private downloadTask: request.age... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets#L46-L183 | 6d137ffdb1d7081042ea0a2ad15ff254c205cedf | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | rmdirSync | 删除整个目录,以同步方法。
@param path 目录的应用沙箱路径。 | static rmdirSync(path: string) {
return fs.rmdirSync(path);
} | AST#method_declaration#Left static rmdirSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left r... | static rmdirSync(path: string) {
return fs.rmdirSync(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L352-L354 | 5bce5ad286ba0fa0796a7c8b7c24d51b2b8384bb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment4.ets | arkts | [StartExclude Case4] | build() {
Column() {
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#... | build() {
Column() {
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment4.ets#L70-L73 | ff96a5ceff8edd29099207ac849990bdfad48ed1 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets | arkts | selectServerCert | 选择并加载服务器证书 | selectServerCert() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.serverCert = result[0];
this.msgHistory += `Selected server certificate file: ${this.serverCert}\n`;
}
}).catch((err: Error) => {
... | AST#method_declaration#Left selectServerCert AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#... | selectServerCert() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
this.serverCert = result[0];
this.msgHistory += `Selected server certificate file: ${this.serverCert}\n`;
}
}).catch((err: Error) => {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TlsServer.ets#L200-L210 | 5697c329799fc96a77b4eff561622ef76a8d3dba | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 消息列表
@param date
@returns | export function getMessageList(page:number) {
return axiosClient.post<MessageWrapModel>({
url: `message/lg/readed_list/${page}/json`,
checkResultCode:true,
showLoading:true,
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getMessageList AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | export function getMessageList(page:number) {
return axiosClient.post<MessageWrapModel>({
url: `message/lg/readed_list/${page}/json`,
checkResultCode:true,
showLoading:true,
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L344-L350 | 35f2c49b7ff007897ec16537e97d81fff5bcb3c0 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | boxesComputed | /计算 指定piece的所有box | private static boxesComputed(piece: Piece, distances: DistanceFromBase[]): Box[] {
let boxes: Box[] = [];
//遍历每个distance
distances.forEach(distance => {
//某天的其中一个box
boxes.push(new Box(distance, piece.pieceNo));
});
return boxes;
} | AST#method_declaration#Left private static boxesComputed AST#parameter_list#Left ( AST#parameter#Left piece : AST#type_annotation#Left AST#primary_type#Left Piece AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left distances : AST#type_annotation#Left AST#primary_type#Left AST#arra... | private static boxesComputed(piece: Piece, distances: DistanceFromBase[]): Box[] {
let boxes: Box[] = [];
distances.forEach(distance => {
boxes.push(new Box(distance, piece.pieceNo));
});
return boxes;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L469-L477 | 24ac45fb3ddcdae34dde3e71c137794576b1ac6b | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | isUseAutoScaleMaxRestriction | Returns true if autoscale restriction for axis max value is enabled
@Deprecated | public isUseAutoScaleMaxRestriction(): boolean {
return this.mUseAutoScaleRestrictionMax;
} | AST#method_declaration#Left public isUseAutoScaleMaxRestriction AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Lef... | public isUseAutoScaleMaxRestriction(): boolean {
return this.mUseAutoScaleRestrictionMax;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L479-L481 | d71e89c2efe4a9c647ef3e7875caef4f2095e93d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/TaskManagement/TransientTask/entry/src/main/ets/pages/TitleBar.ets | arkts | TitleBar | 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... | @Component
export struct TitleBar {
build() {
Row() {
Text($r("app.string.MainAbility_label"))
.fontSize(25)
.layoutWeight(1)
.fontColor(Color.White)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('8%')
.backgroundColor($r('app.color.background'))
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST... | @Component
export struct TitleBar {
build() {
Row() {
Text($r("app.string.MainAbility_label"))
.fontSize(25)
.layoutWeight(1)
.fontColor(Color.White)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('8%')
.backgroundColor($r('app.color.background'))
.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/TaskManagement/TransientTask/entry/src/main/ets/pages/TitleBar.ets#L16-L31 | 4f8fc6d06adaa331e3987bfe1aa4a88a0dd6924f | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/ASF.ets | arkts | setAddress | 设置全局服务器地址 | setAddress(address: string) {
this.address = this.getFinalAddress(address);
Logger.debug(this.LOG_TAG, `当前ASF地址: ${this.address}`);
} | AST#method_declaration#Left setAddress AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio... | setAddress(address: string) {
this.address = this.getFinalAddress(address);
Logger.debug(this.LOG_TAG, `当前ASF地址: ${this.address}`);
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/ASF.ets#L18-L21 | 4ceaa93a20aa71ec0cc988a51028af5406bb5736 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isSharedArrayBuffer | 检查是否为SharedArrayBuffer类型。
@param value
@returns | static isSharedArrayBuffer(value: Object): boolean {
return new util.types().isSharedArrayBuffer(value);
} | AST#method_declaration#Left static isSharedArrayBuffer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object 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#p... | static isSharedArrayBuffer(value: Object): boolean {
return new util.types().isSharedArrayBuffer(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L154-L156 | 8a8810bffb2c11d8608cafd56f90014d08f7858e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | decodeAfterRemoveSalt | 先去盐再进行Base64解码
@param str 要处理的字符串
@returns 处理后的字符串或null | static decodeAfterRemoveSalt(str: string | null): string | null {
const withoutSalt = StringEncoder.removedSalt(str);
return withoutSalt ? StringEncoder.decodedFromBase64(withoutSalt) : null;
} | AST#method_declaration#Left static decodeAfterRemoveSalt AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Ri... | static decodeAfterRemoveSalt(str: string | null): string | null {
const withoutSalt = StringEncoder.removedSalt(str);
return withoutSalt ? StringEncoder.decodedFromBase64(withoutSalt) : null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L61-L64 | b648372e1ea0b0a6bbcead4a01445517ff34cc5e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets | arkts | computeHSLGradient | TODO:知识点:根据 HSL 色相数组和色阶数生成按亮度渐变的 HEX 格式颜色 | computeHSLGradient(hues: HslType[], levels: number): string[] {
if (levels <= 0) {
return [];
}
const colors: string[] = [];
for (let i = 0; i < levels; i++) {
hues.forEach(hsl => {
// 根据给定的渐变亮度起止点和所处色阶计算渐变亮度
const fadedL =
this.gradientStartPoint + Math.round(i * (... | AST#method_declaration#Left computeHSLGradient AST#parameter_list#Left ( AST#parameter#Left hues : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HslType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left levels : AST#type_annotation#Le... | computeHSLGradient(hues: HslType[], levels: number): string[] {
if (levels <= 0) {
return [];
}
const colors: string[] = [];
for (let i = 0; i < levels; i++) {
hues.forEach(hsl => {
const fadedL =
this.gradientStartPoint + Math.round(i * (this.gradientEndPoint - th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets#L371-L388 | 9ff59e69c66936e0be625f0f6f38afc42572f050 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SegmentButtonV2.d.ets | arkts | SegmentButtonV2Items | Defines the items of the segmented button.
@extends Array<SegmentButtonV2Item>
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ObservedV2
export declare class SegmentButtonV2Items extends Array<SegmentButtonV2Item> {
/**
* The constructor of SegmentedButtonItems
*
* @param { SegmentButtonV2ItemOptions[] } items - the options array of the segmented button items
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossp... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class SegmentButtonV2Items extends 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 S... | @ObservedV2
export declare class SegmentButtonV2Items extends Array<SegmentButtonV2Item> {
constructor(items: SegmentButtonV2ItemOptions[]);
get hasHybrid(): boolean;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L325-L348 | 11d9912847f85e13c7ca156d8d41400cef0b337f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets | arkts | tabBar | tabBar样式 | @Builder
function tabBar($$: TabBarItemInterface) {
Column() {
Image($r('app.media.return_home_fill'))
.height(20)
.width(20)
.objectFit(ImageFit.Contain)
Text($$.title)
.fontSize($$.curIndex === $$.index ? $r('app.float.custom_animation_tab_list_select_font_size') :
$r('app.floa... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function tabBar AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left TabBarItemInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS... | @Builder
function tabBar($$: TabBarItemInterface) {
Column() {
Image($r('app.media.return_home_fill'))
.height(20)
.width(20)
.objectFit(ImageFit.Contain)
Text($$.title)
.fontSize($$.curIndex === $$.index ? $r('app.float.custom_animation_tab_list_select_font_size') :
$r('app.floa... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets#L189-L203 | 24e8b90cf6a6ec323d8fe94337fe7f1820a87456 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets | arkts | error | Outputs error-level logs.
@param args Indicates the log parameters. | error(...args: string[]) {
hilog.error(this.domain, this.prefix, this.format, args);
} | AST#method_declaration#Left error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AS... | error(...args: string[]) {
hilog.error(this.domain, this.prefix, this.format, args);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets#L65-L67 | 033be9614d0efe91ffce8941249ab2c3030de436 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/PureTabsExt/entry/src/main/ets/view/SwitchTabComponent.ets | arkts | [EndExclude custom_switch_tab] | build() {
Column() {
Row() {
Button('Previous Tab')
.onClick(() => {
this.tabController.changeIndex((this.currentIndex + 3) % 4); // call tabController.changeIndex() to switch tab
})
// [StartExclude custom_switch_tab]
.width(158)
.height(... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Button('Previous Tab')
.onClick(() => {
this.tabController.changeIndex((this.currentIndex + 3) % 4);
})
.width(158)
.height(40)
.margin({top:10, right: 10 })
.backgroundColor('rgba(0,0,0,0... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/SwitchTabComponent.ets#L64-L115 | 5df1e03015f3cb9859cc848b65348efa33b12b93 | gitee | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/mock/InterviewArticleMockData.ets | arkts | getArticlesByCategory | 根据分类获取文章 | static getArticlesByCategory(category: InterviewArticleCategory): InterviewArticleModel[] {
return InterviewArticleMockData.articles.filter(article => article.category === category);
} | AST#method_declaration#Left static getArticlesByCategory AST#parameter_list#Left ( AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left InterviewArticleCategory AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_... | static getArticlesByCategory(category: InterviewArticleCategory): InterviewArticleModel[] {
return InterviewArticleMockData.articles.filter(article => article.category === category);
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/mock/InterviewArticleMockData.ets#L986-L988 | 65290f0bf3d3bf89846cccab809ff40da94b556d | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinS.ets | arkts | SpinS | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinS {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 1;
@Local scale2: number = 0.3;
@Local scale3: number = 0.4;
@Local scale4: number = 0.5;
@Local scale5: number = 0.6;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinS AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinS {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 1;
@Local scale2: number = 0.3;
@Local scale3: number = 0.4;
@Local scale4: number = 0.5;
@Local scale5: number = 0.6;
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinS.ets#L27-L142 | 54c8e0277e56d0c235e5336400ecbbe98e8d54e5 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/mock/NewsDetailData.ets | arkts | 模拟评论数据 | export function mockData(): NewsCommentData {
const commentList: NewsCommentData = new NewsCommentData();
commentList.pushData(new NewsCommentModel("1", $r("app.media.news_image_1"), '你若安好便是晴天', '', '', '国足加油!国足必胜!', new Date('2024-11-01 23:00:00'),new NewsCommentData()))
commentList.pushData(new NewsCommentModel... | AST#export_declaration#Left export AST#function_declaration#Left function mockData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NewsCommentData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration... | export function mockData(): NewsCommentData {
const commentList: NewsCommentData = new NewsCommentData();
commentList.pushData(new NewsCommentModel("1", $r("app.media.news_image_1"), '你若安好便是晴天', '', '', '国足加油!国足必胜!', new Date('2024-11-01 23:00:00'),new NewsCommentData()))
commentList.pushData(new NewsCommentModel... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/mock/NewsDetailData.ets#L19-L30 | adf58f6fe2b51bd70f192103ec25720baae71c91 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | getVideoTime | Recording Time Timer
@param millisecond-Data value | getVideoTime(millisecond: number): string {
let millisecond2minute = 60000;
let millisecond2second = 1000;
let minute = Math.floor(millisecond / millisecond2minute);
let second = Math.floor((millisecond - minute * millisecond2minute) / millisecond2second);
return `${this.fill(minute)} : ${this.fill(... | AST#method_declaration#Left getVideoTime AST#parameter_list#Left ( AST#parameter#Left millisecond : 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 string AST#primary_ty... | getVideoTime(millisecond: number): string {
let millisecond2minute = 60000;
let millisecond2second = 1000;
let minute = Math.floor(millisecond / millisecond2minute);
let second = Math.floor((millisecond - minute * millisecond2minute) / millisecond2second);
return `${this.fill(minute)} : ${this.fill(... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L49-L55 | 3291f636db3af1b860a38b744936450008298716 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService.ets | arkts | initializeMappingService | 初始化农历公历映射服务 | private async initializeMappingService(): Promise<void> {
try {
await this.mappingService.initialize();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'LunarSolarMappingService initialized successfully in ContactService');
} catch (error) {
hilog.error(LogConstants.DOMAIN_AP... | AST#method_declaration#Left private async initializeMappingService 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#... | private async initializeMappingService(): Promise<void> {
try {
await this.mappingService.initialize();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'LunarSolarMappingService initialized successfully in ContactService');
} catch (error) {
hilog.error(LogConstants.DOMAIN_AP... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L94-L103 | 439d6a6c90d59799ef79b6d79019884e4e4dd561 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | requestPermissions | 请求必要权限 | private async requestPermissions(): Promise<void> {
try {
const atManager = abilityAccessCtrl.createAtManager();
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const tokenId = bundleInfo.appInfo.accessTokenId;
// 必要权限:... | AST#method_declaration#Left private async requestPermissions 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 ... | private async requestPermissions(): Promise<void> {
try {
const atManager = abilityAccessCtrl.createAtManager();
const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const tokenId = bundleInfo.appInfo.accessTokenId;
c... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/entryability/EntryAbility.ets#L94-L151 | ff3aba7d4dcfac4c9246361d409a94fc1de6e501 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHA.ets | arkts | digestSHA1 | SHA1摘要
@param str 带摘要的字符串
@returns 摘要后的字符串 | static async digestSHA1(str: string): Promise<string> {
return CryptoUtil.digest(str, 'SHA1');
} | AST#method_declaration#Left static async digestSHA1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | static async digestSHA1(str: string): Promise<string> {
return CryptoUtil.digest(str, 'SHA1');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L32-L34 | 3c93a42501103b549387903bb88a3d75c8715007 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets | arkts | modSqrt | 计算模P下的平方根
@param a 要计算平方根的数
@returns 平方根,如果不存在则返回null | private static modSqrt(a: number): number | null {
a = ((a % EllipticCurveKeyExchange.P) + EllipticCurveKeyExchange.P) % EllipticCurveKeyExchange.P;
for (let x = 0; x < EllipticCurveKeyExchange.P; x++) {
if ((x * x) % EllipticCurveKeyExchange.P === a) {
return x;
}
}
return null;
} | AST#method_declaration#Left private static modSqrt AST#parameter_list#Left ( AST#parameter#Left a : 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#union_type#Left AST#primary_type#Left n... | private static modSqrt(a: number): number | null {
a = ((a % EllipticCurveKeyExchange.P) + EllipticCurveKeyExchange.P) % EllipticCurveKeyExchange.P;
for (let x = 0; x < EllipticCurveKeyExchange.P; x++) {
if ((x * x) % EllipticCurveKeyExchange.P === a) {
return x;
}
}
return null;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets#L36-L44 | ddf359ddfa3b1223f0329395ad55681ef65a79f8 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LogUtil.ets | arkts | uniLog | 统一日志输出 | private static uniLog(message: string[] | object[], level: hilog.LogLevel) {
if (!LogUtil.showLog) {
return; //不打印日志
}
let topLine = LogUtil.getLine(LogUtil.tag);
LogUtil.levelLog(topLine, level);
if (level === hilog.LogLevel.ERROR || level === hilog.LogLevel.FATAL) {
let locationLog = L... | AST#method_declaration#Left private static uniLog AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Rig... | private static uniLog(message: string[] | object[], level: hilog.LogLevel) {
if (!LogUtil.showLog) {
return;
}
let topLine = LogUtil.getLine(LogUtil.tag);
LogUtil.levelLog(topLine, level);
if (level === hilog.LogLevel.ERROR || level === hilog.LogLevel.FATAL) {
let locationLog = LogUtil.... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L163-L185 | 3ae347bffce0d08cf26a2dd11838ae5573d43646 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets | arkts | getCurrentCityInfo | 获取当前所在城市位置
@returns | static async getCurrentCityInfo(): Promise<string> {
try {
const requestInfo: geoLocationManager.CurrentLocationRequest = {
priority: geoLocationManager.LocationRequestPriority.FIRST_FIX,
timeoutMs: 1000,
};
const currentLocation = await geoLocationManager.getCurrentLocation(reques... | AST#method_declaration#Left static async getCurrentCityInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right... | static async getCurrentCityInfo(): Promise<string> {
try {
const requestInfo: geoLocationManager.CurrentLocationRequest = {
priority: geoLocationManager.LocationRequestPriority.FIRST_FIX,
timeoutMs: 1000,
};
const currentLocation = await geoLocationManager.getCurrentLocation(reques... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L158-L177 | ca4fd7d3a53684dbb5d356a0b1ba2d9714d7b636 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/AchievementMapInfo.ets | arkts | Achievement map info | export default class AchievementMapInfo {
off_3: Resource = $r('app.media.ic_badge_3_off');
on_3: Resource = $r('app.media.ic_badge_3_on');
off_7: Resource = $r('app.media.ic_badge_7_off');
on_7: Resource = $r('app.media.ic_badge_7_on');
off_30: Resource = $r('app.media.ic_badge_30_off');
on_30: Resource = ... | AST#export_declaration#Left export default AST#class_declaration#Left class AchievementMapInfo AST#class_body#Left { AST#property_declaration#Left off_3 : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#... | export default class AchievementMapInfo {
off_3: Resource = $r('app.media.ic_badge_3_off');
on_3: Resource = $r('app.media.ic_badge_3_on');
off_7: Resource = $r('app.media.ic_badge_7_off');
on_7: Resource = $r('app.media.ic_badge_7_on');
off_30: Resource = $r('app.media.ic_badge_30_off');
on_30: Resource = ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/AchievementMapInfo.ets#L19-L32 | 2c61d041719564c9ab2bba009f3022e8f1a52970 | gitee | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/FootprintPage.ets | arkts | loadFootprintMerchants | 加载足迹商家数据 | private async loadFootprintMerchants(): Promise<void> {
try {
this.isLoading = true;
hilog.info(DOMAIN, TAG, 'Loading footprint merchants, ids: %{public}s', JSON.stringify(this.footprintIds));
// 获取所有商家数据
const allMerchants = MockDataManager.getInstance().getAllMerchants();
// 根据足迹 I... | AST#method_declaration#Left private async loadFootprintMerchants 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#Ri... | private async loadFootprintMerchants(): Promise<void> {
try {
this.isLoading = true;
hilog.info(DOMAIN, TAG, 'Loading footprint merchants, ids: %{public}s', JSON.stringify(this.footprintIds));
const allMerchants = MockDataManager.getInstance().getAllMerchants();
const merchan... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/FootprintPage.ets#L39-L63 | a53ba86c16fd46d612eecfc0e0ac3aea9aac999d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/EmptyAlbumComponent.ets | arkts | EmptyAlbumComponent | New style | @Component
export struct EmptyAlbumComponent {
@Consume gridHeight: number;
@Consume isBigCard: boolean;
@State icHeight: number = 0;
gridAspectRatio = Constants.CARD_ASPECT_RATIO;
aboutToAppear(): void {
let numberHeight = px2vp(fp2px(Constants.TEXT_SIZE_BODY2));
let nameHeight = px2vp(fp2px(Constan... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmptyAlbumComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right gridHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS... | @Component
export struct EmptyAlbumComponent {
@Consume gridHeight: number;
@Consume isBigCard: boolean;
@State icHeight: number = 0;
gridAspectRatio = Constants.CARD_ASPECT_RATIO;
aboutToAppear(): void {
let numberHeight = px2vp(fp2px(Constants.TEXT_SIZE_BODY2));
let nameHeight = px2vp(fp2px(Constan... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/EmptyAlbumComponent.ets#L19-L68 | 52eeb640fca91e45cc324c3a57e1606989a5e74f | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | init | Init cropShow.
@param limit
@param imageRatio | init(limit: RectF, imageRatio: number) {
this.limitRect.set(limit.left, limit.top, limit.right, limit.bottom);
MathUtils.computeMaxRectWithinLimit(this.imageRect, limit, imageRatio);
this.cropRect.set(this.imageRect.left, this.imageRect.top, this.imageRect.right, this.imageRect.bottom);
this.ratio.set(C... | AST#method_declaration#Left init AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | init(limit: RectF, imageRatio: number) {
this.limitRect.set(limit.left, limit.top, limit.right, limit.bottom);
MathUtils.computeMaxRectWithinLimit(this.imageRect, limit, imageRatio);
this.cropRect.set(this.imageRect.left, this.imageRect.top, this.imageRect.right, this.imageRect.bottom);
this.ratio.set(C... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L70-L79 | 27a64992624e06f035a9f66f3e6b1f7df2730c58 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildInfoRow | 信息行 | @Builder
buildInfoRow(label: string, value: string) {
Row() {
Text(label)
.fontSize(14)
.fontColor(this.COLORS.textSecondary)
.layoutWeight(1)
Text(value)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
}
.width(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildInfoRow AST#parameter_list#Left ( AST#parameter#Left label : 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 ... | @Builder
buildInfoRow(label: string, value: string) {
Row() {
Text(label)
.fontSize(14)
.fontColor(this.COLORS.textSecondary)
.layoutWeight(1)
Text(value)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
}
.width(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5783-L5797 | 3a12fe5a9ba68e917ecb8911d0cf81b5efcc64f3 | github |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onBackground | 当切换到后台 | onBackground(): void {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
} | AST#method_declaration#Left onBackground 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 { // Ability has back to background AST#expression_statement#Left AST#expression#Left AST#ca... | onBackground(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/entryability/EntryAbility.ets#L55-L58 | 23662176e272e3adf4284054126318180f399245 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoHelper.ets | arkts | stringToHex | 字符串转Hex
@param str
@returns | static stringToHex(str: string): string {
let hex = '';
for (let i = 0; i < str.length; i++) {
let hexCharCode = str.charCodeAt(i).toString(16);
// 确保每个字符的十六进制编码占两位,不足补零
hex += ('00' + hexCharCode).slice(-2);
}
return hex;
} | AST#method_declaration#Left static stringToHex AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static stringToHex(str: string): string {
let hex = '';
for (let i = 0; i < str.length; i++) {
let hexCharCode = str.charCodeAt(i).toString(16);
hex += ('00' + hexCharCode).slice(-2);
}
return hex;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L187-L195 | dfc374f3d5488af941a2839eb46f46a237d2ebaa | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets | arkts | changefavoriteCount | 点击收藏按钮的回调函数 | private changefavoriteCount(isIncrease: boolean) {
let favoriteCountNum = Number(this.favoriteCount);
if (isIncrease) {
favoriteCountNum++;
} else {
favoriteCountNum--;
}
this.favoriteCount = '' + favoriteCountNum;
animateTo({ duration: 200, curve: Curve.EaseInOut }, () => {
th... | AST#method_declaration#Left private changefavoriteCount AST#parameter_list#Left ( AST#parameter#Left isIncrease : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#varia... | private changefavoriteCount(isIncrease: boolean) {
let favoriteCountNum = Number(this.favoriteCount);
if (isIncrease) {
favoriteCountNum++;
} else {
favoriteCountNum--;
}
this.favoriteCount = '' + favoriteCountNum;
animateTo({ duration: 200, curve: Curve.EaseInOut }, () => {
th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets#L59-L70 | 9316bb8d6f010d0ba16e337427c84c2176ea5b2b | gitee |
zhangyuhang0914/ArkTs-HarmonyOs.git | c9773cad7ebeee413f98ee1a57cc8fba91fecf7d | entry/src/main/ets/route/RoutePath.ets | arkts | 路由表管理 | export class RoutePath {
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly NewNoticeTab = "pages/list/NewNoticeTab"
static readonly CommonDetail = "pages/newNotice/detail/CommonDetail"
} | AST#export_declaration#Left export AST#class_declaration#Left class RoutePath AST#class_body#Left { AST#property_declaration#Left static readonly SplashPage = AST#expression#Left "pages/SplashPage" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly MainPage = AST#expressi... | export class RoutePath {
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly NewNoticeTab = "pages/list/NewNoticeTab"
static readonly CommonDetail = "pages/newNotice/detail/CommonDetail"
} | https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/route/RoutePath.ets#L4-L9 | db8ae3ada5772980814670bc8ff9a57b7fc92642 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/component/VerificationCodeField.ets | arkts | getSendCodeTextColor | 获取发送验证码文本颜色
@returns {ResourceColor} 文本颜色 | private getSendCodeTextColor(): ResourceColor {
return this.isPhoneValid ? $r("app.color.warning") : $r("app.color.text_quaternary");
} | AST#method_declaration#Left private getSendCodeTextColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | private getSendCodeTextColor(): ResourceColor {
return this.isPhoneValid ? $r("app.color.warning") : $r("app.color.text_quaternary");
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/VerificationCodeField.ets#L105-L107 | 1e42be8059ce8d793580e8826e16dc5a44c5ebd1 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | frameworks/text/interface/export/ani/@ohos.graphics.text.ets | arkts | Enumeration the type of text baseline.
@enum { number }
@syscap SystemCapability.Graphics.Drawing
@since 12 | export enum TextBaseline {
/**
* The alphabetic baseline, typically used for Latin-based scripts where the baseline aligns
* with the base of lowercase letters.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
ALPHABETIC,
/**
* The ideographic baseline, commonly used... | AST#export_declaration#Left export AST#enum_declaration#Left enum TextBaseline AST#enum_body#Left { /**
* The alphabetic baseline, typically used for Latin-based scripts where the baseline aligns
* with the base of lowercase letters.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/ AS... | export enum TextBaseline {
ALPHABETIC,
IDEOGRAPHIC,
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L1152-L1168 | cccf9773019c53dfe80de1014d61ebfc7038d279 | gitee | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/model/MessagesProvider.ets | arkts | putMessage | 加入一条新消息。
@param m 消息对象 | putMessage(m: Message): void {
// 以下代码用于判断并实现仿微信的只显示2分钟内聊天消息的时间标识(参考资料:http://www.52im.net/thread-3008-1-1.html#40)
let previousMessage: Message | undefined = undefined;
let messagesSize: number = this.messages.length;
if (messagesSize > 0) {
previousMessage = this.messages[messagesSize - 1];
... | AST#method_declaration#Left putMessage AST#parameter_list#Left ( AST#parameter#Left m : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#... | putMessage(m: Message): void {
let previousMessage: Message | undefined = undefined;
let messagesSize: number = this.messages.length;
if (messagesSize > 0) {
previousMessage = this.messages[messagesSize - 1];
}
MessagesProvider.setMessageShowTopTime(m, previousMessage);
this.mes... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L39-L53 | ffbd3e0099030d65b80222f9340205617a581951 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | animation/entry/src/main/ets/pages/IconItem.ets | arkts | IconItem | [Start icon_item] | @Component
export struct IconItem {
@StorageLink('renderGroupFlag') renderGroupFlag: boolean = false;
image: string | Resource = '';
text: string | Resource = '';
build() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
alignContent: FlexAlign.Center
}) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IconItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'renderGroupFlag' AST#expression#Right ) AST#decorator#Right renderGroupFlag : AST#type_annotatio... | @Component
export struct IconItem {
@StorageLink('renderGroupFlag') renderGroupFlag: boolean = false;
image: string | Resource = '';
text: string | Resource = '';
build() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
alignContent: FlexAlign.Center
}) {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/animation/entry/src/main/ets/pages/IconItem.ets#L17-L50 | 89ba2f1f94381ec5e86449a39b224e3f8e701ab1 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | enableGridDashedLine | Enables the grid line to be drawn in dashed mode, e.g. like this
"- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF.
Keep in mind that hardware acceleration boosts performance.
@param lineLength the length of the line pieces
@param spaceLength the length of space in between the pieces
@param phase ... | public enableGridDashedLine(lineLength: number, spaceLength: number, phase: number): void {
this.mGridDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase);
} | AST#method_declaration#Left public enableGridDashedLine AST#parameter_list#Left ( AST#parameter#Left lineLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left spaceLength : AST#type_annotation#Left AST#primary_type#Left n... | public enableGridDashedLine(lineLength: number, spaceLength: number, phase: number): void {
this.mGridDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L585-L587 | d6749049f8d424369f253242ac4e0ac6566491ce | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | notifyDataSetChanged | Lets the chart know its underlying data has changed and performs all
necessary recalculations. It is crucial that this method is called
every time data is changed dynamically. Not calling this method can lead
to crashes or unexpected behaviour. | public abstract notifyDataSetChanged(); | AST#method_declaration#Left public abstract notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | public abstract notifyDataSetChanged(); | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L309-L309 | 6b36c5797b0eb7226eb6632ec35aa312df0b2431 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | addLimitLine | Adds a new LimitLine to this axis.
@param l | public addLimitLine(l: LimitLine): void {
this.mLimitLines.add(l);
if (this.mLimitLines.size() > 6) {
console.log(
'MPAndroiChart',
'Warning! You have more than 6 LimitLines on your axis, do you really want ' + 'that?'
);
}
} | AST#method_declaration#Left public addLimitLine AST#parameter_list#Left ( AST#parameter#Left l : AST#type_annotation#Left AST#primary_type#Left LimitLine AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | public addLimitLine(l: LimitLine): void {
this.mLimitLines.add(l);
if (this.mLimitLines.size() > 6) {
console.log(
'MPAndroiChart',
'Warning! You have more than 6 LimitLines on your axis, do you really want ' + 'that?'
);
}
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L430-L439 | 2ffce60ee46a28db172a6e3a3065a642c3c3e5c9 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets | arkts | aboutToAppear | 是否点击一级列表
生命周期函数 | aboutToAppear(): void {
// 构造数据
for (let i = 0; i < TAG_LIST_LENGTH; i++) {
this.tagLists.push(`类别${i + 1}`);
const tempData: Array<CustomDataType> = new Array<CustomDataType>(CONTENT_PER_TAG).fill({
desc: '内容数据',
tag: `类别${i + 1}`
});
this.records.push(i * CONTENT_PER_TA... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 构造数据 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#v... | aboutToAppear(): void {
for (let i = 0; i < TAG_LIST_LENGTH; i++) {
this.tagLists.push(`类别${i + 1}`);
const tempData: Array<CustomDataType> = new Array<CustomDataType>(CONTENT_PER_TAG).fill({
desc: '内容数据',
tag: `类别${i + 1}`
});
this.records.push(i * CONTENT_PER_TAG);
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets#L108-L121 | 21a9a286efb9fe4f5a85e802564a5af6aa4d1d64 | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/util.ets | arkts | Encode bytes to base64 string (unpadded standard alphabet) | export function encodeBase64(bytes: Uint8Array): string {
let out = ''
let i = 0
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
const n = bytes.byteLength
while (i < n) {
const b0 = dv.getUint8(i++)
const b1 = i < n ? dv.getUint8(i++) : 0
const b2 = i < n ? dv.getUint8(i... | AST#export_declaration#Left export AST#function_declaration#Left function encodeBase64 AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left... | export function encodeBase64(bytes: Uint8Array): string {
let out = ''
let i = 0
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
const n = bytes.byteLength
while (i < n) {
const b0 = dv.getUint8(i++)
const b1 = i < n ? dv.getUint8(i++) : 0
const b2 = i < n ? dv.getUint8(i... | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L68-L83 | 6b17bafd06ab9e4cfda0e14fa47cf652fe361e20 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/GlobalContext.ets | arkts | Copyright (c) 2023-2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.insta... | AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat... | export class GlobalContext {
private constructor() {
}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.insta... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/GlobalContext.ets#L17-L42 | 7c353284f7432cb427493a79f2effa0858aae2ad | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | getNodeInfoData | To gain the information while to alter node. | getNodeInfoData(): NodeParam {
return this.nodeParam;
} | AST#method_declaration#Left getNodeInfoData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NodeParam 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_expre... | getNodeInfoData(): NodeParam {
return this.nodeParam;
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L616-L618 | 0dfdbeded1eb7bc714ca3d068febeb35ae82043c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets | arkts | MARK: - 腾讯云下载器类 | export class CosDownloader {
// MARK: - 单例实例
private static instance: CosDownloader = new CosDownloader();
// MARK: - 私有属性
private downloadingSet: Set<string> = new Set();
// private downloadQueue: taskpool.TaskPool = new taskpool.TaskPool("com.ou.TencentCos.Downloader.Queue");
// MARK: - 构造函数
private c... | AST#export_declaration#Left export AST#class_declaration#Left class CosDownloader AST#class_body#Left { // MARK: - 单例实例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left CosDownloader AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_exp... | export class CosDownloader {
private static instance: CosDownloader = new CosDownloader();
private downloadingSet: Set<string> = new Set();
private constructor() {
CosService.shared;
}
public static get shared(): CosDownloader {
return this.instance;
}
private async down... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L21-L191 | 430e2ea038f5abbb039e9c4aa1af3a260f91640b | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | ClickType. include SELECTED and DESELECTED
@enum { number } ClickType
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum ClickType {
/**
* SELECTED. click to select photos or videos, if click camera item, the clickType is SELECTED.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
SELECTED = 0,
/**
* DESELECTED. click to de... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ClickType AST#enum_body#Left { /**
* SELECTED. click to select photos or videos, if click camera item, the clickType is SELECTED.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
... | export declare enum ClickType {
SELECTED = 0,
DESELECTED = 1
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L559-L576 | 40b03532a8f7c2740650b1f802a75ab5a6272bfe | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/DES.ets | arkts | decryptCBCSync | 解密(CBC模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
@returns | static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string = '3DES192|CBC|PKCS7'): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, transformation);
} | AST#method_declaration#Left static decryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe... | static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string = '3DES192|CBC|PKCS7'): cryptoFramework.DataBlob {
return DES.decryptSync(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L128-L131 | 2347a4d6bf233e3b307e59a88a03c3bbe521958d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | TODO 全局异常捕获,崩溃日志收集
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class CrashUtil {
private static observerId: number | undefined = undefined;
private static errorFilePath: string | undefined = undefined; //错误日志文件路径
/**
* 注册错误观测器,该方法建议在Ability里调用。
* 注册后可以捕获到应用产生的js crash,应用崩溃时进程不会退出。将异常信息写入本地文件。
* @param callback 异常回调,可以在该回调里上传异常信息;
*/
static onHandled(c... | AST#export_declaration#Left export AST#class_declaration#Left class CrashUtil AST#class_body#Left { AST#property_declaration#Left private static observerId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#unio... | export class CrashUtil {
private static observerId: number | undefined = undefined;
private static errorFilePath: string | undefined = undefined;
static onHandled(callback: Callback<ExceptionInfo>) {
try {
if (CrashUtil.observerId === undefined) {
CrashUtil.observerId = errorManager.on('e... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L33-L228 | ca516da6be87658d4f8747138a8383b17fd7b6b5 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/EmptyView.ets | arkts | ErrorView | 通用错误状态组件 | @Component
export struct ErrorView {
@Prop title: string = '出错了';
@Prop message: string = '请稍后重试';
@Prop showRetry: boolean = true;
onRetry?: () => void;
build() {
EmptyView({
message: this.title,
description: this.message,
icon: $r('app.media.ic_error'),
showAction: this.showR... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ErrorView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#... | @Component
export struct ErrorView {
@Prop title: string = '出错了';
@Prop message: string = '请稍后重试';
@Prop showRetry: boolean = true;
onRetry?: () => void;
build() {
EmptyView({
message: this.title,
description: this.message,
icon: $r('app.media.ic_error'),
showAction: this.showR... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/EmptyView.ets#L170-L188 | 58a3c7f019baac494ce1febbf81c12ada68d7bb8 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | get | 格式化过期时间字符串(对应Swift中的expireDateString计算属性) | get expireDateString(): string {
if (this.isDebug() && this.debugMember) {
return "<DEBUG>会员无限期";
}
if (this.expireDate) {
// 这里需要实现日期格式化,暂时返回简单字符串
return DateUtils.toDateTimeString(this.expireDate)
}
return "";
} | AST#method_declaration#Left get AST#ERROR#Left expireDateStr in g 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#exp... | get expireDateString(): string {
if (this.isDebug() && this.debugMember) {
return "<DEBUG>会员无限期";
}
if (this.expireDate) {
return DateUtils.toDateTimeString(this.expireDate)
}
return "";
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L141-L152 | 2620749970d3399c0281494591eaf1579bb1df07 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/SetSchemeHandler.ets | arkts | onCreate | [Start set_scheme_handler] EntryAbility.ets | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// register CustomSchemes
testNapi.registerCustomSchemes();
// initializeWebEngine
webview.WebviewController.initializeWebEngine();
// set SchemeHandler。
testNapi.setSchemeHandler();
} | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
testNapi.registerCustomSchemes();
webview.WebviewController.initializeWebEngine();
testNapi.setSchemeHandler();
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/SetSchemeHandler.ets#L9-L16 | 1d8a8984d14df29cd2608eef84a58b0c50671b38 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/componentstack/src/main/ets/model/IconModel.ets | arkts | 图标的数据类 | export class IconDataModel {
id: number;
span: number;
icon: ResourceStr;
title: ResourceStr;
constructor(id: number, span: number, icon: ResourceStr, title: ResourceStr) {
this.id = id;
this.span = span;
this.icon = icon;
this.title = title;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class IconDataModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left span : AST#type... | export class IconDataModel {
id: number;
span: number;
icon: ResourceStr;
title: ResourceStr;
constructor(id: number, span: number, icon: ResourceStr, title: ResourceStr) {
this.id = id;
this.span = span;
this.icon = icon;
this.title = title;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/model/IconModel.ets#L19-L31 | 809d2fc401e34ace28023015bba0f98b5f4d2984 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets | arkts | DayInfo | 一天的信息 | @Observed
export class DayInfo {
public year: number; // 年
public month: number; // 月
public date: number; // 日
public week: number; // 月视图周信息。月视图上点击上个月日期进行月份切换时需要用到
constructor(year: number, month: number, date: number, week: number) {
this.year = year;
this.month = month;
this.date = date;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class DayInfo AST#class_body#Left { AST#property_declaration#Left public year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 年 AST#... | @Observed
export class DayInfo {
public year: number;
public month: number;
public date: number;
public week: number; 视图周信息。月视图上点击上个月日期进行月份切换时需要用到
constructor(year: number, month: number, date: number, week: number) {
this.year = year;
this.month = month;
this.date = date;
this.week = week... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L226-L239 | ece9d7f7dae7bf0566d52f405cf17da0ad1ece08 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 祝福语统计 | export interface GreetingStats {
totalGenerated: number;
totalUsed: number;
averageRating: number;
popularStyles: { style: string; count: number; percentage: number } | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingStats AST#ERROR#Left { AST#type_member#Left totalGenerated : 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 totalUsed : AST#type_annota... | export interface GreetingStats {
totalGenerated: number;
totalUsed: number;
averageRating: number;
popularStyles: { style: string; count: number; percentage: number } | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L55-L59 | bae2d6fae8a5dca87821c8daac70616717b9aa58 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setDataPixelMap | 将PixelMap数据写入系统剪贴板,使用Promise异步回调。
@param pixelMap PixelMap
@returns | static async setDataPixelMap(pixelMap: image.PixelMap): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
} | AST#method_declaration#Left static async setDataPixelMap AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | static async setDataPixelMap(pixelMap: image.PixelMap): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L258-L260 | 00c6c16923a0e8b8b2fc445ff2ff9c8fbe73e1d1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | isFocused | 判断当前窗口是否已获焦。
@param windowClass 不传该值,默认主窗口。
@returns | static isFocused(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return windowClass.isFocused();
} | AST#method_declaration#Left static isFocused AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expr... | static isFocused(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return windowClass.isFocused();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L345-L347 | 1e83cea8c4869061f31bc0d50d883a2765de61c3 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/FillArcData.ets | arkts | The constructor of FillArcData.
@param x The x-axis coordinate of the center of the arc.
@param y The y-axis coordinate of the center of the arc.
@param radius Radius of the arc.
@param startAngle The start point of the arc, in radians.
@param endAngle The end point of the arc, in radians.
@param fillColor The fill co... | constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number) {
this.x = x;
this.y = y;
this.radius = radius;
this.startAngle = startAngle;
this.endAngle = endAngle;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number) {
this.x = x;
this.y = y;
this.radius = radius;
this.startAngle = startAngle;
this.endAngle = endAngle;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/FillArcData.ets#L55-L61 | 0536068a164819e03144f6f874fa709034e6cf5b | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | access | 判断日志文件是否存在
@returns | static access(): boolean {
const path = CrashUtil.getFilePath();
return FileUtil.accessSync(path);
} | AST#method_declaration#Left static access AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left path = A... | static access(): boolean {
const path = CrashUtil.getFilePath();
return FileUtil.accessSync(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L111-L114 | 65a247343d13627289ca56a6ac44a0335572ccf7 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | getSpaceBottom | Returns the bottom axis space in percent of the full range. Default 10f
@return | public getSpaceBottom(): number {
return this.mSpacePercentBottom;
} | AST#method_declaration#Left public getSpaceBottom 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_ex... | public getSpaceBottom(): number {
return this.mSpacePercentBottom;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L362-L364 | 02828dee88579de781586301c20652502b14b2ec | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets | arkts | handle | 应用约束1:明确返回类型 | handle(reaction: MessageReaction): { key: Snowflake, value: MessageReaction } | null {
if (reaction.message.id !== this.message.id) return null;
return {
key: reaction.emoji.id || reaction.emoji.name,
value: reaction,
};
} | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left reaction : AST#type_annotation#Left AST#primary_type#Left MessageReaction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#statem... | handle(reaction: MessageReaction): { key: Snowflake, value: MessageReaction } | null {
if (reaction.message.id !== this.message.id) return null;
return {
key: reaction.emoji.id || reaction.emoji.name,
value: reaction,
};
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets#L34-L40 | fcbb853204409a486e599e2f66af12709a88efd8 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/Index.ets | arkts | PreferencesUtil | @file util 模块统一导出
@author Joker.X | export { PreferencesUtil } from "./src/main/ets/storage/PreferencesUtil"; | AST#export_declaration#Left export { PreferencesUtil } from "./src/main/ets/storage/PreferencesUtil" ; AST#export_declaration#Right | export { PreferencesUtil } from "./src/main/ets/storage/PreferencesUtil"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/Index.ets#L6-L6 | 5fbf5bf9f479a9d8dcda77a2c42f21d226a06b07 | github |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | deleteRoom | 删除房间 | deleteRoom(roomId: number): boolean {
// 不允许删除"全屋"选项(id=0)
if (roomId === 0) {
return false;
}
const index = this.rooms.findIndex(room => room.id === roomId);
if (index === -1) {
return false;
}
// 如果要删除的房间当前被选中,则选中"全屋"
if (this.rooms[index].isSelected) {
this.selectR... | AST#method_declaration#Left deleteRoom AST#parameter_list#Left ( AST#parameter#Left roomId : 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 boolean AST#primary_type#Rig... | deleteRoom(roomId: number): boolean {
if (roomId === 0) {
return false;
}
const index = this.rooms.findIndex(room => room.id === roomId);
if (index === -1) {
return false;
}
if (this.rooms[index].isSelected) {
this.selectRoom(0);
}
this.rooms.splice(in... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L260-L291 | b70e659c3ff91113b949eae68095829729cc30d0 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/CryptoHelper.ets | arkts | getUint8ArrayPaddingZero | Uint8Array补零操作
@param len 密钥规格长度
@returns | static getUint8ArrayPaddingZero(uint8Array: Uint8Array, len: number = 0): Uint8Array {
if (len > 0 && uint8Array.length < len) {
let diff = len - uint8Array.length;
let randArray = new Array<number>();
for (let i = 0; i < diff; i++) {
randArray.push(0);
}
let diffUint8Array = n... | AST#method_declaration#Left static getUint8ArrayPaddingZero AST#parameter_list#Left ( AST#parameter#Left uint8Array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left n... | static getUint8ArrayPaddingZero(uint8Array: Uint8Array, len: number = 0): Uint8Array {
if (len > 0 && uint8Array.length < len) {
let diff = len - uint8Array.length;
let randArray = new Array<number>();
for (let i = 0; i < diff; i++) {
randArray.push(0);
}
let diffUint8Array = n... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/CryptoHelper.ets#L144-L158 | edcd8e4e6f372f5e6535af7e3b08cf964b929a56 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets | arkts | SubHeader | Declare struct SubHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare struct SubHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct SubHeader {
/**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SubHeader AST#component_body#Left { /**
* Icon resource of content area.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
... | @Component
export declare struct SubHeader {
@Prop
icon?: ResourceStr;
iconSymbolOptions?: SymbolOptions;
@Prop
primaryTitle?: ResourceStr;
@Prop
secondaryTitle?: ResourceStr;
select?: SelectOptions;
@Prop
operationType?: Ope... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L252-L406 | a0f19d19c54aeef571e531fbeb86ed34e0dde094 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getBooleanByName | 获取指定资源名称对应的布尔结果
@param resName 资源名称。
@returns | static getBooleanByName(resName: string): boolean {
return ResUtil.getResourceManager().getBooleanByName(resName);
} | AST#method_declaration#Left static getBooleanByName 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 boolean AST#pr... | static getBooleanByName(resName: string): boolean {
return ResUtil.getResourceManager().getBooleanByName(resName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L57-L59 | f751380bbfc84779b6e8e0b9dfc374921bb9ceaf | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/entry/src/main/ets/managers/ArktsSendableModule.ets | arkts | A | 正确示例,导出对象合集 | @Sendable
export class A {
private count_: number = 0;
public lock_: ArkTSUtils.locks.AsyncLock = new ArkTSUtils.locks.AsyncLock();
public async getCount(): Promise<number> {
return this.lock_.lockAsync(() => {
return this.count_;
})
}
public async increaseCount() {
await this.lock_.lockAs... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class A AST#class_body#Left { AST#property_declaration#Left private count_ : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ... | @Sendable
export class A {
private count_: number = 0;
public lock_: ArkTSUtils.locks.AsyncLock = new ArkTSUtils.locks.AsyncLock();
public async getCount(): Promise<number> {
return this.lock_.lockAsync(() => {
return this.count_;
})
}
public async increaseCount() {
await this.lock_.lockAs... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableObjectRelated/entry/src/main/ets/managers/ArktsSendableModule.ets#L22-L38 | 3f8c5366b0831d0f74dbfeede66321479956bbaa | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/pages/VideoPage.ets | arkts | VideoPage | 实现步骤:
1. 通过@kit.NetworkKit接口监听网络状态
2. 添加Video组件,播放在线视频
3. 添加自动播放设置toggle,可以在网络状态变化时修改视频播放状态 | @Component
export struct VideoPage {
@Provide('navPathStack') navPathStack: NavPathStack = new NavPathStack();
// 视频控制器
controller: VideoController = new VideoController();
// WI-FI自动播放
@StorageLink('wifi_auto_play') wifiAutoPlay: boolean = false;
// 3G/4G/5G自动播放
@StorageLink('cellular_auto_play') cellula... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide ( AST#expression#Left 'navPathStack' AST#expression#Right ) AST#decorator#Right navPathStack : AST#type_annotation#Left AS... | @Component
export struct VideoPage {
@Provide('navPathStack') navPathStack: NavPathStack = new NavPathStack();
controller: VideoController = new VideoController();
@StorageLink('wifi_auto_play') wifiAutoPlay: boolean = false;
@StorageLink('cellular_auto_play') cellularAutoPlay: boolean = false;
pr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/pages/VideoPage.ets#L38-L77 | f852510748e5b71751277e2f017f0d9b35f6c716 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/NewFileIoManager.ets | arkts | setFileTime | 修改文件时间 | setFileTime(filePath: string, timeStr: string): void {
try {
let time = new Date(timeStr).getTime();
if (Number.isNaN(time)) {
return prompt.showToast({ message: $r('app.string.tip_invalid_time') });
}
fs.utimes(filePath,time);
} catch (err) {
Logger.error(`setFileTime fail... | AST#method_declaration#Left setFileTime AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | setFileTime(filePath: string, timeStr: string): void {
try {
let time = new Date(timeStr).getTime();
if (Number.isNaN(time)) {
return prompt.showToast({ message: $r('app.string.tip_invalid_time') });
}
fs.utimes(filePath,time);
} catch (err) {
Logger.error(`setFileTime fail... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/NewFileIoManager.ets#L36-L47 | 62e8c5acfff08183f49005b2ba111dc425dff23b | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | add_bookmark | Adds a bookmark to this bunch_of_bookmarks.
@param item A bookmark object.
@param path A string, technically the path of the folder which the bookmark item will be put into.
@param no_reconstruct_plain_bookmarks A boolean, will not reconstruct the plain bookmarks array if set true,
otherwise (unfilled or set false) wil... | add_bookmark(item: bookmark, path: string, no_reconstruct_plain_bookmarks?: boolean) {
let check_path = "";
if (path == "") {
check_path = item.get_label()
} else {
check_path = path + "/" + item.get_label()
}
// Add
let add_result: boolean;
if (this.access_bookmark(check_path))... | AST#method_declaration#Left add_bookmark AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left bookmark AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | add_bookmark(item: bookmark, path: string, no_reconstruct_plain_bookmarks?: boolean) {
let check_path = "";
if (path == "") {
check_path = item.get_label()
} else {
check_path = path + "/" + item.get_label()
}
let add_result: boolean;
if (this.access_bookmark(check_path)) {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L43-L77 | 5eaf75ae3df8c07d3ee690ceb2fb3fa2df7139ef | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/RouterModule.ets | arkts | getNavParam | 获取指定栈中指定页面的参数,不支持栈内存在多个同名页面的情况 | public static getNavParam<T = ESObject>(info: NavRouterInfo): T | undefined {
try {
const paramsArr = RouterModule._stack.getParamByName(info.url) as T[] | undefined[];
if (paramsArr.length && paramsArr[0]) {
return paramsArr[0];
}
} catch (err) {
Logger.error(TAG, 'navigation st... | AST#method_declaration#Left public static getNavParam AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left info : A... | public static getNavParam<T = ESObject>(info: NavRouterInfo): T | undefined {
try {
const paramsArr = RouterModule._stack.getParamByName(info.url) as T[] | undefined[];
if (paramsArr.length && paramsArr[0]) {
return paramsArr[0];
}
} catch (err) {
Logger.error(TAG, 'navigation st... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/RouterModule.ets#L92-L102 | 08060afde2d57049635624439668530152bbee99 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/common/db/AccountData.ets | arkts | 最佳实践:点击响应优化 | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
} | AST#export_declaration#Left export default AST#class_declaration#Left class AccountData 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 AST#unary_expression#Left - AST#expression#Left 1 ... | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/common/db/AccountData.ets#L19-L24 | 7dd8298e804c60efe2e45aff764c4020ea68ec40 | gitee | |
hi-dhl/HarmonyPractice.git | 0ebaac278d286ab99c4d0d06eb68c95148e89901 | Basic/entry/src/main/ets/syntax/Exception2.ets | arkts | <pre>
author: 程序员DHL
date : 2024/1/21
公众号 : ByteCode
desc :
文件名以 ts 的结尾表示 TypeScript
文件名以 ets 的结尾表示 ArkTS
基于 ArkTS 语法
</pre> | export class Exception {
testException() {
try {
// ...
} catch (error) {
// 处理异常
}
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Exception AST#class_body#Left { AST#method_declaration#Left testException 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#block_statem... | export class Exception {
testException() {
try {
} catch (error) {
}
}
} | https://github.com/hi-dhl/HarmonyPractice.git/blob/0ebaac278d286ab99c4d0d06eb68c95148e89901/Basic/entry/src/main/ets/syntax/Exception2.ets#L13-L21 | 7e64ac2df82567ef54ebf8a9ae0a4281f44faddf | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets | arkts | getPreviewProfile | [End Case1_start] | getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined {
let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles;
if (previewProfiles.length < 1) {
return undefined;
}
let index: number = previewProfiles.findIndex((previewPr... | AST#method_declaration#Left getPreviewProfile AST#parameter_list#Left ( AST#parameter#Left cameraOutputCapability : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraOutputCapability AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined {
let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles;
if (previewProfiles.length < 1) {
return undefined;
}
let index: number = previewProfiles.findIndex((previewPr... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets#L104-L118 | c71f0f5ada5f1d21968935e2e27c23fd39ee694f | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets | arkts | 应用约束:使用ES模块导出(错误60) | export default Attachment; | AST#export_declaration#Left export default AST#expression#Left Attachment AST#expression#Right ; AST#export_declaration#Right | export default Attachment; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets#L58-L58 | ae9109f842a4b10a804e8dd8751732abebb1d38c | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ExceptionPrompt.d.ets | arkts | ExceptionPrompt | Declare struct ExceptionPrompt higher-order component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Declare struct ExceptionPrompt higher-order component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | @Component
export declare struct ExceptionPrompt {
/**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ExceptionPrompt AST#component_body#Left { /**
* Configuration information of ExceptionPrompt.
* @type { PromptOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* ... | @Component
export declare struct ExceptionPrompt {
@Prop options: PromptOptions;
onTipClick?: () => void;
onActionTextClick?: () => void;
build(): void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L209-L279 | 8d1afc351368b4861444a8f50ad7899576cd6b92 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildSendMethodOption | 构建发送方式选项 | @Builder
buildSendMethodOption(label: string, method: NotificationMethod, icon: string) {
Column({ space: 4 }) {
Text(icon)
.fontSize(24)
.width('24vp')
.height('24vp')
.textAlign(TextAlign.Center)
Text(label)
.fontSize(12)
.fontColor(this.sendMet... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendMethodOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annota... | @Builder
buildSendMethodOption(label: string, method: NotificationMethod, icon: string) {
Column({ space: 4 }) {
Text(icon)
.fontSize(24)
.width('24vp')
.height('24vp')
.textAlign(TextAlign.Center)
Text(label)
.fontSize(12)
.fontColor(this.sendMet... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L545-L565 | af1a25a19777e1d7a9865f0351e69d07fc5bbfac | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.TreeView.d.ets | arkts | on | Event registration and processing.
The event will not be destroyed after being processed.
@param { type } event Registered Events.
@param { callback }.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Event registration and processing.
The event will not be destroyed after being processed.
@param { type } event ... | on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; | AST#method_declaration#Left on AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ... | on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L134-L134 | 2029dcf305d0296478b3f0866faa00607cde1963 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.