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/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Video object collection. | export const VIDEO_DATA: VideoBean[] = [
{
'name': 'video1',
'src': 'video1.mp4'
},
{
'name': 'video2',
'src': 'video2.mp4'
}
] | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left VIDEO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VideoBean [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expre... | export const VIDEO_DATA: VideoBean[] = [
{
'name': 'video1',
'src': 'video1.mp4'
},
{
'name': 'video2',
'src': 'video2.mp4'
}
] | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L136-L145 | f320410c5313d6a60643fb2600af89198d99e3e4 | gitee | |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets | arkts | HomeTabBar | 首页tabBar 显示“场景”和“设备” | @Component
export struct HomeTabBar {
private tabBars: HomeTabBarModel[] = [
{ id: 0, name: $r("app.string.scence") },
{ id: 1, name: $r("app.string.device") }]
private controller: TabsController = new TabsController()
@Link homeTabIndex: number
/**
* 获取tab当前颜色
*/
getTabTextColor(tabIndex: number... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HomeTabBar AST#component_body#Left { AST#property_declaration#Left private tabBars : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HomeTabBarModel [ ] AST#array_type#Right AST#primary_type#Right A... | @Component
export struct HomeTabBar {
private tabBars: HomeTabBarModel[] = [
{ id: 0, name: $r("app.string.scence") },
{ id: 1, name: $r("app.string.device") }]
private controller: TabsController = new TabsController()
@Link homeTabIndex: number
getTabTextColor(tabIndex: number, index: HomeTabBarModel... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets#L292-L307 | aba2f6ba10b57cb726ccd056b564da2cfc20d1d7 | gitee |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/TargetInfoApi.type.ets | arkts | 新增目标 | export interface TargetInfoAddParam {
/**
* 目标内容
*/
content: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoAddParam AST#object_type#Left { /**
* 目标内容
*/ AST#type_member#Left content : 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 AS... | export interface TargetInfoAddParam {
content: string
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L22-L28 | 8717248accc5bfacb752211d941da62f939d72bf | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | downloadEpisode | 下载单集 | async downloadEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Download: ${this.episode.title}`);
try {
await this.downloadService.downloadEpisode(this.episode);
UIUtils.showToast(new ToastOptions('已添加到下载队列', 2000));
this.isDownloading = true;
} catch (erro... | AST#method_declaration#Left async downloadEpisode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expressio... | async downloadEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Download: ${this.episode.title}`);
try {
await this.downloadService.downloadEpisode(this.episode);
UIUtils.showToast(new ToastOptions('已添加到下载队列', 2000));
this.isDownloading = true;
} catch (erro... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L81-L94 | f0b3e409fec03b149c955a8a453321079132c9cd | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/SplashScreenSample/entry/src/main/ets/view/CopyrightComponent.ets | arkts | CopyrightComponent | Copyright component for splash screen page. | @Component
export default struct CopyrightComponent {
build() {
Column() {
Row() {
Image($r("app.media.ic_video"))
.objectFit(ImageFit.Contain)
.width($r('app.float.copy_right_image_width'))
.height($r('app.float.copy_right_image_width'))
Text($r('app.string.co... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CopyrightComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_co... | @Component
export default struct CopyrightComponent {
build() {
Column() {
Row() {
Image($r("app.media.ic_video"))
.objectFit(ImageFit.Contain)
.width($r('app.float.copy_right_image_width'))
.height($r('app.float.copy_right_image_width'))
Text($r('app.string.co... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/view/CopyrightComponent.ets#L6-L34 | dd2c75b5bd93e79743febd7992f0e863d1aa4f76 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets | arkts | CommentView | Comment component. | @Component
export struct CommentView {
@ObjectLink private item: VideoItem;
build() {
Column() {
Image($r("app.media.ic_head"))
.width(CommonConstants.WIDTH_HEAD)
.height(CommonConstants.HEIGHT_HEAD)
.margin({ top: CommonConstants.TOP_HEAD })
.objectFit(ImageFit.Contain)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommentView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right private item : AST#type_annotation#Left AST#primary_type#Left VideoItem AST#primary_type#Right AS... | @Component
export struct CommentView {
@ObjectLink private item: VideoItem;
build() {
Column() {
Image($r("app.media.ic_head"))
.width(CommonConstants.WIDTH_HEAD)
.height(CommonConstants.HEIGHT_HEAD)
.margin({ top: CommonConstants.TOP_HEAD })
.objectFit(ImageFit.Contain)
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets#L36-L85 | f5f0eac34cc472a111d715b3c9f34ecf3e36c1d5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | eventbus/src/main/ets/EventBusCore.ets | arkts | off | 注销事件监听
@param eventName 事件名
@param handler 监听回调 | off(eventName: string, handler?: Function): void {
if (EventBusCore.events.has(eventName)) {
if (handler) {
EventBusCore.events.get(eventName)?.delete(handler);
} else {
EventBusCore.events.delete(eventName);
}
}
} | AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler ? : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Ri... | off(eventName: string, handler?: Function): void {
if (EventBusCore.events.has(eventName)) {
if (handler) {
EventBusCore.events.get(eventName)?.delete(handler);
} else {
EventBusCore.events.delete(eventName);
}
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L67-L75 | 2d2930f2b4874af5a27fd26edbef3d95e3e8d264 | gitee |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/PictureSaving.ets | arkts | photoPickerGetUri.
Returns the URI of the selected file based on the select method of PhotoViewPicker.
@return Promise<string>. | export async function photoPickerGetUri(): Promise<string> {
try {
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelper.PhotoVi... | AST#export_declaration#Left export AST#function_declaration#Left async function photoPickerGetUri AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primar... | export async function photoPickerGetUri(): Promise<string> {
try {
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelper.PhotoVi... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/PictureSaving.ets#L28-L45 | 9dad54425d98d7ccfd1a713e8ee358499d87c3d0 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets | arkts | 照片页 | build() {
Column() {
Text('photo')
.textAlign(TextAlign.Start)
.width('100%')
.fontSize(30)
.padding(20)
Image($r('app.media.startIcon'))
.opacity(this.opacityDegree)
.width('90%')
.id('origin')// 挂载半模态页
.enabled(this.isEnabled)
.on... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'photo' AST#expression#Right... | build() {
Column() {
Text('photo')
.textAlign(TextAlign.Start)
.width('100%')
.fontSize(30)
.padding(20)
Image($r('app.media.startIcon'))
.opacity(this.opacityDegree)
.width('90%')
.id('origin')
.enabled(this.isEnabled)
.onClick(() ... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets#L150-L208 | 813a8b285c11391e3688ef421b004785c876d01e | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | getPixelMapFromMedia | 用户获取resource目录下的media中的图片PixelMap
@param resource 例如:$r("app.media.icon")
@returns | static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await ResUtil.getMediaContent(resource);
return await ImageUtil.createImageSource(uint8Array.buffer).createPixelMap(options);
} | AST#method_declaration#Left static async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Le... | static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await ResUtil.getMediaContent(resource);
return await ImageUtil.createImageSource(uint8Array.buffer).createPixelMap(options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L249-L252 | 4f5bf68090e574e93e65a210cc0880fed5b55389 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets | arkts | 应用规则61:使用export default替代module.exports | export default UserUpdateAction; | AST#export_declaration#Left export default AST#expression#Left UserUpdateAction AST#expression#Right ; AST#export_declaration#Right | export default UserUpdateAction; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets#L43-L43 | c0acf4a1fac5b30f3aabee227649c013d12b806d | github | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 初始化数据存储 | async aboutToAppear() {
try {
const context = getContext(this);
this.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化存储失败:', err);
}
} | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#c... | async aboutToAppear() {
try {
const context = getContext(this);
this.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化存储失败:', err);
}
} | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Index.ets#L346-L353 | 6a97fdccc684d07e6df7922b0cd609b74c1a7690 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets | arkts | getCertFromFile | 从文件获取X509证书 | async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> {
let newCert: cert.X509Cert | undefined = undefined
let certData = this.getContent(filePath);
if (certData) {
let encodingBlob: cert.EncodingBlob = {
data: new Uint8Array(certData),
encodingFormat: cert.Encodi... | AST#method_declaration#Left async getCertFromFile 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#type_annotation#Left AST#primary_type#Left AST#generic_typ... | async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> {
let newCert: cert.X509Cert | undefined = undefined
let certData = this.getContent(filePath);
if (certData) {
let encodingBlob: cert.EncodingBlob = {
data: new Uint8Array(certData),
encodingFormat: cert.Encodi... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets#L223-L241 | 4d2a29378db50ec7ea4ef390b795b433c9ad270b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/ReminderScheduler.ets | arkts | snoozeReminder | 暂停提醒(贪睡) | async snoozeReminder(reminderId: string, snoozeMinutes: number = 10): Promise<void> {
try {
const config = this.activeReminders.get(reminderId);
if (!config) {
throw new Error('提醒不存在');
}
if (config.snoozeCount !== undefined && config.maxSnoozeCount !== undefined) {
if (conf... | AST#method_declaration#Left async snoozeReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left snoozeMinutes : AST#type_annotation#Left AST#primary_type#Left number... | async snoozeReminder(reminderId: string, snoozeMinutes: number = 10): Promise<void> {
try {
const config = this.activeReminders.get(reminderId);
if (!config) {
throw new Error('提醒不存在');
}
if (config.snoozeCount !== undefined && config.maxSnoozeCount !== undefined) {
if (conf... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L401-L454 | 44c5c4400026c9be5721a70857e4e8dec3c2224f | github |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | setToke | 写入date日期对应的浏览历史 | async setToke(token) {
return this.putPreference('token',token)
} | AST#method_declaration#Left async setToke AST#parameter_list#Left ( AST#parameter#Left token AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expre... | async setToke(token) {
return this.putPreference('token',token)
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L78-L80 | df7f122d97bda34c943fdf0961d9fd888e4256f5 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/ThemeManager.ets | arkts | isDarkTheme | 判断是否为深色主题 | isDarkTheme(): boolean {
return false; // 临时返回false
} | AST#method_declaration#Left isDarkTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Le... | isDarkTheme(): boolean {
return false;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L241-L243 | 58d6250a30cb86d79c82ebf7147f0645010c226b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStateChange.ets | arkts | StatePopupExample | [Start state_popup] | @Entry
@Component
export struct StatePopupExample {
@State handlePopup: boolean = false;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('PopupOptions')
.margin({ top: 300 })
.onClick(() => {
this.handlePopup = !this.handlePo... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct StatePopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#primar... | @Entry
@Component
export struct StatePopupExample {
@State handlePopup: boolean = false;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('PopupOptions')
.margin({ top: 300 })
.onClick(() => {
this.handlePopup = !this.handlePo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStateChange.ets#L17-L50 | e6f90381bd867e49e156637c0f3a9b5f7183ba63 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets | arkts | createCardToDeskTop | createCardToDeskTop
@param formCardItem | async createCardToDeskTop(formCardItem: FormCardItem) {
if (CheckEmptyUtils.isEmpty(formCardItem)) {
return;
}
Logger.info(TAG, `createCardToDeskTop formCardItem ${JSON.stringify(formCardItem)}`);
let gridItem = this.createNewCardItemInfo(formCardItem);
if (formCardItem.bundleName === SHOPPING... | AST#method_declaration#Left async createCardToDeskTop AST#parameter_list#Left ( AST#parameter#Left formCardItem : AST#type_annotation#Left AST#primary_type#Left FormCardItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#... | async createCardToDeskTop(formCardItem: FormCardItem) {
if (CheckEmptyUtils.isEmpty(formCardItem)) {
return;
}
Logger.info(TAG, `createCardToDeskTop formCardItem ${JSON.stringify(formCardItem)}`);
let gridItem = this.createNewCardItemInfo(formCardItem);
if (formCardItem.bundleName === SHOPPING... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L434-L455 | 2ada02dc400721a3526c5744a57ade6636b63699 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/AboutSample/entry/src/main/ets/view/AppInfoComponent.ets | arkts | AppInfoComponent | AppInfo component shows the relevant information of the application. | @Component
export struct AppInfoComponent {
private appInfoData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.appInfoData, (item: ListItemData) => {
ListItem() {
Column() {
AppInfoItem({
appInfoItem: item
})
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AppInfoComponent AST#component_body#Left { AST#property_declaration#Left private appInfoData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | @Component
export struct AppInfoComponent {
private appInfoData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.appInfoData, (item: ListItemData) => {
ListItem() {
Column() {
AppInfoItem({
appInfoItem: item
})
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/view/AppInfoComponent.ets#L9-L39 | 6b3573431d62e33b0662f45cfa797619fa7e1ee0 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | onLocationEnabledChange | 订阅位置服务状态变化。
@param callback 回调函数。返回true表示位置信息开关已经开启;返回false表示位置信息开关已经关闭。 | static onLocationEnabledChange(callback: Callback<boolean>) {
geoLocationManager.on('locationEnabledChange', callback);
} | AST#method_declaration#Left static onLocationEnabledChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Rig... | static onLocationEnabledChange(callback: Callback<boolean>) {
geoLocationManager.on('locationEnabledChange', callback);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L175-L177 | 2c6434b9b3f8d6d2991f5d5ca0dd5cbd1b3e94b4 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/PodcastService.ets | arkts | updatePodcastEpisodes | 更新播客的Episodes
成功时更新 lastSuccessfulFetch,失败时标记 isFetchFailed | async updatePodcastEpisodes(podcastId: string): Promise<void> {
try {
console.info(`[PodcastService] Starting to update episodes for podcast: ${podcastId}`);
// 从数据库获取播客信息,拿到 feedUrl
const podcast = await this.dbService.getPodcastById(podcastId);
if (!podcast || !podcast.feedUrl) {
... | AST#method_declaration#Left async updatePodcastEpisodes AST#parameter_list#Left ( AST#parameter#Left podcastId : 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#gene... | async updatePodcastEpisodes(podcastId: string): Promise<void> {
try {
console.info(`[PodcastService] Starting to update episodes for podcast: ${podcastId}`);
const podcast = await this.dbService.getPodcastById(podcastId);
if (!podcast || !podcast.feedUrl) {
console.warn('[Pod... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L115-L170 | 5d2c32ca26900281c9b715dae9df984a37d31804 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets | arkts | onIdle | [End builder_node_pool] [Start on_idle] The onIdle callback returns the idle time idleTimeInNano at the end of the frame. | onIdle(idleTimeInNano: number): void {
// Stop pre creation when the number of pre created components exceeds the number of simulated data
if (this.todoCount >= this.viewItems.length) {
return;
}
// The current time will be used to calculate the remaining idle time of this frame in the future.
... | AST#method_declaration#Left onIdle AST#parameter_list#Left ( AST#parameter#Left idleTimeInNano : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri... | onIdle(idleTimeInNano: number): void {
if (this.todoCount >= this.viewItems.length) {
return;
}
let cur: number = systemDateTime.getTime(true);
let timeLeft = idleTimeInNano;
while (timeLeft >= 1000000) {
hiTraceMeter.startTrace('onIdle_prebuild', ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets#L47-L84 | 49d01a1e09819914160308063f0b35a8ea5d85d3 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets | arkts | 字节流转字符串 | export function arrayBufferToString(uint8Array: Uint8Array): string {
let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM: true
}
let decodeToStringOptions: util.DecodeToStringOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions)... | AST#export_declaration#Left export AST#function_declaration#Left function arrayBufferToString AST#parameter_list#Left ( AST#parameter#Left uint8Array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | export function arrayBufferToString(uint8Array: Uint8Array): string {
let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM: true
}
let decodeToStringOptions: util.DecodeToStringOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions)... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets#L60-L72 | cd13e8e75e15354c712e60cad574dbe504c04a05 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Defines the PersistentStorage interface.
@since 7 | export class PersistentStorage {
/**
* Called when a persistence property is stored.
* @since 7
* @deprecated since 10
*/
static PersistProp<T>(key: string, defaultValue: T): void {
PersistentStorage.persistProp(key, defaultValue)
}
/**
* Called when a persistence proper... | AST#export_declaration#Left export AST#class_declaration#Left class PersistentStorage AST#class_body#Left { /**
* Called when a persistence property is stored.
* @since 7
* @deprecated since 10
*/ AST#method_declaration#Left static PersistProp AST#type_parameters#Left < AST#type_parameter#Left T AST... | export class PersistentStorage {
static PersistProp<T>(key: string, defaultValue: T): void {
PersistentStorage.persistProp(key, defaultValue)
}
static persistProp<T>(key: string, defaultValue: T): void {
throw new Error("PersistentStorage.persistProp is not implemented")
}
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L367-L423 | 1c1250b240d2a4e05d026ebeda79ef18f0851ae1 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NonSameLayerRendering/entry/src/main/ets/pages/Index.ets | arkts | WebviewController controller | build() {
Stack() {
Web({ src: $rawfile('nativeembed_view.html'), controller: this.browserTabController })
.backgroundColor('#F1F3F5')
.onPageEnd(() => {
this.browserTabController.runJavaScript(
'getEmbedSize()',
(error, result) => {
if (result) ... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_para... | build() {
Stack() {
Web({ src: $rawfile('nativeembed_view.html'), controller: this.browserTabController })
.backgroundColor('#F1F3F5')
.onPageEnd(() => {
this.browserTabController.runJavaScript(
'getEmbedSize()',
(error, result) => {
if (result) ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets#L28-L56 | 9d156969cc12cda8ab4896c404092f736bc9198a | gitee | |
AlatusLee/HarmonyOS-Next-Weather-Assistant.git | d3c7060a8ff7f7656175e83fa32536b11e136556 | alatus/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 获取数据 | aboutToAppear(): void {
this.initDate();
} | 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.initDate();
} | https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/pages/Index.ets#L32-L34 | 5542947e4a1f18aee37bed977263704dcb2f5362 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PixelMapUtils.ets | arkts | createPixelMapFromUint8Array | 从 Uint8Array 创建 PixelMap(create 系列命名)
@param data Uint8Array 数据
@param options 解码选项 | static async createPixelMapFromUint8Array(
data: Uint8Array,
options?: image.DecodingOptions
): Promise<image.PixelMap | null> {
return await PixelMapUtil.uint8ArrayToPixelMap(data, options);
} | AST#method_declaration#Left static async createPixelMapFromUint8Array AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_t... | static async createPixelMapFromUint8Array(
data: Uint8Array,
options?: image.DecodingOptions
): Promise<image.PixelMap | null> {
return await PixelMapUtil.uint8ArrayToPixelMap(data, options);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L57-L62 | 3395cbd57bafebfe2565abc2f241f8842ef51d46 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets | arkts | pinyinToChinese | 拼音朝代转汉字朝代 并拼接 前后括号 | pinyinToChinese(pinyin:string){
return '[' + DYNASTY_MAP[pinyin] + ']'
} | AST#method_declaration#Left pinyinToChinese AST#parameter_list#Left ( AST#parameter#Left pinyin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ... | pinyinToChinese(pinyin:string){
return '[' + DYNASTY_MAP[pinyin] + ']'
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets#L13-L15 | 69c505b570c4f2b31f91ead8f082d3f7ad3f6062 | gitee |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/models/CommonDataSource.ets | arkts | getAllData | @deprecated
@returns | getAllData(): T [] {
return this.dataArray;
} | AST#method_declaration#Left getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#... | getAllData(): T [] {
return this.dataArray;
} | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/models/CommonDataSource.ets#L13-L15 | ce6550962ac5bd88a51e39607f948301f7c8ed5d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets | arkts | updateConfirmPassword | 更新确认密码
@param {string} value - 确认密码
@returns {void} 无返回值 | updateConfirmPassword(value: string): void {
} | AST#method_declaration#Left updateConfirmPassword AST#parameter_list#Left ( AST#parameter#Left value : 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_t... | updateConfirmPassword(value: string): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets#L38-L39 | 010c98e9cb5d3e5bc4a00a55daac7dd0dcd50597 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/InsertionSort.ets | arkts | 插入排序实现 | export class InsertionSort {
/**
* 插入排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/
public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
for (let i = 1; i < n; i++) {
const key = result[i];
let j = i - 1;
// 将比key大的元素向后移动
w... | AST#export_declaration#Left export AST#class_declaration#Left class InsertionSort AST#class_body#Left { /**
* 插入排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/ AST#property_declaration#Left public static sort AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#prima... | export class InsertionSort {
public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
for (let i = 1; i < n; i++) {
const key = result[i];
let j = i - 1;
while (j >= 0 && result[j] > key) {
result[j + 1] = result[j];
j--;... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/InsertionSort.ets#L4-L24 | 409f9036b600c26408370055d1398995169b2bd7 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets | arkts | getWordUserByTitleEn | ====== 查询 ====== | async getWordUserByTitleEn(titleEn: string): Promise<WordUser | null> {
if (!this.db) return null;
const titleEnBase64 = StringEncoder.encodedToBase64(titleEn)
if (!titleEnBase64) return null;
const sql = `SELECT wu.*, dw.${Tables.DeleteWord.Col.DELETED}
FROM ${Tables.Learn.NAME} wu
... | AST#method_declaration#Left async getWordUserByTitleEn AST#parameter_list#Left ( AST#parameter#Left titleEn : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | async getWordUserByTitleEn(titleEn: string): Promise<WordUser | null> {
if (!this.db) return null;
const titleEnBase64 = StringEncoder.encodedToBase64(titleEn)
if (!titleEnBase64) return null;
const sql = `SELECT wu.*, dw.${Tables.DeleteWord.Col.DELETED}
FROM ${Tables.Learn.NAME} wu
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L367-L384 | d5165a1a41b00d79efd41ff65e1ea5d21d8ef9d4 | github |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Loading.ets | arkts | bodyBuilder | 内容展示(自定义builder渲染) | @Builder bodyBuilder() {
Column({ space: 10 }) {
// 自定义颜色
Text('颜色自定义')
.fontSize(14)
.margin({ top:20, bottom: 12})
LoadingProgress()
.height(50)
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(50)
.col... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_paramet... | @Builder bodyBuilder() {
Column({ space: 10 }) {
Text('颜色自定义')
.fontSize(14)
.margin({ top:20, bottom: 12})
LoadingProgress()
.height(50)
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(50)
.color(Color... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Loading.ets#L41-L80 | eaa1f4db1213039954e4a9926a671e1ce3a94186 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringDealUtility.ets | arkts | deal | / 按指定的分隔符和子分隔符进行 split 之后,对每一段子字符进行 transform | private static deal(
srcStr : string,
seperator : string,
subSeperator : string,
transform : DealTransform
): string | null {
const array : Array<string> = srcStr.split(seperator);
const distList: Array<string> = [];
for (const subStr of array) {
const subArray : A... | AST#method_declaration#Left private static deal AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | private static deal(
srcStr : string,
seperator : string,
subSeperator : string,
transform : DealTransform
): string | null {
const array : Array<string> = srcStr.split(seperator);
const distList: Array<string> = [];
for (const subStr of array) {
const subArray : A... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L119-L148 | 863818473e2aaab7feb1ae7c0245ca0f87ea0868 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets | arkts | computeTask | [Start city_list_page] | @Concurrent
function computeTask(): string[] {
let array: string[] = []
// AppConstant.CITYS is the data to be loaded.
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a,... | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function computeTask AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#... | @Concurrent
function computeTask(): string[] {
let array: string[] = []
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a, b))
return array;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets#L28-L38 | d0b62e916b95130019c4d827cb72a7f3be6e8da6 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets | arkts | CategoryTitle | 分类标题 | @Builder
CategoryTitle(title: string) {
Row() {
Divider()
.strokeWidth(2)
.color(AppColors.primary)
.width(4)
.vertical(false)
Text(title)
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.te... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CategoryTitle 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_list#Right AST#builder_function_body#... | @Builder
CategoryTitle(title: string) {
Row() {
Divider()
.strokeWidth(2)
.color(AppColors.primary)
.width(4)
.vertical(false)
Text(title)
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.te... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets#L123-L139 | 7bb83e1984b30789379cc86a95c94e7e6f38b000 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | 窗口的创建,加载,显示,销毁操作 | export class SubWindowApi {
private maskColor: string = ''; // 初始化蒙层颜色
private subWindow: window.Window | null = null; // 初始化window实例
private Storage: LocalStorage = new LocalStorage(); // 创建页面级UI状态存储对象
// eventId为1234565的持续订阅的事件
private callbackEvent: emitter.InnerEvent = {
eventId: EVENT_ID
}
// 显示... | AST#export_declaration#Left export AST#class_declaration#Left class SubWindowApi AST#class_body#Left { AST#property_declaration#Left private maskColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_dec... | export class SubWindowApi {
private maskColor: string = '';
private subWindow: window.Window | null = null;
private Storage: LocalStorage = new LocalStorage();
private callbackEvent: emitter.InnerEvent = {
eventId: EVENT_ID
}
private showSubWindow() {
if (this.subWindow) {
this.subWi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L38-L180 | f4fd1e31f2c1e52ec717ef9179b42a552cbd63a0 | gitee | |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘1.5%’ | export const THOUSANDTH_12: string = '2.2%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_12 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '2.2%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_12: string = '2.2%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L47-L47 | 31893246fb8f65a21c2626f6460af70c5f9d28a9 | github | |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/component/Dialog.ets | arkts | closeDialog | 关闭自定义对话框 | closeDialog() {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.closeCustomDialog(this.contentNode)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'CloseCustomDialog complete'); // 记录日志,对话框关闭完成
})
... | AST#method_declaration#Left closeDialog 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 AST#binary_expression#Lef... | closeDialog() {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.closeCustomDialog(this.contentNode)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'CloseCustomDialog complete');
})
.catch((error: ... | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L48-L62 | d7ac29fdc84835d28f6b9f41fade7a3239c277c5 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/string_lib_func_018_F.ets | arkts | Introduction 库函数-string_toUpperCase | export function string_lib_func_018_F(taint_src : string) {
let clean = "clean";
let t = clean.toUpperCase();
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_018_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function string_lib_func_018_F(taint_src : string) {
let clean = "clean";
let t = clean.toUpperCase();
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_018_F.ets#L7-L11 | 9041a539d56ae95404c4b06ecfc038ca0ee1f9fc | github | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/cache/MemoryLruCache.ets | arkts | trimToSize | 移除较少使用的缓存数据 | trimToSize(): void {
while (true) {
if (this.currentMemory <= this.maxMemory || this.lruCache.isEmpty()) {
break
}
let delkey = this.lruCache.keys()[0]
let data: ImageKnifeData | undefined = this.lruCache.get(delkey)
if (data != undefined) {
this.removeMemorySize(data)
... | AST#method_declaration#Left trimToSize 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#while_statement#Left while ( AST#expression#Left AST#boolean_literal#Left t... | trimToSize(): void {
while (true) {
if (this.currentMemory <= this.maxMemory || this.lruCache.isEmpty()) {
break
}
let delkey = this.lruCache.keys()[0]
let data: ImageKnifeData | undefined = this.lruCache.get(delkey)
if (data != undefined) {
this.removeMemorySize(data)
... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/cache/MemoryLruCache.ets#L93-L105 | 3fd28f709bb5a6bf34d9363d49cf44592757185f | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DownloadFileButton.d.ets | arkts | Defines the DownloadFileButton style option.
@interface DownloadStyleOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface DownloadStyleOptions {
/**
* Icon size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconSize?: Dimension;
/**
* Layout direction.
*
* @type { ?DownloadLayoutDirection }
* @syscap System... | AST#export_declaration#Left export AST#interface_declaration#Left interface DownloadStyleOptions AST#object_type#Left { /**
* Icon size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left iconSize ? : AST#typ... | export interface DownloadStyleOptions {
iconSize?: Dimension;
layoutDirection?: DownloadLayoutDirection;
fontSize?: Dimension;
fontStyle?: FontStyle;
fontWeight?: number | FontWeight | string;
fontFamily?: string | Resource;
fontColor?: ResourceColor;
iconColor?: Resource... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L218-L318 | a9b040bf0a7313331266973593013eef5c11755f | gitee | |
Jasmine709/HarmonyOS-News-App.git | e0388ad8a55ffcc001cf026113d2fd0fae842594 | entry/src/main/ets/views/NewsItem.ets | arkts | NewsItem | 不是完整的页面,是一个页面碎片 | @Preview
@Component
export struct NewsItem {
@State typeArr: string[] = ['新闻', '购物', '体育']
news: News = new News()
build() {
Column() {
Row() {
Text(this.typeArr[this.news.type])
.fontColor($r('app.color.blue'))
.borderWidth(1)
.borderColor($r('app.color.blue'))
.pa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct NewsItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right typeArr : AST#type_annotation#Left AST#primary_type#Left... | @Preview
@Component
export struct NewsItem {
@State typeArr: string[] = ['新闻', '购物', '体育']
news: News = new News()
build() {
Column() {
Row() {
Text(this.typeArr[this.news.type])
.fontColor($r('app.color.blue'))
.borderWidth(1)
.borderColor($r('app.color.blue'))
.pa... | https://github.com/Jasmine709/HarmonyOS-News-App.git/blob/e0388ad8a55ffcc001cf026113d2fd0fae842594/entry/src/main/ets/views/NewsItem.ets#L5-L55 | 7496380034a2a7a947da55e3f5873f02beeddebb | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | fps | 帧率设置 | public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
} | AST#method_declaration#Left public fps AST#parameter_list#Left ( AST#parameter#Left value : 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 FFmpegCommandBuilder AST#prim... | public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L140-L142 | bb40642e20799e8170601bae371244941d927e50 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | refreshData | Refresh all data from database | async refreshData(): Promise<void> {
try {
console.info(`[MainViewModel] ========== 开始刷新数据 ==========`);
// Load all tasks (not just today's) and recent memos
const tasks = await this.rdbHelper.getTasks();
const memos = await this.rdbHelper.getRecentMemos(10);
console.info(`[MainViewM... | AST#method_declaration#Left async refreshData 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_argu... | async refreshData(): Promise<void> {
try {
console.info(`[MainViewModel] ========== 开始刷新数据 ==========`);
const tasks = await this.rdbHelper.getTasks();
const memos = await this.rdbHelper.getRecentMemos(10);
console.info(`[MainViewModel] 从数据库加载了 ${tasks.length} 个任务`);
if (tasks.... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L136-L174 | 255f3cd1076f1b35fcfac40224d0ac4a34771385 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/LongPressGesture.ets | arkts | LongPress | [Start catch_long_press_event] | @Entry
@Component
export struct LongPress {
@State count: number = 0;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Text('LongPress OnAction:' + this.count).fontSize(28)
.gesture(
// 绑定可以重复触发的LongPressGesture
LongPressGesture({ r... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct LongPress AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right count : AST#type_annotation#Left AST#primary_type#Left nu... | @Entry
@Component
export struct LongPress {
@State count: number = 0;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Text('LongPress OnAction:' + this.count).fontSize(28)
.gesture(
LongPressGesture({ repeat: true })
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/LongPressGesture.ets#L17-L55 | c847c6955be6ff39829249a0b3c6b2a0cb34182b | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/pages/Profile.ets | arkts | addIntroduction | 用户输入的自我介绍 添加自我介绍到列表中 | addIntroduction() {
if (this.introText.trim()) { // 确保输入不为空
this.profileInfo.push(this.introText.trim()); // 将输入内容添加到 profileInfo 列表
this.introText = ""; // 清空输入框
this.showIntroInput = false; // 隐藏输入框
}
} | AST#method_declaration#Left addIntroduction 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#L... | addIntroduction() {
if (this.introText.trim()) {
this.profileInfo.push(this.introText.trim());
this.introText = "";
this.showIntroInput = false;
}
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/pages/Profile.ets#L11-L17 | 636d782ecc6d90d32aebac7a96dc821777fc4cf7 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | initCreateMode | 初始化新增模式数据
@returns {void} 无返回值 | private initCreateMode(): void {
this.updateFormData(new Address());
this.setSuccessState();
} | AST#method_declaration#Left private initCreateMode 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#e... | private initCreateMode(): void {
this.updateFormData(new Address());
this.setSuccessState();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L286-L289 | ead88d8ef5e89e034a87a28d5cd0890e169aecdc | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | decodePKCS1 | 解密
@param decodeStr 待解密的字符串
@param priKey RSA私钥 | static async decodePKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async decodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static async decodePKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L87-L89 | dec690136ca63ca64dea40ec82d97a1b40e78170 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | DeleteProp | Called when a property is deleted.
@since 7
@deprecated since 10 | static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
} | AST#method_declaration#Left static DeleteProp 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#Ri... | static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L389-L391 | 1564733667cbcbaad5202b548554935bd5ab7e34 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getBoolean | 获取指定资源对应的布尔结果
@param resId 资源ID值/资源信息
@returns | static getBoolean(resId: number | Resource): boolean {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getBoolean(resId);
} else {
return ResUtil.getResourceManager().getBoolean(resId);
}
} | AST#method_declaration#Left static getBoolean AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number 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 getBoolean(resId: number | Resource): boolean {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getBoolean(resId);
} else {
return ResUtil.getResourceManager().getBoolean(resId);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L44-L50 | f6107b37a4a33a371364469b31969658176ff726 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/Model.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class Model {
id: number;
uri: Resource;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: Resource, title: ResourceStr, content: ResourceStr, views: number, likes:... | AST#export_declaration#Left export AST#class_declaration#Left class Model AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#type_annotati... | export class Model {
id: number;
uri: Resource;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: Resource, title: ResourceStr, content: ResourceStr, views: number, likes:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/Model.ets#L16-L45 | 65c584eb0cb9b1a11fef36e01ca8b699a9dd13ad | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets | arkts | returnPromise | [Start return_3] Sample6.ets | @Concurrent
async function returnPromise() {
let promise = new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 1000);
})
return promise;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function returnPromise AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promise = AST#expression#Left AST#cal... | @Concurrent
async function returnPromise() {
let promise = new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 1000);
})
return promise;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets#L16-L24 | 743cc8e284cc7dd06038dcc454270c0563d111ec | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/managers/StorageManager.ets | arkts | setItem | 设置数据
@param key 键
@param value 值
@param config 存储配置
@returns 操作结果 | static async setItem<T>(key: string, value: T, config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storage... | AST#method_declaration#Left static async setItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramet... | static async setItem<T>(key: string, value: T, config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storage... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L71-L96 | b696fe2b9041eab459f5c72ea172eec8fdcc9c7d | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/buttons/TextStyleButton.ets | arkts | getBackgroundColor | ========================== 获取背景颜色 ========================== | private getBackgroundColor(style: TextStyleButtonStyle): ColorSet {
switch (style) {
case TextStyleButtonStyle.DEFAULT: return { normal: theme.color.clear, selected: theme.color.primary };
case TextStyleButtonStyle.LIGHT: return { normal: theme.color.clear, selected: theme.color.light ... | AST#method_declaration#Left private getBackgroundColor AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left TextStyleButtonStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | private getBackgroundColor(style: TextStyleButtonStyle): ColorSet {
switch (style) {
case TextStyleButtonStyle.DEFAULT: return { normal: theme.color.clear, selected: theme.color.primary };
case TextStyleButtonStyle.LIGHT: return { normal: theme.color.clear, selected: theme.color.light ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/buttons/TextStyleButton.ets#L118-L128 | c71e68ba977051e4edeafa960f22ec709214ef19 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | setSliceSpace | Sets the space that is left out between the piechart-slices in vp.
Default: 0 --> no space, maximum 20f
@param spaceDp | public setSliceSpace(spaceDp: number): void {
if (spaceDp > 20)
spaceDp = 20;
if (spaceDp < 0)
spaceDp = 0;
this.mSliceSpace = Utils.handleDataValues(spaceDp);
} | AST#method_declaration#Left public setSliceSpace AST#parameter_list#Left ( AST#parameter#Left spaceDp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_... | public setSliceSpace(spaceDp: number): void {
if (spaceDp > 20)
spaceDp = 20;
if (spaceDp < 0)
spaceDp = 0;
this.mSliceSpace = Utils.handleDataValues(spaceDp);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L91-L98 | 7160890f243f402267f59c96753196cda36aa9fa | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | transcode | 视频转码 | transcode(): void {
const cmd = FFmpegFactory.transcode('/input.mp4', '/output.mp4', '2M');
this.run(cmd);
} | AST#method_declaration#Left transcode 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 cmd = AST#expre... | transcode(): void {
const cmd = FFmpegFactory.transcode('/input.mp4', '/output.mp4', '2M');
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L55-L58 | 16b761c9b25a864b7bdbcc5f6755c7bb8761f5b0 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/arrow_function/arrow_function_002_F.ets | arkts | Introduction 箭头函数-一阶 | export function arrow_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let arrowFunction2 = (t : string): void => taint.Sink(t)
arrowFunction2(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function arrow_function_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function arrow_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let arrowFunction2 = (t : string): void => taint.Sink(t)
arrowFunction2(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/arrow_function/arrow_function_002_F.ets#L6-L11 | cac56a0a07d55f25724fd729b362a5d989857342 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | getDate | 获取日期 | getDate(): number {
return this.date.day;
} | AST#method_declaration#Left getDate 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_expression#Left ... | getDate(): number {
return this.date.day;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L175-L177 | 088e97572800d37f44dcc6a43709d1d125ae0295 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets | arkts | watchCameraPermission | 监听相机权限变化 | watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped) ... | AST#method_declaration#Left watchCameraPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left interval = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right... | watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped) ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets#L252-L266 | 0999df1707f95b954b6594c5928a84bed2d708b1 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets | arkts | buildBodyContent | 构造上传文件的body内容 | buildBodyContent(boundary: string, fileName: string, content: Uint8Array, contentType: string = "application/octet-stream") {
let textEncoder = new util.TextEncoder();
//构造文件内容前的部分
let preFileContent = `--${boundary}\r\n`
preFileContent = preFileContent + `Content-Disposition: form-data; name="file"; f... | AST#method_declaration#Left buildBodyContent AST#parameter_list#Left ( AST#parameter#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | buildBodyContent(boundary: string, fileName: string, content: Uint8Array, contentType: string = "application/octet-stream") {
let textEncoder = new util.TextEncoder();
let preFileContent = `--${boundary}\r\n`
preFileContent = preFileContent + `Content-Disposition: form-data; name="file"; filename="${f... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L131-L150 | 395c690429735c9c44ba8068bbec454db7170d98 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.ets | arkts | 列表中当前的位置 | constructor() {
this.dataSouce = [];
this.listSize = 0; // 列表的大小
this.pos = 0; // 列表中当前的位置
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSouce AST#member... | constructor() {
this.dataSouce = [];
this.listSize = 0;
this.pos = 0;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.ets#L23-L27 | e45ae1b9950fca7e3ed5abd52aca8d4fa8944dcc | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/views/ContentView.ets | arkts | languageChange | 监听语言模式变化 | @Monitor('appGeneralData.language')
languageChange() {
if (this.appGeneralData.language === 'en-Latn-US') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJ... | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'appGeneralData.language' AST#expression#Right ) AST#decorator#Right languageChange 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#L... | @Monitor('appGeneralData.language')
languageChange() {
if (this.appGeneralData.language === 'en-Latn-US') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJ... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L132-L149 | fc0ff358ccd77a594b52db9d2f52fc3ad4c3162d | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | insertTask | ==================== TASK OPERATIONS ====================
Insert a new task
@param task - Task object to insert
@returns Row ID of inserted task | async insertTask(task: Task): Promise<number> {
if (!this.rdbStore) {
console.error(`[RdbHelper] ❌ insertTask失败:数据库未初始化`);
throw new Error('Database not initialized');
}
try {
console.info(`[RdbHelper] ========== 插入任务到数据库 ==========`);
console.info(`[RdbHelper] 任务详情:`);
consol... | AST#method_declaration#Left async insertTask AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async insertTask(task: Task): Promise<number> {
if (!this.rdbStore) {
console.error(`[RdbHelper] ❌ insertTask失败:数据库未初始化`);
throw new Error('Database not initialized');
}
try {
console.info(`[RdbHelper] ========== 插入任务到数据库 ==========`);
console.info(`[RdbHelper] 任务详情:`);
consol... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L155-L189 | 1112e25e9512aaa95642b81f8cb1e2c7da1e4851 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/PreferencesUtils.ets | arkts | private static preferenceName: string = defaultPreferenceName | private constructor() {
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | private constructor() {
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L15-L16 | 781ef56ccd5aab90f8e61139f92ca2ef91065e2c | gitee | |
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/CityWeather.ets | arkts | checkColdWarning | 检查感冒提示 | private checkColdWarning() {
if (this.weatherData?.life_index?.cold) {
const coldIndex = this.weatherData.life_index.cold;
// 如果感冒指数包含"易发"、"高发"、"较易发"等关键词,显示提示
if (coldIndex.includes('易发') || coldIndex.includes('高发') || coldIndex.includes('较易发') || coldIndex.includes('较易感冒') || coldIndex.includes('... | AST#method_declaration#Left private checkColdWarning AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left ... | private checkColdWarning() {
if (this.weatherData?.life_index?.cold) {
const coldIndex = this.weatherData.life_index.cold;
if (coldIndex.includes('易发') || coldIndex.includes('高发') || coldIndex.includes('较易发') || coldIndex.includes('较易感冒') || coldIndex.includes('易感冒')) {
this.showColdWarni... | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/CityWeather.ets#L142-L150 | ccd659a2a7cb2506a63def51d328463b3250f08d | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
RowSpaceEvenlyBottom() { Text("A"); Text("B"); Text("C"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1564-L1579 | bf1c90cb3736206c9a5f21e30a00757d45ae058f | github | |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/index.ets | arkts | RpcTransport | RPC 传输接口
用于 gRPC 客户端实现 | export { RpcTransport } from './RpcTransport' | AST#export_declaration#Left export { RpcTransport } from './RpcTransport' AST#export_declaration#Right | export { RpcTransport } from './RpcTransport' | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L106-L106 | 829633341cf2071e714a8229d9ce3f9a8cfd3097 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets | arkts | start | [EndExclude manage] | public start(controllerName: string, path: string, url: string): Promise<string> {
return new Promise((resolve, reject) => {
const controller = this.getController(controllerName);
// [StartExclude manage]
// [Start gate]
this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadIte... | AST#method_declaration#Left public start AST#parameter_list#Left ( AST#parameter#Left controllerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | public start(controllerName: string, path: string, url: string): Promise<string> {
return new Promise((resolve, reject) => {
const controller = this.getController(controllerName);
this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadItem) => {
this.currentTask = webD... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets#L68-L118 | 0dea94df75ddc98e9412d4815d9476abbe00edee | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets | arkts | verifySegment | 对数据进行分段验签,异步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param len 自定义的数据拆分长度,此处取64
@returns | static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
len: number = 64): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, 'ECC256|SHA256', len);
} | AST#method_declaration#Left static async verifySegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST... | static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
len: number = 64): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, 'ECC256|SHA256', len);
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets#L105-L108 | 198d36cdeb65c38062d9eb9fecddd45bd23ccde5 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildGreetingGenerator | 祝福语生成器 | @Builder
buildGreetingGenerator() {
Column({ space: 16 }) {
Row() {
Text('🎯 智能生成')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Button('高级配置')
.type(ButtonType.Capsule)
.fontSiz... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingGenerator AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compon... | @Builder
buildGreetingGenerator() {
Column({ space: 16 }) {
Row() {
Text('🎯 智能生成')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Button('高级配置')
.type(ButtonType.Capsule)
.fontSiz... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3132-L3182 | eb2b1447adcda8aefd0cdfdbc17780f842a27440 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/TaskBoardPage.ets | arkts | TaskBoardPage | ==================== P2: 任务板页面 ==================== | @Component
export struct TaskBoardPage {
@State tasks: TaskItem[] = AppState.tasks;
@State showAddDialog: boolean = false;
@State newTaskName: string = '';
@State newTaskMinutes: number = 25;
onSwitchToTimer: (task: TaskItem) => void = () => {}; // 接收回调函数作为普通参数
// 监听任务更新信号
@Consume('taskUpdateSignal') ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TaskBoardPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_ty... | @Component
export struct TaskBoardPage {
@State tasks: TaskItem[] = AppState.tasks;
@State showAddDialog: boolean = false;
@State newTaskName: string = '';
@State newTaskMinutes: number = 25;
onSwitchToTimer: (task: TaskItem) => void = () => {};
@Consume('taskUpdateSignal') @Watch('onTaskUpdate') tas... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TaskBoardPage.ets#L4-L252 | eaa471c4bb1fe810d66a40f0a63ef974dc27c443 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreviewUtil.ets | arkts | loadData | 加载预览文件信息。仅当预览窗口存在时起效。
@param previewInfo 文件的预览信息
@returns | static loadData(previewInfo: filePreview.PreviewInfo) {
return filePreview.loadData(AppUtil.getContext(), previewInfo);
} | AST#method_declaration#Left static loadData AST#parameter_list#Left ( AST#parameter#Left previewInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left filePreview . PreviewInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right... | static loadData(previewInfo: filePreview.PreviewInfo) {
return filePreview.loadData(AppUtil.getContext(), previewInfo);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L81-L83 | 0a61d7a24c234a3a605be7809212dcdec6df0414 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | isFile | 判断文件是否是普通文件。
@param file string|number 文件应用沙箱路径path或已打开的文件描述符fd。
@returns | static isFile(file: string | number): boolean {
return fs.statSync(file).isFile();
} | AST#method_declaration#Left static isFile AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa... | static isFile(file: string | number): boolean {
return fs.statSync(file).isFile();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L276-L278 | 80a15c37e4eda9fda9b855fd3ed0d4e8198a241e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinC.ets | arkts | SpinC | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinC {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0.4;
@Local scale2: number = 0.4;
@Local scale3: number = 0.4;
@Local scale4: number = 0.4;
@Local scale5: number = 0.4;
build() {
Row() {
Canvas()
.c... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinC AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinC {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0.4;
@Local scale2: number = 0.4;
@Local scale3: number = 0.4;
@Local scale4: number = 0.4;
@Local scale5: number = 0.4;
build() {
Row() {
Canvas()
.c... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinC.ets#L22-L183 | f57ac62c563cf0b4874abb9425e8850631d6379e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/user/User.ets | arkts | 用户信息模型 | export class User {
userId: number | null = null;
userName: string | null = null;
email: string | null = null;
password: string | null = null;
loginType: LoginType | null = null;
loginIdentifier: string | null = null;
loginTime: Date | null = null;
createTime: Date | null = null;
imageAddr: string | n... | AST#export_declaration#Left export AST#class_declaration#Left class User AST#class_body#Left { AST#property_declaration#Left userId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotat... | export class User {
userId: number | null = null;
userName: string | null = null;
email: string | null = null;
password: string | null = null;
loginType: LoginType | null = null;
loginIdentifier: string | null = null;
loginTime: Date | null = null;
createTime: Date | null = null;
imageAddr: string | n... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/User.ets#L66-L100 | 56f0467417d148344607edf754892e17387a5930 | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/home/CategoryGrid.ets | arkts | handleCategoryClick | 处理分类点击
@param index 分类索引
@param category 分类数据 | private handleCategoryClick(index: number, category: CategoryItem) {
if (this.selectedIndex === index) {
// 再次点击已选中的分类,取消筛选
this.selectedIndex = -1;
if (this.onCategoryClick) {
this.onCategoryClick(''); // 传递空字符串表示取消筛选
}
} else {
// 点击新的分类,选中并筛选
this.selectedIndex = i... | AST#method_declaration#Left private handleCategoryClick 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#Left category : AST#type_annotation#Left AST#primary_type#Left CategoryI... | private handleCategoryClick(index: number, category: CategoryItem) {
if (this.selectedIndex === index) {
this.selectedIndex = -1;
if (this.onCategoryClick) {
this.onCategoryClick('');
}
} else {
this.selectedIndex = index;
if (this.onCategoryClick) {
... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/CategoryGrid.ets#L52-L66 | a563d67036a1d970bd2b6287c774cf40a6fd6804 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | saveTask | 保存任务 | async saveTask() {
// 表单验证
if (!this.task.title.trim()) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请输入任务标题',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
if (!this.task.dreamId) {
const toastOptions: promptAction.Sh... | AST#method_declaration#Left async saveTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 表单验证 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#... | async saveTask() {
if (!this.task.title.trim()) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请输入任务标题',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
if (!this.task.dreamId) {
const toastOptions: promptAction.ShowToast... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L252-L319 | dc16e96d02c19054071230cfd5cb97b039536558 | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | Index.ets | arkts | FLog | 日志工具 | export { FLog } from './src/main/ets/ffmpeg/FLog'; | AST#export_declaration#Left export { FLog } from './src/main/ets/ffmpeg/FLog' ; AST#export_declaration#Right | export { FLog } from './src/main/ets/ffmpeg/FLog'; | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L24-L24 | 8404e7448ade752e15b86580349f7af0783e00ea | github |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets | arkts | getDoorbellOpenCommand | 获取智能门铃打开门命令
@return Command | static getDoorbellOpenCommand():DeviceCommandModel {
let param = {}
param["Lock"] = "ON";
return new DeviceCommandModel("SetLock", "DoorBell", JSON.stringify(param));
} | AST#method_declaration#Left static getDoorbellOpenCommand AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DeviceCommandModel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable... | static getDoorbellOpenCommand():DeviceCommandModel {
let param = {}
param["Lock"] = "ON";
return new DeviceCommandModel("SetLock", "DoorBell", JSON.stringify(param));
} | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets#L84-L88 | 499d88083604dda67395fbc5c1d93623a72ee66d | gitee |
tang01611/Mobile-Internet-job.git | 3b570970f9a742f89ea3b170483cb34f48c17e7d | entry/src/main/ets/model/NewsData.ets | arkts | Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class NewsData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
constructor(newsId: string, title: string, newsType: string, imgUrl: Resource, reads: string, likes: string, content: string) {
this.newsId = newsId;
this.ti... | AST#export_declaration#Left export AST#class_declaration#Left class NewsData AST#class_body#Left { AST#property_declaration#Left newsId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type... | export class NewsData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
constructor(newsId: string, title: string, newsType: string, imgUrl: Resource, reads: string, likes: string, content: string) {
this.newsId = newsId;
this.ti... | https://github.com/tang01611/Mobile-Internet-job.git/blob/3b570970f9a742f89ea3b170483cb34f48c17e7d/entry/src/main/ets/model/NewsData.ets#L16-L34 | 001ca7527ef12cc0c36d15894f959d8c4d827733 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets | arkts | initWantAgentNotificationRequest | init wantAgent NotificationRequest
@param notificationContent
@param notificationWantAgent
@return return the created NotificationRequest | initWantAgentNotificationRequest(
notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent,
... | AST#method_declaration#Left initWantAgentNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete... | initWantAgentNotificationRequest(
notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent,
wantAgent: n... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets#L42-L51 | ca6fd03e32665d30a7fb3b6a9734f98ad82e1043 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets | arkts | === ServerCfg 数据模型 === | export class ServerCfg {
key : string | null = null
name : string | null = null
value : number | null = null
constructor | AST#export_declaration#Left export AST#ERROR#Left class ServerCfg { key AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_lite... | export class ServerCfg {
key : string | null = null
name : string | null = null
value : number | null = null
constructor | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets#L8-L13 | eb73cb5a0abb1af67399a4d1257a3daa4c18d910 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets | arkts | rgb | Converts the given hex-color-string to rgb.
@param hex
@return | public static rgb(hex: string): number {
var color: number = Number(hex.replace('#', ''));
var r: number = (color >> 16) & 0xff;
var g: number = (color >> 8) & 0xff;
var b: number = (color >> 0) & 0xff;
return Color.rgb(r, g, b);
} | AST#method_declaration#Left public static rgb AST#parameter_list#Left ( AST#parameter#Left hex : 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 number AST#primary_type#... | public static rgb(hex: string): number {
var color: number = Number(hex.replace('#', ''));
var r: number = (color >> 16) & 0xff;
var g: number = (color >> 8) & 0xff;
var b: number = (color >> 0) & 0xff;
return Color.rgb(r, g, b);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets#L200-L206 | 35745284c61e7a31a3569bc98919a71d0d9635f7 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhDialog.ets | arkts | hide | 关闭弹框
@param dialogId 目前弹框id | public static hide(dialogId: string) {
DialogHelper.closeDialog(dialogId)
} | AST#method_declaration#Left public static hide AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#... | public static hide(dialogId: string) {
DialogHelper.closeDialog(dialogId)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhDialog.ets#L128-L130 | 68646fca0e7e588a9e10a52d3a35d65671a836c9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildAISuggestions | 构建AI建议 | @Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgre... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAISuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgre... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L390-L476 | d3e1fd7095da26009e0da0f50b1b4f8eefd4d554 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_search_engines.ets | arkts | export_string | Export search engines in a specific plain text format.
@returns '\n' connected string of search engines in the format of:
@example 'Bing\nhttps://www.cn.bing.com/search?q=%s\nGoogle\nhttps://www.google.com/search?q=%s' | static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_search_engines.list_of_search_engines.length; index++) {
let ua: search_engine = bunch_of_search_engines.list_of_search_engines[index];
export_list.push(ua.label);
export_list.push(ua.url);
}
r... | AST#method_declaration#Left static export_string AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left export_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Ri... | static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_search_engines.list_of_search_engines.length; index++) {
let ua: search_engine = bunch_of_search_engines.list_of_search_engines[index];
export_list.push(ua.label);
export_list.push(ua.url);
}
r... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L58-L66 | 082184904d38640e96a2a343442f50507f3f3a9e | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateX | Animates values along the X axis.
@param durationMillis animation duration
@param easing EasingFunction | public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
} | AST#method_declaration#Left public animateX AST#parameter_list#Left ( AST#parameter#Left durationMillis : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left easing : AST#type_annotation#Left AST#primary_type#Left EasingFunction... | public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L61-L65 | 1e061b24b7d6674c0e3f7a451f9d6082600c58be | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/base/DialogOptions.ets | arkts | TODO 弹窗工具类,Base参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface DialogOptions extends BaseDialogOptions {
title?: ResourceStr; //弹框标题
actionCancel?: boolean; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:true。
onAction?: ActionCallBack | ActionStrCallBack; //按钮的CallBack事件。
height?: Dimension | Length; //设置弹窗的高度;很多弹框都是自适应高度,谨慎设置该值。
width?: Dimension | Length; //设置弹窗的... | AST#export_declaration#Left export AST#interface_declaration#Left interface DialogOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left title ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation... | export interface DialogOptions extends BaseDialogOptions {
title?: ResourceStr;
actionCancel?: boolean;
onAction?: ActionCallBack | ActionStrCallBack;
height?: Dimension | Length;
width?: Dimension | Length;
maxHeight?: Dimension | Length;
maxWidth?: Length;
backgroundColor?: ResourceColor;
b... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/DialogOptions.ets#L25-L43 | f8c645e4859a2e159efe791f84034eff529b6e49 | gitee | |
openharmony-sig/ohos_axios | 75d72897982ea6e10fa99c62c62a65425af0a568 | entry/src/main/ets/pages/Index.ets | arkts | defaultSetting | 默认设置 | defaultSetting() {
this.clear()
this.showUrl = this.postUrl
this.startTime = new Date().getTime();
axios.defaults.headers['customer-header'] = 'customer-value'
axios.defaults.method = 'post'
axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.postUrl,
data: {
id:... | AST#method_declaration#Left defaultSetting AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expr... | defaultSetting() {
this.clear()
this.showUrl = this.postUrl
this.startTime = new Date().getTime();
axios.defaults.headers['customer-header'] = 'customer-value'
axios.defaults.method = 'post'
axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.postUrl,
data: {
id:... | https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L556-L585 | 00c4f65714361e2ea3c427056f125bb8b8201aa5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets | arkts | closeDialog | 关闭弹窗 | closeDialog(): void {
logger.info('Start to close dialog.');
if (this.isDialogShow && this.dialogController !== undefined) {
this.isDialogShow = false;
this.dialogController.close();
logger.info('Succeeded in closing dialog.');
}
} | AST#method_declaration#Left closeDialog 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#L... | closeDialog(): void {
logger.info('Start to close dialog.');
if (this.isDialogShow && this.dialogController !== undefined) {
this.isDialogShow = false;
this.dialogController.close();
logger.info('Succeeded in closing dialog.');
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets#L51-L58 | 08ed636e37950947149f817916728e62feecb333 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets | arkts | Declare ButtonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare ButtonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class ButtonOptions {
/**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ButtonOptions AST#class_body#Left { /**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the Disp... | export declare class ButtonOptions {
value: ResourceStr;
action?: () => void;
background?: ResourceColor;
fontColor?: ResourceColor;
buttonStyle?: ButtonStyleMode;
role?: ButtonRole;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L31-L108 | c74e1887a94c5a5a659c437be6b599f97b747543 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | listFile | 列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Promise异步回调。
@param path string 文件夹的应用沙箱路径。
@param options 文件过滤选项。默认不进行过滤。
recursion boolean 是否递归子目录下文件名,默认为false。
listNum number 列出文件名数量。当设置0时,列出所有文件,默认为0。
filter Filter 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。
@returns | static listFile(path: string, options?: ListFileOptions): Promise<string[]> {
return fs.listFile(path, options);
} | AST#method_declaration#Left static listFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left ListFileOptions AST#p... | static listFile(path: string, options?: ListFileOptions): Promise<string[]> {
return fs.listFile(path, options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L542-L544 | 2576ff245b10c290a88f4c758a19d5b7276f61c9 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/CorePage.ets | arkts | CorePage | @file 核心页面视图
@author Joker.X | @ComponentV2
export struct CorePage {
/**
* 核心页面 ViewModel
*/
@Local
private vm: CoreViewModel = new CoreViewModel();
/**
* 窗口安全区状态
*/
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
/**
* 全局计数器状态
*/
@Local
private counterState: DemoCounterState = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CorePage AST#component_body#Left { /**
* 核心页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left CoreViewModel... | @ComponentV2
export struct CorePage {
@Local
private vm: CoreViewModel = new CoreViewModel();
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
@Local
private counterState: DemoCounterState = getDemoCounterState();
build() {
AppNavDestination({
titl... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L19-L109 | b9df28c09a21fcf993acb1721940407701cf3ae4 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/utils/DeviceScreen.ets | arkts | getDeviceHeight | Get the screen height.
@returns screen height. | public static getDeviceHeight() {
let height = 0;
try {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (Const.DEVICE_DPI / screenDensityDPI);
} catch (err) ... | AST#method_declaration#Left public static getDeviceHeight AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_dec... | public static getDeviceHeight() {
let height = 0;
try {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (Const.DEVICE_DPI / screenDensityDPI);
} catch (err) ... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/DeviceScreen.ets#L43-L56 | 2cb4c0a63356543ab8f40c06e87289d0d9427844 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 会话监听器 | export class sessionListener {
/**
* 会话关闭事件回调。会话关闭时调用
*/
onClosed: () => void = () => {
};
/**
* 会话取消事件的回调。会话取消时调用
*/
onCanceled: () => void = () => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class sessionListener AST#class_body#Left { /**
* 会话关闭事件回调。会话关闭时调用
*/ AST#property_declaration#Left onClosed : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#prim... | export class sessionListener {
onClosed: () => void = () => {
};
onCanceled: () => void = () => {
};
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L107-L118 | 7d8f8d01659c0a7b98ebd4b532b22a0192a4bf7c | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets | arkts | default constructor for initialization in code | constructor() {
this.init();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init A... | constructor() {
this.init();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L170-L172 | 6bae5c88b695556fc275c6f02e48eddb590bab52 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/Card.ets | arkts | CompletedRoutableCard | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symb... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompletedRoutableCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right symbol : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#t... | @Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symb... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/Card.ets#L16-L48 | a0fa31cb6bd9cb8b12bd40446a2a1800db2a2ad0 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ContentRule.ets | arkts | 正文处理规则 | export class ContentRule {
content?: string
title?: string //有些网站只能在正文中获取标题
nextContentUrl?: string
webJs?: string
sourceRegex?: string
replaceRegex?: string //替换规则
imageStyle?: string //默认大小居中,FULL最大宽度
imageDecode?: string //图片bytes二次解密js, 返回解密后的bytes
payAction?: string //购买操作,js或者包含{{js}}的url
} | AST#export_declaration#Left export AST#class_declaration#Left class ContentRule AST#class_body#Left { AST#property_declaration#Left content ? : AST#ERROR#Left string title ? : string //有些网站只能在正文中获取标题 nextContentUrl ? : string webJs ? : string sourceRegex ? : string replaceRegex ? : string //替换规则 imageStyle ? : string /... | export class ContentRule {
content?: string
title?: string
nextContentUrl?: string
webJs?: string
sourceRegex?: string
replaceRegex?: string
imageStyle?: string
imageDecode?: string
payAction?: string
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ContentRule.ets#L4-L14 | 959909d698011645dd567fb6a54c385ffc290c86 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | MaxSelected
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class MaxSelected {
/**
* data. support to set max_total_count, max_photo_count and max_video_count.
*
* @type { ?Map<MaxCountType, number> }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
data?: Map<MaxCountType, number>;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class MaxSelected AST#class_body#Left { /**
* data. support to set max_total_count, max_photo_count and max_video_count.
*
* @type { ?Map<MaxCountType, number> }
* @syscap SystemCapability.FileManagement.Pho... | export declare class MaxSelected {
data?: Map<MaxCountType, number>;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L725-L735 | 91cb350df45a823136928b9fd80270f258b93893 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.