nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets | arkts | startRenderer | 播放录音 | async startRenderer(filePath: string) {
// 根据路径打开文件
const file = fileIo.openSync(filePath)
// 获取文件信息,如果读取时已经超出文件大小,自动停止
const stat = fileIo.statSync(file.fd)
// 1. 获取音频渲染器(播放器)
const audioRenderer = await this.getAudioRenderer()
// 偏移值
let bufferSize: number = 0
// 2. 调用on('writeData... | AST#method_declaration#Left async startRenderer AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 根据路径打开文件 AST#statement#Left AST#vari... | async startRenderer(filePath: string) {
const file = fileIo.openSync(filePath)
const stat = fileIo.statSync(file.fd)
const audioRenderer = await this.getAudioRenderer()
let bufferSize: number = 0
let writeDataCallback = (buffer: ArrayBuffer) => {
fileIo.readSync(file.f... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSAudioCapturer/entry/src/main/ets/pages/Index.ets#L146-L173 | 72384537b1ff291b5015f53ef95a04cdbe1e6208 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets | arkts | aboutToAppear | 在自定义组件生命周期aboutToAppear中,根据当前颜色模式刷新banner状态变量,切换不同的图片。 | aboutToAppear(): void {
const applicationContext = getContext(this).getApplicationContext();
applicationContext.setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.banner = setBanner(this.currentMode);
} | 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#variable_declaration#Left const AST#variable_declarator#Left application... | aboutToAppear(): void {
const applicationContext = getContext(this).getApplicationContext();
applicationContext.setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.banner = setBanner(this.currentMode);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets#L52-L56 | a4209b525e6a20b1a50cb231b15b26fbc8d84549 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/src/main/ets/view/ProfilePage.ets | arkts | ProfileContent | 个人中心内容视图
@returns {void} 无返回值 | @Builder
private ProfileContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
IBestCell({
title: $r("app.string.user_profile_nickname_label"),
value: this.vm.getDisplayNickName(),
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ProfileContent 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 MediumPaddingVerticalScroll ( ) AST#container_conte... | @Builder
private ProfileContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestCellGroup({ inset: true, outerMargin: 0 }) {
IBestCell({
title: $r("app.string.user_profile_nickname_label"),
value: this.vm.getDisplayNickName(),
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/view/ProfilePage.ets#L35-L71 | 86d9b36d1e701d9e05bfff686ff8cbfb9a81e364 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | replacePathByName | @deprecated
@see {ZRouter.getInstance().replacePathByName}
@param name
@param param
@param animated | public static replacePathByName(name: string, param?: ObjectOrNull, animated: boolean = true) {
ZRouter.getRouterMgr().replacePathByName<ObjectOrNull>(name, param, animated)
} | AST#method_declaration#Left public static replacePathByName AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left ObjectO... | public static replacePathByName(name: string, param?: ObjectOrNull, animated: boolean = true) {
ZRouter.getRouterMgr().replacePathByName<ObjectOrNull>(name, param, animated)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L571-L573 | d15de27d7971d9259b4efe1c1109e8d02f2cd167 | gitee |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/utils/FileUtil.ets | arkts | selectImage | 选择图片 | static selectImage(): Promise<string> {
return new Promise<string>((resolve, reject) => {
try {
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker ... | AST#method_declaration#Left static selectImage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | static selectImage(): Promise<string> {
return new Promise<string>((resolve, reject) => {
try {
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker ... | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/FileUtil.ets#L49-L67 | fea886e8f39eb9e45074bb9375398af6bc790955 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getErrorCount | 获取全部错题数量
@returns | public getErrorCount(): number {
return this.examDetails.filter(item => item.isCorrect === false).length;
} | AST#method_declaration#Left public getErrorCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | public getErrorCount(): number {
return this.examDetails.filter(item => item.isCorrect === false).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L180-L182 | c5f2efd220ba7204edc52335427f2f49368ff36e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/LunarUtils.ets | arkts | getLunarYearInfo | 获取农历年份的信息
@param year 农历年份
@returns 年份信息 | private static getLunarYearInfo(year: number): {
leapMonth: number;
monthDays: number[];
totalDays: number;
} | AST#method_declaration#Left private static getLunarYearInfo AST#parameter_list#Left ( AST#parameter#Left year : 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#ERROR#Left : AST#ERROR#Right AST#builder_function_body... | private static getLunarYearInfo(year: number): {
leapMonth: number;
monthDays: number[];
totalDays: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/LunarUtils.ets#L60-L64 | 4fa9160951b730f2ac2dc5d88c49cdcd5adbb92a | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets | arkts | 计算特定类型账目在指定日期的日收支统计 | export function dayStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number {
return accounts
.filter((account) => account.accountType === accountType && isSameDay(date, account.date))
.map((account) => account.amount)
.reduce((total, cur) => total + cur, 0);
} | AST#export_declaration#Left export AST#function_declaration#Left function dayStatistics AST#parameter_list#Left ( AST#parameter#Left accounts : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Rig... | export function dayStatistics(accounts: Array<Account>, accountType: number, date: Date = new Date()): number {
return accounts
.filter((account) => account.accountType === accountType && isSameDay(date, account.date))
.map((account) => account.amount)
.reduce((total, cur) => total + cur, 0);
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets#L7-L12 | 0bb820c8390e71b322965ee5fccb9c9371cc62c0 | github | |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/database/HerbalTable.ets | arkts | addHerb | static getInstance() { if (!HerbalTable.instance) { HerbalTable.instance = new HerbalTable(() => { console.info('[herbalTable] 创建药材表成功') }) } return HerbalTable.instance } | async addHerb(herb: IHerbalModel, callback: Function) {
console.info('Adding herb: ', JSON.stringify(herb));
this.insertData(herb, callback);
} | AST#method_declaration#Left async addHerb AST#parameter_list#Left ( AST#parameter#Left herb : AST#type_annotation#Left AST#primary_type#Left IHerbalModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#prima... | async addHerb(herb: IHerbalModel, callback: Function) {
console.info('Adding herb: ', JSON.stringify(herb));
this.insertData(herb, callback);
} | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/HerbalTable.ets#L29-L32 | 467a162970813e6533ded8877f65eb025e18f0e8 | github |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | selector/src/main/ets/MediaSelector.ets | arkts | 图片选择器
@Author sea
@Date 2024/7/8 | export class MediaSelector {
// 标题样式
titleStyleData: TitleStyleData
// 图片列表样式
pictureItemStyleData: PictureItemStyleData
// 设置权限弹窗样式
settingDialogStyleData: CommonDialogData
// 最大选择数量
maxSelectCount: number
constructor | AST#export_declaration#Left export AST#ERROR#Left class MediaSelector { // 标题样式 titleStyleData AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left TitleStyleData AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right // 图片列表样式 AST#ERROR#Left pictureItemStyleData : PictureItemStyleData // 设置权限弹窗样式 ... | export class MediaSelector {
titleStyleData: TitleStyleData
pictureItemStyleData: PictureItemStyleData
settingDialogStyleData: CommonDialogData
maxSelectCount: number
constructor | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/MediaSelector.ets#L15-L25 | 908855ad2f4495a879958853391d4139eeebac9c | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/JSONUtil.ets | arkts | jsonToArray | JSON字符串转Array
@param cls 类名
@param jsonStr JSON字符串
@returns | static jsonToArray<T>(jsonStr: string): Array<T> {
try {
return JSON.parse(jsonStr) as Array<T>
} catch (err) {
LogUtil.error(err);
return []
}
} | AST#method_declaration#Left static jsonToArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#param... | static jsonToArray<T>(jsonStr: string): Array<T> {
try {
return JSON.parse(jsonStr) as Array<T>
} catch (err) {
LogUtil.error(err);
return []
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/JSONUtil.ets#L81-L88 | 6e29befd82c7adf6571188d2e166bcdbd934d590 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/marquee/src/main/ets/utils/MarqueeSection.ets | arkts | MarqueeSection | 功能描述:
1. 进入页面,跑马灯文本超过Scroll本身的长度,文本滚动。
实现原理:
1. Text组件外层包裹一层Scroll组件,Scroll组件设置一定的百分比宽度值,并获取当前文本内容宽度和Scroll组件宽度,文本宽度大于Scroll组件宽度时,通过添加判断显示同样的文本,在偏移过程中可实现文本接替并显示在同一显示区的效果。
2. 页面进来执行文本滚动函数scrollAnimation(),在指定的时间内完成文本的偏移,当循环一次之后,通过定时器setTimeout来实现停滞操作。
@param {()=>void} marqueeTextBuilder - 跑马灯文本内容视图
@param {MarqueeAni... | @Component
export struct MarqueeSection {
// -------------------对外暴露变量-----------------------
// 跑马灯文本视图
@BuilderParam marqueeTextBuilder: () => void;
// 跑马灯动画属性
marqueeAnimationModifier: MarqueeAnimationModifier = new MarqueeAnimationModifier();
// 跑马灯文本滚动属性
marqueeScrollModifier: MarqueeScrollModifier =... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MarqueeSection AST#component_body#Left { // -------------------对外暴露变量----------------------- // 跑马灯文本视图 AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right marqueeTextBuilder : AST#type... | @Component
export struct MarqueeSection {
@BuilderParam marqueeTextBuilder: () => void;
marqueeAnimationModifier: MarqueeAnimationModifier = new MarqueeAnimationModifier();
marqueeScrollModifier: MarqueeScrollModifier = new MarqueeScrollModifier();
@State ticketCheckTextOffset: number = 0;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/utils/MarqueeSection.ets#L33-L147 | bc6e619f50380da04fbde0b880f51a6533ff73fb | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/storage/StorageManager.ets | arkts | getAllKeys | 获取所有键 | static async getAllKeys(): Promise<string[]> {
const instance = StorageManager.getInstance();
if (!instance.dataPreferences) {
return [];
}
try {
const all = await instance.dataPreferences.getAll();
const allObj = all as Record<string, preferences.ValueType>;
return Object.keys(a... | AST#method_declaration#Left static async getAllKeys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary... | static async getAllKeys(): Promise<string[]> {
const instance = StorageManager.getInstance();
if (!instance.dataPreferences) {
return [];
}
try {
const all = await instance.dataPreferences.getAll();
const allObj = all as Record<string, preferences.ValueType>;
return Object.keys(a... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L192-L205 | f8656aa327ec5268e7ddd5875fd8bd501fdea841 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | calculateLunarBirthdayDays | 计算农历生日距离现在的天数 | async calculateLunarBirthdayDays(lunarMonth: number, lunarDay: number): Promise<number> {
const today = new Date();
const currentYear = today.getFullYear();
// 先尝试今年的农历生日
let birthdayThisYear = await this.getLunarToSolar(currentYear, lunarMonth, lunarDay);
if (!birthdayThisYear) {
return 365... | AST#method_declaration#Left async calculateLunarBirthdayDays AST#parameter_list#Left ( AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarDay : AST#type_annotation#Left AST#primary_type#Left... | async calculateLunarBirthdayDays(lunarMonth: number, lunarDay: number): Promise<number> {
const today = new Date();
const currentYear = today.getFullYear();
let birthdayThisYear = await this.getLunarToSolar(currentYear, lunarMonth, lunarDay);
if (!birthdayThisYear) {
return 365;
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L212-L238 | 75635c62efe507d0c94c134cc1e715825d830e67 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/ToastUtil.ets | arkts | showShort | 弹出土司,时长为:1.5s,距离底部默认为80vp
@param message 提示消息
@param options (距离屏幕底部的位置、是否显示在应用之上) | static showShort(message: string | Resource, options?: ToastOptions) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 1);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
if (opti... | AST#method_declaration#Left static showShort AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ... | static showShort(message: string | Resource, options?: ToastOptions) {
if (message || (typeof message === 'string' && message.length > 0)) {
options = ToastUtil.initToastDefault(options, 1);
let toastOptions = options as promptAction.ShowToastOptions;
toastOptions.message = message;
if (opti... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/ToastUtil.ets#L65-L76 | 383ca76a8ca6e1b16857f19c2dbf361f2858abb5 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/search.ets | arkts | recommandItem | **************************************** 推荐运动列表 *********************************************// | @Builder
recommandItem(item:searchContent,index:number){
Column(){
Row(){
Text(index+"")
.width(30)
.height(30)
.padding({right:15})
Image(this.getImage(item.iname)).width(100)
.height(100)
.borderRadius(12)
Column(){
Text(i... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right recommandItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left searchContent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotatio... | @Builder
recommandItem(item:searchContent,index:number){
Column(){
Row(){
Text(index+"")
.width(30)
.height(30)
.padding({right:15})
Image(this.getImage(item.iname)).width(100)
.height(100)
.borderRadius(12)
Column(){
Text(i... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L159-L190 | ffd51a99dfb1bd46792eb362f0ecacaf605a1553 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | Q2/DxinTranslate/entry/src/main/ets/model/Data.ets | arkts | 请求结果返回的类型 | export class Resp{
from:string
to:string
src:string
dst:string
//那个翻译API : 天行 百度 聚合
tranApi:string
constructor | AST#export_declaration#Left export AST#ERROR#Left class Resp { from : AST#ERROR#Left string to : string src : string dst : string //那个翻译API : 天行 百度 聚合 tranApi : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_dec... | export class Resp{
from:string
to:string
src:string
dst:string
tranApi:string
constructor | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/model/Data.ets#L24-L32 | c35963a28a9d0139f0d5358bfdfc39b7e94f1928 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/TimedReminderService.ets | arkts | createDailyCheckReminder | 创建每日检查提醒 | public async createDailyCheckReminder(hour: number, minute: number): Promise<boolean> {
try {
// 设置每日提醒时间
const triggerTime = new Date();
triggerTime.setHours(hour, minute, 0, 0);
// 如果今天的时间已经过了,设置为明天
if (triggerTime <= new Date()) {
triggerTime.setDate(triggerTime.getDate() +... | AST#method_declaration#Left public async createDailyCheckReminder AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left nu... | public async createDailyCheckReminder(hour: number, minute: number): Promise<boolean> {
try {
const triggerTime = new Date();
triggerTime.setHours(hour, minute, 0, 0);
if (triggerTime <= new Date()) {
triggerTime.setDate(triggerTime.getDate() + 1);
}
const confi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L75-L102 | 6d2329aa40777b6dc5f0c3d1638a29c3475dd728 | github |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | entry/src/main/ets/Utils/FormIdStore.ets | arkts | removeFormId | 2. 移除 formId (当用户删除小组件时调用) | static async removeFormId(context: common.Context, formId: string) {
try {
const store = await FormIdStore.getStore(context);
const currentStr = await store.get(KEY_FORM_IDS, '[]') as string;
let idList: string[] = JSON.parse(currentStr);
if (idList.includes(formId)) {
idList = idLi... | AST#method_declaration#Left static async removeFormId 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#Left formId :... | static async removeFormId(context: common.Context, formId: string) {
try {
const store = await FormIdStore.getStore(context);
const currentStr = await store.get(KEY_FORM_IDS, '[]') as string;
let idList: string[] = JSON.parse(currentStr);
if (idList.includes(formId)) {
idList = idLi... | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/Utils/FormIdStore.ets#L34-L49 | 0b32dadc98445361162c86dffe3b8d76103194e6 | github |
HunZiLei/ArtTs_PokeAccountBook.git | 3d91db931f5dd6cea3c6cd414fad7c28942a58ac | entry/src/main/ets/pages/sumPage.ets | arkts | jumpDetailPage | 页面跳转的函数 | jumpDetailPage(): void{
router.pushUrl({
url: 'pages/Index' // 目标url
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`###Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('###Invoke pushUrl succeeded.');
}... | AST#method_declaration#Left jumpDetailPage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | jumpDetailPage(): void{
router.pushUrl({
url: 'pages/Index'
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`###Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('###Invoke pushUrl succeeded.');
});
} | https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/pages/sumPage.ets#L25-L35 | 058c25501915f62f5d05b6043f21bec69c251fe1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | moveWindowToAsync | 移动窗口位置,使用Promise异步回调。调用生效后返回,回调中可使用getWindowProperties()(见示例)立即获取最终生效结果。
@param x 窗口在x轴方向移动到的坐标位置,单位为px,值为正表示位置在x轴右侧;值为负表示位置在x轴左侧;值为0表示位置在x轴坐标原点。该参数仅支持整数输入,浮点数输入将向下取整。
@param y 窗口在y轴方向移动到的坐标位置,单位为px,值为正表示位置在y轴下侧;值为负表示位置在y轴上侧;值为0表示位置在y轴坐标原点。该参数仅支持整数输入,浮点数输入将向下取整。
@param windowClass 不传该值,默认主窗口。
@returns | static async moveWindowToAsync(x: number, y: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.moveWindowToAsync(x, y);
} | AST#method_declaration#Left static async moveWindowToAsync 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#primar... | static async moveWindowToAsync(x: number, y: number,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.moveWindowToAsync(x, y);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L436-L439 | 98fb7f84a7a419ecdd1a9636050aac3abfcca858 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getSizeStringFromBytes | ================== 数据处理方法 ==================
根据数字返回大小
@param size 字节大小
@returns 格式化后的尺寸字符串 | static getSizeStringFromBytes(size: number): string {
const b: number = 1;
const k: number = 1024 * b;
const m: number = 1024 * k;
const g: number = 1024 * m;
const gg: number = size / g;
if (gg > 1) {
return `${gg.toFixed(1)}GB`;
}
const mm: number = size / m;
if (mm > 1) {
... | AST#method_declaration#Left static getSizeStringFromBytes AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#... | static getSizeStringFromBytes(size: number): string {
const b: number = 1;
const k: number = 1024 * b;
const m: number = 1024 * k;
const g: number = 1024 * m;
const gg: number = size / g;
if (gg > 1) {
return `${gg.toFixed(1)}GB`;
}
const mm: number = size / m;
if (mm > 1) {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L104-L122 | 55c489ffcd4142b833adc64e7ed3259ee26857ee | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/navigation/ContributorsNav.ets | arkts | ContributorsNav | @file 贡献者页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function ContributorsNav(): void {
ContributorsPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ContributorsNav 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_custo... | @Builder
export function ContributorsNav(): void {
ContributorsPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/ContributorsNav.ets#L8-L11 | 26e8f1b9bfdd9402d6f860392dd89a00f9777ebf | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | getDBPieces | / 获取转换后的 DBPieces | getDBPieces(): DBPiece[] {
let dbPieces: DBPiece[] = [];
this.pieces.forEach((piece) => {
(piece.wordIds ?? []).forEach((wordId) => {
let dbPiece = new DBPiece();
dbPiece.planId = this.planId;
dbPiece.pieceNo = piece.pieceNo;
dbPiece.wordId = wordId;
dbPie... | AST#method_declaration#Left getDBPieces AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DBPiece [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left ... | getDBPieces(): DBPiece[] {
let dbPieces: DBPiece[] = [];
this.pieces.forEach((piece) => {
(piece.wordIds ?? []).forEach((wordId) => {
let dbPiece = new DBPiece();
dbPiece.planId = this.planId;
dbPiece.pieceNo = piece.pieceNo;
dbPiece.wordId = wordId;
dbPie... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L421-L433 | 617e7ddaf8ca5579a11f2c148e119cbe6ff86187 | github |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/common/Constant.ets | arkts | 页面顶部navigation高度 | export const PAGE_HEADER_HEIGHT: number = 60; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PAGE_HEADER_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 AST#expression#Right AST#variable_declarator#Right ; AST#variable_decla... | export const PAGE_HEADER_HEIGHT: number = 60; | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/common/Constant.ets#L7-L7 | 71a4e9b6f07b39e6251306908515ba928bd2a1e2 | github | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | ProfilePage | 我的页面 | @Builder
ProfilePage() {
Column() {
// 用户信息卡片
Column() {
// 顶部用户名和头像
Row() {
// 头像
if (this.avatarUri) {
Image(this.avatarUri)
.width(50)
.height(50)
.borderRadius(25)
.margin({ right: 12 })
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ProfilePage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 用户信息卡片 AST#ark... | @Builder
ProfilePage() {
Column() {
Column() {
Row() {
if (this.avatarUri) {
Image(this.avatarUri)
.width(50)
.height(50)
.borderRadius(25)
.margin({ right: 12 })
.onClick(() => {
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1441-L1577 | 55188f9e4d62c60dfe8b6ddffcf3445f03c1db7b | github |
GAOMUgenius/SounderHarbor.git | ac0efa1a290980999e38aa868259d32c2f107bb2 | features/play/src/main/ets/pages/PlayingPage.ets | arkts | calculateRotationAngle | 计算当前应该旋转的角度 | private calculateRotationAngle(): number {
// 确保duration不为0,避免除零错误
if (this.playingData.duration <= 0) {
return 0;
}
// 根据播放进度计算角度 (time/duration) * 360°
return (this.playingData.time / this.playingData.duration) * 360 * 3;
} | AST#method_declaration#Left private calculateRotationAngle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 确保duration不为0,避免除零错误 AST#statement#Left AST#if_statement#Left if ( AST#ex... | private calculateRotationAngle(): number {
if (this.playingData.duration <= 0) {
return 0;
}
return (this.playingData.time / this.playingData.duration) * 360 * 3;
} | https://github.com/GAOMUgenius/SounderHarbor.git/blob/ac0efa1a290980999e38aa868259d32c2f107bb2/features/play/src/main/ets/pages/PlayingPage.ets#L27-L34 | 1629746e5b7b28d87081b6a1c5c5e78f013db18c | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/pages/WorldClockPage.ets | arkts | 构建页面内容 | build() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
HeaderContainer({ title: WorldClockConstants.WORLD_CLOCK }) {
Row({ space: DimensionUtil.getVp($r('app.float.new_alarm_button_size')) }) {
// 添加新城市的按钮
Button() {
Image($r('app.media.ic_add'... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right .... | build() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
HeaderContainer({ title: WorldClockConstants.WORLD_CLOCK }) {
Row({ space: DimensionUtil.getVp($r('app.float.new_alarm_button_size')) }) {
Button() {
Image($r('app.media.ic_add')).objectFi... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/WorldClockPage.ets#L54-L139 | 375cbc660815b4ed421dc77836530f13db30d9f1 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets | arkts | genRsa2048PubKeySpec | 根据密钥参数构造RSA公钥规范对象 | function genRsa2048PubKeySpec() {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4' +
'328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee' +
'34e4d933c868187bdc26f7be07149... | AST#function_declaration#Left function genRsa2048PubKeySpec AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left nIn = AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right... | function genRsa2048PubKeySpec() {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4' +
'328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee' +
'34e4d933c868187bdc26f7be07149... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets#L36-L45 | 1f18851e7dc427f10bb9c20f480dd3c3bb923e55 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | decodeECB | 解密-ECB模式
@param str 加密的字符串
@param key 给定秘钥规格密钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格 | static async decodeECB(str: string, sm4Key: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//转换密钥
let symKey = await CryptoUtil.convertKeyFromStr(sm4Key, symAlgName, keyName);
// 初始化加解密操作环境:开始解密
let mode = crypto.CryptoMode.DECRYPT_MODE;
//创建解密器
let c... | AST#method_declaration#Left static async decodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async decodeECB(str: string, sm4Key: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let symKey = await CryptoUtil.convertKeyFromStr(sm4Key, symAlgName, keyName);
let mode = crypto.CryptoMode.DECRYPT_MODE;
let cipher = crypto.createCipher(sym... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L197-L211 | 8d16c052ecfa714d3617bf6ff98ca074dfe51d97 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/DailySummary.ets | arkts | Unix timestamp | constructor(
id: number = 0,
date: string = '',
summary: string = '',
keyTopics: string[] = [],
tasksCreated: number = 0,
memosCreated: number = 0,
moodTrend: string = 'neutral',
timestamp: number = Date.now()
) {
this.id = id;
this.date = date;
this.summary = summary;
... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#... | constructor(
id: number = 0,
date: string = '',
summary: string = '',
keyTopics: string[] = [],
tasksCreated: number = 0,
memosCreated: number = 0,
moodTrend: string = 'neutral',
timestamp: number = Date.now()
) {
this.id = id;
this.date = date;
this.summary = summary;
... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/DailySummary.ets#L45-L63 | 6bf79d47efe2fb9c325cff483e91bea1d468ac44 | github | |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets | arkts | calculateData | 获取需要跨节点迁移的组件的位置,及迁移前后节点的公共父节点的位置,用以计算做动画组件的动画参数 | public calculateData(key: string): void {
let clickedImageInfo = this.getRectInfoById(key);
let rootStackInfo = this.getRectInfoById('rootStack');
this.positionX = px2vp(clickedImageInfo.left - rootStackInfo.left);
this.positionY = px2vp(clickedImageInfo.top - rootStackInfo.top);
this.calculatedTran... | AST#method_declaration#Left public calculateData AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | public calculateData(key: string): void {
let clickedImageInfo = this.getRectInfoById(key);
let rootStackInfo = this.getRectInfoById('rootStack');
this.positionX = px2vp(clickedImageInfo.left - rootStackInfo.left);
this.positionY = px2vp(clickedImageInfo.top - rootStackInfo.top);
this.calculatedTran... | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets#L50-L57 | 3b010df0ab3c53d42ea84787b45073c8c7f24d4e | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets | arkts | submitter数据格式 | export interface SubmitterType {
id: number
name: string
email: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SubmitterType AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left name : AST#type_annotation#Left AST... | export interface SubmitterType {
id: number
name: string
email: string
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets#L44-L48 | e4b6a96afbc4e80aea87470cf62708acc1006279 | gitee | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/viewmodels/ReviewViewModel.ets | arkts | calculateAverageTime | 计算平均时长(分钟) | static calculateAverageTime(): string {
if (AppState.completedTasks.length === 0) return '0';
const totalSeconds = AppState.completedTasks.reduce((sum, task) =>
sum + (task.actualTime || 0), 0);
const result = Math.floor(totalSeconds / AppState.completedTasks.length / 60).toString();
console.info(... | AST#method_declaration#Left static calculateAverageTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_ex... | static calculateAverageTime(): string {
if (AppState.completedTasks.length === 0) return '0';
const totalSeconds = AppState.completedTasks.reduce((sum, task) =>
sum + (task.actualTime || 0), 0);
const result = Math.floor(totalSeconds / AppState.completedTasks.length / 60).toString();
console.info(... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L30-L37 | 3ea11cac6c20145fe78d4db93f6431589b924ef6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/common/ErrorHandler.ets | arkts | getDefaultUserMessage | 获取默认用户消息 | private getDefaultUserMessage(type: ErrorType): string {
const messageMap: Record<ErrorType, string> = {
[ErrorType.NETWORK]: '网络连接失败,请检查网络设置',
[ErrorType.VALIDATION]: '输入信息有误,请检查后重试',
[ErrorType.AI_SERVICE]: 'AI服务暂时不可用,请稍后重试',
[ErrorType.DATA_ACCESS]: '数据访问失败,请重启应用',
[ErrorType.PERMIS... | AST#method_declaration#Left private getDefaultUserMessage AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ErrorType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string A... | private getDefaultUserMessage(type: ErrorType): string {
const messageMap: Record<ErrorType, string> = {
[ErrorType.NETWORK]: '网络连接失败,请检查网络设置',
[ErrorType.VALIDATION]: '输入信息有误,请检查后重试',
[ErrorType.AI_SERVICE]: 'AI服务暂时不可用,请稍后重试',
[ErrorType.DATA_ACCESS]: '数据访问失败,请重启应用',
[ErrorType.PERMIS... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L166-L178 | 7000f8afa3dea5bf38aad49b60e96d0e08dace47 | github |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | dev/team_x/smart_cookie_pan/openharmony_hi3516/electricitycakeclangdemo/entry/src/main/ets/MainAbility/pages/second.ets | arkts | OnWifi | async function getRequest() { 每一个httpRequest对应一个http请求任务,不可复用 let httpRequest = http.createHttp() let url = 'http://apis.juhe.cn/simpleWeather/query?key=397c9db4cb0621ad0313123dab416668&city=北京' httpRequest.request(url, (err, data) => { 处理数据 prompt.showToast({message:"zhibo2022"+" "+data}) }) } | async function OnWifi() {
var hh= WifiNativeJs.enableWifi();
console.log("test0002"+hh);
} | AST#function_declaration#Left async function OnWifi AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left hh = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expre... | async function OnWifi() {
var hh= WifiNativeJs.enableWifi();
console.log("test0002"+hh);
} | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/dev/team_x/smart_cookie_pan/openharmony_hi3516/electricitycakeclangdemo/entry/src/main/ets/MainAbility/pages/second.ets#L21-L24 | 97f680c192ea025d0fe4e4c1f3c6b9e5428a333c | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/RadiusColumn.ets | arkts | RadiusColumn | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct RadiusColumn {
@BuilderParam noParam: () => void;
build() {
Column() {
this.noParam();
}
.width('100%')
.borderRadius(24)
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding({
left: 12,
right: 12,
top: 6,
bottom... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RadiusColumn AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right noParam : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#para... | @Component
export struct RadiusColumn {
@BuilderParam noParam: () => void;
build() {
Column() {
this.noParam();
}
.width('100%')
.borderRadius(24)
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding({
left: 12,
right: 12,
top: 6,
bottom... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/RadiusColumn.ets#L16-L35 | b637a85e2818342b436c55ba77919ddb7d479641 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/analytics/ReportsPage.ets | arkts | buildHeader | 构建标题栏 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
if (this.showReport... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
if (this.showReport... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/analytics/ReportsPage.ets#L81-L186 | ad507691f9b6bf469c7e3c5a334f8b85ee53fc73 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/log/Logger.ets | arkts | error | Error 日志 | error(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.ERROR, tag, message, args);
} | AST#method_declaration#Left error 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#... | error(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.ERROR, tag, message, args);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L80-L82 | 8e7ba96ff9a433e592acc57096c3be96ab9b7b2d | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Popup.d.ets | arkts | Defines the popup text options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Defines the popup text options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface PopupTextOptions {
/**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @cros... | AST#export_declaration#Left export AST#interface_declaration#Left interface PopupTextOptions AST#object_type#Left { /**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Set the text display content.
* @type... | export interface PopupTextOptions {
text: ResourceStr;
fontSize?: number | string | Resource;
fontColor?: ResourceColor;
fontWeight?: number | FontWeight | string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Popup.d.ets#L36-L104 | f2255ae2cde121ec4f7ac17548fef450661b6947 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusScriptEngine.ets | arkts | 应用约束45:添加构造函数返回类型 | constructor(player: any) {
// 应用约束9:super需要显式调用
super(player);
try {
// 应用约束60:模块已在顶部导入
this.encoder = new OpusScript(this.samplingRate, this.channels);
super.init();
} catch (err) {
throw err;
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left player : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 应用约束9:super需要显式调用 AST#statement#Left AST#exp... | constructor(player: any) {
super(player);
try {
this.encoder = new OpusScript(this.samplingRate, this.channels);
super.init();
} catch (err) {
throw err;
}
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusScriptEngine.ets#L13-L24 | 7d227619e623853e48e50713a366dfd3329902e8 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | 语言检测结果接口 | export interface LanguageDetectionResult {
detectedLanguage: SupportedLanguage;
confidence: number;
source: DetectionSource;
alternatives: SupportedLanguage[];
systemLanguage?: string;
region?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LanguageDetectionResult AST#object_type#Left { AST#type_member#Left detectedLanguage : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Lef... | export interface LanguageDetectionResult {
detectedLanguage: SupportedLanguage;
confidence: number;
source: DetectionSource;
alternatives: SupportedLanguage[];
systemLanguage?: string;
region?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L15-L22 | e35597bbe5fd06ebbd55c8d09717c315664a5a35 | github | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/model/NavItemModel.ets | arkts | tabId | export enum TabId {
HOME,
DETAIL,
STATISTICS,
MINE
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TabId AST#enum_body#Left { AST#enum_member#Left HOME AST#enum_member#Right , AST#enum_member#Left DETAIL AST#enum_member#Right , AST#enum_member#Left STATISTICS AST#enum_member#Right , AST#enum_member#Left MINE AST#enum_member#Right } AST#enum_body#Right... | export enum TabId {
HOME,
DETAIL,
STATISTICS,
MINE
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/model/NavItemModel.ets#L10-L15 | 33c48671967dc880b43aa2dcea276af28246f826 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/auth/AuthNavigator.ets | arkts | @file 认证模块导航封装
@author Joker.X | export class AuthNavigator {
/**
* 跳转到登录主页
* @returns {void} 无返回值
*/
static toLogin(): void {
navigateTo(AuthRoutes.Login);
}
/**
* 跳转到账号密码登录
* @returns {void} 无返回值
*/
static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
}
/**
* 跳转到短信验证码登录
* @returns {void... | AST#export_declaration#Left export AST#class_declaration#Left class AuthNavigator AST#class_body#Left { /**
* 跳转到登录主页
* @returns {void} 无返回值
*/ AST#method_declaration#Left static toLogin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | export class AuthNavigator {
static toLogin(): void {
navigateTo(AuthRoutes.Login);
}
static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
}
static toSmsLogin(): void {
navigateTo(AuthRoutes.SmsLogin);
}
static toRegister(): void {
navigateTo(AuthRoutes.Regis... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L8-L48 | d06ddac541038a83dbfbb5ce72af60037ddc64c4 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets | arkts | uploadImages | 上传图片到服务器
@param imageUris 图片URI列表
@returns 上传后的图片URL列表 | private async uploadImages(imageUris: string[]): Promise<string[]> {
try {
const uploadPromises: Promise<string>[] = [];
// 处理每个图片
for (let i = 0; i < imageUris.length; i++) {
const uri = imageUris[i];
// 转换为Base64
const base64 = await this.convertImageToBase64(uri);... | AST#method_declaration#Left private async uploadImages AST#parameter_list#Left ( AST#parameter#Left imageUris : 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_an... | private async uploadImages(imageUris: string[]): Promise<string[]> {
try {
const uploadPromises: Promise<string>[] = [];
for (let i = 0; i < imageUris.length; i++) {
const uri = imageUris[i];
const base64 = await this.convertImageToBase64(uri);
if (base64) ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L374-L413 | 9e2762f3c00da97caf39afff1c07a06ac8ff8891 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/payment/PaymentManager.ets | arkts | queryPaymentStatus | 查询支付状态 | async queryPaymentStatus(orderId: string): Promise<PaymentResult> {
try {
Logger.info('PaymentManager', `Querying payment status: ${orderId}`);
// Demo 实现
return {
success: true,
orderId: orderId
};
} catch (error) {
Logger.error('PaymentManager', `Failed to query p... | AST#method_declaration#Left async queryPaymentStatus AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async queryPaymentStatus(orderId: string): Promise<PaymentResult> {
try {
Logger.info('PaymentManager', `Querying payment status: ${orderId}`);
return {
success: true,
orderId: orderId
};
} catch (error) {
Logger.error('PaymentManager', `Failed to query payment sta... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/payment/PaymentManager.ets#L65-L81 | 20cc73aeb8600b72e2e4d57cad5ae40d9c4b1984 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleOfflineManager.ets | arkts | clearAllOfflineData | 清除所有离线数据 | async clearAllOfflineData(): Promise<void> {
try {
this.offlineOperations = [];
await this.saveOfflineOperations();
hilog.info(0x0000, 'SimpleOfflineManager', 'All offline data cleared');
} catch (error) {
hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to clear offline data');
}... | AST#method_declaration#Left async clearAllOfflineData 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... | async clearAllOfflineData(): Promise<void> {
try {
this.offlineOperations = [];
await this.saveOfflineOperations();
hilog.info(0x0000, 'SimpleOfflineManager', 'All offline data cleared');
} catch (error) {
hilog.error(0x0000, 'SimpleOfflineManager', 'Failed to clear offline data');
}... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L101-L109 | 8b803cebb507a15758b9cdc31bcbd9b883e35a6a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/Index.ets | arkts | PublishMultimediaUpdates | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { PublishMultimediaUpdates } from './src/main/ets/pages/PublishMultimediaUpdates'; | AST#export_declaration#Left export { PublishMultimediaUpdates } from './src/main/ets/pages/PublishMultimediaUpdates' ; AST#export_declaration#Right | export { PublishMultimediaUpdates } from './src/main/ets/pages/PublishMultimediaUpdates'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/PublishMultimediaUpdate/publishmultimediaupdate/Index.ets#L16-L16 | af6a929af7a69889cf775daf4c07671fd04386ef | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getToday | 获取今天日期
@returns 今天的日期对象 | static getToday(): Date {
const now = new Date();
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
} | AST#method_declaration#Left static getToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now = AST... | static getToday(): Date {
const now = new Date();
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L74-L77 | 2735612e6621082dfd521b912421994f3ca243da | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkListDemoPage.ets | arkts | NetworkListDemoPage | @file Network List Demo 示例页视图
@author Joker.X | @ComponentV2
export struct NetworkListDemoPage {
/**
* Network List Demo 示例页 ViewModel
*/
@Local
private vm: NetworkListDemoViewModel = new NetworkListDemoViewModel();
/**
* 列表滚动控制器
*/
private listScroller: Scroller = new Scroller();
/**
* 构建 Network List Demo 示例页
* @returns {void} 无返回值
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct NetworkListDemoPage AST#component_body#Left { /**
* Network List Demo 示例页 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#pri... | @ComponentV2
export struct NetworkListDemoPage {
@Local
private vm: NetworkListDemoViewModel = new NetworkListDemoViewModel();
private listScroller: Scroller = new Scroller();
build() {
AppNavDestination({
title: $r("app.string.demo_base_network_list_title"),
viewModel: this.vm
}) ... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkListDemoPage.ets#L11-L82 | ea7c6f5f408333d990b1a8df82346bee87661bb1 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/TextEditNodeController.ets | arkts | 文本编辑节点控制器 | export class TextEditNodeController extends NodeController {
/**
* 组件根节点
*/
private rootNode: FrameNode | null = null;
/**
* 文本记录列表,用于刷新、回退操作
*/
private textRecords: Array<OperateRecord> = new Array();
/**
* 上下文
*/
private uiContext: UIContext | null = null;
/**
* 编辑记录管理器
*/
priv... | AST#export_declaration#Left export AST#class_declaration#Left class TextEditNodeController 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_annotatio... | export class TextEditNodeController extends NodeController {
private rootNode: FrameNode | null = null;
private textRecords: Array<OperateRecord> = new Array();
private uiContext: UIContext | null = null;
private recordManager: EditRecordManager;
constructor(recordManager: EditRecordManager) {
... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L40-L313 | 55f785f503cce3b379f3f341007fc1a1f9a7e61b | gitee | |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleF/entry/src/main/ets/model/CameraModel.ets | arkts | initCamera | 初始化相机
@param surfaceId | async initCamera(surfaceId: string): Promise<void> {
Logger.info(TAG, `initCamera surfaceId:${surfaceId}`);
await this.cameraRelease();
Logger.info(TAG, `initCamera this.cameraRelease surfaceId:${surfaceId}`);
Logger.info(TAG, 'getCameraManager begin');
try {
Logger.info(TAG, 'getCameraManager... | AST#method_declaration#Left async initCamera AST#parameter_list#Left ( AST#parameter#Left surfaceId : 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#Le... | async initCamera(surfaceId: string): Promise<void> {
Logger.info(TAG, `initCamera surfaceId:${surfaceId}`);
await this.cameraRelease();
Logger.info(TAG, `initCamera this.cameraRelease surfaceId:${surfaceId}`);
Logger.info(TAG, 'getCameraManager begin');
try {
Logger.info(TAG, 'getCameraManager... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleF/entry/src/main/ets/model/CameraModel.ets#L132-L185 | 107b8996c8559f76b7b815be29f9c02d6e9940f0 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | calcMinMax | Calc minimum and maximum values (both x and y) over all DataSets. | public calcMinMax() {
if (this.mDataSets == null) {
return;
}
this.mYMax = -Number.MAX_VALUE;
this.mYMin = Number.MAX_VALUE;
this.mXMax = -Number.MAX_VALUE;
this.mXMin = Number.MAX_VALUE;
for (let dataSet of this.mDataSets.dataSouce) {
th... | AST#method_declaration#Left public calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDataS... | public calcMinMax() {
if (this.mDataSets == null) {
return;
}
this.mYMax = -Number.MAX_VALUE;
this.mYMin = Number.MAX_VALUE;
this.mXMax = -Number.MAX_VALUE;
this.mXMin = Number.MAX_VALUE;
for (let dataSet of this.mDataSets.dataSouce) {
th... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L122-L180 | 559041e35ce1c10a12c5913554994687f2b40aa4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | toastTip | 带图标的吐司Tip | toastTip(index: number) {
if (index == 0) {
//简单使用
DialogHelper.showToastTip({
message: "操作成功",
imageRes: $r('app.media.icon_tip_ok')
})
} else if (index == 1) {
DialogHelper.showToastTip({
message: "操作失败",
imageRes: $r('app.media.icon_tip_warn')
})
... | AST#method_declaration#Left toastTip AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Le... | toastTip(index: number) {
if (index == 0) {
DialogHelper.showToastTip({
message: "操作成功",
imageRes: $r('app.media.icon_tip_ok')
})
} else if (index == 1) {
DialogHelper.showToastTip({
message: "操作失败",
imageRes: $r('app.media.icon_tip_warn')
})
} ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L1127-L1161 | b1a3a7af93b520cac10b7e0d45cfbbf12b2d77f1 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getInstance | 获取TaskViewModel单例实例 | static getInstance(): TaskViewModel {
if (!TaskViewModel.instance) {
TaskViewModel.instance = new TaskViewModel();
}
return TaskViewModel.instance;
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TaskViewModel 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 ... | static getInstance(): TaskViewModel {
if (!TaskViewModel.instance) {
TaskViewModel.instance = new TaskViewModel();
}
return TaskViewModel.instance;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L22-L27 | 9ef9315bf66e1b82b9723c71c6d8e1b13fe8439e | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets | arkts | onSubmitComment | 提交评论点击事件
@returns {void} 无返回值 | onSubmitComment(): void {
} | AST#method_declaration#Left onSubmitComment 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#builder_function_body#Right AST#method_declaration#Right | onSubmitComment(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets#L72-L73 | a60b8f071fc9f1e3cc71618addb626f133d74368 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | release | 释放资源 | public async release(): Promise<void> {
if (!this.soundPool) {
return;
}
try {
// 先清空所有音效
await this.clear();
// 移除事件监听
this.removeEventListeners();
// 释放SoundPool
await this.soundPool.release();
this.soundPool = null;
this.isInitialized = false;
... | AST#method_declaration#Left public async release 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... | public async release(): Promise<void> {
if (!this.soundPool) {
return;
}
try {
await this.clear();
this.removeEventListeners();
await this.soundPool.release();
this.soundPool = null;
this.isInitialized = false;
console.info('SoundPool resourc... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L268-L289 | d81a705af15de49bef788e68843dc953eac66be0 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets | arkts | updateSession | 分段添加密钥操作的数据并进行相应的密钥操作,输出处理数据 | function updateSession(handle: number, huksOptions: huks.HuksOptions, throwObject: ThrowObject) {
return new Promise<huks.HuksReturnResult>((resolve, reject) => {
try {
huks.updateSession(handle, huksOptions, (error, data) => {
if (error) {
reject(error);
} else {
resolve... | AST#function_declaration#Left function updateSession AST#parameter_list#Left ( AST#parameter#Left handle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left AST#qual... | function updateSession(handle: number, huksOptions: huks.HuksOptions, throwObject: ThrowObject) {
return new Promise<huks.HuksReturnResult>((resolve, reject) => {
try {
huks.updateSession(handle, huksOptions, (error, data) => {
if (error) {
reject(error);
} else {
resolve... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L202-L217 | ceced29719f7db3338bbafe293651c1da9ff6d8c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 实验性配置接口 | export interface ExperimentalConfig {
betaFeatures: boolean;
featureFlags: Record<string, boolean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ExperimentalConfig AST#object_type#Left { AST#type_member#Left betaFeatures : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left featureFlags : AS... | export interface ExperimentalConfig {
betaFeatures: boolean;
featureFlags: Record<string, boolean>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L123-L126 | 2864ed02dda530b26e9e06085ae6bc2835531b40 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onCastPlayDeviceConnected | 已连接的投屏设备。
@param state. 0 设备已准备好可以播放。1:设备已断开 | onCastPlayDeviceConnected(device: VHCastPickerDevice) {
this.castPickDevice = device.deviceName;
} | AST#method_declaration#Left onCastPlayDeviceConnected AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left VHCastPickerDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_st... | onCastPlayDeviceConnected(device: VHCastPickerDevice) {
this.castPickDevice = device.deviceName;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L330-L332 | bbad93250e174aba58feda0d8be2b999c837bb6f | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/view/components/CommandTile.ets | arkts | MainContent | 条目的主要内容 | @Builder
MainContent() {
Row() {
Column({ space: StyleConstants.COMMAND_TILE_COL_SPACE }) {
Column({ space: StyleConstants.COMMAND_TILE_COL_SPACE / 2 }) {
Text(this.item.nickname)
.fontSize(StyleConstants.COMMAND_TILE_NAME_FONT_SIZE)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MainContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
MainContent() {
Row() {
Column({ space: StyleConstants.COMMAND_TILE_COL_SPACE }) {
Column({ space: StyleConstants.COMMAND_TILE_COL_SPACE / 2 }) {
Text(this.item.nickname)
.fontSize(StyleConstants.COMMAND_TILE_NAME_FONT_SIZE)
... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/view/components/CommandTile.ets#L93-L182 | 6cbac9ce99cc6a3ad024f5c3f8b4ae73bf838545 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhToast.ets | arkts | showSuccess | / 成功弹框 | public static showSuccess(loadingText: ResourceStr) {
JhToast._showToast(loadingText, _ToastType.success)
} | AST#method_declaration#Left public static showSuccess AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stat... | public static showSuccess(loadingText: ResourceStr) {
JhToast._showToast(loadingText, _ToastType.success)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L49-L51 | 29d5013c9d97f0a54b7a683b3189973e98a006d0 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.router.d.ets | arkts | disableAlertBeforeBackPage | cancel enableAlertBeforeBackPage
@param { DisableAlertBeforeBackPageOptions } options Options.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 6
@deprecated since 8 | static disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void; | AST#method_declaration#Left static disableAlertBeforeBackPage AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left DisableAlertBeforeBackPageOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le... | static disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L331-L331 | 33c581602a662e37794f8b4fed2d57dce91f0a43 | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 取消收藏文章
@param date
@returns | export function unCollectArticle(id: number) {
return axiosClient.post<any>({
url: `lg/uncollect_originId/${id}/json`,
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | AST#export_declaration#Left export AST#function_declaration#Left function unCollectArticle AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | export function unCollectArticle(id: number) {
return axiosClient.post<any>({
url: `lg/uncollect_originId/${id}/json`,
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L78-L85 | 133e1c60839887b74b65182f82e9977b65d9bbc6 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppFunctions.ets | arkts | 判断磁盘空间是否足够(纯计算) | export function isDiskSpaceEnough(needMegas: number = AppSettings.App.minDisk): boolean {
return FileUtility.isDiskSpaceEnough(needMegas)
} | AST#export_declaration#Left export AST#function_declaration#Left function isDiskSpaceEnough AST#parameter_list#Left ( AST#parameter#Left needMegas : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left... | export function isDiskSpaceEnough(needMegas: number = AppSettings.App.minDisk): boolean {
return FileUtility.isDiskSpaceEnough(needMegas)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L20-L22 | 9b767819992ab568aac7e8e3cccc20c21518da2c | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | verifyPKCS1 | 验签-PKCS1
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey RSA公钥
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static async verifyPKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
} | AST#method_declaration#Left static async verifyPKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AS... | static async verifyPKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L156-L158 | 80ad6ad0c3cd216f54490abc760e2b045128d7c4 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/OneAutumn/entry/src/main/ets/pages/HotRecommendPage.ets | arkts | nianJiBar | TabContent 的 tarBar的样式 | @Builder
nianJiBar(currentNianJi: string, index: number) {
Stack() {
Image('/images/bg1.jpg')
.width('30%')
.borderRadius(10)
Text(currentNianJi)
.margin({ top: 20 })
.fontColor(this.currentIndex === index ? '#fff60101' : '#ff023866')
.fontSize(this.currentIndex... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right nianJiBar AST#parameter_list#Left ( AST#parameter#Left currentNianJi : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#... | @Builder
nianJiBar(currentNianJi: string, index: number) {
Stack() {
Image('/images/bg1.jpg')
.width('30%')
.borderRadius(10)
Text(currentNianJi)
.margin({ top: 20 })
.fontColor(this.currentIndex === index ? '#fff60101' : '#ff023866')
.fontSize(this.currentIndex... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/pages/HotRecommendPage.ets#L32-L44 | ea92e031cb90997317ac05679dd697ba00e0e9ca | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/sideslipintercept/src/main/ets/components/mainpage/MainPage.ets | arkts | 上层navigation用来管理页面,navigation是空的,在onAppear回调时直接跳转到主页面 | build() {
// 应用主页用NavDestination承载,用于显示Navigation的内容区
Navigation(this.pageStackForComponentSharedPages) {
}
.onAppear(() => {
this.pageStackForComponentSharedPages.pushPathByName("MainPage", null, false);
})
// 创建NavDestination组件,需使用此组件的onBackPressed回调拦截返回事件
.navDestination(this.textAr... | AST#build_method#Left build ( ) AST#build_body#Left { // 应用主页用NavDestination承载,用于显示Navigation的内容区 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageStackForComponentSharedPage... | build() {
Navigation(this.pageStackForComponentSharedPages) {
}
.onAppear(() => {
this.pageStackForComponentSharedPages.pushPathByName("MainPage", null, false);
})
.navDestination(this.textArea)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sideslipintercept/src/main/ets/components/mainpage/MainPage.ets#L151-L160 | 8f54dd39444baefccbf34ec9de9503ca1afbd613 | gitee | |
MaLunan/harmonyos-WeChat.git | 802be209f5de085434722a96733e0559fcee95b4 | entry/src/main/ets/pages/Index.ets | arkts | TabBuilder | 自定义导航栏 | @Builder TabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {
Column() {
Image(this.currentIndex === targetIndex ? selectedImg : normalImg)
.size({ width: 25, height: 25 })
Text(title)
.fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_annotation#L... | @Builder TabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {
Column() {
Image(this.currentIndex === targetIndex ? selectedImg : normalImg)
.size({ width: 25, height: 25 })
Text(title)
.fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B... | https://github.com/MaLunan/harmonyos-WeChat.git/blob/802be209f5de085434722a96733e0559fcee95b4/entry/src/main/ets/pages/Index.ets#L38-L70 | e0dbd95ff38c4be28a59edb51547cd2b3845fbef | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | NicknameDialog | 昵称修改弹窗 | @Builder
NicknameDialog() {
Stack() {
// 半透明背景遮罩
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showNicknameDialog = false; // 点击遮罩关闭
})
// 昵称修改内容
Column() {
Text('修改昵称')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NicknameDialog 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 Stack ( ) AST#container_content_body#Left { // 半透明背景遮罩 AST#... | @Builder
NicknameDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showNicknameDialog = false;
})
Column() {
Text('修改昵称')
.fontSize(18)
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1830-L1909 | 270af515f659a30fbfd8dce0cedfd78d037fed81 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | 构造函数
@param {FootprintLocalDataSource} dataSource 可选的数据源实例 | constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource : AST#type_annotation#Left AST#primary_type#Left FootprintLocalDataSource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new A... | constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L18-L20 | 83a48a3677021ee4fb270ea2c1ea16f0a9f643ef | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/rssSourcesDataSource.ets | arkts | reloadNewData | 重新加载 | public reloadNewData(data: rssGroupList[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | AST#method_declaration#Left public reloadNewData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left rssGroupList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat... | public reloadNewData(data: rssGroupList[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/rssSourcesDataSource.ets#L44-L51 | 80d17aae2228b205ceffd9305cb8da3e1ed06032 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSWantOpenSetting/entry/src/main/ets/pages/Index.ets | arkts | explicitStartAbility | 显示启动Ability | explicitStartAbility() {
try {
// 在启动Ability时指定了abilityName和bundleName
let want: Want = {
deviceId: '',
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility'
};
// 获取UIAbility的上下文信息
let context = getContext(this) as common... | AST#method_declaration#Left explicitStartAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 在启动Ability时指定了abilityName和bundleName AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#L... | explicitStartAbility() {
try {
let want: Want = {
deviceId: '',
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility'
};
let context = getContext(this) as common.UIAbilityContext;
context.startAbility(want)... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSWantOpenSetting/entry/src/main/ets/pages/Index.ets#L26-L44 | 6e07d58bfd73fee1770aba742e9e5c3018d95a80 | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/component/Logger.ets | arkts | 导出默认的 Logger 实例 | export default new Logger(LOGGER_PREFIX, 0xFF02); | AST#export_declaration#Left export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Logger AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left LOGGER_PREFIX AST#expression#Right , AST#expr... | export default new Logger(LOGGER_PREFIX, 0xFF02); | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Logger.ets#L55-L55 | 2597544635387a9d33b13897cd48df8e7d764f9e | github | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/ReminderSetting.ets | arkts | DeleteConfirmDialog | 删除确认对话框 | @Builder
DeleteConfirmDialog() {
Stack() {
// 半透明背景遮罩
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showDeleteDialog = false; // 点击遮罩关闭
})
// 对话框内容
Column() {
Text('提示')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteConfirmDialog 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 Stack ( ) AST#container_content_body#Left { // 半透明背景遮罩... | @Builder
DeleteConfirmDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 0.5)')
.onClick(() => {
this.showDeleteDialog = false;
})
Column() {
Text('提示')
.fontSize(18)
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/ReminderSetting.ets#L267-L344 | b41107407ce3580cb1f73823928ab4311a994c3f | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getMoodEntriesForMonth | 获取指定月份的情绪记录
@param year - 年份
@param month - 月份 (1-12) | async getMoodEntriesForMonth(year: number, month: number): Promise<MoodEntry[]> {
try {
return await this.rdbHelper.getMoodEntriesForMonth(year, month);
} catch (error) {
console.error(`[MainViewModel] Failed to get mood entries: ${JSON.stringify(error)}`);
return [];
}
} | AST#method_declaration#Left async getMoodEntriesForMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#p... | async getMoodEntriesForMonth(year: number, month: number): Promise<MoodEntry[]> {
try {
return await this.rdbHelper.getMoodEntriesForMonth(year, month);
} catch (error) {
console.error(`[MainViewModel] Failed to get mood entries: ${JSON.stringify(error)}`);
return [];
}
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L619-L626 | ed80a6ea3aaf8abdca452a15eee6088021cd5144 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | isBlankIfStr | 判断传入的对象是否是空格
@param obj
@returns | static isBlankIfStr(obj: Object): boolean {
if (null == obj) {
return true;
} else {
return obj instanceof String ? StrUtil.isBlank(String(obj)) : false;
}
} | AST#method_declaration#Left static isBlankIfStr AST#parameter_list#Left ( AST#parameter#Left obj : 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 isBlankIfStr(obj: Object): boolean {
if (null == obj) {
return true;
} else {
return obj instanceof String ? StrUtil.isBlank(String(obj)) : false;
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L73-L79 | 44154eb4a1a38e5c889f51f9888eab354a8bf5f7 | gitee |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/pages/SelfStockComponent.ets | arkts | SelfStockComponent | 自选股列表页面
添加到自选股数据库中的页面均在这里显示
支持:置顶股票、置底股票、删除股票。 | @Component
export struct SelfStockComponent {
private context = getContext(this) as common.UIAbilityContext;
/**
* 自选股数据库
*/
private selfStockTable = new SelfStockTable(() => {
});
private dataSource = new SelfStockDataSource()
private requestStockBasicInfoApi = new RequestStockBasicInfoApi()
// htt... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SelfStockComponent AST#component_body#Left { AST#property_declaration#Left private context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#e... | @Component
export struct SelfStockComponent {
private context = getContext(this) as common.UIAbilityContext;
private selfStockTable = new SelfStockTable(() => {
});
private dataSource = new SelfStockDataSource()
private requestStockBasicInfoApi = new RequestStockBasicInfoApi()
@State showSelfStockP... | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/SelfStockComponent.ets#L18-L275 | 041f34c10a7bafa82cf5a9533e68a606342f682c | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/Add/KeyBoardComponent.ets | arkts | backupClick | 回退键逻辑处理 | backupClick() {
if (this.operate === false) {
this.amount = this.amount.slice(0, -1);
this.firstNum = Math.floor(this.firstNum / 10);
}
else {
let char = this.amount.charAt(this.amount.length - 1);
if (char === '+' || char === '-') {
this.operate = false;
this.secondN... | AST#method_declaration#Left backupClick 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right... | backupClick() {
if (this.operate === false) {
this.amount = this.amount.slice(0, -1);
this.firstNum = Math.floor(this.firstNum / 10);
}
else {
let char = this.amount.charAt(this.amount.length - 1);
if (char === '+' || char === '-') {
this.operate = false;
this.secondN... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Add/KeyBoardComponent.ets#L219-L239 | d1ced0a43d751c8b3e8980f98c5778774466021b | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelUpdate.ets | arkts | 应用约束:60. 使用ES模块导出 | export default ChannelUpdateAction; | AST#export_declaration#Left export default AST#expression#Left ChannelUpdateAction AST#expression#Right ; AST#export_declaration#Right | export default ChannelUpdateAction; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelUpdate.ets#L74-L74 | b64ee980badcc3dfa92ebd5563a8a2a6465fbf43 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/menu/VHInviteDialog.ets | arkts | saveImage | 保存图片到本地像册 | private async saveImage() {
this.showActionMenu = false;
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
// 处理获取到的快照
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(... | AST#method_declaration#Left private async saveImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showActionMenu AST#member_... | private async saveImage() {
this.showActionMenu = false;
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(context, pi... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDialog.ets#L133-L147 | d52402c1caf136ad8f0182b344cdb9e4567d6f77 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getLearnedWords | 获取已学习的单词 | getLearnedWords(): WordUser[] {
const learnedWords: WordUser[] = [];
const aliveUnits = this.getAliveUnits();
aliveUnits.forEach(unit => {
learnedWords.push(...unit.learnedWords);
});
return learnedWords;
} | AST#method_declaration#Left getLearnedWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | getLearnedWords(): WordUser[] {
const learnedWords: WordUser[] = [];
const aliveUnits = this.getAliveUnits();
aliveUnits.forEach(unit => {
learnedWords.push(...unit.learnedWords);
});
return learnedWords;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L451-L460 | 1a2dd9a9c49b0c88348076ff883dd301d3b93ec1 | github |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/views/FocusComponent.ets | arkts | FocusComponent | 曝光选择 | @Component
export struct FocusComponent {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
private mBorderWidth = 1.6;
private mBorderRadius = 10;
private mRowSize = 40;
private mFocusPoint = 60;
private focusFrameSize = 120;
build() {
if (this.focusPointBol) {
Row() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FocusComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#ty... | @Component
export struct FocusComponent {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
private mBorderWidth = 1.6;
private mBorderRadius = 10;
private mRowSize = 40;
private mFocusPoint = 60;
private focusFrameSize = 120;
build() {
if (this.focusPointBol) {
Row() {
... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/views/FocusComponent.ets#L17-L94 | bbc7173452cc1f92524fcd46257ac7745c32d977 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageSizeItem.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export interface ImageSizeItem {
/**
* Image width.
*/
width: number;
/**
* Image height.
*/
height: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ImageSizeItem AST#object_type#Left { /**
* Image width.
*/ AST#type_member#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Image height.
... | export interface ImageSizeItem {
width: number;
height: number;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageSizeItem.ets#L16-L26 | 09465952b9015193803aa7c2375287237801626d | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | ConcaveCircle | 凹槽使用类 | @Observed
export class ConcaveCircle extends CircleClass {
// X的定位
@Track
positionX: number = 0;
// Y的定位
@Track
positionY: number = 0;
// 旧的定位
oldPositionX: number = 0
oldPositionY: number = 0
// 悬浮球半径
@Track
circleRadius: number = 0;
@Track
circleDiameter: number = 0;
constructor(context... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ConcaveCircle extends AST#type_annotation#Left AST#primary_type#Left CircleClass AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // X的定位 AST#property_declaration#Left AST#decorator#Left @ Track AS... | @Observed
export class ConcaveCircle extends CircleClass {
@Track
positionX: number = 0;
@Track
positionY: number = 0;
oldPositionX: number = 0
oldPositionY: number = 0
@Track
circleRadius: number = 0;
@Track
circleDiameter: number = 0;
constructor(context: CanvasRenderingContext2D, m... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L79-L149 | 140b69a16975f710ecf2f7dea920ae38b573b0a4 | gitee |
zhonghaojie/ArkTSComponentPractice.git | 73f56243f10439a872d0990320bb3f8df17d0001 | entry/src/main/ets/pages/Login.ets | arkts | lineStyle | 分割线样式 | @Extend(Line) function lineStyle () {
.width('100%')
.height(1)
.backgroundColor($r("app.color.line_color"))
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Line AST#expression#Right ) AST#decorator#Right function lineStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#ex... | @Extend(Line) function lineStyle () {
.width('100%')
.height(1)
.backgroundColor($r("app.color.line_color"))
} | https://github.com/zhonghaojie/ArkTSComponentPractice.git/blob/73f56243f10439a872d0990320bb3f8df17d0001/entry/src/main/ets/pages/Login.ets#L21-L25 | 5179ec318bcd8c9b456dbbe89bb612f14566e08e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | getOccasionLabel | 获取场合标签 | private getOccasionLabel(occasion: string): string {
switch (occasion) {
case 'birthday':
return '生日';
case 'holiday':
return '节日';
case 'anniversary':
return '纪念日';
case 'graduation':
return '毕业';
case 'other':
return '其他';
default:
... | AST#method_declaration#Left private getOccasionLabel AST#parameter_list#Left ( AST#parameter#Left occasion : 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#p... | private getOccasionLabel(occasion: string): string {
switch (occasion) {
case 'birthday':
return '生日';
case 'holiday':
return '节日';
case 'anniversary':
return '纪念日';
case 'graduation':
return '毕业';
case 'other':
return '其他';
default:
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L676-L691 | afec4d4172a4313567caad9c395c0b7527cb184a | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets | arkts | setWindowStage | [Start set_stage1] | public setWindowStage(windowStage: window.WindowStage): void {
const uiContext: UIContext | undefined = AppStorage.get('uiContext');
this.windowStage = windowStage;
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
// [StartExclude set_stage1]
if (err.code) {
Logger.e... | AST#method_declaration#Left public setWindowStage AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | public setWindowStage(windowStage: window.WindowStage): void {
const uiContext: UIContext | undefined = AppStorage.get('uiContext');
this.windowStage = windowStage;
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
Logger.error(TAG, `Failed to obtain ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets#L37-L70 | 5266669ab6d44f49c2a9c7a311c9d391ca477351 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/dialog/DialogHelper.ets | arkts | 空间不足弹框
@param operator 回调 | export function displayNotEnoughSpaceDialog(operator ?: DialogOperator): void {
defaultKnowDialog($r('app.string.space_not_enough_title'), $r('app.string.space_not_enough_content'), operator);
} | AST#export_declaration#Left export AST#function_declaration#Left function displayNotEnoughSpaceDialog AST#parameter_list#Left ( AST#parameter#Left operator ? : AST#type_annotation#Left AST#primary_type#Left DialogOperator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | export function displayNotEnoughSpaceDialog(operator ?: DialogOperator): void {
defaultKnowDialog($r('app.string.space_not_enough_title'), $r('app.string.space_not_enough_content'), operator);
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L124-L126 | e8d5ef09ce55269155c0742733de9a25aab035bd | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | get | / 获取 所有此plan中的所有存在于pieces中的所有[wordId], / 包括可能是 已删除状态 的 wordId | get wordIdsAll(): number[] | null {
return this.pieces.reduce<number[]>((acc, p) => acc.concat(p.wordIds ?? []), []);
} | AST#method_declaration#Left get AST#ERROR#Left wordIdsAll AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Rig... | get wordIdsAll(): number[] | null {
return this.pieces.reduce<number[]>((acc, p) => acc.concat(p.wordIds ?? []), []);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L227-L229 | 64ee15dbac9828296460ceaf9c115fef0688e7a4 | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets | arkts | addToCollect | 加入收藏 | async addToCollect(): Promise<void> {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(
'http://192.168.32.1:8080/api/collect/add',
{
method: http.RequestMethod.POST,
header: {
'Content-Type': 'application/json',
... | AST#method_declaration#Left async addToCollect 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_arg... | async addToCollect(): Promise<void> {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(
'http://192.168.32.1:8080/api/collect/add',
{
method: http.RequestMethod.POST,
header: {
'Content-Type': 'application/json',
... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets#L264-L296 | 8f10e87beb3be6840234e164f1aa32a51bc8f790 | github |
openharmony/bundlemanager_bundle_framework | 89882654172b6bfba2a4a1ebfacdd6c9296f6f21 | interfaces/kits/ani/resource_manager/ets/bundleManager/LauncherAbilityResourceInfo.ets | arkts | @file
@kit AbilityKit | export interface LauncherAbilityResourceInfo {
readonly bundleName: string;
readonly moduleName: string;
readonly abilityName: string;
readonly icon: string;
readonly label: string;
readonly appIndex: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LauncherAbilityResourceInfo AST#object_type#Left { AST#type_member#Left readonly AST#ERROR#Left bundleName AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#... | export interface LauncherAbilityResourceInfo {
readonly bundleName: string;
readonly moduleName: string;
readonly abilityName: string;
readonly icon: string;
readonly label: string;
readonly appIndex: number;
} | https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/resource_manager/ets/bundleManager/LauncherAbilityResourceInfo.ets#L21-L28 | a86cb99065693f5674ba0c937513143efefaa430 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets | arkts | The constant of SearchComponent. | export class SearchBar {
/**
* The width of layout.
*/
static readonly WEIGHT: string = '90%';
/**
* The size of image.
*/
static readonly IMAGE_SIZE: number = 20;
/**
* The height of SearchBar.
*/
static readonly BAR_HEIGHT: number = 40;
/**
* The right margin of input.
*/
st... | AST#export_declaration#Left export AST#class_declaration#Left class SearchBar AST#class_body#Left { /**
* The width of layout.
*/ AST#property_declaration#Left static readonly WEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%... | export class SearchBar {
static readonly WEIGHT: string = '90%';
static readonly IMAGE_SIZE: number = 20;
static readonly BAR_HEIGHT: number = 40;
static readonly TEXT_INPUT_MARGIN_RIGHT: number = 20;
static readonly CONTAINER_PADDING_LEFT: number = 10;
static readonly BORDER_RADIUS: ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets#L241-L271 | 082f521dd19cc4c9ace67a6b9392a7ce5a9f83a6 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customsafekeyboard/Index.ets | arkts | CustomSafeKeyboardViewComponent | 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 { CustomSafeKeyboardViewComponent } from './src/main/ets/view/CustomSafeKeyboardView'; | AST#export_declaration#Left export { CustomSafeKeyboardViewComponent } from './src/main/ets/view/CustomSafeKeyboardView' ; AST#export_declaration#Right | export { CustomSafeKeyboardViewComponent } from './src/main/ets/view/CustomSafeKeyboardView'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customsafekeyboard/Index.ets#L15-L15 | 56f17a9bce42d6035f983edfc7edc8a51619347c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | setDrawBottomYLabelEntry | set this to true to enable drawing the bottom y-label entry. Disabling this can be helpful
when the bottom y-label and
left x-label interfere with each other. default: true
@param enabled | public setDrawBottomYLabelEntry(enabled: boolean): void {
this.mDrawBottomYLabelEntry = enabled;
} | AST#method_declaration#Left public setDrawBottomYLabelEntry AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void ... | public setDrawBottomYLabelEntry(enabled: boolean): void {
this.mDrawBottomYLabelEntry = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L281-L283 | e2f3dd466fe63d119db02eeae17d1ebfa9f8204a | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/AppState.ets | arkts | get | 获取token | public get token(): string | null {
return this._token;
} | AST#method_declaration#Left public get AST#ERROR#Left token AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation... | public get token(): string | null {
return this._token;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L168-L170 | dfe286e542ebb8a296a1fadbfae138aa6fae3276 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/list/BaseList.ets | arkts | 基础列表组件
支持下拉刷新、上拉加载 | export interface ListItem {
id: string; | AST#export_declaration#Left export AST#interface_declaration#Left interface ListItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#object_type#Right AST#interface_declaration#Right AST#... | export interface ListItem {
id: string; | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/list/BaseList.ets#L5-L6 | f6dbd9c9b89732a19078cc45a205f80f5c029df3 | github | |
IceTeacher/DrawingBook.git | c101a1b904388fcfa72de1ff402307bb9036b68b | entry/src/main/ets/pages/BookDetailPage.ets | arkts | aboutToAppear | 生命周期钩子,页面创建时,build构建前 | aboutToAppear(): void {
this.getBookDetail()
this.getBookRecommend()
this.getRecommendGoodsList()
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
this.getBookDetail()
this.getBookRecommend()
this.getRecommendGoodsList()
} | https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookDetailPage.ets#L94-L98 | 2ddac3e630edb9d2623b9e809157cf10207476ab | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets | arkts | 聊天list中item对象
@param user 用户名
@param lastMsg 最后一天信息
@param time 时间 | export class ChatModel {
user: ChatContact
lastMsg: string
lastTime: string
unreadMsgCount: number
constructor | AST#export_declaration#Left export AST#ERROR#Left class ChatModel { user AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left ChatContact AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left l as tMsg : string l as tTime AST#ERROR#Right : string unreadMsgCount AST#ERROR#Right : number AST#ERROR#Ri... | export class ChatModel {
user: ChatContact
lastMsg: string
lastTime: string
unreadMsgCount: number
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets#L24-L30 | 4d245e56bc63afff60062592380401ef0ce949b0 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | getConvertSymKey | 获取转换的对称密钥SymKey,异步
@param key 字符串key
@param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@param keyLen 密钥规格的最小长度,默认为0,为0时不补全。
@returns | static async getConvertSymKey(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): Promise<cryptoFramework.SymKey> {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = crypto... | AST#method_declaration#Left static async getConvertSymKey AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_... | static async getConvertSymKey(algName: string, key: string | Uint8Array | cryptoFramework.DataBlob,
keyCoding: crypto.BhuCoding, keyLen: number = 0): Promise<cryptoFramework.SymKey> {
let symKeyBlob: cryptoFramework.DataBlob = CryptoHelper.getSymKeyDataBlob(key, keyCoding, keyLen);
let aesGenerator = crypto... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L126-L132 | 49d3954e2ddc35387917c99b6238d4a134320bfc | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.