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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets | arkts | requestPermissionOnSetting | 在Setting中获取授权
首次申请授权时会弹出dialog,当用户拒绝后再次申请权限则不会弹出dialog,需要用户手动去设置中开启授权
@param context
@returns 授权结果 | static async requestPermissionOnSetting(context: common.UIAbilityContext,
permissions: Array<Permissions>): Promise<PermissionResult> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let result: Array<abilityAccessCtrl.GrantStatus> =
await atManager.requestPermission... | AST#method_declaration#Left static async requestPermissionOnSetting AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#... | static async requestPermissionOnSetting(context: common.UIAbilityContext,
permissions: Array<Permissions>): Promise<PermissionResult> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let result: Array<abilityAccessCtrl.GrantStatus> =
await atManager.requestPermission... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/utils/PermissionUtils.ets#L36-L42 | 67b7fa4e15f0cea3146f7b7c6afee574bdd36031 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/navigation/UserAgreementNav.ets | arkts | UserAgreementNav | @file 用户协议页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function UserAgreementNav(): void {
UserAgreementPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function UserAgreementNav 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_cust... | @Builder
export function UserAgreementNav(): void {
UserAgreementPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/UserAgreementNav.ets#L8-L11 | a791afaec5cb9524e4f5e4a25ca5769e65dc9ba5 | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/types/SwipeCardTypes.ets | arkts | 滑动卡片类型定义
定义滑动卡片组件所需的所有类型和接口
遵循ArkTS严格语法规范
@since 1.0.0
@syscap SystemCapability.ArkUI.ArkUI.Full
滑动方向枚举 | export const enum SwipeDirection {
LEFT = 'left',
RIGHT = 'right',
UP = 'up',
DOWN = 'down'
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum SwipeDirection AST#enum_body#Left { AST#enum_member#Left LEFT = AST#expression#Left 'left' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left RIGHT = AST#expression#Left 'right' AST#expression#Right AST#enum_member#Right , AST#enum_m... | export const enum SwipeDirection {
LEFT = 'left',
RIGHT = 'right',
UP = 'up',
DOWN = 'down'
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L14-L19 | abd73c860a8a2e6fc0c5a6f8b04c9c5dda5ec3cd | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets | arkts | isVideoPhotoFn | Determine the video or photo mode | async isVideoPhotoFn() {
await this.getPhotoSurfaceID();
if (this.modelBagCol == 'photo') {
cameraDemo.startPhotoOrVideo(this.modelBagCol, this.videoId, this.mSurfaceId);
} else if (this.modelBagCol == 'video') {
this.isModeBol = false;
if (this.timer) {
clearInterval(this.timer);... | AST#method_declaration#Left async isVideoPhotoFn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left awai... | async isVideoPhotoFn() {
await this.getPhotoSurfaceID();
if (this.modelBagCol == 'photo') {
cameraDemo.startPhotoOrVideo(this.modelBagCol, this.videoId, this.mSurfaceId);
} else if (this.modelBagCol == 'video') {
this.isModeBol = false;
if (this.timer) {
clearInterval(this.timer);... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets#L290-L308 | 576b29738290706cbd3b017d9e139ad93b037aef | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/ECDSA.ets | arkts | signSegmentSync | 对数据进行分段签名,同步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(ECC256|SHA256、ECC256|SHA512、ECC384|SHA256、等)。
@param len 自定义的数据拆分长度,此处取64
@returns | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName = 'ECC256|SHA256',
len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
} | AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified... | static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName = 'ECC256|SHA256',
len: number = 64): cryptoFramework.DataBlob {
return CryptoUtil.signSegmentSync(data, priKey, algName, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/ECDSA.ets#L101-L104 | 32e61c25e6184823f004c69f2e9c14c479152f3c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PreviewUtil.ets | arkts | rightFileSuffix | 预览格式判断
@param type 预览类型
@param uri 预览url
@returns 判断结果 | private static rightFileSuffix(type: string, uri: string): OutDTO<string> {
//判断结果
let result: OutDTO<string> = OutDTO.create();
//获取后缀
let suffix = uri.substring(uri.lastIndexOf(".") + 1);
if (type === 'txt') {
result.setSuccess(true);
if (suffix === 'txt') {
result.setDataRow('... | AST#method_declaration#Left private static rightFileSuffix AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#p... | private static rightFileSuffix(type: string, uri: string): OutDTO<string> {
let result: OutDTO<string> = OutDTO.create();
let suffix = uri.substring(uri.lastIndexOf(".") + 1);
if (type === 'txt') {
result.setSuccess(true);
if (suffix === 'txt') {
result.setDataRow('text/plain')... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L122-L186 | 54ebc5177f0966f3b41d0da95462470e9bdcb0d5 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/PixelConversion/entry/src/main/ets/viewmodel/ConversionViewModel.ets | arkts | getConversionList | Get conversion list data on the left.
@return {Array<ConversionItem>} conversionItems | getConversionList() {
let conversionItems = CONVERSION_LIST;
return conversionItems;
} | AST#method_declaration#Left getConversionList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left conversionItems = AST#expression#Left CONVERSION_LIST AST#expression#Right AST#variable_declarator#Right ; AST#v... | getConversionList() {
let conversionItems = CONVERSION_LIST;
return conversionItems;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/PixelConversion/entry/src/main/ets/viewmodel/ConversionViewModel.ets#L25-L28 | 4f474a7df7c5cdd78b2662fe19ccac597b909265 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/startup/SplashPage.ets | arkts | navigateToHomePage | 导航到首页 | private navigateToHomePage() {
router.replaceUrl({
url: 'pages/Index'
});
} | AST#method_declaration#Left private navigateToHomePage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . replace... | private navigateToHomePage() {
router.replaceUrl({
url: 'pages/Index'
});
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/startup/SplashPage.ets#L70-L74 | d29926bcf2b916b81132a07a97efc192348fce2a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/src/main/ets/model/ClockInModel.ets | arkts | ClockInController 类用于处理打卡相关的逻辑。
该控制器负责获取当前位置地址等功能。 | export class ClockInController {
/**
* 获取当前位置地址的方法。
* @returns {string} 当前位置的地址字符串。
*/
getAddress: () => string = () => '';
} | AST#export_declaration#Left export AST#class_declaration#Left class ClockInController AST#class_body#Left { /**
* 获取当前位置地址的方法。
* @returns {string} 当前位置的地址字符串。
*/ AST#property_declaration#Left getAddress : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AS... | export class ClockInController {
getAddress: () => string = () => '';
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/model/ClockInModel.ets#L20-L26 | e527803a87ca71695e3825109a59d30223de8a57 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets | arkts | loadServerCfgs | 获取所有 ServerCfg | static loadServerCfgs(completion: (success: boolean, msg: string | null, cfgs: ServerCfg[] | null) => void): void {
const params: HttpUtils.HttpParams = {}
const url = Servers.getRouteUrl(Route.servercfg)
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object... | AST#method_declaration#Left static loadServerCfgs AST#parameter_list#Left ( AST#parameter#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#p... | static loadServerCfgs(completion: (success: boolean, msg: string | null, cfgs: ServerCfg[] | null) => void): void {
const params: HttpUtils.HttpParams = {}
const url = Servers.getRouteUrl(Route.servercfg)
Http.request(url, HttpUtils.Method.GET, params, (succeed: boolean, msg: string | null, result: Object... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets#L30-L39 | d83c9bd1e58f18a0fa275b8225013c3830a94beb | github |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/view/components/CommandTile.ets | arkts | sleep | debug 模拟长时间执行 | private async sleep(time: number) {
await new Promise<void>(resolve => setTimeout(resolve, time));
} | AST#method_declaration#Left private async sleep AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp... | private async sleep(time: number) {
await new Promise<void>(resolve => setTimeout(resolve, time));
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/view/components/CommandTile.ets#L23-L25 | 3201c9abd8a3c2f821236a9f40e798cfc027a011 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Condition.ets | arkts | @file 优惠券条件
@author Joker.X | export class Condition {
/**
* 满多少金额
*/
fullAmount: number = 0.0;
constructor(init?: Partial<Condition>) {
if (!init) {
return;
}
this.fullAmount = init.fullAmount ?? this.fullAmount;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Condition AST#class_body#Left { /**
* 满多少金额
*/ AST#property_declaration#Left fullAmount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.0 AST#expression#Right ; AST#... | export class Condition {
fullAmount: number = 0.0;
constructor(init?: Partial<Condition>) {
if (!init) {
return;
}
this.fullAmount = init.fullAmount ?? this.fullAmount;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Condition.ets#L5-L17 | beae3f0fd6b84a04d4f1f9d89a990bf9f3b079f0 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | handlePreBaseDate | 处理基准日期之前的日期(1900年1月1日-1月30日) | private static handlePreBaseDate(solarYear: number, solarMonth: number, solarDay: number): LunarDateInfo {
return {
year: 1899,
month: 12,
day: solarDay,
isLeapMonth: false,
yearCn: "一八九九年",
monthCn: "腊月",
dayCn: LunarCalendarFixed.getLunarDayCn(solarDay),
gzYear: "己亥... | AST#method_declaration#Left private static handlePreBaseDate AST#parameter_list#Left ( AST#parameter#Left solarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left solarMonth : AST#type_annotation#Left AST#primary_type#Lef... | private static handlePreBaseDate(solarYear: number, solarMonth: number, solarDay: number): LunarDateInfo {
return {
year: 1899,
month: 12,
day: solarDay,
isLeapMonth: false,
yearCn: "一八九九年",
monthCn: "腊月",
dayCn: LunarCalendarFixed.getLunarDayCn(solarDay),
gzYear: "己亥... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L399-L413 | 3ab9bb797ee4324c1084c388a29b3ea2105bc5f0 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/log/Logger.ets | arkts | info | Info 日志 | info(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.INFO, tag, message, args);
} | AST#method_declaration#Left info AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t... | info(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.INFO, tag, message, args);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L66-L68 | 387cee128ad2091c65bf89d12e5ef7d4b6a8932b | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | Index.ets | arkts | Task | 任务相关 | export { Task } from './src/main/ets/ffmpeg/Task'; | AST#export_declaration#Left export { Task } from './src/main/ets/ffmpeg/Task' ; AST#export_declaration#Right | export { Task } from './src/main/ets/ffmpeg/Task'; | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L12-L12 | 2ff070823087a9f4d695e9d74e18ccae41bb3746 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/DateUtils.ets | arkts | calculateAge | 计算年龄
@param birthDate 出生日期
@returns 年龄 | static calculateAge(birthDate: string | Date): number {
const birth = typeof birthDate === 'string' ? new Date(birthDate) : birthDate;
const today = new Date();
if (isNaN(birth.getTime())) {
return 0;
}
let age = today.getFullYear() - birth.getFullYear();
const monthDiff = today.... | AST#method_declaration#Left static calculateAge AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right... | static calculateAge(birthDate: string | Date): number {
const birth = typeof birthDate === 'string' ? new Date(birthDate) : birthDate;
const today = new Date();
if (isNaN(birth.getTime())) {
return 0;
}
let age = today.getFullYear() - birth.getFullYear();
const monthDiff = today.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L154-L170 | a1be6180107371f75129fac051c819572695151b | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/DApp/DMPApp.ets | arkts | 小程序应用实例 | export class DMPApp {
appIndex: number;
appConfig: DMPAppConfig
customConfig: DMPCustomConfig = new DMPCustomConfig();
private onUpdateResult?: DMPBundleUpdateCallback
private _container: DMPContainer = new DMPContainer(this)
private static _context: common.UIAbilityContext
private _containerBridges: DMPB... | AST#export_declaration#Left export AST#class_declaration#Left class DMPApp AST#class_body#Left { AST#property_declaration#Left appIndex : 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 appConfig : AST#... | export class DMPApp {
appIndex: number;
appConfig: DMPAppConfig
customConfig: DMPCustomConfig = new DMPCustomConfig();
private onUpdateResult?: DMPBundleUpdateCallback
private _container: DMPContainer = new DMPContainer(this)
private static _context: common.UIAbilityContext
private _containerBridges: DMPB... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/DApp/DMPApp.ets#L35-L390 | 691c46edfe379770dba9fea1bb3b1cb4901ce9fe | github | |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/common/Constant.ets | arkts | 页面padding | export const PAGE_PADDING_LEFT: number = 20; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PAGE_PADDING_LEFT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const PAGE_PADDING_LEFT: number = 20; | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/common/Constant.ets#L2-L2 | 7669cdabff618ed1d0062c743576ea890d4b1a65 | github | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/database/DistributedDB.ets | arkts | restoreSurvey | 根据 id 恢复在废纸篓中的问卷 | async restoreSurvey(surveyId: number, isSync = true): Promise<boolean> {
if (!this.rdbStore) {
Logger.info('[restoreSurvey]', 'restoreSurvey() has no callback!');
return false;
}
try {
const valueBucket: relationalStore.ValuesBucket = {
'deleted': 0
};
const predicates... | AST#method_declaration#Left async restoreSurvey AST#parameter_list#Left ( AST#parameter#Left surveyId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSync = AST#expression#Left AST#boolean_literal#Left true AST#boolean_l... | async restoreSurvey(surveyId: number, isSync = true): Promise<boolean> {
if (!this.rdbStore) {
Logger.info('[restoreSurvey]', 'restoreSurvey() has no callback!');
return false;
}
try {
const valueBucket: relationalStore.ValuesBucket = {
'deleted': 0
};
const predicates... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/database/DistributedDB.ets#L219-L240 | 7efb4db575c743025db770ab988d1440f02706e4 | github |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/IoTUtil.ets | arkts | loadConfigs | 加载配置文件 | private async loadConfigs(): Promise<void> {
// 读取配置文件数据
let context = getContext(this);
const iotConfigData: Uint8Array = await context.resourceManager.getRawFileContent('IotConfig.json');
const deviceConfigData: Uint8Array = await context.resourceManager.getRawFileContent('DeviceConfig.json');
// ... | AST#method_declaration#Left private async loadConfigs 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#t... | private async loadConfigs(): Promise<void> {
let context = getContext(this);
const iotConfigData: Uint8Array = await context.resourceManager.getRawFileContent('IotConfig.json');
const deviceConfigData: Uint8Array = await context.resourceManager.getRawFileContent('DeviceConfig.json');
const dec... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/IoTUtil.ets#L29-L43 | bcea71edb7bbd1cf9e5e777da48d048263dd73a5 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Logger.ets | arkts | info | info级别日志【入参为两个字符串,第一个为提示消息,第二个为错误原因】
@param args 错误信息 | static info(...args1: string[]): void {
// Logger.printLog((prefix: string, args: string[] | string) => {
// hilog.info(Logger.domain, prefix, Logger.format, args);
// }, args1);
// let content: string = args.join();
// if (content.length <= Logger.maxSize) {
// // 长度小于等于限制直接打印
// hilo... | AST#method_declaration#Left static info AST#parameter_list#Left ( AST#parameter#Left ... args1 : 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#type_annotation#Left A... | static info(...args1: string[]): void {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L114-L133 | 75d10a90a1bbf0003730c4e1e85b64b0920a40e3 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/MPPointD.ets | arkts | Point encapsulating two double values. | export default class MPPointD extends Poolable {
private static pool: ObjectPool<MPPointD> = ObjectPool.create(64, new MPPointD(0, 0))
.setReplenishPercentage(0.5) as ObjectPool<MPPointD>;
public static getInstance(x: number, y: number): MPPointD {
let result: MPPointD = MPPointD.pool.get();
result.x =... | AST#export_declaration#Left export default AST#class_declaration#Left class MPPointD extends AST#type_annotation#Left AST#primary_type#Left Poolable AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private static pool : AST#type_annotation#Left AST#primary_type#Left A... | export default class MPPointD extends Poolable {
private static pool: ObjectPool<MPPointD> = ObjectPool.create(64, new MPPointD(0, 0))
.setReplenishPercentage(0.5) as ObjectPool<MPPointD>;
public static getInstance(x: number, y: number): MPPointD {
let result: MPPointD = MPPointD.pool.get();
result.x =... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MPPointD.ets#L25-L63 | a8a17c939eb45c8c0da72f72642bc9fcc5912cf5 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | stopNetObserve | 停止网络监听 | public stopNetObserve(netType: connection.NetBearType) {
this.connectionMap.get(netType).unregister(() => {
logger.info('Success unregister:' + netType.toString());
})
} | AST#method_declaration#Left public stopNetObserve AST#parameter_list#Left ( AST#parameter#Left netType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | public stopNetObserve(netType: connection.NetBearType) {
this.connectionMap.get(netType).unregister(() => {
logger.info('Success unregister:' + netType.toString());
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L109-L113 | c9bebc3091b8b2e2b23870e5f0843b2da0ed0c21 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/todo/TodoEditPage.ets | arkts | buildReminderSection | 构建提醒设置区域 | @Builder
buildReminderSection() {
Column({ space: 16 }) {
Row() {
Text('提醒设置')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Toggle({ type: ToggleType.Switch, isOn: this.reminder })
.onChange((is... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildReminderSection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen... | @Builder
buildReminderSection() {
Column({ space: 16 }) {
Row() {
Text('提醒设置')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Toggle({ type: ToggleType.Switch, isOn: this.reminder })
.onChange((is... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L469-L513 | ca84d0ec81a57c5eeb59f132eb2d5887590357f8 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/modules/Scroll.ets | arkts | ScrollComponent | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ScrollComponent {
@State list: string[] = new Array(100).fill('');
@State banner_height: number = 50;
scroll_start_timeout?: number;
scroll_stop_timeout?: number;
build() {
Flex({ direction: FlexDirection.Column }) {
Flex({ justifyContent: FlexAlign.Center, alignItems: Item... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScrollComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_typ... | @Component
export struct ScrollComponent {
@State list: string[] = new Array(100).fill('');
@State banner_height: number = 50;
scroll_start_timeout?: number;
scroll_stop_timeout?: number;
build() {
Flex({ direction: FlexDirection.Column }) {
Flex({ justifyContent: FlexAlign.Center, alignItems: Item... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/Scroll.ets#L16-L70 | cf8140dfadb35f80ce9a38d84607813ff63f532d | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets | arkts | generateAESKey192 | 生成AES的对称密钥-192位-默认base64
@param resultCoding 生成AES秘钥的字符串格式(hex/base64)-默认不传为base64格式
@returns AES密钥-192位 | static generateAESKey192(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.generateSymKey('AES192', resultCoding);
} | AST#method_declaration#Left static generateAESKey192 AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#exp... | static generateAESKey192(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.generateSymKey('AES192', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L79-L81 | 387b182b6812f778e300583a9a1e0a14a8336911 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Alarm/AlarmManager.ets | arkts | 轻量存储实例 私有构造方法 | private constructor(context: common.UIAbilityContext) {
this.context = context;
this.prefs = preferences.getPreferencesSync(context, {name: 'alarm_prefs'})
// .then(prefs => this.prefs = prefs)
// .catch((err: BusinessError) => DebugLog.e(`Preferences初始化失败: ${err.code}`));
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | private constructor(context: common.UIAbilityContext) {
this.context = context;
this.prefs = preferences.getPreferencesSync(context, {name: 'alarm_prefs'})
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/AlarmManager.ets#L15-L20 | ef1a2d6d519c24f3a2c739ef2df82499de6067e5 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets | arkts | initGpuLoadData | GPULoad | private initGpuLoadData(): LineData {
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.gpuLoad == '') {
continue
}
values.add(new EntryOhos(Number(index).valueOf(), Nu... | AST#method_declaration#Left private initGpuLoadData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left... | private initGpuLoadData(): LineData {
let values = new JArrayList<EntryOhos>();
for (let index: number = 0; index < this.gpData.length; index++) {
const gpDataCur = this.gpData[index];
if (gpDataCur.gpuLoad == '') {
continue
}
values.add(new EntryOhos(Number(index).valueOf(), Nu... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets#L927-L961 | c8311853349d1e7b73763f1ef188fb7169bfae22 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/refresh/RefreshLayout.ets | arkts | RefreshLayout | @file 刷新布局组件(基于 IBestPullRefresh)
@author Joker.X | @ComponentV2
export struct RefreshLayout {
/**
* 是否处于加载状态
*/
@Param
loading: boolean = false;
/**
* 是否启用上滑加载
*/
@Param
isEnableSlideUp: boolean = true;
/**
* 列表/网格使用的 scroller
*/
@Param
scroller: Scroller = new Scroller();
/**
* 刷新回调
*/
@Param
onRefresh: (direction: "pull... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RefreshLayout AST#component_body#Left { /**
* 是否处于加载状态
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right loading : AST#type_annotation#Left AST#primary_type#Left boolean AST#prima... | @ComponentV2
export struct RefreshLayout {
@Param
loading: boolean = false;
@Param
isEnableSlideUp: boolean = true;
@Param
scroller: Scroller = new Scroller();
@Param
onRefresh: (direction: "pull" | "slideUp") => void = () => {
};
@Require
@BuilderParam
content: CustomBuilder;
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/refresh/RefreshLayout.ets#L7-L53 | 94bb7295754d293db9c2b86787f0a7fc911e3fbc | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildCalendarContent | 构建日历内容 | @Builder
buildCalendarContent() {
Column({ space: 16 }) {
// 月份导航
Row() {
Button('◀')
.type(ButtonType.Circle)
.width(40)
.height(40)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.onClick(() => {
promptAction.showToas... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen... | @Builder
buildCalendarContent() {
Column({ space: 16 }) {
Row() {
Button('◀')
.type(ButtonType.Circle)
.width(40)
.height(40)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.onClick(() => {
promptAction.showToast({
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L869-L999 | 758b3f6ed6e9b73007f570d8f3b4136acf693ec5 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets | arkts | getLabelPaint | Returns the Paint object used for drawing the Legend labels.
@return | public getLabelPaint(): Paint {
return this.mLegendLabelPaint;
} | AST#method_declaration#Left public getLabelPaint AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Paint AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expr... | public getLabelPaint(): Paint {
return this.mLegendLabelPaint;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets#L84-L86 | b823b22208fcd978dfcbf3b9f5f38f07e9d69206 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/SysUtil.ets | arkts | getString | 获取指定资源对应的字符串
@param res | static getString(res: Resource): string {
return SysUtil.getResourceManager().getStringSync(res);
} | AST#method_declaration#Left static getString AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource 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 getString(res: Resource): string {
return SysUtil.getResourceManager().getStringSync(res);
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L36-L38 | 499d45988920c81cc3bfad8d98e85d95fcc45d87 | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/common/AccountData.ets | arkts | 账户数据管理类 | export class AccountDataManager {
private static preferencesStore: preferences.Preferences | null = null;
private static readonly ACCOUNT_KEY = 'accounts_data';
// 初始化存储
static async init(context: Context): Promise<void> {
try {
AccountDataManager.preferencesStore = await preferences.getPreferences(c... | AST#export_declaration#Left export AST#class_declaration#Left class AccountDataManager AST#class_body#Left { AST#property_declaration#Left private static preferencesStore : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#p... | export class AccountDataManager {
private static preferencesStore: preferences.Preferences | null = null;
private static readonly ACCOUNT_KEY = 'accounts_data';
static async init(context: Context): Promise<void> {
try {
AccountDataManager.preferencesStore = await preferences.getPreferences(context, ... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L25-L147 | 1dbd4ed73901f97ea9b58853092cda546068a27d | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderLogisticsPage.ets | arkts | getLogisticsData | 获取物流数据
@returns {Logistics} 物流数据 | private getLogisticsData(): Logistics {
return this.vm.logisticsInfo ?? new Logistics();
} | AST#method_declaration#Left private getLogisticsData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#cal... | private getLogisticsData(): Logistics {
return this.vm.logisticsInfo ?? new Logistics();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L336-L338 | 67b16f1de1a95834c9aaa5fee5c6c76bd71283d6 | github |
yangsongming/ArkTs-HuXiHelper.git | ed148299fc6dcf351bcc0f2863a5aee4885fbaf5 | ets/viewmodel/DrawModel.ets | arkts | drawCircularText | Draw Arc Text.
@param textString textString.
@param startAngle startAngle.
@param endAngle endAngle. | drawCircularText(textString: string, startAngle: number, endAngle: number) {
if (CheckEmptyUtils.isEmptyStr(textString)) {
Logger.error('[DrawModel][drawCircularText] textString is empty.');
return;
}
class CircleText {
x: number = 0;
y: number = 0;
radius: number = 0;
} | AST#method_declaration#Left drawCircularText AST#parameter_list#Left ( AST#parameter#Left textString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left startAngle : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | drawCircularText(textString: string, startAngle: number, endAngle: number) {
if (CheckEmptyUtils.isEmptyStr(textString)) {
Logger.error('[DrawModel][drawCircularText] textString is empty.');
return;
}
class CircleText {
x: number = 0;
y: number = 0;
radius: number = 0;
} | https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/viewmodel/DrawModel.ets#L200-L210 | 8503c31f2e32a23f01d1070d16e7e8a166ecc82a | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/FoldersList.ets | arkts | aboutToAppear | 初始化用户名、文件夹、日程记录数据。 | public aboutToAppear(): void {
if (router.getParams()?.['username']) {
this.username = router.getParams()['username'];
}
// 读取所有文件夹数据
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])
.then((value: string) => {
this.allFolders = JSON.parse(value) as Array<Folder... | AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#sub... | public aboutToAppear(): void {
if (router.getParams()?.['username']) {
this.username = router.getParams()['username'];
}
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])
.then((value: string) => {
this.allFolders = JSON.parse(value) as Array<Folder>;
});... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/FoldersList.ets#L131-L147 | 633b3f00a95395b46ce013eba1d02dec8acebab1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | TODO Want工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class WantUtil {
static readonly URI_NOTIFICATION: string = "systemui_notification_settings"; //通知设置页面
static readonly URI_WIFI: string = "wifi_entry"; //WLAN设置页面
static readonly URI_BLUETOOTH: string = "bluetooth_entry"; //蓝牙设置页面
static readonly URI_NFC: string = "nfc_settings"; //NFC设置页面
static rea... | AST#export_declaration#Left export AST#class_declaration#Left class WantUtil AST#class_body#Left { AST#property_declaration#Left static readonly URI_NOTIFICATION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "systemui_notification_settings... | export class WantUtil {
static readonly URI_NOTIFICATION: string = "systemui_notification_settings";
static readonly URI_WIFI: string = "wifi_entry";
static readonly URI_BLUETOOTH: string = "bluetooth_entry";
static readonly URI_NFC: string = "nfc_settings";
static readonly URI_VOLUME: string = "volume_... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L28-L271 | 270e06a9a7bda440c3f46f926c23d27df96ec435 | gitee | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | Index.ets | arkts | FFmpegManager | @prq/ffmpeg-tools - HarmonyOS FFmpeg 工具库
@author prq
@version 2.0.0
核心管理类 | export { FFmpegManager } from './src/main/ets/ffmpeg/FFmpegManager'; | AST#export_declaration#Left export { FFmpegManager } from './src/main/ets/ffmpeg/FFmpegManager' ; AST#export_declaration#Right | export { FFmpegManager } from './src/main/ets/ffmpeg/FFmpegManager'; | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L9-L9 | b137f84dfa910945035e95d6e2ecc92ca1441c0c | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/function_var/function_var_004_F.ets | arkts | Introduction 变量函数 | export function function_var_004_F(taint_src : string){
let _t = taint_src;
let _clean = "clean";
let f11 = ff;
f11(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function function_var_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function function_var_004_F(taint_src : string){
let _t = taint_src;
let _clean = "clean";
let f11 = ff;
f11(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_var/function_var_004_F.ets#L6-L11 | 9f7c5e90f10cbe97c77deaea4f718bd06bf1fcb5 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets | arkts | isvlidUser | 校验用户名密码长度是否正确 | isvlidUser(user: User): boolean {
return user.userName.length >= Constants.usernameLength && user.password.length >= Constants.passwordLength
} | AST#method_declaration#Left isvlidUser AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User 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#Right A... | isvlidUser(user: User): boolean {
return user.userName.length >= Constants.usernameLength && user.password.length >= Constants.passwordLength
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L45-L47 | a64d3c29a5904ed0e26379b43667631c99972bdc | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets | arkts | encode | 加密
@param encodeStr 待加密的字符串
@param pubKey SM2公钥 | static async encode(str: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256);
} | AST#method_declaration#Left static async encode AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static async encode(str: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2.ets#L42-L44 | 391a3121f28595a978f477948ddd51a98aff39f8 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets | arkts | getObject | 获取对象数据
@param key 键
@param defaultValue 默认值
@returns 存储的对象 | public async getObject<T>(key: string, defaultValue: T): Promise<T> {
try {
await this.ensureInitialized();
const jsonString = await this.preferences?.get(key, '');
if (!jsonString) {
return defaultValue;
}
return JSON.parse(jsonString as string) as T;
} catch... | AST#method_declaration#Left public async getObject AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#param... | public async getObject<T>(key: string, defaultValue: T): Promise<T> {
try {
await this.ensureInitialized();
const jsonString = await this.preferences?.get(key, '');
if (!jsonString) {
return defaultValue;
}
return JSON.parse(jsonString as string) as T;
} catch... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L75-L89 | 108d02ae850b24e1fa98210be063854bee4fc3de | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | ColumnSpaceBetweenEnd | 纵向两端分布 + 水平末尾 | @ComponentV2
export struct ColumnSpaceBetweenEnd {
/**
* Column 构造参数
*/
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceBetweenEnd AST#component_body#Left { /**
* Column 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#prim... | @ComponentV2
export struct ColumnSpaceBetweenEnd {
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: P... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1025-L1100 | 637ef554dd225664f4020b6d95f836e84295d603 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/RegexUtil.ets | arkts | isPhone | 判断传入的电话号码格式是否正确。
@param phone 电话号码 | static isPhone(phone: string): boolean {
return FormatUtil.isPhone(phone);
} | AST#method_declaration#Left static isPhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | static isPhone(phone: string): boolean {
return FormatUtil.isPhone(phone);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L214-L216 | 102cec82304eb1889bac01a168c9ff968c8708f6 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 30% 百分比 | export const P30: string = "30%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P30 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "30%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P30: string = "30%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L39-L39 | b433fe54ab04876776e44220464b635865bc7e98 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | getInstance | 使用单例模式,用于全局管理组件复用池 | public static getInstance() {
if (!NodePool.instance) {
NodePool.instance = new NodePool();
}
return NodePool.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left NodePool A... | public static getInstance() {
if (!NodePool.instance) {
NodePool.instance = new NodePool();
}
return NodePool.instance;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L64-L69 | 041f83ebf431a3a82684ce9e35b67c8815b19cb2 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | generate2048RSAKey | 生成2048位RSA的非对称密钥
@param resultCoding 生成RSA秘钥的字符串格式(hex/base64)-默认不传为base64格式
@returns 2048位RSA密钥{publicKey:2048位公钥,privateKey:2048位私钥} | static generate2048RSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA2048', resultCoding);
} | AST#method_declaration#Left static generate2048RSAKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#ex... | static generate2048RSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA2048', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L44-L46 | e2bb6cd6a61c3a6ea003291a2dbbd41b2fd55f5d | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets | arkts | 应用约束60:改用ES模块导出 | export default GuildSync; | AST#export_declaration#Left export default AST#expression#Left GuildSync AST#expression#Right ; AST#export_declaration#Right | export default GuildSync; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildSync.ets#L40-L40 | e48473f272a8330882982345cb8c3b0518aa48a9 | github | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | common/src/main/ets/manager/UpgradeInterface.ets | arkts | ux页面显示内容
@since 2022-12-01 | export interface IPage {
/**
* 取新版本数据
*
* @param versionComponents 升级包
* @param componentDescriptions 更新日志
* @return Promise<VersionPageInfo> 具体的新版本数据
*/
getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.ComponentDescription>): Promis... | AST#export_declaration#Left export AST#interface_declaration#Left interface IPage AST#object_type#Left { /**
* 取新版本数据
*
* @param versionComponents 升级包
* @param componentDescriptions 更新日志
* @return Promise<VersionPageInfo> 具体的新版本数据
*/ AST#type_member#Left getNewVersionPageInfo AST#parameter_list#Left (... | export interface IPage {
getNewVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions?: Array<update.ComponentDescription>): Promise<VersionPageInfo>;
getCurrentVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions: Array<update.Com... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/manager/UpgradeInterface.ets#L136-L156 | a93ab986f95eafc15f4c409abc21ee87dd1d3fe5 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 用户注册参数 | export interface RegisterParams {
username: string;
password: string;
nickname: string;
email?: string;
phone?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RegisterParams AST#object_type#Left { AST#type_member#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left password : AST#type_annota... | export interface RegisterParams {
username: string;
password: string;
nickname: string;
email?: string;
phone?: string;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L277-L283 | 57bd80a144ed8741f8b98a7ff1e830164604aca4 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | Used to control and feedback the behavior of nodes on the corresponding NodeContainer, which needs to be used together with NodeContainer | export class MyNodeController extends NodeController {
private rootNode: BuilderNode<Data[]> | null = null;
private root: FrameNode | null = null;
// The method that must be overridden is used to build the number of nodes and return the nodes to be mounted in the corresponding NodeContainer.
// //Called when t... | AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left ... | export class MyNodeController extends NodeController {
private rootNode: BuilderNode<Data[]> | null = null;
private root: FrameNode | null = null;
makeNode(uiContext: UIContext): FrameNode | null {
console.log(' uicontext is undefined : '+ (uiContext === undefined));
if (this.rootNode != null) {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L45-L95 | 6eb54247dd426a03ccf0bb559638164417fa44d5 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets | arkts | @file 账号登录页面 ViewModel
@author Joker.X | @ObservedV2
export default class AccountLoginViewModel extends BaseViewModel {
/**
* 全局用户状态
*/
private readonly userState: UserState = getUserState();
/**
* 认证仓库
*/
private readonly authRepository: AuthRepository = new AuthRepository();
/**
* 账号存储仓库
*/
private readonly accountStoreReposito... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class AccountLoginViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 全局用户状态
*... | @ObservedV2
export default class AccountLoginViewModel extends BaseViewModel {
private readonly userState: UserState = getUserState();
private readonly authRepository: AuthRepository = new AuthRepository();
private readonly accountStoreRepository: AccountStoreRepository =
new AccountStoreRepository(C... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L13-L139 | 952b9b913cc70fa8c0ee0aa3a3d32f49202afd6c | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | beginTransaction | 开始事务 | async beginTransaction(): Promise<void> {
try {
this.checkInitialized();
await this.store!.beginTransaction();
hilog.debug(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, 'Transaction started');
} catch (error) {
const businessError = error as BusinessError;
hilog.error(Lo... | AST#method_declaration#Left async beginTransaction 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... | async beginTransaction(): Promise<void> {
try {
this.checkInitialized();
await this.store!.beginTransaction();
hilog.debug(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, 'Transaction started');
} catch (error) {
const businessError = error as BusinessError;
hilog.error(Lo... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L495-L505 | 3b91b0a7223e041e2759c3c10296313dcbb7c3bd | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/TextInputDialogView.ets | arkts | aboutToAppear | @Local buttons?: Array<CustomButtonOptions> private title: ResourceStr | undefined @Local themeColorMode: ThemeColorMode = DialogHub.getThemeColorMode();//@ComponentV2不支持WithTheme | aboutToAppear(): void {
this.text = this.options.text ?? "";
this.modifier.inputFilter = this.options.inputFilter;
this.showPassword = this.options.showPassword ?? false;
if (this.options.cancelButton) {
this.cancelButton = this.options.cancelButton;
}
this.customOptions = (this.options as... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | aboutToAppear(): void {
this.text = this.options.text ?? "";
this.modifier.inputFilter = this.options.inputFilter;
this.showPassword = this.options.showPassword ?? false;
if (this.options.cancelButton) {
this.cancelButton = this.options.cancelButton;
}
this.customOptions = (this.options as... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/TextInputDialogView.ets#L24-L62 | 78a3f00f90883058ca45909b191eba593c235c41 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | getBookId | MARK: - Getters for private properties / 关联的 bookId | getBookId(): number | null {
return this.bookId;
} | AST#method_declaration#Left getBookId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#... | getBookId(): number | null {
return this.bookId;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L70-L72 | b527148d426bf8f2aeabf7d95f61aa77dad44f3e | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/viewmodel/EntryViewModel.ets | arkts | aboutToAppear | 入口页面初始化
由 EntryPage.aboutToAppear 调用,统一触发窗口相关初始化
@param {Context} context - 组件上下文
@returns {void} 无返回值 | aboutToAppear(context: common.Context): void {
this.windowAdapter.init(context);
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | aboutToAppear(context: common.Context): void {
this.windowAdapter.init(context);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/viewmodel/EntryViewModel.ets#L25-L27 | cece791899878a1d9ee9240c2ed2a20fefeb199a | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the Distribution OS name.
<p>Independent Software Vendor (ISV) may distribute OHOS with their own OS name.
distributionOsName will return the ISV OS name
If ISV not specified, it will return an empty string
@syscap SystemCapability.Startup.SystemInfo
@since 20
@arkts 1.2 | static get distributionOSName(): string; | AST#method_declaration#Left static get AST#ERROR#Left distributionOSName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get distributionOSName(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L395-L395 | 2109824808d0797abcbf3fad170eec7e8106caae | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/viewmodel/Comment.ets | arkts | aboutToAppear | 底部导航栏高度 | aboutToAppear(): void {
// 加载示例评论
for (let i = 0; i < Consts.TEST_COMMENTS_COUNT; i++) {
this.data.pushItem(i);
}
} | 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... | aboutToAppear(): void {
for (let i = 0; i < Consts.TEST_COMMENTS_COUNT; i++) {
this.data.pushItem(i);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/viewmodel/Comment.ets#L29-L34 | d24737ba8298d1578845f3cc05b49d9a559b7c95 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets | arkts | deletePlan | ====== 删除操作 ====== | async deletePlan(planId: number): Promise<void> {
const sql = `DELETE FROM ${Tables.Plan.name} WHERE ${Tables.Plan.Col.planId} = ?`;
await this.db?.updateDb(sql, [planId]);
} | AST#method_declaration#Left async deletePlan AST#parameter_list#Left ( AST#parameter#Left planId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async deletePlan(planId: number): Promise<void> {
const sql = `DELETE FROM ${Tables.Plan.name} WHERE ${Tables.Plan.Col.planId} = ?`;
await this.db?.updateDb(sql, [planId]);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L169-L172 | 55548706bad0c57ce7cf03c3c61f64aa986a7f0f | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | StringToUint8Array | [End write_file] | function StringToUint8Array(str: string): Uint8Array {
let textEncoder = util.TextEncoder.create('utf-8');
return textEncoder.encodeInto(str);
} | AST#function_declaration#Left function StringToUint8Array 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 Uint8Array A... | function StringToUint8Array(str: string): Uint8Array {
let textEncoder = util.TextEncoder.create('utf-8');
return textEncoder.encodeInto(str);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L128-L131 | f811eca676dd2fc0d64a67a08196597d244692f1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | logger | 视频开始播放 | logger.info('state playing called'); | AST#method_declaration#Left logger AST#ERROR#Left . in fo AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'state playing called' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | logger.info('state playing called'); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L247-L247 | 162377024d8e951512f2e4ea662492415e685182 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/AVplayerConstants.ets | arkts | 倍速类型 | export interface speedObj {
text: string,
value: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface speedObj AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left value : AST#type_annotation#Left AST... | export interface speedObj {
text: string,
value: number
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/AVplayerConstants.ets#L42-L45 | b877d41ed6d4856d315b1e109723660e3fa2eccd | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 错过的生日接口 | export interface MissedBirthday {
contact: Contact;
daysMissed: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MissedBirthday AST#object_type#Left { AST#type_member#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left daysMissed : AST#type_anno... | export interface MissedBirthday {
contact: Contact;
daysMissed: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L49-L52 | cd88001611e2bbe2add9d53337dc502694d4fe37 | github | |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/HomePage.ets | arkts | openHandleDialog | 打开弹窗 | openHandleDialog(item: WarningItem) {
this.handleDialogController = new CustomDialogController({
builder: HandleDialog({
item: item,
onConfirm: async (note: string) => {
// 调用 Service 处理
const success = await HomeService.handleWarning(item, note);
if (success) {
... | AST#method_declaration#Left openHandleDialog AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left WarningItem 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#e... | openHandleDialog(item: WarningItem) {
this.handleDialogController = new CustomDialogController({
builder: HandleDialog({
item: item,
onConfirm: async (note: string) => {
const success = await HomeService.handleWarning(item, note);
if (success) {
promp... | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/HomePage.ets#L72-L90 | 1807d107ed35f48347028007d721465be8e95d3e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/annotation/AppRouter.ets | arkts | 装饰器参数 | export interface AppRouterParam {
// 跳转的路由名
name?: string;
// 是否需要传递参数,需要的话设置为true,否则可不需要设置。
hasParam?: boolean;
// 路由跳转的常量文件路径和常量名
routeLocation?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AppRouterParam AST#object_type#Left { // 跳转的路由名 AST#type_member#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 是否需要传递参数,需要的话设置为true,否则可不需要设置。 AST#t... | export interface AppRouterParam {
name?: string;
hasParam?: boolean;
routeLocation?: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/annotation/AppRouter.ets#L22-L29 | 49ef40d94535d369722151eda8953efc4ba1d0bf | gitee | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/util/VersionUtils.ets | arkts | 获取主页的显示版本号
@return 显示版本号 | export function getDisplayVersionForIndex(): string {
return DeviceUtils.getDisplayVersion();
} | AST#export_declaration#Left export AST#function_declaration#Left function getDisplayVersionForIndex AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_state... | export function getDisplayVersionForIndex(): string {
return DeviceUtils.getDisplayVersion();
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/util/VersionUtils.ets#L73-L75 | dba24e595010e490e438686a37f241409f045147 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isDataView | 检查是否为DataView类型。
@param value
@returns | static isDataView(value: Object): boolean {
return new util.types().isDataView(value);
} | AST#method_declaration#Left static isDataView 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#primary_ty... | static isDataView(value: Object): boolean {
return new util.types().isDataView(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L279-L281 | e2d48b9b7f65ae76dd59cc2afa4e6e859be9ca09 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets | arkts | loadUserDreams | 加载用户的梦想列表 | async loadUserDreams(): Promise<void> {
try {
this.isLoadingDreams = true;
const userId = this.userSession.getUserId();
if (!userId) {
const toastOpts: ToastOptions = {
message: '无法获取用户信息',
duration: 2000
};
promptAction.showToast(toastOpts);
re... | AST#method_declaration#Left async loadUserDreams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async loadUserDreams(): Promise<void> {
try {
this.isLoadingDreams = true;
const userId = this.userSession.getUserId();
if (!userId) {
const toastOpts: ToastOptions = {
message: '无法获取用户信息',
duration: 2000
};
promptAction.showToast(toastOpts);
re... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets#L74-L102 | e5493414413e9d1ca690cc1eb9a0b7286c8a3b60 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | moveWindowTo | 移动窗口位置,使用Promise异步回调。调用成功即返回,但返回后无法立即获取最终生效结果。如需立即获取,请使用moveWindowToAsync()。
@param x 窗口在x轴方向移动到的坐标位置,单位为px,值为正表示位置在x轴右侧;值为负表示位置在x轴左侧;值为0表示位置在x轴坐标原点。该参数仅支持整数输入,浮点数输入将向下取整。
@param y 窗口在y轴方向移动到的坐标位置,单位为px,值为正表示位置在y轴下侧;值为负表示位置在y轴上侧;值为0表示位置在y轴坐标原点。该参数仅支持整数输入,浮点数输入将向下取整。
@param windowClass 不传该值,默认主窗口。
@returns | static async moveWindowTo(x: number, y: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.moveWindowTo(x, y);
} | AST#method_declaration#Left static async moveWindowTo 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_typ... | static async moveWindowTo(x: number, y: number, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.moveWindowTo(x, y);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L425-L427 | 53f2108335d160ded2d0c9c1cf5a6ce498d5d2f6 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_export_html | Get the encoded HTML text of the whole bunch_of_bookmark.
@returns A string[] array, each element refers to a line after .join("\n"). | get_export_html() {
let result: string[] = [];
let head: string = "<!DOCTYPE NETSCAPE-bookmark-file-1>\n" +
"<!-- This is an automatically generated file.\n" +
" It will be read and overwritten.\n" +
" DO NOT EDIT! -->\n" +
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; ... | AST#method_declaration#Left get_export_html AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#pr... | get_export_html() {
let result: string[] = [];
let head: string = "<!DOCTYPE NETSCAPE-bookmark-file-1>\n" +
"<!-- This is an automatically generated file.\n" +
" It will be read and overwritten.\n" +
" DO NOT EDIT! -->\n" +
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; ... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L352-L367 | 88a20fb6edb9c5f50ed3dd7d667300b1980bb929 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/IGuideDialogOptions.ets | arkts | 引导弹窗参数配置 | export interface IGuideDialogOptions extends IBaseDialogOptions {
// /**
// * 目标引导区域点击事件(不传则:actionCancel为true时【默认true】,点击任意区域直接关闭)
// */
// onAction?: ActionCallback;
/**
* 点击区域是否自动关闭
* @default 默认值:true。
*/
actionCancel?: boolean;
guidMaskColor?: ResourceColor;
/**
* 目标组件配置
* @Area:... | AST#export_declaration#Left export AST#interface_declaration#Left interface IGuideDialogOptions AST#extends_clause#Left extends IBaseDialogOptions AST#extends_clause#Right AST#object_type#Left { // /** // * 目标引导区域点击事件(不传则:actionCancel为true时【默认true】,点击任意区域直接关闭) // */ // onAction?: ActionCallback; /**
* 点击区域是否自动关闭
... | export interface IGuideDialogOptions extends IBaseDialogOptions {
actionCancel?: boolean;
guidMaskColor?: ResourceColor;
targetPositionOptions?: Area | IGuideTargetComponentId | IGuideTarget;
targetBorderRadius?: number;
customContent?: IGuideCustomContentOptions;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/IGuideDialogOptions.ets#L9-L44 | 1dca4af24182140c6cf8e98eaeaf44d243d4cb09 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/search/SearchHead.ets | arkts | if | 源来的books的source源 id和 books的source源 id相同不添加 | if (item.source?.bookSourceUrl !== book.source?.bookSourceUrl && book.source) {
// 确保 sourceList 已经存在并且是一个数组
if (!item.sourceList) {
item.sourceList = [];
}
item.sourceList.push(book.source)
} | AST#method_declaration#Left if AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right AST#ERROR#Left . source ?. bookSourceUrl !== book . source ?. bookSourceUrl && book . source AST#ERROR#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 确保 sourceList 已经存在并且是一个数组 AST#ui_control_flow#L... | if (item.source?.bookSourceUrl !== book.source?.bookSourceUrl && book.source) {
if (!item.sourceList) {
item.sourceList = [];
}
item.sourceList.push(book.source)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/search/SearchHead.ets#L85-L91 | f30c2cab07190e87c043560d4c0d0b9881340b56 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets | arkts | saveModel | / 存 Model | public static saveModel(key: string, value: Object) {
let jsonString: string = JSON.stringify(value)
JhAESPreferencesUtils.saveString(key, jsonString)
} | AST#method_declaration#Left public static saveModel AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary... | public static saveModel(key: string, value: Object) {
let jsonString: string = JSON.stringify(value)
JhAESPreferencesUtils.saveString(key, jsonString)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L51-L54 | 71ef932ce15da4fb7ff104fa51718c7e1dcdf52d | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export default class CommonConstants {
/**
* The main ability tag.
*/
static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility';
/**
* The launcher page tag.
*/
static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage';
/**
* The advertsing page tag.
*/
static readonly ADVERTISING_PAGE_T... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* The main ability tag.
*/ AST#property_declaration#Left static readonly ENTRY_ABILITY_TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ... | export default class CommonConstants {
static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility';
static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage';
static readonly ADVERTISING_PAGE_TAG: string = 'AdvertisingPage';
static readonly CUSTOM_DIALOG_TAG: string = 'CustomDialogComponent';
s... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/common/constants/CommonConstants.ets#L20-L157 | 34d15e9ef4087e4c6583049b3abb44dfe9b438af | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | cameraInputOpenFn | Turn on the camera | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `cre... | AST#method_declaration#Left async cameraInputOpenFn AST#parameter_list#Left ( AST#parameter#Left cameraInput : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraInput AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | async cameraInputOpenFn(cameraInput: camera.CameraInput): Promise<boolean> {
let isOpenSuccess = false;
try {
await cameraInput.open();
isOpenSuccess = true;
Logger.info(TAG, 'cameraInput open success');
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `cre... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L420-L431 | dea543850ce49c1e299a3edbee3931645c2a6440 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets | arkts | TODO 土司工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class ToastUtil {
private static defaultConfig: ToastConfig = new ToastConfig(); //默认样式
/**
* 设置默认统一样式
* @param configs
*/
static setDefaultConfig(configs: (config: ToastConfig) => void): void {
configs(ToastUtil.defaultConfig);
}
/**
* 弹出土司,默认时长为2s,距离底部默认为80vp
* @param message ... | AST#export_declaration#Left export AST#class_declaration#Left class ToastUtil AST#class_body#Left { AST#property_declaration#Left private static defaultConfig : AST#type_annotation#Left AST#primary_type#Left ToastConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#... | export class ToastUtil {
private static defaultConfig: ToastConfig = new ToastConfig();
static setDefaultConfig(configs: (config: ToastConfig) => void): void {
configs(ToastUtil.defaultConfig);
}
static showToast(message: string | Resource, options: ToastOptions = new ToastOptions()) {
if (m... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets#L26-L110 | 9cd64be7dbdee6bdfba62589c41a67bc737e4e09 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets | arkts | MARK: - PlanDbAccess | export class PlanDbAccess extends UserDbSuperAccess{
private static instance: PlanDbAccess;
// private db: DBAccessor | null = null;
private constructor(){ super();}
public static get shared(): PlanDbAccess {
if (!PlanDbAccess.instance) {
PlanDbAccess.instance = new PlanDbAccess();
}
return... | AST#export_declaration#Left export AST#class_declaration#Left class PlanDbAccess extends AST#type_annotation#Left AST#primary_type#Left UserDbSuperAccess AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_ty... | export class PlanDbAccess extends UserDbSuperAccess{
private static instance: PlanDbAccess;
private constructor(){ super();}
public static get shared(): PlanDbAccess {
if (!PlanDbAccess.instance) {
PlanDbAccess.instance = new PlanDbAccess();
}
return PlanDbAccess.instance;
}
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L64-L452 | 50c1cf7479a167f072331dd635c05e02fe9cb62a | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/LoadingView.ets | arkts | ListLoadingMore | 列表加载更多组件 | @Component
export struct ListLoadingMore {
@Prop loading: boolean = false;
@Prop hasMore: boolean = true;
@Prop loadingText: string = '加载更多...';
@Prop noMoreText: string = '没有更多数据';
build() {
Row({ space: 12 }) {
if (this.loading && this.hasMore) {
LoadingProgress()
.width('16vp')... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListLoadingMore AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right loading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct ListLoadingMore {
@Prop loading: boolean = false;
@Prop hasMore: boolean = true;
@Prop loadingText: string = '加载更多...';
@Prop noMoreText: string = '没有更多数据';
build() {
Row({ space: 12 }) {
if (this.loading && this.hasMore) {
LoadingProgress()
.width('16vp')... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/LoadingView.ets#L60-L89 | 497381481c79f72c29123cf8f9781b04744f68c0 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | buildDataManagementCard | 构建数据管理卡片 | @Builder
buildDataManagementCard() {
Column({ space: 16 }) {
// 卡片标题
Row() {
Text('💾')
.fontSize(20)
Text('数据管理')
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.padding({ top: 4, bottom: 4 })... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDataManagementCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compo... | @Builder
buildDataManagementCard() {
Column({ space: 16 }) {
Row() {
Text('💾')
.fontSize(20)
Text('数据管理')
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.padding({ top: 4, bottom: 4 })
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L848-L918 | 92e8e3bdf7859bf7a3e2e87c97112b61214e6d3e | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/SwiperView.ets | arkts | [Start swiper_view] | build() {
NodeContainer(this.nodeItem)
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NodeContainer ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodeItem AST#member_expression#Right AST#expression#Right ) AST#ui_compo... | build() {
NodeContainer(this.nodeItem)
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/SwiperView.ets#L50-L52 | b9f6609312b6d3920576590e4b6ecedf8e7bb581 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets | arkts | getProtocolUrl | Obtain the privacy policy address from rawfile. | getProtocolUrl(privacyUrl: string): string {
try {
// Read files from /AppScope/resources/rawfile.
const value: Uint8Array = getContext().resourceManager.getRawFileContentSync(this.srcPath);
// Return the link to the HUAWEI ID User Authentication Agreement.
return JSON.parse(buffer.from(valu... | AST#method_declaration#Left getProtocolUrl AST#parameter_list#Left ( AST#parameter#Left privacyUrl : 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_t... | getProtocolUrl(privacyUrl: string): string {
try {
const value: Uint8Array = getContext().resourceManager.getRawFileContentSync(this.srcPath);
return JSON.parse(buffer.from(value.buffer).toString())[privacyUrl] as string;
} catch (error) {
hilog.error(this.domainId, this.logTag,
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets#L165-L176 | 61a49c5378876476112b16669bbe61731b895d31 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/models/ResponseData.ets | arkts | status | 判断返回值 status: success 成功 fail 失败 result: true 有 false 没有 errorMessage: 错误信息 | export type ResponseData = {
status: string,
errorMessage: string,
result?: boolean
} | AST#export_declaration#Left export AST#ERROR#Left type ResponseData = AST#ERROR#Right { status AST#ERROR#Left : string AST#ERROR#Right , errorMessage AST#ERROR#Left : string AST#ERROR#Right , result AST#ERROR#Left ? : boolean AST#ERROR#Right } AST#export_declaration#Right | export type ResponseData = {
status: string,
errorMessage: string,
result?: boolean
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/models/ResponseData.ets#L17-L21 | aaafb5bd819383cb9f4b1704e397a2b782533fc0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | backup | 备份数据库
@returns 备份数据 | async backup(): Promise<Record<string, Record<string, relationalStore.ValueType>[]>> {
try {
this.checkInitialized();
const backup: Record<string, Record<string, relationalStore.ValueType>[]> = {};
const tables: string[] = [
StorageConstants.TABLE_CONTACTS,
StorageConstants.... | AST#method_declaration#Left async backup AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation... | async backup(): Promise<Record<string, Record<string, relationalStore.ValueType>[]>> {
try {
this.checkInitialized();
const backup: Record<string, Record<string, relationalStore.ValueType>[]> = {};
const tables: string[] = [
StorageConstants.TABLE_CONTACTS,
StorageConstants.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L558-L581 | 6461f996e7256aef1615c20fe17a7434bd25858b | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | TODO 屏幕相关工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class DisplayUtil {
/**
* 获取当前默认的display对象。
* @returns
*/
static getDefaultDisplaySync(): display.Display {
return display.getDefaultDisplaySync()
}
/**
* 获取主屏信息。除2in1之外的设备获取的是设备自带屏幕的Display对象;2in1设备外接屏幕时获取的是当前主屏幕的Display对象;2in1设备没有外接屏幕时获取的是自带屏幕的Display对象。<API14+>
* @returns
*/
... | AST#export_declaration#Left export AST#class_declaration#Left class DisplayUtil AST#class_body#Left { /**
* 获取当前默认的display对象。
* @returns
*/ AST#method_declaration#Left static getDefaultDisplaySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualifie... | export class DisplayUtil {
static getDefaultDisplaySync(): display.Display {
return display.getDefaultDisplaySync()
}
static getPrimaryDisplaySync(): display.Display {
if (AppUtil.isApiSupported(14)) {
return display.getPrimaryDisplaySync()
} else {
return display.getDefaultDispl... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L25-L230 | 74a8686ea7b9ac63f02a90a307bbf43269dddf15 | gitee | |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets | arkts | getMethod | Getter and setter for method | getMethod(): http.RequestMethod | undefined {
return this.method;
} | AST#method_declaration#Left getMethod AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . RequestMethod AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_... | getMethod(): http.RequestMethod | undefined {
return this.method;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L29-L31 | f20839f91258bc8e9d5b282d3e77680cf2e6f3d3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets | arkts | genEccCommonSpec | 根据关键规范构造EccCommonSpec结构体。EccCommonSpec结构体定义了ECC私钥和公钥的公共参数 | function genEccCommonSpec(): cryptoFramework.ECCCommonParamsSpec {
let fieldFp: cryptoFramework.ECFieldFp = {
fieldType: 'Fp',
p: BigInt('0xffffffffffffffffffffffffffffffff000000000000000000000001')
}
let G: cryptoFramework.Point = {
x: BigInt('0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d2... | AST#function_declaration#Left function genEccCommonSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCCommonParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left {... | function genEccCommonSpec(): cryptoFramework.ECCCommonParamsSpec {
let fieldFp: cryptoFramework.ECFieldFp = {
fieldType: 'Fp',
p: BigInt('0xffffffffffffffffffffffffffffffff000000000000000000000001')
}
let G: cryptoFramework.Point = {
x: BigInt('0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d2... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets#L37-L57 | bc8a18a2161454da781882d45b703d3353d271c3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets | arkts | compressByWorker | 向worker线程发送信息,进行压缩
@returns | compressByWorker(): void {
/**
* TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。
* TODO:知识点:相对路径加载形式,加载路径规则:{relativePath}。
*/
let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../worker/Worker.ets');
// TODO:知识点:主线程使用postMessage()向worker线程发送消息。
// 主线程使用postMessage()向wo... | AST#method_declaration#Left compressByWorker 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 { /**
* TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。
* TODO:知识点:相对路径加载形式,加载路径规则... | compressByWorker(): void {
let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../worker/Worker.ets');
workerInstance.postMessage({
pathDir: this.pathDir,
compressZipPath: this.compressZipPath,
beCompressFileDir: this.beCompressFileDir
});
workerInst... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L60-L88 | 7367e0afa6f09821ba0df7e3f8fbd3e5184b8229 | gitee |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/api/SongApi.ets | arkts | 获取mv地址
@param mvId
@returns | export function fetchMovieUrl(mvId: number) {
const params = { id: mvId };
return new Promise <{ url: string }>((resolve, reject) => {
httpRequestGet<MvUrlResponse>(AccessUrls.MvUrl, { queryParams: params })
.then((res) => {
if (res.code === 200) {
resolve({ url: res.data.url });
... | AST#export_declaration#Left export AST#function_declaration#Left function fetchMovieUrl AST#parameter_list#Left ( AST#parameter#Left mvId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST... | export function fetchMovieUrl(mvId: number) {
const params = { id: mvId };
return new Promise <{ url: string }>((resolve, reject) => {
httpRequestGet<MvUrlResponse>(AccessUrls.MvUrl, { queryParams: params })
.then((res) => {
if (res.code === 200) {
resolve({ url: res.data.url });
... | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/api/SongApi.ets#L220-L236 | a18124913df37f907cd40076b185dc0a6b577e7e | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/viewmodel/PressKeysItem.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class PressKeysBean {
public flag: number;
public width: string;
public height: string;
public value: string;
public source?: Resource;
constructor(flag: number, width: string, height: string, value: string, source?: Resource) {
this.flag = flag;
this.width = width;
this.height = height;... | AST#export_declaration#Left export AST#class_declaration#Left class PressKeysBean AST#class_body#Left { AST#property_declaration#Left public flag : 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 public... | export class PressKeysBean {
public flag: number;
public width: string;
public height: string;
public value: string;
public source?: Resource;
constructor(flag: number, width: string, height: string, value: string, source?: Resource) {
this.flag = flag;
this.width = width;
this.height = height;... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/viewmodel/PressKeysItem.ets#L16-L30 | 85e83b2359890ca8957d353cf7ab4d0f8d2f9dbe | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/components/emoji/EmojiItem.ets | arkts | EmojiItem | 无大小写的按键组件 | @Component
export struct EmojiItem {
private keyValue: keySourceListType | undefined = undefined;
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
aboutToAppear() {
// familySrc支持RawFile
font.registerFont({
familyName: 'emoji',
familySrc: $rawfile('fo... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmojiItem AST#component_body#Left { AST#property_declaration#Left private keyValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left keySourceListType AST#primary_type#Right | AST#primary_type#Left ... | @Component
export struct EmojiItem {
private keyValue: keySourceListType | undefined = undefined;
@StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle();
aboutToAppear() {
font.registerFont({
familyName: 'emoji',
familySrc: $rawfile('font/NotoColorEmoji-Reg... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/emoji/EmojiItem.ets#L30-L66 | 55d848b4ebef3e813b48c6594af41dc63d0922c0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets | arkts | snapShotToOffset | 滚动截图。 | async snapShotToOffset() {
// 记录截图前是否滚动到底部
const scrollerTouchBottom: boolean = this.scroller.isAtEnd();
// 截图前状态初始化
await this.beforeSnapshot();
// TODO: 性能知识点: 使用Canvas离屏绘制在缓冲区拼接截图
const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true);
const offCanvasCtx: Offsc... | AST#method_declaration#Left async snapShotToOffset AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 记录截图前是否滚动到底部 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left scrollerTouchBottom : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | async snapShotToOffset() {
const scrollerTouchBottom: boolean = this.scroller.isAtEnd();
await this.beforeSnapshot();
const canvasSetting: RenderingContextSettings = new RenderingContextSettings(true);
const offCanvasCtx: OffscreenCanvasRenderingContext2D =
new OffscreenCanvasRender... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets#L319-L387 | 9d737e90e74bbb6dbf5e0abe62a5fdb26b424042 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/media/MediaManager.ets | arkts | playMusic | 播放音乐 | async playMusic(url: string): Promise<boolean> {
try {
Logger.info('MediaManager', `Playing music: ${url}`);
// 实际实现需要使用 @ohos.multimedia.media
this.playerState.isPlaying = true;
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to play music: ${String(error)}`);
... | AST#method_declaration#Left async playMusic AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async playMusic(url: string): Promise<boolean> {
try {
Logger.info('MediaManager', `Playing music: ${url}`);
this.playerState.isPlaying = true;
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to play music: ${String(error)}`);
return false;
}
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L37-L47 | 648653d17fa31b3152b87dc06e6ffe46dca7312a | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoProcessBaseWeb/entry/src/main/ets/utils/CustomFunction.ets | arkts | [End link1] | export function openVideoInBrowser(uri: string, context: common.UIAbilityContext) {
let want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri
};
context.startAbility(want);
} | AST#export_declaration#Left export AST#function_declaration#Left function openVideoInBrowser AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Le... | export function openVideoInBrowser(uri: string, context: common.UIAbilityContext) {
let want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri
};
context.startAbility(want);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/utils/CustomFunction.ets#L48-L55 | 8bc89999cfed03f46634b72481d2c8a90c5a68cf | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/XAxis.ets | arkts | setCustomLabels | 设置自定义Labels
@param numbers labels数组 | public setCustomLabels(numbers: number[]): void {
this.customLabels = numbers;
} | AST#method_declaration#Left public setCustomLabels AST#parameter_list#Left ( AST#parameter#Left numbers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | public setCustomLabels(numbers: number[]): void {
this.customLabels = numbers;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L187-L189 | 12a3e02157c7445e2bb2d8ee7e945dab4daadd39 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets | arkts | onScale | 需要覆写的平移事件 的缩放事件
@param event | public onScale(event: TouchEvent) {} | AST#method_declaration#Left public onScale AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST... | public onScale(event: TouchEvent) {} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets#L179-L179 | 8815a664fa6393f6e4e762fb4410b937bc87b2e3 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/view/components/CommandTile.ets | arkts | runCommand | 点击执行按钮后执行指令 根据条目设置,弹出对应的输入页面 | private async runCommand() {
try {
this.changeRunningState(true);
let command = this.item.command;
if (this.item.accountInputRequired === 1 && this.onAccountInput) {
let asfAcc = await this.onAccountInput();
if(asfAcc === "") {
... | AST#method_declaration#Left private async runCommand AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left ... | private async runCommand() {
try {
this.changeRunningState(true);
let command = this.item.command;
if (this.item.accountInputRequired === 1 && this.onAccountInput) {
let asfAcc = await this.onAccountInput();
if(asfAcc === "") {
... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/view/components/CommandTile.ets#L37-L64 | 4c5621f5ad50769a391c7fca3492d14e879a0155 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/this_expression/this_expression_002_F.ets | arkts | Introduction this表达式 | export function this_expression_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
let a = new A(clean);
taint.Sink(a.getValue());
} | AST#export_declaration#Left export AST#function_declaration#Left function this_expression_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function this_expression_002_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
let a = new A(clean);
taint.Sink(a.getValue());
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/this_expression/this_expression_002_F.ets#L7-L12 | d908264269e10b2825afa08127fec747936316a3 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | generateMockGreeting | 生成个性化祝福语 (替代模拟祝福语) | private generateMockGreeting(params: GenerationParams): string {
const contact = params.contact;
const name = contact.name;
const age = (contact.birthday && contact.birthday.age) ? `${contact.birthday.age}岁` : '';
const relation = this.getRelationText(contact.relation);
// 添加时间戳确保每次生成不同
const t... | AST#method_declaration#Left private generateMockGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GenerationParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ... | private generateMockGreeting(params: GenerationParams): string {
const contact = params.contact;
const name = contact.name;
const age = (contact.birthday && contact.birthday.age) ? `${contact.birthday.age}岁` : '';
const relation = this.getRelationText(contact.relation);
const timestamp = Date.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L632-L668 | c1f0787e2b369b193897d60ff5d34b4e7ff2d89d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textexpand/src/main/ets/utils/Model.ets | arkts | 文本展开视图模型
@param {ResourceStr} title - 文本内容
@param {boolean} needProcess - 是否展示展开收起按钮
@param {exceedOneLine} boolean - 加上'收起'二字时超过一行需要换行 | export class TextExpandModel {
title: ResourceStr = '';
needProcess: boolean = true;
exceedOneLine: boolean = false;
} | AST#export_declaration#Left export AST#class_declaration#Left class TextExpandModel AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declara... | export class TextExpandModel {
title: ResourceStr = '';
needProcess: boolean = true;
exceedOneLine: boolean = false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/utils/Model.ets#L23-L27 | 66bb1b206f34f68bc6f7c982fe2a4550cef6919a | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | init time of string | export const START_TIME: string = '00:00'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left START_TIME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '00:00' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat... | export const START_TIME: string = '00:00'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L39-L39 | 95a0d7159ad26a8c6c88d8e456494de6e00b02a5 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.