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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | update | 子类可以重写 | update(_: number): void {
} | AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left _ : 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#Right AST#type_... | update(_: number): void {
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L168-L169 | 67349b4b48ffc89a77bdd7b77c7a8a8a71031763 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/common/ErrorHandler.ets | arkts | showErrorDialog | 显示错误对话框 | private async showErrorDialog(message: string, suggestions: string[]): Promise<void> {
const suggestionText = suggestions.length > 0
? `\n\n建议解决方案:\n${suggestions.map((s, i) => `${i + 1}. ${s}`).join('\n')}`
: '';
promptAction.showDialog({
title: '操作失败',
message: message + suggestionTex... | AST#method_declaration#Left private async showErrorDialog AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left suggestions : AST#type_annotation#Left AST#primary_type#Left AS... | private async showErrorDialog(message: string, suggestions: string[]): Promise<void> {
const suggestionText = suggestions.length > 0
? `\n\n建议解决方案:\n${suggestions.map((s, i) => `${i + 1}. ${s}`).join('\n')}`
: '';
promptAction.showDialog({
title: '操作失败',
message: message + suggestionTex... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L125-L140 | 98aac7c6b12338247343562fc0911e8ad8399876 | github |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/pagedesktop/src/main/ets/default/common/components/FolderItem.ets | arkts | formatFolderInfo | format FolderInfo | private formatFolderInfo() {
if (typeof this.folderItem.layoutInfo === 'undefined') {
return;
}
let column = this.mBigFolderViewModel?.getFolderLayoutConfig().column as number;
let row = this.mBigFolderViewModel?.getFolderLayoutConfig().row as number;
const allCount = column * row;
if (thi... | AST#method_declaration#Left private formatFolderInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left ... | private formatFolderInfo() {
if (typeof this.folderItem.layoutInfo === 'undefined') {
return;
}
let column = this.mBigFolderViewModel?.getFolderLayoutConfig().column as number;
let row = this.mBigFolderViewModel?.getFolderLayoutConfig().row as number;
const allCount = column * row;
if (thi... | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FolderItem.ets#L95-L117 | 99324629ab76eef93292b472a0161aa104535321 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.TreeView.d.ets | arkts | getTreeListener | Get treeListener.
@return treeListener object
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Get treeListener.
@return treeListener object
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | getTreeListener(): TreeListener; | AST#method_declaration#Left getTreeListener AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TreeListener AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | getTreeListener(): TreeListener; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L219-L219 | aad9398d1ac211a7fb4ff0501f17c1998d733ff6 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/pages/Profile.ets | arkts | navigateToSettings | 跳转到设置页 | navigateToSettings(): void {
Router.push(Routes.SETTINGS);
} | AST#method_declaration#Left navigateToSettings 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#expre... | navigateToSettings(): void {
Router.push(Routes.SETTINGS);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/pages/Profile.ets#L34-L36 | a9e1d31546bda082eac7aa4d84f34ccfb9413583 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets | arkts | Defines the download content options.
@interface DownloadContentOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface DownloadContentOptions {
/**
* DownloadFileButton icon Style.
*
* @type { ?DownloadIconStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
icon?: DownloadIconStyle;
/**
* DownloadFileButton descrip... | AST#export_declaration#Left export AST#interface_declaration#Left interface DownloadContentOptions AST#object_type#Left { /**
* DownloadFileButton icon Style.
*
* @type { ?DownloadIconStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
... | export interface DownloadContentOptions {
icon?: DownloadIconStyle;
text?: DownloadDescription;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L169-L190 | 3b536a9e9addecefa271aeff3e6f5883055dbfd6 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onConnectRemoteService | 连接远端Service | async function onConnectRemoteService(deviceId) {
// 连接成功的回调
async function onConnectCallback(element, remote) {
prompt.showToast({
message: "onConnectRemoteService success" + remote,
duration: 3000
});
mRemote = remote;
}
// Service异常死亡的回调
function onDisconnectCallback(element) {
... | AST#function_declaration#Left async function onConnectRemoteService AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 连接成功的回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#function_expression#Left async function ... | async function onConnectRemoteService(deviceId) {
async function onConnectCallback(element, remote) {
prompt.showToast({
message: "onConnectRemoteService success" + remote,
duration: 3000
});
mRemote = remote;
}
function onDisconnectCallback(element) {
console.info(element)
}
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OHMailETS/entry/src/main/ets/MainAbility/pages/index.ets#L109-L148 | 3804dbc361b2d55d3c63c1c00874007985ae5848 | gitee |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/http/apiService.ets | arkts | 获取wanAndroid首页Banner数据,测试校验API data:T泛型数据
@returns | export function getWanAndroidBanner() {
return axiosClient.get<ApiResponse<BannerDataModelData[]>>(
{
url: wanAndroidUrl + "/banner/json",
checkResultCode: true,
showLoading: true
}
)
} | AST#export_declaration#Left export AST#function_declaration#Left function getWanAndroidBanner AST#parameter_list#Left ( ) 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 AS... | export function getWanAndroidBanner() {
return axiosClient.get<ApiResponse<BannerDataModelData[]>>(
{
url: wanAndroidUrl + "/banner/json",
checkResultCode: true,
showLoading: true
}
)
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L140-L148 | 6a2e06abc16d74aafc08b8be31cedd24ef6498d6 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets | arkts | frequency Dialog | export const EVERYDAY: string = '每天'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EVERYDAY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '每天' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R... | export const EVERYDAY: string = '每天'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L66-L66 | 90f3d1b42623d2144d3cc08f42e211d7485fad5d | gitee | |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/model/BaseDataSourceWrapper.ets | arkts | 通用IDataSource配合LazyForEach使用的数据包装类 | export class BaseDataSourceWrapper<T> implements IDataSource{
private list: T[] = []
private listener: DataChangeListener
constructor | AST#export_declaration#Left export AST#ERROR#Left class BaseDataSourceWrapper AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { AST#property_declaration#Left private list : AST#type_an... | export class BaseDataSourceWrapper<T> implements IDataSource{
private list: T[] = []
private listener: DataChangeListener
constructor | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/model/BaseDataSourceWrapper.ets#L4-L8 | 13d69329c8c0c3cee4f6d82744a30b325b31f436 | github | |
softfatgay/harmony-netease.git | 5f3d226b72ba8579cacfbd229e4eb0054d63abef | entry/src/main/ets/base/Api.ets | arkts | /购物车删除 | export const CART_DELETE = baseUrl + '/xhr/front/trade/cart/delete'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CART_DELETE = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/front/trade/cart/delete' AST#expression#Right AST#binary_expression#Right AST#expr... | export const CART_DELETE = baseUrl + '/xhr/front/trade/cart/delete'; | https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L73-L73 | 9dbde4bb02295549d8b2d651fc63455213ea2d21 | github | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSVideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets | arkts | createAvPlayer | Creates a videoPlayer object. | createAvPlayer() {
media.createAVPlayer().then((video) => {
if (video != null) {
this.avPlayer = video;
this.bindState();
this.url = this.context.src;
this.avPlayer.url = this.url;
} else {
Logger.info(`[HomeDialogModel] createAVPlayer fail`);
}
}).catch... | AST#method_declaration#Left createAvPlayer 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 AST#call_expression#Left AST#expression#Left AST#... | createAvPlayer() {
media.createAVPlayer().then((video) => {
if (video != null) {
this.avPlayer = video;
this.bindState();
this.url = this.context.src;
this.avPlayer.url = this.url;
} else {
Logger.info(`[HomeDialogModel] createAVPlayer fail`);
}
}).catch... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets#L24-L37 | d7525d15269063274b56616a881bdb60c9f13bcb | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | requestNavigationResult | 发起结果回传跳转
@returns {void} 无返回值 | requestNavigationResult(): void {
DemoNavigator.toNavigationResult()
.then((result?: DemoResult): void => {
const title: string = result?.title?.trim() ?? "";
const description: string = result?.description?.trim() ?? "";
if (title.length === 0 && description.length === 0) {
... | AST#method_declaration#Left requestNavigationResult 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#... | requestNavigationResult(): void {
DemoNavigator.toNavigationResult()
.then((result?: DemoResult): void => {
const title: string = result?.title?.trim() ?? "";
const description: string = result?.description?.trim() ?? "";
if (title.length === 0 && description.length === 0) {
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L52-L65 | a9838b56ec9467b769949e8dbf08053fd1bd79cf | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | getLoading | 加载中弹窗
@returns | static getLoading(content?: string, uiContext?: UIContext): LoadingBuilderProxy {
return new LoadingBuilderProxy(content, uiContext)
} | AST#method_declaration#Left static getLoading AST#parameter_list#Left ( AST#parameter#Left content ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AS... | static getLoading(content?: string, uiContext?: UIContext): LoadingBuilderProxy {
return new LoadingBuilderProxy(content, uiContext)
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L173-L175 | a6bf5a13d6dc3fe9c41230056bfa3caf6646f790 | github |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/view/ImageSelectComponent.ets | arkts | aboutToAppear | 图像数组 生命周期钩子函数,当页面即将显示时调用 | aboutToAppear() {
// 获取默认显示对象
let displayClass: display.Display = display.getDefaultDisplaySync();
let width = displayClass?.width / displayClass.densityPixels ?? Constants.DEFAULT_WIDTH;
this.deviceWidth = width;
this.smallImgWidth = (width - Constants.LIST_ITEM_SPACE * (Constants.SHOW_COUNT - 1)) ... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取默认显示对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left displayClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display ... | aboutToAppear() {
let displayClass: display.Display = display.getDefaultDisplaySync();
let width = displayClass?.width / displayClass.densityPixels ?? Constants.DEFAULT_WIDTH;
this.deviceWidth = width;
this.smallImgWidth = (width - Constants.LIST_ITEM_SPACE * (Constants.SHOW_COUNT - 1)) / Constants... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/ImageSelectComponent.ets#L26-L32 | a6dada1041282e559397a966949c303c9fd7464e | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets | arkts | 自定义获取NodeController接口 | export const getNWeb = (url: string): MyNodeController | undefined => {
// 加载新的Url时,建议复用预创建的Web组件
if (!NodeMap.get(url) && NodeMap.get('about://blank')) {
// 获取预创建的Web组件
let webNode = NodeMap.get('about://blank') as MyNodeController;
// 重新加载url
webNode.loadUrl(url);
return webNode;
}
return ... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getNWeb = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramete... | export const getNWeb = (url: string): MyNodeController | undefined => {
if (!NodeMap.get(url) && NodeMap.get('about://blank')) {
let webNode = NodeMap.get('about://blank') as MyNodeController;
webNode.loadUrl(url);
return webNode;
}
return NodeMap.get(url);
}; | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets#L115-L125 | ba724f0a22f0e422ebbce456ec62dd93c26e7210 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | isDrawBottomYLabelEntryEnabled | returns true if drawing the bottom y-axis label entry is enabled
@return | public isDrawBottomYLabelEntryEnabled(): boolean {
return this.mDrawBottomYLabelEntry;
} | AST#method_declaration#Left public isDrawBottomYLabelEntryEnabled 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#L... | public isDrawBottomYLabelEntryEnabled(): boolean {
return this.mDrawBottomYLabelEntry;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L270-L272 | 10fc2d5b32cab3ef92f25141ccea2546f296c938 | gitee |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/StorageUtil.ets | arkts | 极简数据库 - 使用Preferences存储 | export class StorageUtil {
private static prefs: preferences.Preferences | null = null;
// 初始化
private static async init(): Promise<boolean> {
try {
if (StorageUtil.prefs) {
return true;
}
StorageUtil.prefs = await preferences.getPreferences(globalThis.context, 'weather_app');
... | AST#export_declaration#Left export AST#class_declaration#Left class StorageUtil AST#class_body#Left { AST#property_declaration#Left private static prefs : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right ... | export class StorageUtil {
private static prefs: preferences.Preferences | null = null;
private static async init(): Promise<boolean> {
try {
if (StorageUtil.prefs) {
return true;
}
StorageUtil.prefs = await preferences.getPreferences(globalThis.context, 'weather_app');
cons... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L23-L162 | 1a17edb2916a1b07c67a0beb503cb25e64f42bd1 | github | |
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/SM4.ets | arkts | encryptECBSync | 加密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@returns | static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return SM4.encryptSync(data, symKey, null, 'SM4_128|ECB|PKCS7');
} | AST#method_declaration#Left static encryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe... | static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob {
return SM4.encryptSync(data, symKey, null, 'SM4_128|ECB|PKCS7');
} | 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/SM4.ets#L165-L167 | 18ec3368179e09e429039590ef59c5c65ea1a7e2 | github |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets | arkts | aboutToAppear | 页面加载时获取购物车数据 | aboutToAppear() {
this.getCartData();
} | AST#method_declaration#Left aboutToAppear 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 . getCartData AST#member... | aboutToAppear() {
this.getCartData();
} | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L244-L246 | c1cb3be3ac0f76a1d5de14f767893cf69e9cae61 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | getAddressPage | 分页获取地址列表
@param {PageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<Address>>>} 地址分页数据 | async getAddressPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Address>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Address>>> =
await NetworkClient.http.post("user/address/page", params);
return resp.data;
} | AST#method_declaration#Left async getAddressPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | async getAddressPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Address>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Address>>> =
await NetworkClient.http.post("user/address/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L27-L31 | fdca5fbb5b8d629df5109e149246b444328ae631 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets | arkts | onDeviceIdChange | 定时器id
DeviceId变动事件 | onDeviceIdChange(): void {
Log.showInfo(TAG, `onDeviceIdChange: deviceId = ${this.deviceId}`);
} | AST#method_declaration#Left onDeviceIdChange 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#express... | onDeviceIdChange(): void {
Log.showInfo(TAG, `onDeviceIdChange: deviceId = ${this.deviceId}`);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets#L69-L71 | 4318474fc1702252e956c6d1d6fd44734a06cfc4 | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/DataManager.ets | arkts | loadEvents | 加载事件列表 | async loadEvents(): Promise<EventModel[]> {
if (!this.preferences) {
console.error('Preferences not initialized')
return []
}
try {
const eventsStr = await this.preferences.get(this.EVENTS_KEY, '[]') as string
const eventsJson: Object[] = JSON.parse(eventsStr) as Object[]
cons... | AST#method_declaration#Left async loadEvents AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EventModel [ ] AST#array_type#Right AST#primary_ty... | async loadEvents(): Promise<EventModel[]> {
if (!this.preferences) {
console.error('Preferences not initialized')
return []
}
try {
const eventsStr = await this.preferences.get(this.EVENTS_KEY, '[]') as string
const eventsJson: Object[] = JSON.parse(eventsStr) as Object[]
cons... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L50-L66 | 3f83f60a71082509f1359adbd38fbac864f4fecd | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 80% 百分比 | export const P80: string = "80%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P80 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "80%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P80: string = "80%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L89-L89 | 575902f430a9e2acb950d76db80d4f87d1a35e72 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/QQLoginRequest.ets | arkts | @param {QQLoginRequest} init - 初始化数据 | constructor(init: QQLoginRequest) {
this.accessToken = init.accessToken;
this.openId = init.openId;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left QQLoginRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stat... | constructor(init: QQLoginRequest) {
this.accessToken = init.accessToken;
this.openId = init.openId;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/QQLoginRequest.ets#L18-L21 | bd7bbf46c9f674b6f037036617244d0914246797 | github | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/pages/MusicCategoryPage.ets | arkts | usePlayMusicList | @description: 播放音乐分类
@date: 2024-07-17 22:23
@author wuwenqiang | async usePlayMusicList(musicModel:MusicInterface,index:number){
let musicList:Array<MusicInterface> = [];
if(this.musicStorage.classifyName !== this.activeCategory.classifyName){
musicList = await getMusicListByClassifyIdService(this.activeCategory.id,1,500).then(res=>res.data)
}
usePlayerRouter(t... | AST#method_declaration#Left async usePlayMusicList AST#parameter_list#Left ( AST#parameter#Left musicModel : AST#type_annotation#Left AST#primary_type#Left MusicInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left numb... | async usePlayMusicList(musicModel:MusicInterface,index:number){
let musicList:Array<MusicInterface> = [];
if(this.musicStorage.classifyName !== this.activeCategory.classifyName){
musicList = await getMusicListByClassifyIdService(this.activeCategory.id,1,500).then(res=>res.data)
}
usePlayerRouter(t... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/MusicCategoryPage.ets#L74-L80 | bd2aa848dc70b23f8219742290cc76bf1495126e | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/permissionMananger.ets | arkts | requestPermission | 异步静态方法用于请求用户授权指定的权限 | static async requestPermission(permissions: Permissions[]): Promise<boolean> {
// 创建一个访问令牌管理器实例
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// 获取上下文(这里假设getContext是一个可以获取到UI能力上下文的方法)
let context: Context = getContext() as common.UIAbilityContext;
// 请求用户授权指定的权... | AST#method_declaration#Left static async requestPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | static async requestPermission(permissions: Permissions[]): Promise<boolean> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let context: Context = getContext() as common.UIAbilityContext;
const result = await atManager.requestPermissionsFromUser(context,... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/permissionMananger.ets#L32-L44 | 8bcc501a2a190bcf4c1133a09757534c0b7ef960 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/router/AppRouter.ets | arkts | 应用路由管理器 | export class AppRouter {
private static instance: AppRouter;
private navigationStack: string[] = [];
private constructor() {}
/**
* 获取单例实例
*/
static getInstance(): AppRouter {
if (!AppRouter.instance) {
AppRouter.instance = new AppRouter();
}
return AppRouter.instance;
}
/... | AST#export_declaration#Left export AST#class_declaration#Left class AppRouter AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left AppRouter AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#... | export class AppRouter {
private static instance: AppRouter;
private navigationStack: string[] = [];
private constructor() {}
static getInstance(): AppRouter {
if (!AppRouter.instance) {
AppRouter.instance = new AppRouter();
}
return AppRouter.instance;
}
async push(path: st... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L60-L312 | 9568a9b17e952962eeae85c86c122b30a766dc3d | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SegmentButtonV2.d.ets | arkts | CapsuleSegmentButtonV2 | Defines the segmented button with capsule style.
@struct CapsuleSegmentButtonV2
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ComponentV2
export declare struct CapsuleSegmentButtonV2 {
/**
* Sets the items of the segmented button.
*
* @type { SegmentButtonV2Items }
* @readonly
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Require
@Param
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct CapsuleSegmentButtonV2 AST#component_body#Left { /**
* Sets the items of the segmented button.
*
* @type { SegmentButtonV2Items }
* @readonly
* @sysca... | @ComponentV2
export declare struct CapsuleSegmentButtonV2 {
@Require
@Param
readonly items: SegmentButtonV2Items;
@Require
@Param
readonly selectedIndex: number;
@Event
$selectedIndex?: OnSelectedIndexChange;
@Event
onItemClicked?: Callback<number>;
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L799-L1228 | 0314b81de5e1b6684b678770da8611b1e5cf30d7 | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/pages/StatisticPage.ets | arkts | 渲染页面 | build() {
Scroll(this.scroller) {
Column({ space: CommonConstants.SPACE_M }) {
Column() {
Text(" ").height($r('app.float.edge_size_M')).width('100%')
.backgroundColor($r('app.color.blue'))
Row() {
Text('统计页面')
.margin({ left: '50px', right: '85... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_conte... | build() {
Scroll(this.scroller) {
Column({ space: CommonConstants.SPACE_M }) {
Column() {
Text(" ").height($r('app.float.edge_size_M')).width('100%')
.backgroundColor($r('app.color.blue'))
Row() {
Text('统计页面')
.margin({ left: '50px', right: '85... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/StatisticPage.ets#L39-L201 | 1d1146c4bbcdd34784f39c3af2d16d9b00c3a4b5 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FeedbackRepository.ets | arkts | submitFeedback | 提交意见反馈
@param params 反馈提交请求参数
@returns 提交结果 | async submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitFeedback(params);
} | AST#method_declaration#Left async submitFeedback AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left FeedbackSubmitRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST... | async submitFeedback(params: FeedbackSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitFeedback(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FeedbackRepository.ets#L27-L29 | 55b8cd5bbec75990dfff09164da6acb3b83f6523 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/launch/src/main/ets/view/GuidePage.ets | arkts | 构建引导页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "引导页",
viewModel: this.vm
}) {
this.GuideContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "引导页" AST#expression#Right AST#component_parameter#Right , AST#component_p... | build() {
AppNavDestination({
title: "引导页",
viewModel: this.vm
}) {
this.GuideContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/view/GuidePage.ets#L20-L27 | 9d29eae9e14d5aaf05bf7b2f3cfa731ce199f843 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderRefundPage.ets | arkts | getRefundReasonText | 获取退款原因文本
@returns {string | Resource} 退款原因文本 | private getRefundReasonText(): string | Resource {
return this.vm.selectedRefundReason?.name ?? $r("app.string.please_select");
} | AST#method_declaration#Left private getRefundReasonText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block... | private getRefundReasonText(): string | Resource {
return this.vm.selectedRefundReason?.name ?? $r("app.string.please_select");
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L186-L188 | f40905b999b9c17c44f5e748a42dd24b7afa46a7 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | getMonthDays | 获取指定年份指定月份的天数 | static getMonthDays(year: number, month: number): number {
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
return (yearInfo & (0x10000 >> month)) ? 30 : 29;
} | AST#method_declaration#Left static getMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | static getMonthDays(year: number, month: number): number {
const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year);
return (yearInfo & (0x10000 >> month)) ? 30 : 29;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L153-L156 | 795b30538d3772639c10c2738f9c4a8e91fd492c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets | arkts | loginByQqApp | QQ APP 授权登录
@param {QQLoginRequest} params - QQ 授权参数
@returns {Promise<NetworkResponse<Auth>>} 登录结果 | async loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/qq", params);
return response.data;
} | AST#method_declaration#Left async loginByQqApp AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left QQLoginRequest 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 loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/qq", params);
return response.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L27-L31 | 86a70b04361fe50c57ebcfe19c018b0c77adce12 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCertextensionObject.ets | arkts | certExtensionSample | 证书扩展示例 | function certExtensionSample(): void {
let textEncoder = new util.TextEncoder();
let encodingBlob: cert.EncodingBlob = {
data: extData,
// 证书扩展格式,目前仅支持DER格式
encodingFormat: cert.EncodingFormat.FORMAT_DER
};
// 创建一个证书扩展实例
cert.createCertExtension(encodingBlob, (err, certExtension) => {
if (err... | AST#function_declaration#Left function certExtensionSample AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#L... | function certExtensionSample(): void {
let textEncoder = new util.TextEncoder();
let encodingBlob: cert.EncodingBlob = {
data: extData,
encodingFormat: cert.EncodingFormat.FORMAT_DER
};
cert.createCertExtension(encodingBlob, (err, certExtension) => {
if (err != null) {
console.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCertextensionObject.ets#L37-L71 | a8a9ca4a3409749e43ba95420ccedc334dbff844 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/model/BasicDataSource.ets | arkts | getData | 获取指定索引数据 | public getData(index: number): VideoBuilder {
return this.videoNew[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left VideoBuilder AST#primary_... | public getData(index: number): VideoBuilder {
return this.videoNew[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/BasicDataSource.ets#L84-L86 | f217a35285fcbb401f2a1062e3e02b569d3a4f3b | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseViewModel.ets | arkts | aboutToAppear | 页面出现前(组件创建后、build 前)
@returns {void} 无返回值 | aboutToAppear(): void {
} | 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#builder_function_body#Right AST#method_declaration#Right | aboutToAppear(): void {
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseViewModel.ets#L11-L12 | 33d6f58ef97f4a11251fef371559874110ed59dc | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/Logger.ets | arkts | 创建默认的 Logger 实例并导出 | export default new Logger('AlarmClock', 0xFF00); | AST#export_declaration#Left export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Logger AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AlarmClock' AST#expression#Right , AST#expre... | export default new Logger('AlarmClock', 0xFF00); | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L57-L57 | cff6af994c14610ebc566dcd1f2bd6803b738620 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationService.ets | arkts | sendBirthdayNotification | 发送生日提醒通知 | public async sendBirthdayNotification(contacts: Contact[]): Promise<void> {
if (!this.settings.enabled || !this.settings.notificationEnabled) {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Birthday notifications are disabled');
return;
}
try {
hilog.inf... | AST#method_declaration#Left public async sendBirthdayNotification AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | public async sendBirthdayNotification(contacts: Contact[]): Promise<void> {
if (!this.settings.enabled || !this.settings.notificationEnabled) {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Birthday notifications are disabled');
return;
}
try {
hilog.inf... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L143-L172 | 990ab2499b4a950b7aac8c5331f526c954bd0778 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets | arkts | drawHeartRateLine | 画心率变动曲线 | drawHeartRateLine() {
this.context.lineWidth = LINE_WIDTH;
this.context.strokeStyle = COLOR_LINE;
// draw broken line
let path: Path2D = new Path2D();
for (let i = 0; i < SIZE; i++) {
let x = START_X + this.mOffset * i + PADDING_HORIZONTAL;
let y =
this.viewHeight - PADDING_VERT... | AST#method_declaration#Left drawHeartRateLine 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 AST#member_expression#Left AST#expression#Left ... | drawHeartRateLine() {
this.context.lineWidth = LINE_WIDTH;
this.context.strokeStyle = COLOR_LINE;
let path: Path2D = new Path2D();
for (let i = 0; i < SIZE; i++) {
let x = START_X + this.mOffset * i + PADDING_HORIZONTAL;
let y =
this.viewHeight - PADDING_VERTICAL - X_COORDINATE... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets#L176-L210 | 9d4ef40845d3fc3517698eb84110181fc25c3b96 | gitee |
patient-fyd/HarmonyOS4.git | 5ee3421130cb66278a1eac52fbd43dde7843f845 | projects/MyApplication/entry/src/main/ets/pages/ItemPage.ets | arkts | fillScreen | // 全局自定义构建函数
@Builder function ItemCard(item: Item) {
Row({space:10}){
Image(item.image)
.width(100)
Column({space:4}){
if (item.discount) {
Text(item.name)
.fontSize(20)
.fontWeight(FontWeight.Bold)
Text('原价:¥'+item.price)
.fontColor('#CCC')
.fontSize(14)
.decoration({type:TextDecorationType.LineThrough})
Text('折扣价:¥'... | @Styles function fillScreen() {
.width('100%')
.height('100%')
.backgroundColor('#EFEFEF')
.padding(20)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function fillScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Le... | @Styles function fillScreen() {
.width('100%')
.height('100%')
.backgroundColor('#EFEFEF')
.padding(20)
} | https://github.com/patient-fyd/HarmonyOS4.git/blob/5ee3421130cb66278a1eac52fbd43dde7843f845/projects/MyApplication/entry/src/main/ets/pages/ItemPage.ets#L57-L62 | 6c6229ea9851478e9caa65add3010b43b58fd2e9 | github |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/models/StringUtils.ets | arkts | string2Uint8Array2 | string转Uint8Array
@param value 包含要编码的文本的源字符串
@param dest 存储编码结果的Uint8Array对象实例
@returns 它返回一个包含读取和写入的两个属性的对象 | string2Uint8Array2(value: string, dest: Uint8Array) {
if (!value) return null;
if (!dest) dest = new Uint8Array(value.length);
let textEncoder = new util.TextEncoder();
//read:它是一个数值,指定转换为 UTF-8 的字符串字符数。如果 uint8Array 没有足够的空间,这可能小于 src.length(length of source 字符串)。
//dest:也是一个数值,指定存储在目标 Uint8Array 对象... | AST#method_declaration#Left string2Uint8Array2 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#Left dest : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary... | string2Uint8Array2(value: string, dest: Uint8Array) {
if (!value) return null;
if (!dest) dest = new Uint8Array(value.length);
let textEncoder = new util.TextEncoder();
textEncoder.encodeIntoUint8Array(value, dest)
} | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/StringUtils.ets#L22-L32 | 3573f52d4f8cc9a4f96c2daa49eb697e588baa85 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | createAVPlayer | Creates a videoPlayer object. | async createAVPlayer() {
let avPlayer: media.AVPlayer = await media.createAVPlayer();
this.avPlayer = avPlayer;
this.bindState();
} | AST#method_declaration#Left async createAVPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualif... | async createAVPlayer() {
let avPlayer: media.AVPlayer = await media.createAVPlayer();
this.avPlayer = avPlayer;
this.bindState();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets#L51-L55 | bc564f2c8a2524e5101de156c77af67669e5d016 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/an0n-chat-lib/0.1.5/package/build/service/service.ets | arkts | 后缀转换 | export class Service {
// 显式声明类属性(约束18)
public name: string;
public directory: string;
constructor(name: string, directory: string) {
this.name = name;
this.directory = directory;
}
extractTokens(content: string): List<Token> {
let _a: string | undefined;
const ... | AST#export_declaration#Left export AST#class_declaration#Left class Service AST#class_body#Left { // 显式声明类属性(约束18) AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#... | export class Service {
public name: string;
public directory: string;
constructor(name: string, directory: string) {
this.name = name;
this.directory = directory;
}
extractTokens(content: string): List<Token> {
let _a: string | undefined;
const tokens = new Lis... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/service.ets#L15-L52 | fd29b17723623ee8779f6ce19bcad8d1abee2643 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | startAnimation | 开始动画循环 | startAnimation() {
this.animationId = setInterval(() => {
this.updateIcons()
this.drawAllIcons()
}, 16) // 约60fps的刷新率
} | AST#method_declaration#Left startAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationId AST#member_expression#R... | startAnimation() {
this.animationId = setInterval(() => {
this.updateIcons()
this.drawAllIcons()
}, 16)
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L251-L256 | a61eb65675ff6da5dbdeff13c31a63cab1f40484 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DeviceUtils.ets | arkts | isHuaweiDevice | 判断是否为华为设备 (精确匹配) | static isHuaweiDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'huawei';
} | AST#method_declaration#Left static isHuaweiDevice 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#binary_e... | static isHuaweiDevice(): boolean {
return DeviceUtil.getPhoneBrand() === 'huawei';
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L67-L69 | 706bd49a4b4e51925ce061d0b2ad99e389d8e25e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/menus/MoveMenuOperation.ets | arkts | onOperateContinue | Move cancel callback | onOperateContinue(): void {
this.onOperateContinueBindImpl();
} | AST#method_declaration#Left onOperateContinue 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#expres... | onOperateContinue(): void {
this.onOperateContinueBindImpl();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/menus/MoveMenuOperation.ets#L97-L99 | 4079b08a6e8c714633f1554a72885e7a4777501a | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/PracticePage.ets | arkts | practiceGraphType | ***************************************统计图************************************************88 | @Builder
practiceGraphType(workoutdata:WorkoutData,isTime:boolean){
Column(){
// 标题行
Row(){
//左边标题
Text((isTime)?'锻炼时长':'卡路里')
.fontSize(24)
.fontColor('#333333')
.fontWeight(500)
.margin({left:15})
//右边数据
Row(){
Text((... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right practiceGraphType AST#parameter_list#Left ( AST#parameter#Left workoutdata : AST#type_annotation#Left AST#primary_type#Left WorkoutData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isTime : AST#type... | @Builder
practiceGraphType(workoutdata:WorkoutData,isTime:boolean){
Column(){
Row(){
Text((isTime)?'锻炼时长':'卡路里')
.fontSize(24)
.fontColor('#333333')
.fontWeight(500)
.margin({left:15})
Row(){
Text((isTime)?workoutdat... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/PracticePage.ets#L301-L373 | 4f4e3f643bde9ae264e79aed5c37b69b85d3a429 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ClickUtil.ets | arkts | throttle | 防抖Id
节流:在一定时间内,只触发一次
@param func 要执行的回调函数
@param wait = 1500 延时的时间 毫秒
@param immediate = true 是否立即执行 | static throttle(func: () => void, wait: number = 1000, immediate: boolean = true) {
if (immediate) {
if (!ClickUtil.flag) {
ClickUtil.flag = true;
typeof func === 'function' && func();
ClickUtil.throttleTimeoutID = setTimeout(() => {
ClickUtil.flag = false;
clearTim... | AST#method_declaration#Left static throttle AST#parameter_list#Left ( AST#parameter#Left func : AST#type_annotation#Left AST#function_type#Left 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#function_type#R... | static throttle(func: () => void, wait: number = 1000, immediate: boolean = true) {
if (immediate) {
if (!ClickUtil.flag) {
ClickUtil.flag = true;
typeof func === 'function' && func();
ClickUtil.throttleTimeoutID = setTimeout(() => {
ClickUtil.flag = false;
clearTim... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ClickUtil.ets#L37-L57 | 336a393a3b377793c60653d5570bc1e7138fe720 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/ComponentBase.ets | arkts | setTextSize | sets the size of the label text in density pixels min = 6f, max = 24f, default
10f
@param size the text size, in vp | public setTextSize(size: number): void {
if (size > 48)
size = 48;
if (size < 6)
size = 6;
this.mTextSize = size;
} | AST#method_declaration#Left public setTextSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | public setTextSize(size: number): void {
if (size > 48)
size = 48;
if (size < 6)
size = 6;
this.mTextSize = size;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L124-L132 | ef0d5b08b8a19de6c0e9658b9b49b597e6e6a59d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/TabBarModel.ets | arkts | Tab组件信息,包括当前id、标题、切换图片、切换前图片 | export interface TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
defaultIcon: ResourceStr;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TabBarData AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left... | export interface TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
defaultIcon: ResourceStr;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/TabBarModel.ets#L19-L24 | 14e4fdfc4c5668a7ed6b4ea82d9a739175dd7ddc | gitee | |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/PreferenceModel.ets | arkts | deletePreference | 删除 key 对应的 value | async deletePreference(key: string) {
await this.ensurePreferenceInitialized();
if (preference) {
try {
await preference.delete(key);
await preference.flush();
} catch (err) {
console.error(`Failed to delete preference [${key}]:`, err);
}
} else {
console.err... | AST#method_declaration#Left async deletePreference 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#block_statement#Left { AST#statement#Left AST#expression_stateme... | async deletePreference(key: string) {
await this.ensurePreferenceInitialized();
if (preference) {
try {
await preference.delete(key);
await preference.flush();
} catch (err) {
console.error(`Failed to delete preference [${key}]:`, err);
}
} else {
console.err... | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L69-L82 | b7694406de05c150fe64a05fa9894838a35e9e8a | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/Index.ets | arkts | navigateToLogin | 跳转到登录页 | private navigateToLogin(message: string) {
console.info(`Index页面: 跳转到登录页,提示: ${message}`);
promptAction.showToast({
message: message,
duration: 2000
});
router.replaceUrl({
url: 'pages/auth/LoginPage'
});
} | AST#method_declaration#Left private navigateToLogin AST#parameter_list#Left ( AST#parameter#Left message : 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 ... | private navigateToLogin(message: string) {
console.info(`Index页面: 跳转到登录页,提示: ${message}`);
promptAction.showToast({
message: message,
duration: 2000
});
router.replaceUrl({
url: 'pages/auth/LoginPage'
});
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/Index.ets#L73-L83 | 2b40401ec7636eea04af8d110dd7798094816300 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/CsSession.ets | arkts | @file 客服会话
@author Joker.X | export class CsSession {
/**
* ID
*/
id: number = 0;
/**
* 用户ID
*/
userId: number = 0;
/**
* 最后一条消息
*/
lastMsg?: CsMsg | null = null;
/**
* 客服未读消息数
*/
adminUnreadCount: number = 0;
/**
* 用户昵称
*/
nickName: string = "";
/**
* 用户头像
*/
avatarUrl: string = "";
/*... | AST#export_declaration#Left export AST#class_declaration#Left class CsSession AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_decl... | export class CsSession {
id: number = 0;
userId: number = 0;
lastMsg?: CsMsg | null = null;
adminUnreadCount: number = 0;
nickName: string = "";
avatarUrl: string = "";
createTime?: string | null = null;
updateTime?: string | null = null;
constructor(init?: Partial<CsSession>)... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/CsSession.ets#L7-L54 | 8ffdb59f53f4679c1c457cce9336c5e17e505443 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/app/AppConfig.ets | arkts | 应用配置 | export class AppConfig {
// 应用名称
static readonly APP_NAME = 'Universal Starter';
// 应用版本
static readonly APP_VERSION = '1.0.0';
// API 基础地址
static readonly API_BASE_URL = 'https://api.example.com';
// Mock API 地址(开发环境)
static readonly MOCK_API_URL = 'mock://';
// 是否启用 Mock
static readonl... | AST#export_declaration#Left export AST#class_declaration#Left class AppConfig AST#class_body#Left { // 应用名称 AST#property_declaration#Left static readonly APP_NAME = AST#expression#Left 'Universal Starter' AST#expression#Right ; AST#property_declaration#Right // 应用版本 AST#property_declaration#Left static readonly APP_VER... | export class AppConfig {
static readonly APP_NAME = 'Universal Starter';
static readonly APP_VERSION = '1.0.0';
static readonly API_BASE_URL = 'https://api.example.com';
static readonly MOCK_API_URL = 'mock://';
static readonly USE_MOCK = true;
static readonly LOG_LEVEL = 'D... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/app/AppConfig.ets#L4-L28 | 8c57bd5930872bfd8e1f861a9275fa2f052618f0 | github | |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/utils/MoodDB.ets | arkts | registerUser | --- 用户功能 --- | static async registerUser(username: string, password: string): Promise<number> {
if (!MoodDB.rdbStore) return Promise.reject('DB Error');
// 查重
let predicates = new relationalStore.RdbPredicates('USER_TABLE');
predicates.equalTo('username', username);
let resultSet = await MoodDB.rdbStore.query(pred... | AST#method_declaration#Left static async registerUser AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string A... | static async registerUser(username: string, password: string): Promise<number> {
if (!MoodDB.rdbStore) return Promise.reject('DB Error');
let predicates = new relationalStore.RdbPredicates('USER_TABLE');
predicates.equalTo('username', username);
let resultSet = await MoodDB.rdbStore.query(predicate... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/utils/MoodDB.ets#L40-L54 | a926db2a922edf39054eed42df5e73078e62c74a | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/9 11:50
@Version V1.0
@Description Repository | export class Repository extends FinRepository {
constructor(context: Context) {
super(context, new FinVideoApiFactory(context))
}
public getSupportServer(): ServerType {
return ServerType.JELLYFIN
}
protected requireApi(): FinVideoApi {
return super.requireApi() as FinVideoApi
}
/**
* 获... | AST#export_declaration#Left export AST#class_declaration#Left class Repository extends AST#type_annotation#Left AST#primary_type#Left FinRepository AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : A... | export class Repository extends FinRepository {
constructor(context: Context) {
super(context, new FinVideoApiFactory(context))
}
public getSupportServer(): ServerType {
return ServerType.JELLYFIN
}
protected requireApi(): FinVideoApi {
return super.requireApi() as FinVideoApi
}
public ... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L14-L195 | 281899a438d03071bc81b8f8fcb1245361c3d4c4 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getSignalInformation | 获取指定SIM卡槽对应的注册网络信号强度信息列表。
@param slotId 卡槽ID,如果不指定slotId,默认移动数据的SIM卡。
@returns | static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //获取默认移动数据的SIM卡。
let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId);
return signalInfo;
} | AST#method_declaration#Left static async getSignalInformation AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST... | static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId();
let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId);
return signalInfo;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L376-L380 | b0bff0a01aeb8591e971ef183ca32127ba663688 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | isToday | 检查指定位置是否是今天 | private isToday(week: number, dayOfWeek: number): boolean {
if (!this.isValidDay(week, dayOfWeek)) return false;
const dayNumber: number = this.getDayNumber(week, dayOfWeek);
const today: Date = new Date();
const isCurrentMonth: boolean = this.currentYear === today.getFullYear() &&
... | AST#method_declaration#Left private isToday AST#parameter_list#Left ( AST#parameter#Left week : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dayOfWeek : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | private isToday(week: number, dayOfWeek: number): boolean {
if (!this.isValidDay(week, dayOfWeek)) return false;
const dayNumber: number = this.getDayNumber(week, dayOfWeek);
const today: Date = new Date();
const isCurrentMonth: boolean = this.currentYear === today.getFullYear() &&
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4211-L4221 | dc1aafa3098a0b8208063809da7b69ee51c003d6 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/OrderGoodsModal.ets | arkts | 构建订单商品选择弹窗
@returns {void} 无返回值 | build(): void {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContent()
});
} | 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 BottomModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expressi... | build(): void {
BottomModal({
visible: this.visible,
title: this.title,
onDismiss: this.onDismiss,
containerColor: $r("app.color.bg_grey"),
content: (): void => this.ModalContent()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/OrderGoodsModal.ets#L59-L67 | 821874147db4bba8eaea5d46ca631d3613254ef5 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/view/GoodsSearchPage.ets | arkts | GoodsSearchContent | 商品搜索页面内容视图
@returns {void} 无返回值 | @Builder
private GoodsSearchContent() {
Text("商品搜索页面内容视图")
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GoodsSearchContent 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 Text ( AST#expression#Left "商品搜索页面内容视图" AST#exp... | @Builder
private GoodsSearchContent() {
Text("商品搜索页面内容视图")
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsSearchPage.ets#L33-L36 | af51cbb5fd1db0b1508a622f8fbee635f31d3b9e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getSignatureInfoSync | 获取应用包的签名信息
@returns | static getSignatureInfoSync(): bundleManager.SignatureInfo {
return AppUtil.getBundleInfoSync().signatureInfo;
} | AST#method_declaration#Left static getSignatureInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . SignatureInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#sta... | static getSignatureInfoSync(): bundleManager.SignatureInfo {
return AppUtil.getBundleInfoSync().signatureInfo;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L499-L501 | 5b4b025517e6779d8470e8ce273732f5576c11cb | gitee |
yangsongming/ArkTs-HuXiHelper.git | ed148299fc6dcf351bcc0f2863a5aee4885fbaf5 | ets/common/constants/CommonConstants.ets | arkts | Enumerated Value. | export enum EnumeratedValue {
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4,
FIVE = 5,
SIX = 6
} | AST#export_declaration#Left export AST#enum_declaration#Left enum EnumeratedValue AST#enum_body#Left { AST#enum_member#Left ONE = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TWO = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left THREE = ... | export enum EnumeratedValue {
ONE = 1,
TWO = 2,
THREE = 3,
FOUR = 4,
FIVE = 5,
SIX = 6
} | https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/common/constants/CommonConstants.ets#L239-L246 | 97b9c22fe097b3af5453affeb3d5c2982388d321 | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/CategoryListSample/entry/src/main/ets/view/CategoryComponent.ets | arkts | CategoryComponent | This is the list of category item. | @Component
export struct CategoryComponent {
private listData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.listData, (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.float.sub_... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CategoryComponent AST#component_body#Left { AST#property_declaration#Left private listData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Lef... | @Component
export struct CategoryComponent {
private listData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.listData, (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.float.sub_... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/view/CategoryComponent.ets#L8-L60 | 08b6cab6339753fbff4b367952d5895d0682afbc | gitee |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/pages/WeeklyTaskPage.ets | arkts | getInProgressCount | 获取进行中任务数量 | private getInProgressCount(): number {
return this.weeklyTaskTimeRangeList.filter(task => !task.isCompleted).length;
} | AST#method_declaration#Left private getInProgressCount 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#memb... | private getInProgressCount(): number {
return this.weeklyTaskTimeRangeList.filter(task => !task.isCompleted).length;
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L191-L193 | c5b3dd7f59ed11f159fdcbf3fc5408973d87518c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | getConvertKeyPairSync | 获取转换的非对称密钥KeyPair,同步
@param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
@param pubKey 公钥字符串
@param priKey 私钥字符串
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@returns | static getConvertKeyPairSync(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding): cryptoFramework.KeyPair {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pu... | AST#method_declaration#Left static getConvertKeyPairSync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primar... | static getConvertKeyPairSync(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding): cryptoFramework.KeyPair {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyDataBlob(pu... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L199-L207 | 5b48c949e5e8a9393c44a4c570bf9c3c228335cc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/TimedReminderService.ets | arkts | 提醒类型枚举 | export enum ReminderType {
BIRTHDAY_TODAY = 'birthday_today',
BIRTHDAY_UPCOMING = 'birthday_upcoming',
DAILY_CHECK = 'daily_check'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ReminderType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY_TODAY = AST#expression#Left 'birthday_today' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BIRTHDAY_UPCOMING = AST#expression#Left 'birthday_upcoming' AST#expression#Righ... | export enum ReminderType {
BIRTHDAY_TODAY = 'birthday_today',
BIRTHDAY_UPCOMING = 'birthday_upcoming',
DAILY_CHECK = 'daily_check'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L13-L17 | ef844e6d0f6be7dd5a13ae0012d37d5060fbb0c6 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/EmitterUtil.ets | arkts | unSubscribe | 取消事件订阅
@param eventId 事件ID,string类型的eventId不支持空字符串。 | static unSubscribe(eventId: string | number) {
emitter.off(eventId.toString());
} | AST#method_declaration#Left static unSubscribe AST#parameter_list#Left ( AST#parameter#Left eventId : 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 ... | static unSubscribe(eventId: string | number) {
emitter.off(eventId.toString());
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/EmitterUtil.ets#L68-L70 | 174079c2a376cf82b5b53b553ef488805af382f4 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | TextAdaptSection | 文本适配示例
@returns {void} 无返回值 | @Builder
private TextAdaptSection(): void {
Column() {
Row() {
Text($r("app.string.demo_screen_adapt_text_adaptive_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceHorizontalSmall();
Text($r("app.string.demo_screen_... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private TextAdaptSection 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#arkts_ui_element#Left AST... | @Builder
private TextAdaptSection(): void {
Column() {
Row() {
Text($r("app.string.demo_screen_adapt_text_adaptive_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceHorizontalSmall();
Text($r("app.string.demo_screen_... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L201-L226 | 7916a102c9b23818da358fd119af6ee3332bdc1d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildHeader | 构建页面头部 | @Builder
buildHeader() {
AppHeader({
title: '大模型配置',
showBack: true,
showAction: false
})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppHeader ( AST#component_parameters#Left { AST#component_para... | @Builder
buildHeader() {
AppHeader({
title: '大模型配置',
showBack: true,
showAction: false
})
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L556-L563 | 7982baadc3c0a75520a9bc3c3124566855de2b97 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | ScreenAdaptDemoPage | @file 屏幕适配示例页视图
@author Joker.X | @ComponentV2
export struct ScreenAdaptDemoPage {
/**
* 屏幕适配示例页 ViewModel
*/
@Local
private vm: ScreenAdaptDemoViewModel = new ScreenAdaptDemoViewModel();
/**
* 网格示例数据
*/
private gridItems: number[] = [0, 1, 2, 3, 4, 5];
/**
* 断点状态
*/
@Local
private breakpointState: BreakpointState = ge... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ScreenAdaptDemoPage 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... | @ComponentV2
export struct ScreenAdaptDemoPage {
@Local
private vm: ScreenAdaptDemoViewModel = new ScreenAdaptDemoViewModel();
private gridItems: number[] = [0, 1, 2, 3, 4, 5];
@Local
private breakpointState: BreakpointState = getBreakpointState();
private listItems: number[] = [0, 1, 2, 3];
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L17-L295 | 7e4660a9ee1fbc1cf7c53268b996b28a8d76c4f1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | toggleLunarCalendar | 切换农历显示 | private async toggleLunarCalendar(): Promise<void> {
this.showLunarCalendar = !this.showLunarCalendar;
await this.loadCalendarData();
} | AST#method_declaration#Left private async toggleLunarCalendar AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right... | private async toggleLunarCalendar(): Promise<void> {
this.showLunarCalendar = !this.showLunarCalendar;
await this.loadCalendarData();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L176-L179 | 3876cb6162253409156dd41bd24d67523066decf | github |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/databaseability/tables/TodoTable.ets | arkts | deleteData | 删除数据 | deleteData(todoItem: TodoItem, callback: Function) {
let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName);
predicates.equalTo('id', todoItem.id);
this.todoTable.deleteData(predicates, callback);
} | AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left todoItem : AST#type_annotation#Left AST#primary_type#Left TodoItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_... | deleteData(todoItem: TodoItem, callback: Function) {
let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName);
predicates.equalTo('id', todoItem.id);
this.todoTable.deleteData(predicates, callback);
} | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L39-L43 | 6e71af2830b137fcd5b38f14996f039b646bd994 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | queryDatabaseAlarms | Get instant in MainViewModel.
public static getInstant() { if (this.instant == null) { this.instant = new MainViewModel(); } return this.instant; }
Querying alarm task database tables.
@param callback (alarms: Array<AlarmItem>) => void | private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.get(CommonConstants.ALARM_KEY).then((data: string) => {
if (!DataTypeUtils.isNull(data)) {
this.alarms = JSON.parse(data... | AST#method_declaration#Left private queryDatabaseAlarms AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left alarms : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#t... | private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.get(CommonConstants.ALARM_KEY).then((data: string) => {
if (!DataTypeUtils.isNull(data)) {
this.alarms = JSON.parse(data... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets#L54-L62 | 4b1c593c54e6b380fcbe79f03a2c424b15b9f08a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/ReminderScheduler.ets | arkts | loadExistingReminders | 私有方法 | private async loadExistingReminders(): Promise<void> {
try {
const validReminders = await reminderAgentManager.getValidReminders();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Loaded ${validReminders.length} existing reminders`);
} catch (error) {
hilog.error(L... | AST#method_declaration#Left private async loadExistingReminders 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#Rig... | private async loadExistingReminders(): Promise<void> {
try {
const validReminders = await reminderAgentManager.getValidReminders();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Loaded ${validReminders.length} existing reminders`);
} catch (error) {
hilog.error(L... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L502-L511 | 95cb3c0c586e658d413ee45819cfe048943aeb4d | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BackgroundBlur/entry/src/main/ets/pages/FastMode.ets | arkts | FastMode | [Start fast_mode] | @Component
export struct FastMode {
@Consume('navPathStack') navPathStack: NavPathStack;
build() {
NavDestination() {
Stack() {
Stack() {
Image($r('app.media.map')).width('100%').height('100%').borderRadius(15)
Flex({ direction: FlexDirection.ColumnReverse }) {
}
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FastMode AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'navPathStack' AST#expression#Right ) AST#decorator#Right navPathStack : AST#type_annotation#Left AST... | @Component
export struct FastMode {
@Consume('navPathStack') navPathStack: NavPathStack;
build() {
NavDestination() {
Stack() {
Stack() {
Image($r('app.media.map')).width('100%').height('100%').borderRadius(15)
Flex({ direction: FlexDirection.ColumnReverse }) {
}
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BackgroundBlur/entry/src/main/ets/pages/FastMode.ets#L17-L54 | 6948e1bc7a9f49b3a37a45788a45e0d4a862b00e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/immersive/src/main/ets/components/GoodsList.ets | arkts | GoodsList | 超过规定列数6时自动换行 | @Component
export struct GoodsList {
build() {
GridRow({ gutter: { x: GUTTER_X, y: GUTTER_Y }, }) {
// GridRow组件不支持LazyForEach方法
ForEach(PRODUCT_DATA, (item: ProductDataModel) => {
GridCol({ span: SPAN }) {
ItemView({ item: item })
}
}, (item: ProductDataModel) => item.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GoodsList 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 GridRow ( AST#component_parameters#Left { AS... | @Component
export struct GoodsList {
build() {
GridRow({ gutter: { x: GUTTER_X, y: GUTTER_Y }, }) {
ForEach(PRODUCT_DATA, (item: ProductDataModel) => {
GridCol({ span: SPAN }) {
ItemView({ item: item })
}
}, (item: ProductDataModel) => item.id.toString())
}
.pa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/components/GoodsList.ets#L27-L47 | 776bbd05618b2e25ecbeaa23e4395c31ac7ab193 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/hspdephsp/src/main/ets/utils/Calc.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 function add(a:number, b:number) {
return a + b;
} | AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef... | export function add(a:number, b:number) {
return a + b;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/hspdephsp/src/main/ets/utils/Calc.ets#L16-L18 | fb932bfca766dbb6ed6e599dcf39af54a21cf001 | gitee | |
J-Design/ArkUI_Component | d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66 | entry/src/main/ets/component/controller/CustomSlider.ets | arkts | CustomSlider | @author 鼓捣JIA
@date 2023/12/03 23:35 | @Component
export default struct CustomSlider {
@Prop name: string
@Link value: number
@Prop min: number
@Prop max: number
private step? : number
build() {
Column() {
Row() {
Text(this.name)
.fontColor($r('app.color.font_main'))
Blank()
Slider({ value: this.valu... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CustomSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_a... | @Component
export default struct CustomSlider {
@Prop name: string
@Link value: number
@Prop min: number
@Prop max: number
private step? : number
build() {
Column() {
Row() {
Text(this.name)
.fontColor($r('app.color.font_main'))
Blank()
Slider({ value: this.valu... | https://github.com/J-Design/ArkUI_Component/blob/d7ecc33451ec5ebdb01da02616e1b83ecc3bfc66/entry/src/main/ets/component/controller/CustomSlider.ets#L6-L41 | eb03fed74c2c6c8486a69812452780258a0aad51 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets | arkts | getRandomPoem | 随机获取一句诗词 | getRandomPoem(){
return dataArr[Math.floor(Math.random() * dataArr.length)];
} | AST#method_declaration#Left getRandomPoem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left dataArr AST#expression#Right [ AST#expression#Left AST#call_expression#Left ... | getRandomPoem(){
return dataArr[Math.floor(Math.random() * dataArr.length)];
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets#L23-L25 | 7e077db4409d6d4b1506612134b5f53ad636a371 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/pages/player/Player.ets | arkts | Play | 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 Play {
build() {
Column() {
GridRow() {
GridCol({ span: { sm: 12, md: 6, lg: 6 } }) {
Row() {
Image($r('app.media.sing'))
.width(200)
.height(200)
.objectFit(ImageFit.Contain)
}
.margin({ bot... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Play 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_content_body#Left { AST#... | @Component
export struct Play {
build() {
Column() {
GridRow() {
GridCol({ span: { sm: 12, md: 6, lg: 6 } }) {
Row() {
Image($r('app.media.sing'))
.width(200)
.height(200)
.objectFit(ImageFit.Contain)
}
.margin({ bot... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/pages/player/Player.ets#L16-L94 | 5049dd69bf20f4f8fcf1f9ca80e37a59e8f964ce | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | uncompleteTask | 取消完成任务 | async uncompleteTask(id: number): Promise<boolean> {
return await this.updateTask(id, {
completed: false,
completedAt: undefined,
status: AppConstants.TASK_STATUS_PENDING
});
} | AST#method_declaration#Left async uncompleteTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async uncompleteTask(id: number): Promise<boolean> {
return await this.updateTask(id, {
completed: false,
completedAt: undefined,
status: AppConstants.TASK_STATUS_PENDING
});
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L327-L333 | 253853fc7f367a48739cbae5bec6da8195bce571 | github |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | products/phone/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export class Constants {
static readonly DOMAIN: number = 0x00101;
static readonly SECRET_FILE_DIR: string = "/secret.json";
static readonly DISCLAIMER_TITLE_MARGIN: string = "10%";
static readonly DISCLAIMER_CONTENT_MARGIN: string = "3%";
static readonly DISCLAIMER_WIDTH: string = "90%";
static readon... | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly DOMAIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x00101 AST#expression#Right ; AST#prope... | export class Constants {
static readonly DOMAIN: number = 0x00101;
static readonly SECRET_FILE_DIR: string = "/secret.json";
static readonly DISCLAIMER_TITLE_MARGIN: string = "10%";
static readonly DISCLAIMER_CONTENT_MARGIN: string = "3%";
static readonly DISCLAIMER_WIDTH: string = "90%";
static readon... | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/products/phone/src/main/ets/common/Constants.ets#L18-L48 | 16d0de7cb5c33a9d42509e93311cd1187e59f45c | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets | arkts | BuilderNodePoolDemoComponent | 功能描述: 本示例是全局自定义组件复用实现的示例代码,主要讲解如何通过BuilderNode创建全局的自定义组件复用池,实现跨页面的组件复用。
推荐场景: 自定义全局组件复用
核心组件:
1. BuilderNodePool
实现步骤:
1. 使用List+Swiper实现Tabs页面切换
2. 继承NodeController,实现makeNode,用于组件的创建或刷新,并在组件隐藏时(aboutToDisappear)回收组件
3. 使用单例模式实现复用池,应用内统一管理组件复用。添加getNode方法,根据传入的type参数,获取对应的Node组件,如果未找到,则重新创建,实现recycleNode方法,回收Node组件... | @Component
export struct BuilderNodePoolDemoComponent {
@State arrayTitle: Title[] = [];
arrayStr: string[] = [Constants.HOME, Constants.FILM, Constants.TELEPLAY, Constants.ANIMATION, Constants.SPORT];
@State array: TitleDataSource = new TitleDataSource();
swiperController: SwiperController = new SwiperControll... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BuilderNodePoolDemoComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right arrayTitle : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Title... | @Component
export struct BuilderNodePoolDemoComponent {
@State arrayTitle: Title[] = [];
arrayStr: string[] = [Constants.HOME, Constants.FILM, Constants.TELEPLAY, Constants.ANIMATION, Constants.SPORT];
@State array: TitleDataSource = new TitleDataSource();
swiperController: SwiperController = new SwiperControll... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets#L38-L110 | 6b4d52847ea18df3a9b068677be322f16c752cfd | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/transitionanimation/src/main/ets/components/pages/CardPage.ets | arkts | onExpandCardIdChange | 底部导航栏高度 | onExpandCardIdChange() {
// expandCardId 发生变化时,意味着展开状态发生变化,从而改变this.isCardExpand值
animateTo({ duration: 200, onFinish: this.onBackAnimationFinish }, () => {
this.isCardExpand = this.expandCardId === this.cardData.id;
})
} | AST#method_declaration#Left onExpandCardIdChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // expandCardId 发生变化时,意味着展开状态发生变化,从而改变this.isCardExpand值 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_para... | onExpandCardIdChange() {
animateTo({ duration: 200, onFinish: this.onBackAnimationFinish }, () => {
this.isCardExpand = this.expandCardId === this.cardData.id;
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/transitionanimation/src/main/ets/components/pages/CardPage.ets#L28-L33 | ed52f069f9e2d7b9517224d105d11fc537cfc159 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | executeSuggestion | 执行建议操作 | private async executeSuggestion(suggestion: SuggestedAction): Promise<void> {
try {
switch (suggestion.type) {
case ActionType.VIEW_BIRTHDAYS:
await this.sendMessage(); | AST#method_declaration#Left private async executeSuggestion AST#parameter_list#Left ( AST#parameter#Left suggestion : AST#type_annotation#Left AST#primary_type#Left SuggestedAction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type... | private async executeSuggestion(suggestion: SuggestedAction): Promise<void> {
try {
switch (suggestion.type) {
case ActionType.VIEW_BIRTHDAYS:
await this.sendMessage(); | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L552-L556 | b2dddab28e7f83b231a332098b178ebd9c925dc1 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Video object collection. | export const VIDEO_DATA: VideoItem[] = [
new VideoItem('video1', {} as resourceManager.RawFileDescriptor, 'video1.mp4',),
new VideoItem('video2', {} as resourceManager.RawFileDescriptor, '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 VideoItem [ ] 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: VideoItem[] = [
new VideoItem('video1', {} as resourceManager.RawFileDescriptor, 'video1.mp4',),
new VideoItem('video2', {} as resourceManager.RawFileDescriptor, 'video2.mp4',)
] | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L144-L147 | 762488057cd39415e2655dcff1fa8154d3405be0 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ScreenUtils.ets | arkts | hideKeyboard | 隐藏键盘 | static hideKeyboard(): void {
// 实际实现需要使用 InputMethod 相关API
// InputMethod.hideKeyboard();
} | AST#method_declaration#Left static hideKeyboard 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 { // 实际实现需要使用 InputMethod 相关API // InputMethod.hideKeyboard(); } AST#builder_function... | static hideKeyboard(): void {
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ScreenUtils.ets#L72-L75 | e90a36798815f511798aaef48c3527acb6b4ae07 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/JumpSearch.ets | arkts | searchOptimized | 优化的跳跃查找,使用动态步长
@param arr 已排序的数组
@param target 目标值
@returns 目标值在数组中的索引,如果不存在则返回-1 | public static searchOptimized(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
const n = arr.length;
let step = Math.floor(Math.sqrt(n));
let prev = 0;
// 使用动态步长进行跳跃
while (prev < n && arr[prev] < target) {
prev += step;
step = Math.fl... | AST#method_declaration#Left public static searchOptimized AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_anno... | public static searchOptimized(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
const n = arr.length;
let step = Math.floor(Math.sqrt(n));
let prev = 0;
while (prev < n && arr[prev] < target) {
prev += step;
step = Math.floor(Math.sqrt... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/JumpSearch.ets#L52-L81 | 23c223f21aa4ee05bd83a4e19a69962f52f334ce | github |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/utils/crypto.ets | arkts | md5 | @throws | static md5(msg: string) {
const buf = buffer.from(msg, 'utf-8')
const md5 = cryptoFramework.createMd('MD5')
md5.updateSync({ data: new Uint8Array(buf.buffer) })
return buffer.from(md5.digestSync().data).toString('hex')
} | AST#method_declaration#Left static md5 AST#parameter_list#Left ( AST#parameter#Left msg : 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#variable_declaration#Left cons... | static md5(msg: string) {
const buf = buffer.from(msg, 'utf-8')
const md5 = cryptoFramework.createMd('MD5')
md5.updateSync({ data: new Uint8Array(buf.buffer) })
return buffer.from(md5.digestSync().data).toString('hex')
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/utils/crypto.ets#L51-L56 | 4e85e306154298e5e7ed99022fe264a2b1437aaf | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets | arkts | MARK: - 录音数据库访问类 | export class SpeechRecordDbAccessor extends UserDbSuperAccess {
// 单例实例
private static instance: SpeechRecordDbAccessor;
// 数据库访问器
// private db: DBAccessor | null = null;
private constructor(){ super();}
public static get shared(): SpeechRecordDbAccessor {
if (!SpeechRecordDbAccessor.instance) {
... | AST#export_declaration#Left export AST#class_declaration#Left class SpeechRecordDbAccessor extends AST#type_annotation#Left AST#primary_type#Left UserDbSuperAccess AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 单例实例 AST#property_declaration#Left private static instance : AST#type_annotation#L... | export class SpeechRecordDbAccessor extends UserDbSuperAccess {
private static instance: SpeechRecordDbAccessor;
private constructor(){ super();}
public static get shared(): SpeechRecordDbAccessor {
if (!SpeechRecordDbAccessor.instance) {
SpeechRecordDbAccessor.instance = new SpeechRecordDbA... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L30-L197 | 41e40b2c76f3c7415c931af595cddafe40cd2058 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWarmPlayerView.ets | arkts | onCastPlayDuration | 投屏播放时长。
@param duration:number 播放总时长 ,单位ms | onCastPlayDuration(duration: number){
this.totalDuration = duration;
} | AST#method_declaration#Left onCastPlayDuration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#... | onCastPlayDuration(duration: number){
this.totalDuration = duration;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L255-L257 | d8c020a3fff89f2ff4ee038498fc9037b5259a8c | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DialogV2.d.ets | arkts | @file
@kit ArkUI
Declare the action when the button of dialog is clicked.
@typedef { function } AdvancedDialogV2ButtonAction
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export declare type AdvancedDialogV2ButtonAction = () => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type AdvancedDialogV2ButtonAction = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#t... | export declare type AdvancedDialogV2ButtonAction = () => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L30-L30 | adca909e0664d94f998f9325f20a1519511bd595 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/reclaimword/ReclaimWordView.ets | arkts | refreshUIState | ================= 逻辑 ================= | private refreshUIState() {
const hasSelected =
this.isBtnPreClaim1 || this.isBtnPreClaim2 || this.isBtnPreClaim3 ||
this.isBtnPreClaim4 || this.isBtnPreClaim5 || this.isBtnPreClaim6
this.characterCount = this.content.trim().length
this.isSendButtonEnabled = hasSelected ||
(this.character... | AST#method_declaration#Left private refreshUIState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hasSelected = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expressio... | private refreshUIState() {
const hasSelected =
this.isBtnPreClaim1 || this.isBtnPreClaim2 || this.isBtnPreClaim3 ||
this.isBtnPreClaim4 || this.isBtnPreClaim5 || this.isBtnPreClaim6
this.characterCount = this.content.trim().length
this.isSendButtonEnabled = hasSelected ||
(this.character... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/reclaimword/ReclaimWordView.ets#L190-L199 | eca0103957fb5c8cfed70d3113888b29ec2aafcf | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | formatDate | 格式化日期
@param date 日期对象
@param format 格式化字符串,支持: YYYY-MM-DD, MM/DD/YYYY, DD/MM/YYYY等
@returns 格式化后的日期字符串 | static formatDate(date: Date, format: string = 'YYYY-MM-DD'): string {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
const formatMap: Record<st... | AST#method_declaration#Left static formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static formatDate(date: Date, format: string = 'YYYY-MM-DD'): string {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
const formatMap: Record<st... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L16-L41 | 4154fd571720cbcd24ae420bc3b056289fcb8920 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | customTextBuilder | 自定义文本 | @Builder
customTextBuilder(content: string) {
Text(content)
.fontFamily('MyFont')
.fontColor($r('app.color.font_title'))
.fontSize(16)
.padding(5)
.textShadow({
color: Color.Brown,
type: ShadowType.COLOR,
radius: 3,
offsetX: 5,
offsetY: 5,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customTextBuilder AST#parameter_list#Left ( AST#parameter#Left content : 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... | @Builder
customTextBuilder(content: string) {
Text(content)
.fontFamily('MyFont')
.fontColor($r('app.color.font_title'))
.fontSize(16)
.padding(5)
.textShadow({
color: Color.Brown,
type: ShadowType.COLOR,
radius: 3,
offsetX: 5,
offsetY: 5,
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L1288-L1303 | 271a6da68c559877802bfdc265af574bd2684c73 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/crash/CrashReporter.ets | arkts | getCrashes | 获取所有崩溃日志 | getCrashes(): CrashInfo[] {
const crashes: CrashInfo[] = [];
this.crashQueue.forEach((crash) => {
crashes.push(crash);
});
return crashes;
} | AST#method_declaration#Left getCrashes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CrashInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left... | getCrashes(): CrashInfo[] {
const crashes: CrashInfo[] = [];
this.crashQueue.forEach((crash) => {
crashes.push(crash);
});
return crashes;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/crash/CrashReporter.ets#L120-L126 | 4f8747d403bdcc8b3cf9e91d2660eeec5ef1f134 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets | arkts | getUserId | 获取用户id | async getUserId(): Promise<number> {
let accountMgr = account_osAccount.getAccountManager();
return await accountMgr.getOsAccountLocalIdFromProcess();
} | AST#method_declaration#Left async getUserId 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | async getUserId(): Promise<number> {
let accountMgr = account_osAccount.getAccountManager();
return await accountMgr.getOsAccountLocalIdFromProcess();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L82-L85 | 9ccba1eec82ee62406e8e3d5437de91a7d1a8cb9 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/hiDumper/src/main/ets/view/ConditionView.ets | arkts | ConditionView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ConditionView {
@State isShow: boolean = true
build() {
Column() {
Button($r('app.string.showChange'))
.fontSize(20)
.onClick(() => {
this.isShow = !this.isShow;
})
.margin({ top: 30 })
if (this.isShow) {
Row()
.w... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConditionView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_anno... | @Component
export struct ConditionView {
@State isShow: boolean = true
build() {
Column() {
Button($r('app.string.showChange'))
.fontSize(20)
.onClick(() => {
this.isShow = !this.isShow;
})
.margin({ top: 30 })
if (this.isShow) {
Row()
.w... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/hiDumper/src/main/ets/view/ConditionView.ets#L15-L36 | bb10f21a4489883ce1ec250b8254c42766d69688 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.