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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/Constraint.ets | arkts | string类型Callback | export declare type StringCallback = (content: string, dialogId: string) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type StringCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio... | export declare type StringCallback = (content: string, dialogId: string) => void; | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/Constraint.ets#L5-L5 | ebdccea3f1fdc2d140dc964834d3b0bf34f214da | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | bufferToUint8Array | ArrayBuffer转Uint8Array
@param str
@returns | static bufferToUint8Array(src: ArrayBuffer): Uint8Array {
return new Uint8Array(src);
} | AST#method_declaration#Left static bufferToUint8Array AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array ... | static bufferToUint8Array(src: ArrayBuffer): Uint8Array {
return new Uint8Array(src);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L358-L360 | ed67eed05303a4a4209494945b591c9a19732925 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/EmptyView.ets | arkts | NetworkErrorView | 网络错误状态组件 | @Component
export struct NetworkErrorView {
onRetry?: () => void;
build() {
EmptyView({
message: '网络连接异常',
description: '请检查网络设置后重试',
icon: $r('app.media.ic_network_error'),
showAction: true,
actionText: '重试',
onAction: this.onRetry
})
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NetworkErrorView AST#component_body#Left { AST#property_declaration#Left onRetry ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST... | @Component
export struct NetworkErrorView {
onRetry?: () => void;
build() {
EmptyView({
message: '网络连接异常',
description: '请检查网络设置后重试',
icon: $r('app.media.ic_network_error'),
showAction: true,
actionText: '重试',
onAction: this.onRetry
})
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/EmptyView.ets#L151-L165 | 9fd5778d8be9e74f2e9bacaefb7287d884f7bf64 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | sendMessageToRemoteService | 连接成功后发送消息 | async function sendMessageToRemoteService() {
console.log('[handle]connectRemoteService sendMessageToRemoteService:')
if (mRemote == null) {
console.log('[handle]connectRemoteService mRemote == null')
prompt.showToast({
message: "mRemote is null"
});
return;
}
let option = new rpc.MessageO... | AST#function_declaration#Left async function sendMessageToRemoteService AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console... | async function sendMessageToRemoteService() {
console.log('[handle]connectRemoteService sendMessageToRemoteService:')
if (mRemote == null) {
console.log('[handle]connectRemoteService mRemote == null')
prompt.showToast({
message: "mRemote is null"
});
return;
}
let option = new rpc.MessageO... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L48-L65 | cc0a3633dd2b4288eaaa2db06e780cac366ea1e5 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | executeRequest | 发起请求
@returns {void} 无返回值 | executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
} | AST#method_declaration#Left executeRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L47-L54 | c4b5b1cbbf4338113ea8dd0b3c641a4f288d41b6 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getTargetVersion | 获取应用运行目标版本。 | static getTargetVersion(): number {
return AppUtils.getBundleInfoSync().targetVersion
} | AST#method_declaration#Left static getTargetVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_... | static getTargetVersion(): number {
return AppUtils.getBundleInfoSync().targetVersion
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L135-L137 | 4dcacaf4e5432d2ab6c7930820b92d773211cc3b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getRawFileContentStr | 获取resources/rawfile目录下对应的rawfile文件内容
@param path rawfile文件路径
@returns | static async getRawFileContentStr(path: string): Promise<string> {
let uint8Array = await ResUtil.getRawFileContent(path);
return StrUtil.unit8ArrayToStr(uint8Array);
} | AST#method_declaration#Left static async getRawFileContentStr AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen... | static async getRawFileContentStr(path: string): Promise<string> {
let uint8Array = await ResUtil.getRawFileContent(path);
return StrUtil.unit8ArrayToStr(uint8Array);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L456-L459 | cd696c42aac17702136b5ba1444cc42ceb365533 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/transform/CropSquareTransformation.ets | arkts | CropSquareTransformation | 图片变换:正方形裁剪效果 | @Sendable
export class CropSquareTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let imageInfo: image.ImageInfo = await toTransform.getImageInfo();
let size: Size = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class CropSquareTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor ... | @Sendable
export class CropSquareTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let imageInfo: image.ImageInfo = await toTransform.getImageInfo();
let size: Size = ... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/CropSquareTransformation.ets#L22-L49 | 40b5b03210a280f103eb066a78ca217401513df7 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/DialogOptions.ets | arkts | ActionSheet参数类 | export class ActionSheetOptions extends DialogOptions {
sheets: Array<SheetInfo | ResourceStr> = []; //title-选项的文本内容、icon-选项的图标、action-选项选中的回调。
confirm?: SheetConfirm | ResourceStr;
} | AST#export_declaration#Left export AST#class_declaration#Left class ActionSheetOptions extends AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left sheets : AST#type_annotation#Left AST#primary_type#Left AST#gen... | export class ActionSheetOptions extends DialogOptions {
sheets: Array<SheetInfo | ResourceStr> = [];
confirm?: SheetConfirm | ResourceStr;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L92-L95 | 9dfd21d67fa06f3a8e5eb5be819d95500aa43c10 | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/models/ThemeModel.ets | arkts | resetToDefault | 重置为默认主题 | async resetToDefault(): Promise<boolean> {
return await this.setCurrentTheme(ThemeType.MINIMAL);
} | AST#method_declaration#Left async resetToDefault 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#typ... | async resetToDefault(): Promise<boolean> {
return await this.setCurrentTheme(ThemeType.MINIMAL);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L292-L294 | 6bb91a637db4686aefb57ed5b4f61a736d3d663e | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | addImageCollapse | NodeInfo add collapse image
@param isHasChildNode whether node has child node | addImageCollapse(isHasChildNode: boolean): void {
if (isHasChildNode) {
this.nodeItemView.imageCollapse =
CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT);
} else {
this.nodeItemView.imageCollapse = undefined;
}
} | AST#method_declaration#Left addImageCollapse AST#parameter_list#Left ( AST#parameter#Left isHasChildNode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim... | addImageCollapse(isHasChildNode: boolean): void {
if (isHasChildNode) {
this.nodeItemView.imageCollapse =
CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT);
} else {
this.nodeItemView.imageCollapse = undefined;
}
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L457-L464 | 2efa5fb1e592594c208fa105827ca827d5ebe33d | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | imageWatermark | 图片添加水印
@param input 输入图片路径
@param watermark 水印图片路径
@param output 输出图片路径
@param position 位置:'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' | public static imageWatermark(
input: string,
watermark: string,
output: string,
position: string = 'bottom-right'
): string[] {
let overlay = '';
switch (position) {
case 'top-left':
overlay = '10:10';
break;
case 'top-right':
overlay = 'main_w-overlay_w-10:... | AST#method_declaration#Left public static imageWatermark AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left watermark : AST#type_annotation#Left AST#primary_type#Left string ... | public static imageWatermark(
input: string,
watermark: string,
output: string,
position: string = 'bottom-right'
): string[] {
let overlay = '';
switch (position) {
case 'top-left':
overlay = '10:10';
break;
case 'top-right':
overlay = 'main_w-overlay_w-10:... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L327-L339 | ad973c4bdd42b82c8045c2fbb89cb22385db8551 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | dividedPieces | / 获取划分好的pieces / 获取划分好的 pieces(完全等效于 Swift 原版逻辑) | private static dividedPieces(
wordIds: number[],
countPerDay: number,
pieceCounts: PieceCount[] | null = null,
isRepeatPieceCount: boolean = false
): Piece[] {
// 将 words 分隔为 piece
const pieces: Piece[] = [];
let tempWordIds: number[] = [...wordIds]; // 剩余wordId,等效 Swift 中的 tempIds
le... | AST#method_declaration#Left private static dividedPieces AST#parameter_list#Left ( AST#parameter#Left wordIds : 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 countPerDay : AST#t... | private static dividedPieces(
wordIds: number[],
countPerDay: number,
pieceCounts: PieceCount[] | null = null,
isRepeatPieceCount: boolean = false
): Piece[] {
const pieces: Piece[] = [];
let tempWordIds: number[] = [...wordIds];
let i = 0;
while (tempWordIds.length > 0) {... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L481-L515 | bf063382ea41d38b41769db3cbb86324691529b2 | github |
zhangyuhang0914/ArkTs-HarmonyOs.git | c9773cad7ebeee413f98ee1a57cc8fba91fecf7d | entry/src/main/ets/components/StateComponent.ets | arkts | holdContent | 占位组件 | @Builder
holdContent() {
if (this.showSkeleton && this.viewState === ViewStateConstant.VIEW_STATE_LOADING) {
CommonSkeleton()
} else {
Column() {
LoadingProgress().width($r('app.float.size_36')).height($r('app.float.size_36')).color('#3598DB')
// Image(this.convertImage())
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right holdContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#L... | @Builder
holdContent() {
if (this.showSkeleton && this.viewState === ViewStateConstant.VIEW_STATE_LOADING) {
CommonSkeleton()
} else {
Column() {
LoadingProgress().width($r('app.float.size_36')).height($r('app.float.size_36')).color('#3598DB')
Text(this.c... | https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/components/StateComponent.ets#L27-L103 | 97f90b55f0e576570c3f8c5117bdfd46b3cae531 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | font-size | export const GOODS_LIST_PADDING: number = 8; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GOODS_LIST_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const GOODS_LIST_PADDING: number = 8; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L24-L24 | 565dc8b83216da6869f463b4dbb8e47caea27fb1 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets | arkts | logger | 取消加载 | logger.info('state playing called'); | AST#method_declaration#Left logger AST#ERROR#Left . in fo AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'state playing called' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | logger.info('state playing called'); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L224-L224 | 85bfcb80bb6672a4541e8fd2300a938147fde512 | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/model/Message.ets | arkts | isOutgoing | 是否"我"发出的消息 | static isOutgoing(senderId: string): boolean {
if (senderId && senderId == (ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)) {
return true;
} else {
return false;
}
} | AST#method_declaration#Left static isOutgoing AST#parameter_list#Left ( AST#parameter#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isOutgoing(senderId: string): boolean {
if (senderId && senderId == (ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)) {
return true;
} else {
return false;
}
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/Message.ets#L66-L72 | 8835538e85a7a3db6a89b75efeb6cab0ad289e52 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets | arkts | The constant of TopBarComponent. | export class TopBar {
/**
* The size of image.
*/
static readonly IMAGE_SIZE: number = 30;
/**
* The height of BalanceComponent.
*/
static readonly HEIGHT: string = '4%';
}; | AST#export_declaration#Left export AST#class_declaration#Left class TopBar AST#class_body#Left { /**
* The size of image.
*/ AST#property_declaration#Left static readonly IMAGE_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AS... | export class TopBar {
static readonly IMAGE_SIZE: number = 30;
static readonly HEIGHT: string = '4%';
}; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets#L276-L286 | b373cf12b519cf920cf1686aba1b952deadb3366 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | isPhone | 判断传入的电话号码格式是否正确。
@param phone
country string 表示电话号码所属国家或地区代码。
options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。
@returns | static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean {
const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option);
return phoneNumberFormat.isValidNumber(phone);
} | AST#method_declaration#Left static isPhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean {
const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option);
return phoneNumberFormat.isValidNumber(phone);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L38-L41 | 3bdff76897a7afc59b51d5cb1cee5ad758a251d4 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the Distribution OS api name.
<p>Independent Software Vendor (ISV) may distribute OHOS with their own OS api name.
distributionOSApiName will return the ISV OS api name
@syscap SystemCapability.Startup.SystemInfo
@since 20
@arkts 1.2 | static get distributionOSApiName(): string; | AST#method_declaration#Left static get AST#ERROR#Left distributionOSApiName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get distributionOSApiName(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L432-L432 | 87afeb9d1046b084ffd3ecfb0c70cded9c96aae3 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkExamplePronUsable | / 检查 例句发音功能 是否可用 | public checkExamplePronUsable(showMessage: boolean = true): boolean {
if (this.isActive) { return true } // 非会员才做检查
if (this.maxExamplePronCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.examplePron)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager... | AST#method_declaration#Left public checkExamplePronUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ... | public checkExamplePronUsable(showMessage: boolean = true): boolean {
if (this.isActive) { return true }
if (this.maxExamplePronCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.examplePron)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L216-L227 | 22ce0c6eb6a69a583eb90b4a5fa6539f12b6116b | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | getMode | Returns the drawing mode for this line dataset
@return | public getMode(): Mode {
return this.mMode;
} | AST#method_declaration#Left public getMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Mode AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#... | public getMode(): Mode {
return this.mMode;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L117-L119 | 050e9345f4234513ca2d8d5b399b1ea26788d7cc | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | clear | Set initial state. | private clear(): void {
this.cropRatio = CropRatioType.RATIO_TYPE_FREE;
this.isFlipHorizontal = false;
this.isFlipVertically = false;
this.rotationAngle = 0;
this.sliderAngle = 0;
} | AST#method_declaration#Left private clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | private clear(): void {
this.cropRatio = CropRatioType.RATIO_TYPE_FREE;
this.isFlipHorizontal = false;
this.isFlipVertically = false;
this.rotationAngle = 0;
this.sliderAngle = 0;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L420-L426 | bcbc49a6225afecdda15b0eb73a3ebc924a51650 | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/pages/RegisterPage.ets | arkts | onConfirm | @description: 修改用户信息
@date: 2024-01-10 23:01
@author wuwenqiang | onConfirm(value) {
this.userData.sex = value;
this.dialogController.close();
} | AST#method_declaration#Left onConfirm AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) 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 AST#member_expression#L... | onConfirm(value) {
this.userData.sex = value;
this.dialogController.close();
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/RegisterPage.ets#L359-L362 | ef5b2684414fb121c5a63da05d3542908cdf54ad | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/DateUtil.ets | arkts | compareDays | 比较日历和指定日期相差的天数(按毫秒级的精度,不足一天将按一天进行计算,正数代表日历时间更早,负数代表日历时间更晚)。
@param date1
@param date2
@returns | static compareDays(date1: number | string | Date, date2: number | string | Date): number {
date1 = DateUtil.getFormatDate(date1);
date2 = DateUtil.getFormatDate(date2);
let calendar: i18n.Calendar = i18n.getCalendar("zh-Hans");
calendar.setTime(date1);
return calendar.compareDays(date2);
} | AST#method_declaration#Left static compareDays AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri... | static compareDays(date1: number | string | Date, date2: number | string | Date): number {
date1 = DateUtil.getFormatDate(date1);
date2 = DateUtil.getFormatDate(date2);
let calendar: i18n.Calendar = i18n.getCalendar("zh-Hans");
calendar.setTime(date1);
return calendar.compareDays(date2);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L268-L274 | cc22b7a22ab0f8f9215aedc68859fb4a72be6e36 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | 时间范围枚举 | export enum TimeRange {
LAST_7_DAYS = 'last_7_days',
LAST_30_DAYS = 'last_30_days',
LAST_90_DAYS = 'last_90_days',
LAST_YEAR = 'last_year',
CUSTOM = 'custom'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TimeRange AST#enum_body#Left { AST#enum_member#Left LAST_7_DAYS = AST#expression#Left 'last_7_days' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LAST_30_DAYS = AST#expression#Left 'last_30_days' AST#expression#Right AST#enum_member#R... | export enum TimeRange {
LAST_7_DAYS = 'last_7_days',
LAST_30_DAYS = 'last_30_days',
LAST_90_DAYS = 'last_90_days',
LAST_YEAR = 'last_year',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L28-L34 | fa89d96830fc4365ebc1508e07336d9e4908bbd3 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets | arkts | 保存当前服务端 发过来的诗词 | export function saveCurrentPoem(obj: PoemFromApi) {
//保存 自行扩展成持久化的效果 保存的就得是一个数组 每一次把当前数据 塞进去数组中。 然后保存新数组。
// let baiShiArr:PoemFromApi[] = [] 这也不对。每次都会置空数组
// 应该用之前上次你存过的数组。 如果是第一次的话。之前没存过。给一个默认空数组。
let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi)
baiShiArr.unshift(obj)
// API9版本。到next时会移除。
... | AST#export_declaration#Left export AST#function_declaration#Left function saveCurrentPoem AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left PoemFromApi AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left... | export function saveCurrentPoem(obj: PoemFromApi) {
let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi)
baiShiArr.unshift(obj)
AppStorage.setOrCreate(Constants.baiShi,baiShiArr)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets#L24-L36 | 88bb1d52e520e6756f7228f517fef58106f3004e | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | getBoolean | 获取布尔值
@param key 键
@param defaultValue 默认值
@returns 布尔值 | async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> {
try {
this.checkInitialized();
return await this.dataPreferences!.get(key, defaultValue) as boolean;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCo... | AST#method_declaration#Left async getBoolean AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar... | async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> {
try {
this.checkInitialized();
return await this.dataPreferences!.get(key, defaultValue) as boolean;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCo... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L150-L159 | 25236cc67faf6e242895928278976c14e9199e1f | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhAlert.ets | arkts | initConfig | 设置默认统一样式 | public static initConfig() {
DialogUtil.setDefaultConfig((config) => {
config.title = ''
config.alignment = DialogAlignment.Center
config.backgroundColor = Color.White
config.cornerRadius = {
topLeft: _borderRadius,
topRight: _borderRadius,
bottomLeft: _borderRadius,
... | AST#method_declaration#Left public static initConfig 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 DialogUtil AST#expression#Right . setDe... | public static initConfig() {
DialogUtil.setDefaultConfig((config) => {
config.title = ''
config.alignment = DialogAlignment.Center
config.backgroundColor = Color.White
config.cornerRadius = {
topLeft: _borderRadius,
topRight: _borderRadius,
bottomLeft: _borderRadius,
... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L52-L65 | 07b606ec45c724013533423cece850570db9629c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets | arkts | addData | 在指定索引位置增加一个元素
@param index | public addData(index: number, data: TabDataModel): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TabDataModel AST#primary_t... | public addData(index: number, data: TabDataModel): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets#L140-L143 | 4c59c711dfe5cfc97fb0e17c46d4f6a940a3017d | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | entry/src/main/ets/pages/LiveEnterPage.ets | arkts | imSDKError | 错误回调
@param im im
@param error 错误 | imSDKError(code: number, errorMsg: string) {
} | AST#method_declaration#Left imSDKError AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMsg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | imSDKError(code: number, errorMsg: string) {
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/entry/src/main/ets/pages/LiveEnterPage.ets#L131-L133 | fa0a15e8c07d445e237d3518d540d8bdaa899deb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/DrawerLayout.ets | arkts | DrawerLayout | 自定义DrawerLayout组件 | @Preview
@ComponentV2
export struct DrawerLayout {
@Require @Param options: DrawerOptions
private scroller: Scroller = new Scroller();
private controller: TextInputController = new TextInputController();
@Local bottom: number = 0; //单位vp
aboutToAppear(): void {
//监听键盘高度
KeyboardUtil.onKeyboardListene... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct DrawerLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right o... | @Preview
@ComponentV2
export struct DrawerLayout {
@Require @Param options: DrawerOptions
private scroller: Scroller = new Scroller();
private controller: TextInputController = new TextInputController();
@Local bottom: number = 0;
aboutToAppear(): void {
KeyboardUtil.onKeyboardListener((show: boole... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/DrawerLayout.ets#L15-L96 | c54bb76ecbe4afbd5decd3634fdcbf35ae720864 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkRequestPage.ets | arkts | 构建通用网络请求示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_network_request_title"),
viewModel: this.vm
}) {
this.NetworkRequestContent();
}
} | 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#resource_expression#Left $r ( AST#expression#Left "app.string.demo_net... | build() {
AppNavDestination({
title: $r("app.string.demo_network_request_title"),
viewModel: this.vm
}) {
this.NetworkRequestContent();
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkRequestPage.ets#L22-L29 | 93276bbc70c9db8fe0fc36e01e2dd41197dc08e0 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | learnedWordIdsWhenNew | / 获取某天的新字wordIds | learnedWordIdsWhenNew(dayOf: DayOf): number[] {
return this.learnedWordIdsFor(dayOf, [BoxType.New]);
} | AST#method_declaration#Left learnedWordIdsWhenNew AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left... | learnedWordIdsWhenNew(dayOf: DayOf): number[] {
return this.learnedWordIdsFor(dayOf, [BoxType.New]);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L319-L321 | 214f720e4ed7a2df9117f4bda4f2bce26814e678 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/UserService.ets | arkts | signOut | 登出 | async signOut(): Promise<boolean> {
this.currentUser = null;
this.loggedIn = false;
return true;
} | AST#method_declaration#Left async signOut 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async signOut(): Promise<boolean> {
this.currentUser = null;
this.loggedIn = false;
return true;
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L83-L87 | 56a0d41794bf523db44c714fa941d451156db9b3 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/formatter/IFillFormatter.ets | arkts | Interface for providing a custom logic to where the filling line of a LineDataSet
should end. This of course only works if setFillEnabled(...) is set to true. | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/IFillFormatter.ets#L25-L25 | 2a691b05ed4cbced653580ac2079909b666caf49 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/view/PoetryMenuEssence.ets | arkts | PoetryMenuEssence | @des 诗单精选模块组件
@author dxin | @Component
export default struct PoetryMenuEssence {
// 默认索引
@State defaultTabsIndex: number = 3
// 诗单精选数据源
PoetryMenuEssenceDataSource: PoetryTypeEssenceJsonType[] =
PoetryMenuEssenceJsonArr as Array<PoetryTypeEssenceJsonType>
build() {
// 精选诗单
Column() {
Text('精选诗单')
.fontSize(20... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct PoetryMenuEssence AST#component_body#Left { // 默认索引 AST#ERROR#Left AST#decorator#Left @ State AST#decorator#Right defaultTabsIndex AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | @Component
export default struct PoetryMenuEssence {
@State defaultTabsIndex: number = 3
PoetryMenuEssenceDataSource: PoetryTypeEssenceJsonType[] =
PoetryMenuEssenceJsonArr as Array<PoetryTypeEssenceJsonType>
build() {
Column() {
Text('精选诗单')
.fontSize(20)
Tabs({ in... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/view/PoetryMenuEssence.ets#L11-L94 | 141830ebbfc5df7f9dee2dbee759042246a7c802 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getCurrentMonthDays | 用于生成当前月份的所有天数的数组
@param year 年
@param month 月
@returns 返回所有天数 | static getCurrentMonthDays(year: number, month: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month);
for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) {
DAYS.push(i);
}
return DAYS;
} | AST#method_declaration#Left static getCurrentMonthDays 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#pri... | static getCurrentMonthDays(year: number, month: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month);
for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) {
DAYS.push(i);
}
return DAYS;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L70-L77 | 3bd6c2714c3f4a7748221ade61f87b0d12f24b5c | gitee |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/bluetooth.ets | arkts | showPairFailedDialog | Show pair failed dialog | showPairFailedDialog() {
this.showPairingFailedDialog();
} | AST#method_declaration#Left showPairFailedDialog 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 . showPairingFail... | showPairFailedDialog() {
this.showPairingFailedDialog();
} | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L630-L632 | b2dee88ae43ac340b6aac407945bd5ce5c51006d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | copySocialMedia | 辅助方法:复制社交媒体对象 | private copySocialMedia(socialMedia: Map<string, string>): Map<string, string> {
const copy = new Map<string, string>();
socialMedia.forEach((value, key) => {
copy.set(key, value);
});
return copy;
} | AST#method_declaration#Left private copySocialMedia AST#parameter_list#Left ( AST#parameter#Left socialMedia : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#t... | private copySocialMedia(socialMedia: Map<string, string>): Map<string, string> {
const copy = new Map<string, string>();
socialMedia.forEach((value, key) => {
copy.set(key, value);
});
return copy;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L59-L65 | a15dd6a847c37d1c221537f411c4423449c15b88 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets | arkts | sendMsg2Target | 发送消息到目的ip和端口 | sendMsg2Target() {
//目的ip和端口
let remoteAddress = { address: this.targetIp, port: this.targetPort, family: 1 }
udpSocket.send({ data: this.sendMsg, address: remoteAddress })
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n"
})
.catch(... | AST#method_declaration#Left sendMsg2Target AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //目的ip和端口 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left remoteAddress = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Le... | sendMsg2Target() {
let remoteAddress = { address: this.targetIp, port: this.targetPort, family: 1 }
udpSocket.send({ data: this.sendMsg, address: remoteAddress })
.then(async () => {
this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n"
})
.catch((e) => {
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets#L137-L147 | 6415dee71e201fca23dbeb838447e138f3d473e5 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SwipeRefresher.d.ets | arkts | SwipeRefresher | Declare component SwipeRefresher
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare component SwipeRefresher
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declare component SwipeRefresher
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20
@noninterop | @Component
export declare struct SwipeRefresher {
/**
* Sets the content when loading.
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the content when loading.
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SwipeRefresher AST#component_body#Left { /**
* Sets the content when loading.
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
... | @Component
export declare struct SwipeRefresher {
@Prop content?: ResourceStr;
@Prop isLoading: boolean;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SwipeRefresher.d.ets#L40-L87 | 66ab9622271ba3dc46b1175e8c2ecb1d8742dae8 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | addCommonHeaders | 添加公共的header
@param headers
@returns | addCommonHeaders(headers: Record<string, string>): EfRcp {
if (headers) {
Object.entries(headers).forEach((row) => {
if (this.cfg.headers) {
this.cfg.headers[row[0]] = row[1];
} else {
this.cfg.headers = {};
this.cfg.headers[row[0]] = row[1];
}
});
... | AST#method_declaration#Left addCommonHeaders AST#parameter_list#Left ( AST#parameter#Left headers : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_anno... | addCommonHeaders(headers: Record<string, string>): EfRcp {
if (headers) {
Object.entries(headers).forEach((row) => {
if (this.cfg.headers) {
this.cfg.headers[row[0]] = row[1];
} else {
this.cfg.headers = {};
this.cfg.headers[row[0]] = row[1];
}
});
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L174-L186 | 919d8f94ed46bd384d36dc3436555e17e12c35bb | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/ScatterDataSet.ets | arkts | copy | @Override | public copy(): DataSet<EntryOhos> {
const entries: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
const copied: ScatterDataSet = new ScatterDataSet(entrie... | AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | public copy(): DataSet<EntryOhos> {
const entries: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
if (this.mEntries != null) {
for (let i = 0; i < this.mEntries.size(); i++) {
entries.add(this.mEntries.get(i).copy());
}
}
const copied: ScatterDataSet = new ScatterDataSet(entrie... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L59-L69 | 80bc942a7bdfa813bb741d54689140d3b8ed4543 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.FoldSplitContainer.d.ets | arkts | FoldSplitContainer | Defines FoldSplitContainer container.
@interface FoldSplitContainer
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | @Component
export declare struct FoldSplitContainer {
/**
* The builder function which will be rendered in the major region of container.
*
* @type { Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
@BuilderParam
primary: Callbac... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct FoldSplitContainer AST#component_body#Left { /**
* The builder function which will be rendered in the major region of container.
*
* @type { Callback<void> }
... | @Component
export declare struct FoldSplitContainer {
@BuilderParam
primary: Callback<void>;
@BuilderParam
secondary: Callback<void>;
@BuilderParam
extra?: Callback<void>;
@Prop
expandedLayoutOptions: ExpandedRegionLayoutOptions;
@Prop
hoverModeLayoutOpti... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L253-L335 | 031358294a240a5542e9efbcc249591c34af2fab | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/view/ProgressEditPanel.ets | arkts | dialogButtonStyle | Custom button style. | @Extend(Text) function dialogButtonStyle() {
.fontSize($r('app.float.button_font'))
.height($r('app.float.dialog_btn_height'))
.width($r('app.float.dialog_btn_width'))
.fontColor($r('app.color.main_blue'))
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function dialogButtonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AS... | @Extend(Text) function dialogButtonStyle() {
.fontSize($r('app.float.button_font'))
.height($r('app.float.dialog_btn_height'))
.width($r('app.float.dialog_btn_width'))
.fontColor($r('app.color.main_blue'))
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/ProgressEditPanel.ets#L103-L108 | 28aa159708b39b919deb4e9241f3d41e6b42ba16 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 生成压缩的通知图标(≤192KB)
@param {Resource | image.PixelMap} src:未压缩的Resource图片或PixelMap对象
@returns {Promise<image.PixelMap>} 返回压缩后的PixelMap对象 | export async function createCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> {
const maxSize = 192 * 1024;
return ImageUtil.createCompressedPixelMap(src, maxSize);
} | AST#export_declaration#Left export AST#function_declaration#Left async function createCompressedIcon AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#... | export async function createCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> {
const maxSize = 192 * 1024;
return ImageUtil.createCompressedPixelMap(src, maxSize);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L431-L434 | fda8ffb85ad84e867da7049628f5c5b3ad851da8 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets | arkts | isEmptyArr | Check array is empty.
@param {Array}arr
@return {boolean} true(empty) | isEmptyArr(arr: Array<string>) {
return arr.length === 0;
} | AST#method_declaration#Left isEmptyArr AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right... | isEmptyArr(arr: Array<string>) {
return arr.length === 0;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets#L46-L48 | 838d56b62fb31adf6fae4dcb664c7c561b4f2d32 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets | arkts | 应用约束60:使用export替代module.exports | export default ReactionCollector; | AST#export_declaration#Left export default AST#expression#Left ReactionCollector AST#expression#Right ; AST#export_declaration#Right | export default ReactionCollector; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets#L58-L58 | 3d61b17b60039bb37deb3b3bfd06dd9012b2f3c0 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/setting/SettingManager.ets | arkts | SettingManager | ============================================================ MARK: - SettingManager - 设置管理器(单例) ============================================================ | @ObservedV2
export class SettingManager {
// MARK: - 单例
private static instance : SettingManager;
public static get shared(): SettingManager {
if (!SettingManager.instance) {
SettingManager.instance = new SettingManager();
}
return SettingManager.instance;
}
// MARK: ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class SettingManager AST#class_body#Left { // MARK: - 单例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left SettingManager AST#primary_type#Right AST#type_annotation#Right... | @ObservedV2
export class SettingManager {
private static instance : SettingManager;
public static get shared(): SettingManager {
if (!SettingManager.instance) {
SettingManager.instance = new SettingManager();
}
return SettingManager.instance;
}
public preferences ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/setting/SettingManager.ets#L45-L222 | d7d759fb919dd02be41e4e22f251309ad86cb0a2 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | redirectForResult | @deprecated
@see {redirectForResult2}
@param name
@param param
@param callback | public static redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) {
ZRouter.getRouterMgr().redirectForResult(name, param, callback)
} | AST#method_declaration#Left public static redirectForResult AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left ObjectO... | public static redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) {
ZRouter.getRouterMgr().redirectForResult(name, param, callback)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L596-L598 | 0e4d1c000f9353372fbde6c9ee01b72d64c9373b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets | arkts | getChamfer | 获取 tabs 尺寸信息 | getChamfer() {
let onLayoutComplete: () => void = (): void => {
let modePosition = componentUtils.getRectangleById(this.tabsId)
if (modePosition.size) {
this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length)
this.tabsListener?.off('draw')
}
}
let FuncDraw = onLa... | AST#method_declaration#Left getChamfer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left onLayoutComplete : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right... | getChamfer() {
let onLayoutComplete: () => void = (): void => {
let modePosition = componentUtils.getRectangleById(this.tabsId)
if (modePosition.size) {
this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length)
this.tabsListener?.off('draw')
}
}
let FuncDraw = onLa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets#L86-L96 | 1cbde21a08f56c2558fff964982b7d432065ec78 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/exception_throw/exception_catch_001_T.ets | arkts | Introduction 异常抛出-catch块 | export function exception_catch_001_T(taint_src : string) {
try {
throw new Error();
} catch (e) {
taint.Sink(taint_src);
}
} | AST#export_declaration#Left export AST#function_declaration#Left function exception_catch_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function exception_catch_001_T(taint_src : string) {
try {
throw new Error();
} catch (e) {
taint.Sink(taint_src);
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_catch_001_T.ets#L6-L12 | 982ee8234b92937621b56264162233df96240903 | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/common/RatingBar.ets | arkts | RatingBar | 星级评分组件
显示 0-5 分的星级评分 | @Component
export struct RatingBar {
@Prop rating: number; // 评分值 (0-5)
private starSize: number = 14; // 星星大小
build() {
Row() {
ForEach([1, 2, 3, 4, 5], (index: number) => {
Text() {
if (this.rating >= index) {
// 满星
Span('★')
.fontSize(this.star... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RatingBar AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right rating : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; ... | @Component
export struct RatingBar {
@Prop rating: number;
private starSize: number = 14;
build() {
Row() {
ForEach([1, 2, 3, 4, 5], (index: number) => {
Text() {
if (this.rating >= index) {
Span('★')
.fontSize(this.starSize)
.fon... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/RatingBar.ets#L6-L35 | bb7c6284b9aee1807ddde4e34a51ca8b1b4d0531 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets | arkts | bottomPenShape | 底部画笔编辑模块,用于切换涂鸦和橡皮擦选中状态,设置线宽 | @Builder
bottomPenShape() {
Row() {
// 涂鸦按钮
Column() {
Image($r('app.media.eraser_screenshot_penshape'))
.fillColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color'))
.width($r('app.integer.eraser_pen_shape_icon_size'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomPenShape AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 涂鸦按钮 AST#arkts... | @Builder
bottomPenShape() {
Row() {
Column() {
Image($r('app.media.eraser_screenshot_penshape'))
.fillColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color'))
.width($r('app.integer.eraser_pen_shape_icon_size'))
.heigh... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L93-L161 | 85eefd9ad7f5bf6d71b70eaf63c73fc3506021ce | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserSettingsUpdate.ets | arkts | Emitted when the client user's settings update.
@event Client#clientUserSettingsUpdate
@param {ClientUserSettings} clientUserSettings The new client user settings | export default UserSettingsUpdateHandler; | AST#export_declaration#Left export default AST#expression#Left UserSettingsUpdateHandler AST#expression#Right ; AST#export_declaration#Right | export default UserSettingsUpdateHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserSettingsUpdate.ets#L28-L28 | e3d742454a4e8c55ea687160aa3db0fd06cb9263 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | init | ============================================================ MARK: - 初始化 | private init(): void {
/// 使用异步获取,以防首次初始化未成功,这样只影响后台线程
setTimeout(() => {
/// 从服务器加载 policies
this.loadNonMemberPolicyIfNeeds()
}, 0)
} | AST#method_declaration#Left private init 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#ui_element_with_modifiers#Le... | private init(): void {
setTimeout(() => {
this.loadNonMemberPolicyIfNeeds()
}, 0)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L86-L92 | bae4d968e88ec05fbbb5223393a948e1de8c0af4 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | envProps | Called when multiple property values are checked.
@since 10 | static envProps(props: EnvPropsOptions[]): void {
for (const prop of props) Environment.envProp(prop.key, prop.defaultValue)
} | AST#method_declaration#Left static envProps AST#parameter_list#Left ( AST#parameter#Left props : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EnvPropsOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | static envProps(props: EnvPropsOptions[]): void {
for (const prop of props) Environment.envProp(prop.key, prop.defaultValue)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L313-L315 | 9d1d190102e15517c35a9d006bdf5e575aba2e37 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语模板接口 | export interface GreetingTemplate {
id: string;
name: string;
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
variables: GreetingVariable[];
isSystem: boolean;
usage: number;
rating: number;
tags: string[];
language?: GreetingLanguage;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingTemplate AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Lef... | export interface GreetingTemplate {
id: string;
name: string;
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
variables: GreetingVariable[];
isSystem: boolean;
usage: number;
rating: number;
tags: string[];
language?: GreetingLanguage;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L336-L348 | 000f94b4c08091b21ce619565401e260f02199fd | github | |
ChangweiZhang/chardet-arkts.git | 3a214882ec6a2753c0fed84162952aa659341c19 | src/main/ets/components/encoding/mbcs.ets | arkts | binarySearch | Binary search implementation (recursive) | function binarySearch(arr: number[], searchValue: number) {
const find = (
arr: number[],
searchValue: number,
left: number,
right: number
): number => {
if (right < left) return -1;
/*
int mid = mid = (left + right) / 2;
There is a bug in the above line;
Joshua Bloch suggests t... | AST#function_declaration#Left function binarySearch 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 searchValue : AST#type_annot... | function binarySearch(arr: number[], searchValue: number) {
const find = (
arr: number[],
searchValue: number,
left: number,
right: number
): number => {
if (right < left) return -1;
const mid = Math.floor((left + right) >>> 1);
if (searchValue > arr[mid]) return find(arr, searchVa... | https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L6-L29 | b49737bb746cc6f2fa3e2a9f5d5e4c0a24748bc8 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/proportionCapability/ProportionCapability.ets | arkts | slider | Bottom slider - adjust container size through slider drag interaction. | @Builder
slider() {
Slider({ value: 100, min: 25, max: 50 })
.blockColor(Color.White)
.width('60%')
.height(50)
.onChange((value: number) => {
this.rate = value / 100;
})
.position({ x: '20%', y: '80%' })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right slider 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 Slider ( AST#component_parameters#Left { AST#component_parameter#Le... | @Builder
slider() {
Slider({ value: 100, min: 25, max: 50 })
.blockColor(Color.White)
.width('60%')
.height(50)
.onChange((value: number) => {
this.rate = value / 100;
})
.position({ x: '20%', y: '80%' })
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/proportionCapability/ProportionCapability.ets#L23-L33 | 365b4ebe6d3784b4ab1dea2febc0c748106ec6b7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets | arkts | pushCreateRoom | 跳转至CreateRoom页面 | pushCreateRoom(): void {
router.pushUrl({
url: 'pages/CreateRoom',
params: {
'userId': this.userId,
'socketType': this.socketType[this.selectAgreementIndex]
}
});
} | AST#method_declaration#Left pushCreateRoom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | pushCreateRoom(): void {
router.pushUrl({
url: 'pages/CreateRoom',
params: {
'userId': this.userId,
'socketType': this.socketType[this.selectAgreementIndex]
}
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L179-L187 | 678108e04acf2006be3527727c2e984ace0671fe | gitee |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/itemview/ShortCutSelectItem.ets | arkts | @Local selectStatus: boolean = false | build() {
RelativeContainer() {
Text(this.itemData.cardBean.name)
.fontSize(30)
.fontColor('#ffffff')
.margin({ left: 15, top: 15 })
Image(this.itemData.cardBean.imageSrc)
.width(140)
.height(140)
.alignRules({
center: { anchor: "__container__",... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres... | build() {
RelativeContainer() {
Text(this.itemData.cardBean.name)
.fontSize(30)
.fontColor('#ffffff')
.margin({ left: 15, top: 15 })
Image(this.itemData.cardBean.imageSrc)
.width(140)
.height(140)
.alignRules({
center: { anchor: "__container__",... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ShortCutSelectItem.ets#L12-L46 | c99022ca5e6d9eaa75c49b4ed10f6672c20615f3 | github | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/component/FlipCard.ets | arkts | flipCard | 翻转卡片 | private flipCard(): void {
this.isFlipped = !this.isFlipped;
animateTo({
duration: 600,
curve: Curve.EaseInOut
}, () => {
this.rotateAngle = this.isFlipped ? 180 : 0;
});
} | AST#method_declaration#Left private flipCard 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#expression_statement#Left AST#expression#Left AST#assignment_expressi... | private flipCard(): void {
this.isFlipped = !this.isFlipped;
animateTo({
duration: 600,
curve: Curve.EaseInOut
}, () => {
this.rotateAngle = this.isFlipped ? 180 : 0;
});
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/component/FlipCard.ets#L10-L18 | fe06f76a1bffc2b3a0dae0012860be87b3a46bc5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/DeviceDataModel.ets | arkts | Copyright (c) 2020-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,... | export class DeviceDataModel {
deviceId: string
deviceName: string
deviceType: string
checked: boolean
networkId: string
range: number
constructor | AST#export_declaration#Left export AST#ERROR#Left class DeviceDataModel { deviceId : AST#ERROR#Left string deviceName : string device Type : string checked : boolean networkId : string range : AST#ERROR#Right number AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_dec... | export class DeviceDataModel {
deviceId: string
deviceName: string
deviceType: string
checked: boolean
networkId: string
range: number
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/DeviceDataModel.ets#L16-L24 | a989afa44051421b37c8a3e6e18febe6ec775ae9 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/model/Message.ets | arkts | createChatMsgEntity_INCOME_TEXT | 构建一条收到的消息对象。
@param senderId 发送者uid
@param nickName 发送者昵称
@param message 消息内容
@param time 消息时间戳,0表示使用当前系统时间戳
@returns 新的消息对象 | static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message {
return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT);
} | AST#method_declaration#Left static createChatMsgEntity_INCOME_TEXT AST#parameter_list#Left ( AST#parameter#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left nickName : AST#type_annotation#Left AST#primary_type#... | static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message {
return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L88-L90 | c372d35b698a3b97f2db255697fca045700fc49a | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | setSuccessState | 设置成功状态
@returns {void} 无返回值 | protected setSuccessState(): void {
this.uiState = BaseNetWorkUiState.SUCCESS;
} | AST#method_declaration#Left protected setSuccessState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#L... | protected setSuccessState(): void {
this.uiState = BaseNetWorkUiState.SUCCESS;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L103-L105 | 7c8fa9f6956c82cffd34435ffcc1ff72a2bcb263 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets | arkts | [End streams_Read_Write_File] 查看文件列表 | export function getListFile(): string {
let str = '';
let listFileOption: ListFileOptions = {
recursion: false,
listNum: 0, // 0 表示不限制文件数量
filter: {
suffix: ['.png', '.jpg', '.txt', '.jpeg', '.json'],
displayName: ['*'],
fileSizeOver: 0, // 0 表示列出所有文件,不限制文件大小
lastModifiedAfter: n... | AST#export_declaration#Left export AST#function_declaration#Left function getListFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left ... | export function getListFile(): string {
let str = '';
let listFileOption: ListFileOptions = {
recursion: false,
listNum: 0,
filter: {
suffix: ['.png', '.jpg', '.txt', '.jpeg', '.json'],
displayName: ['*'],
fileSizeOver: 0,
lastModifiedAfter: new Date(0).getTime()
}
};
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets#L122-L140 | 6875932bd193e84ab82b89ef2f96a28c4667d9f6 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/harB/Index.ets | arkts | [Start har_init] | export function harInit(builderName: string): void {
// 根据routerModule中路由表的key值动态加载要跳转的页面的相对路径
switch (builderName) {
case BuilderNameConstants.HARB_B1:
import("./src/main/ets/components/mainpage/B1");
break;
case BuilderNameConstants.HARB_B2:
import("./src/main/ets/components/mainpage/B2"... | AST#export_declaration#Left export AST#function_declaration#Left function harInit AST#parameter_list#Left ( AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS... | export function harInit(builderName: string): void {
switch (builderName) {
case BuilderNameConstants.HARB_B1:
import("./src/main/ets/components/mainpage/B1");
break;
case BuilderNameConstants.HARB_B2:
import("./src/main/ets/components/mainpage/B2");
break;
case BuilderNameConst... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harB/Index.ets#L18-L33 | 64cd56af442e95a8ac151abffe49c2b703d7007f | gitee | |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhAlert.ets | arkts | showTextPicker | 中间弹框,文本选择器
@param options | public static showTextPicker(options: JhTextPickerOptions) {
DialogUtil.showTextPicker({
range: options.data,
value: options.value,
selected: options.selected,
canLoop: false,
onAccept: (value: TextPickerResult) => {
options.onConfirm?.(value)
},
onCancel: () => {
... | AST#method_declaration#Left public static showTextPicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhTextPickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expressi... | public static showTextPicker(options: JhTextPickerOptions) {
DialogUtil.showTextPicker({
range: options.data,
value: options.value,
selected: options.selected,
canLoop: false,
onAccept: (value: TextPickerResult) => {
options.onConfirm?.(value)
},
onCancel: () => {
... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L202-L215 | 556f61a32a3287566f7bea891c4c81a676290f0c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets | arkts | OnChangeSelectDate | 日期选择监听 | OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
} | AST#method_declaration#Left OnChangeSelectDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left PARTS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AS... | OnChangeSelectDate() {
const PARTS: string[] = this.currentSelectDate.split('-');
this.currentSelectDay.year = Number(PARTS[0]);
this.currentSelectDay.month = Number(PARTS[1]);
this.currentSelectDay.date = Number(PARTS[2]);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets#L49-L54 | 58b8d88dca14220ab8a3165d10f20a0696fdd62c | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets | arkts | getBgColorByIsCorrect | 答题卡-显示对、错和未答题的背景色
@param isCorrect
@returns | getBgColorByIsCorrect(isCorrect: boolean | undefined): string {
if (isCorrect === undefined) {
return '#F1F3F5';
}
return isCorrect ? '#64BB5C' : ' #E84026';
} | AST#method_declaration#Left getBgColorByIsCorrect AST#parameter_list#Left ( AST#parameter#Left isCorrect : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramet... | getBgColorByIsCorrect(isCorrect: boolean | undefined): string {
if (isCorrect === undefined) {
return '#F1F3F5';
}
return isCorrect ? '#64BB5C' : ' #E84026';
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L394-L399 | bc1242a60e730b22941a592ac874f0c447457353 | github |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/viewmodel/ShotCutCardData.ets | arkts | HomeCardItemEntity | 首页Banner的Item数据结构 | @ObservedV2
export class HomeCardItemEntity {
type: string=''
name: string=''
itemId: string=''
imageSrc: ResourceStr=''
urlpath: string=''
// constructor(
// type: string,
// name: string,
// itemId: string,
// imageSrc: ResourceStr,
// urlpath: string) {
// this.type = type
// ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class HomeCardItemEntity AST#class_body#Left { AST#ERROR#Left type AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#express... | @ObservedV2
export class HomeCardItemEntity {
type: string=''
name: string=''
itemId: string=''
imageSrc: ResourceStr=''
urlpath: string=''
setData(
type: string,
name: string,
itemId: string,
imageSrc: ResourceStr,
urlpath: string) {
this.type = ... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/ShotCutCardData.ets#L5-L37 | 31bd2c56545043dc2137a1a880621dd737af15c7 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | hasNetVPN | 判断当前网络是否是VPN网络。 | static hasNetVPN(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN);
} | AST#method_declaration#Left static hasNetVPN 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#call_expressi... | static hasNetVPN(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L153-L155 | 12e6718b020798852c1c8347ae7e125e75458bfd | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildHomeContent | 构建首页内容
基于设计规范的现代卡片布局 | @Builder
buildHomeContent() {
Column({ space: 16 }) {
// 欢迎横幅 - 渐变背景卡片
this.buildWelcomeBanner()
// 数据概览卡片
this.buildStatsOverview()
// 今日生日卡片
this.buildTodayBirthdays()
// 即将到来的生日
this.buildUpcomingBirthdays()
// 快捷操作
this.buildQuickActions()
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHomeContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa... | @Builder
buildHomeContent() {
Column({ space: 16 }) {
this.buildWelcomeBanner()
this.buildStatsOverview()
this.buildTodayBirthdays()
this.buildUpcomingBirthdays()
this.buildQuickActions()
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1268-L1286 | c55d727ce58d6625d2e1f351e65d90fcb263e50b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets | arkts | @file 用户信息相关数据源接口
@author Joker.X | export interface UserInfoNetworkDataSource {
/**
* 获取用户个人信息
* @returns 用户信息响应
*/
getPersonInfo(): Promise<NetworkResponse<User>>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfoNetworkDataSource AST#object_type#Left { /**
* 获取用户个人信息
* @returns 用户信息响应
*/ AST#type_member#Left getPersonInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | export interface UserInfoNetworkDataSource {
getPersonInfo(): Promise<NetworkResponse<User>>;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets#L7-L13 | 2b8011b9894da225c6da1fd71cadd3248f9152e2 | github | |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | commonModule/src/main/ets/components/LoginComp.ets | arkts | customStyle | 拓展TextInput的属性,实现共用 | @Extend(TextInput) function customStyle() {
.height(dp(44))
.borderRadius(dp(2))
.backgroundColor('#ffffff')
.border({ width: { bottom: 0.5 }, color: '#e4e4e4' })
.padding({ left: 0 })
.placeholderColor('#C3C3C5')
.caretColor('#fa711d')
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function customStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#c... | @Extend(TextInput) function customStyle() {
.height(dp(44))
.borderRadius(dp(2))
.backgroundColor('#ffffff')
.border({ width: { bottom: 0.5 }, color: '#e4e4e4' })
.padding({ left: 0 })
.placeholderColor('#C3C3C5')
.caretColor('#fa711d')
} | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/components/LoginComp.ets#L180-L188 | 331735a2dcdd6ab2b8f5671b9569f116107f6224 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets | arkts | renderAxisLabels | draws the y-axis labels to the screen | public renderAxisLabels(c: CanvasRenderingContext2D): void {
if (!this.mYAxis || !this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled() || !this.mViewPortHandler) {
return;
}
let positions: number[] = this.getTransformedPositions();
this.mAxisLabelPaint.setFontFamily(this.mYAxis.getType... | AST#method_declaration#Left public renderAxisLabels AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left vo... | public renderAxisLabels(c: CanvasRenderingContext2D): void {
if (!this.mYAxis || !this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled() || !this.mViewPortHandler) {
return;
}
let positions: number[] = this.getTransformedPositions();
this.mAxisLabelPaint.setFontFamily(this.mYAxis.getType... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets#L77-L116 | f96c2f23a3cb2b12ec4fc2545cb713585cc0b10c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | publishPicture | 发布带有图片的通知
@param options 通知实体
@returns | static async publishPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.title,
text: options.text,
... | AST#method_declaration#Left static async publishPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_... | static async publishPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId();
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.title,
text: options.text,
briefT... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L232-L255 | d515cac8286c3dcb013c3afc3cb9675a610fbfd8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | saveConfig | 保存配置 | private async saveConfig(): Promise<void> {
if (!this.apiKey.trim()) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'API key is required');
return;
}
try {
this.loading = true;
const config: LLMConfig = {
provider: this.selectedProvider,
apiKey: this.a... | AST#method_declaration#Left private async saveConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty... | private async saveConfig(): Promise<void> {
if (!this.apiKey.trim()) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'API key is required');
return;
}
try {
this.loading = true;
const config: LLMConfig = {
provider: this.selectedProvider,
apiKey: this.a... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L140-L169 | 2c5ed075039ec4b2caf5968598e89da1ff5054b9 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | totalCount | 获取数组长度。
@returns {number} 返回数组长度。 | public totalCount(): double {
return this.dataArray.length;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public totalCount(): double {
return this.dataArray.length;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L159-L161 | 8ff61875828308bb067fcfec8e95a9b4adbcb81c | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets | arkts | addLastItem | Add last item to the list. | public addLastItem() {
let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length);
this.dataArray.splice(this.dataArray.length, 0, mediaItem);
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public addLastItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mediaItem : AST#type_annotation#Left AST#primary_type#Left MediaItem AST#primary_type#Right AST#type_annotation... | public addLastItem() {
let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length);
this.dataArray.splice(this.dataArray.length, 0, mediaItem);
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L91-L95 | 9eaad9d8e3276ab8bb245c5a3709f5db6a205335 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets | arkts | pictures of recently play. | export const PICTURE_RECENTLY: PictureItem[] = [
{ id: '1', name: '背影', description: '感人的亲情之歌', image: $r("app.media.ic_recently1") },
{ id: '2', name: '废墟之上', description: '勇闯无人之境', image: $r("app.media.ic_recently2") },
{ id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") },
{ i... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PICTURE_RECENTLY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ A... | export const PICTURE_RECENTLY: PictureItem[] = [
{ id: '1', name: '背影', description: '感人的亲情之歌', image: $r("app.media.ic_recently1") },
{ id: '2', name: '废墟之上', description: '勇闯无人之境', image: $r("app.media.ic_recently2") },
{ id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") },
{ i... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets#L30-L35 | 1015b8158e0d36f9ab212fcd00276bc57bf36a1b | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets | arkts | decodeByFormat | 设置期望的format直接解码resources下的图片资源
@returns 位图操作对象。 | public async decodeByFormat(): Promise<image.PixelMap> {
Logger.info('getPixelMap DecodeByFormat Start');
// [Start pixelmap_decode_using_RGBA_8888_format]
let img = await getContext(this).resourceManager.getMediaContent($r('app.media.image'));
let imageSource: image.ImageSource = image.createImageSourc... | AST#method_declaration#Left public async decodeByFormat 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#qualified_type#Left image . PixelMap AST#qualified_type... | public async decodeByFormat(): Promise<image.PixelMap> {
Logger.info('getPixelMap DecodeByFormat Start');
let img = await getContext(this).resourceManager.getMediaContent($r('app.media.image'));
let imageSource: image.ImageSource = image.createImageSource(img.buffer.slice(0));
let decodingOptions: ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L193-L216 | 89ebdfab61dbecf87a7bde172c52ca6334c40d25 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | handleDreamSelection | 梦想选择按钮点击事件 | handleDreamSelection(): void {
// 显示梦想选择对话框
if (this.dreams.length > 0) {
// 创建结构化的按钮数组
const dreamButtons: promptAction.Button[] = this.dreams.map((dream: Dream) => {
const button: promptAction.Button = {
text: dream.title,
color: $r('app.color.text_primary')
};
... | AST#method_declaration#Left handleDreamSelection 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#if_statement#Left if ( AST#expression#Left AST#binar... | handleDreamSelection(): void {
if (this.dreams.length > 0) {
const dreamButtons: promptAction.Button[] = this.dreams.map((dream: Dream) => {
const button: promptAction.Button = {
text: dream.title,
color: $r('app.color.text_primary')
};
return button;
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L1116-L1167 | 9880cd1a0c68e706e07e993a2c4871c5fd20d034 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | addedSalt | 给字符串添加随机盐值
@param str 要加盐的字符串
@returns 加盐后的字符串或null | static addedSalt(str: string | null): string | null {
return SaltUtil.addSalt(str);
} | AST#method_declaration#Left static addedSalt AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa... | static addedSalt(str: string | null): string | null {
return SaltUtil.addSalt(str);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L33-L35 | cfd3ed0588e85be6b696c1873f1dccf71c886e6c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 分页信息接口 | export interface PaginationInfo {
current: number;
pageSize: number;
total: number;
totalPages: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PaginationInfo AST#object_type#Left { AST#type_member#Left current : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pageSize : AST#type_annotat... | export interface PaginationInfo {
current: number;
pageSize: number;
total: number;
totalPages: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L23-L28 | 1aeba35a89e1ebe351cda1618a05bcb0d9968500 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/KvUtil.ets | arkts | put | 存储数据
@param key 存入的key
@param value 存入的数据
@returns 存储结果 | async put(key: string, value: boolean | string | number | Uint8Array): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.put(key, value);
return "存入数据:" + key + "成功~";
}
return "用户禁止授权,存储失败~";
} | AST#method_declaration#Left async put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#... | async put(key: string, value: boolean | string | number | Uint8Array): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.put(key, value);
return "存入数据:" + key + "成功~";
}
return "用户禁止授权,存储失败~";
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L104-L111 | 4c3566e27edf061cd0a927192af4707ade81a4e0 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets | arkts | scan | 扫描wifi | async scan() {
// 获取有关Wi-Fi连接的信息,存入linkedInfo
await this.getLinkedInfo();
// 不停地扫描wifi
let result: Array<WifiType> = await this.wifiModel.getScanInfos();
if (this.isSwitchOn) {
AppStorage.SetOrCreate('wifiList', result);
setTimeout(async () => {
await this.scan();
}, 3000)
... | AST#method_declaration#Left async scan AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取有关Wi-Fi连接的信息,存入linkedInfo AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await... | async scan() {
await this.getLinkedInfo();
let result: Array<WifiType> = await this.wifiModel.getScanInfos();
if (this.isSwitchOn) {
AppStorage.SetOrCreate('wifiList', result);
setTimeout(async () => {
await this.scan();
}, 3000)
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets#L33-L44 | 482702bf53af245b5b582be9e9a4576bf62c3431 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/Index.ets | arkts | ClockInComponent | 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 { ClockInComponent } from './src/main/ets/components/ClockInComponent'; | AST#export_declaration#Left export { ClockInComponent } from './src/main/ets/components/ClockInComponent' ; AST#export_declaration#Right | export { ClockInComponent } from './src/main/ets/components/ClockInComponent'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/Index.ets#L16-L16 | d6a3afdd5ff9929eb72262a23fb168144860c90a | gitee |
openharmony/communication_wifi | 387ba7fa8f98578629a6148635a4d630b2b99aa1 | wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onDevicesChange | 获取p2p设备列表 | private onDevicesChange() {
logUtil.log("onDevicesChange");
this.p2pDeviceList = []
wifiModel.getP2pDevicesCallBack().then((list) => {
logUtil.log('----------------------------- ' + JSON.stringify(list))
for (let i = 0;i < JSON.parse(JSON.stringify(list))
.length; i++) {
if (this.... | AST#method_declaration#Left private onDevicesChange 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 logUtil AST#expression#Right . log AST#m... | private onDevicesChange() {
logUtil.log("onDevicesChange");
this.p2pDeviceList = []
wifiModel.getP2pDevicesCallBack().then((list) => {
logUtil.log('----------------------------- ' + JSON.stringify(list))
for (let i = 0;i < JSON.parse(JSON.stringify(list))
.length; i++) {
if (this.... | https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/index.ets#L324-L338 | 95a75a995a4a3679051db4375fc1e6d1a6bbfca9 | gitee |
Huarrrr/MiShop_HarmonyOS.git | a94d941f50550522c8324416afe4551ed4a2df93 | entry/src/main/ets/net/cookie/CookieUtils.ets | arkts | parseHttpRequestCookies | httpRequest 返回的 cookie 格式:
```
#HttpOnly_www.wanandroid.com FALSE / TRUE 0 JSESSIONID 564CB756D6C2F19456141DA377A0D692
www.wanandroid.com FALSE / FALSE 1705495544 loginUserName chaywong
www.wanandroid.com FALSE / FALSE 1705495544 token_pass d4fb1b1219a552003c5ec2e93221b0b0
.wanandroid.com TRUE / FA... | static parseHttpRequestCookies(cookieString: string): Array<Cookie> {
if (!cookieString) return [];
let cookies: Array<Cookie> = [];
let lines = cookieString.split("\r\n");
lines.forEach((line) => {
let attrs = line.split("\t");
if (attrs.length !== 7 || !attrs[0]) return;
let cookie =... | AST#method_declaration#Left static parseHttpRequestCookies AST#parameter_list#Left ( AST#parameter#Left cookieString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | static parseHttpRequestCookies(cookieString: string): Array<Cookie> {
if (!cookieString) return [];
let cookies: Array<Cookie> = [];
let lines = cookieString.split("\r\n");
lines.forEach((line) => {
let attrs = line.split("\t");
if (attrs.length !== 7 || !attrs[0]) return;
let cookie =... | https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/net/cookie/CookieUtils.ets#L15-L36 | c184fa092da7407b192fad4c1cc970b307e6c312 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | frameworks/text/interface/export/ani/@ohos.graphics.text.ets | arkts | Builds a Paragraph containing text with the given styling information.
@syscap SystemCapability.Graphics.Drawing
@since 12 | export class ParagraphBuilder {
static { loadLibraryWithPermissionCheck('text_engine_ani.z', "@ohos.graphics.text") } | AST#export_declaration#Left export AST#class_declaration#Left class ParagraphBuilder AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left 'text_engine_ani.z' , "@ohos.graphics.text" AST#ERROR#Right ) AST#paramet... | export class ParagraphBuilder {
static { loadLibraryWithPermissionCheck('text_engine_ani.z', "@ohos.graphics.text") } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L123-L124 | f845ac8dbdc88349e745397b1106a372e003ad2e | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets | arkts | FadingEdgeComponent | 功能描述:本案例介绍组件内容边缘渐变的实现,通常用于提示长列表滑动到边缘的场景。
推荐场景:电商、邮箱、资讯、门户等需要降低视觉噪音的场景
核心组件:
1.FadingEdgeComponent
实现思路:
1. 创建可滚动的主页面。
2. 利用颜色渐变通用属性,创建两端渐隐的自定义组件。
3. 通过overlay通用属性,设置子组件为遮罩层。 | @Component
export struct FadingEdgeComponent {
private textArray: number[] = [];
// 渐变起始和终止颜色
@State linearGradientBeginColor: string = Const.BEGIN_COLOR;
@State linearGradientEndColor: string = Const.END_COLOR;
private scroller: Scroller = new Scroller();
aboutToAppear(): void {
for (let i = 0; i < Co... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FadingEdgeComponent AST#component_body#Left { AST#property_declaration#Left private textArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right... | @Component
export struct FadingEdgeComponent {
private textArray: number[] = [];
@State linearGradientBeginColor: string = Const.BEGIN_COLOR;
@State linearGradientEndColor: string = Const.END_COLOR;
private scroller: Scroller = new Scroller();
aboutToAppear(): void {
for (let i = 0; i < Const.ITEM_COU... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets#L33-L178 | 66d34d6fb8a4aecb73884e9d26613db87dda6c7d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DisplayUtils.ets | arkts | getDensityDPI | 其他原有方法保持不变... | public static getDensityDPI(): number {
return DisplayUtils._defaultDisplay.densityDPI;
} | AST#method_declaration#Left public static getDensityDPI 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#mem... | public static getDensityDPI(): number {
return DisplayUtils._defaultDisplay.densityDPI;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L54-L56 | 133aa30c316fb083f38c3b0cec824430eb765f04 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | reset | Resets a setting to default value.
@param key A string, the key of the setting. | static reset(key: string) {
let index = bunch_of_settings.settings_defaults_key.indexOf(key)
let def_value = bunch_of_settings.settings_defaults_value[index]
let type = bunch_of_settings.settings_defaults_type[index];
if (index >= 0) {
if (type == 'string') {
bunch_of_settings.set(key, def... | AST#method_declaration#Left static reset 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#variable_declaration#Left le... | static reset(key: string) {
let index = bunch_of_settings.settings_defaults_key.indexOf(key)
let def_value = bunch_of_settings.settings_defaults_value[index]
let type = bunch_of_settings.settings_defaults_type[index];
if (index >= 0) {
if (type == 'string') {
bunch_of_settings.set(key, def... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L169-L183 | 0fda9c4b805b1f8114841940b912c22b5102c9ae | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets | arkts | bind2LocalAddress | 绑定本地地址 | async bind2LocalAddress() {
//本地地址
let localAddress = { address: "0.0.0.0", family: 1 }
await tlsSocket.bind(localAddress)
.then(() => {
this.msgHistory += 'bind success' + "\r\n";
})
.catch((e) => {
this.msgHistory += 'bind fail ' + e.message + "\r\n";
})
//收到消... | AST#method_declaration#Left async bind2LocalAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#prope... | async bind2LocalAddress() {
let localAddress = { address: "0.0.0.0", family: 1 }
await tlsSocket.bind(localAddress)
.then(() => {
this.msgHistory += 'bind success' + "\r\n";
})
.catch((e) => {
this.msgHistory += 'bind fail ' + e.message + "\r\n";
})
tlsSoc... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L245-L264 | b15931c00eced664410de4626948aeb38f3fce87 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets | arkts | uploadUserData | MARK: - 文件上传方法
上传用户数据到腾讯云COS
@param filePath 本地文件路径
@param toName 上传后的文件名(例如:101.png)
@param proccessing 上传进度回调(0-100)
@param finished 完成回调(是否成功、文件路径、错误信息) | public uploadUserData(
filePath: string,
toName: string,
proccessing: (progress: number) => void,
finished: (success: boolean, filePath?: string, error?: string) => void
) {
// 存储桶名称,由 bucketname-appid 组成,appid 必须填入,可以在 COS 控制台查看存储桶名称。 https://console.cloud.tencent.com/cos5/bucket
let bucket ... | AST#method_declaration#Left public uploadUserData AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toName : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | public uploadUserData(
filePath: string,
toName: string,
proccessing: (progress: number) => void,
finished: (success: boolean, filePath?: string, error?: string) => void
) {
let bucket = CurrentBucket
let cosPath = `${CosConfig.UserDataPrefix}${toName}`
let srcPath = fil... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets#L36-L86 | 9fc7adffc0c7a98c026cd5c5e4f71a83a834531d | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_a.ets | arkts | Introduction export-default/import | export default function cross_file_003_T_a(taint_src : string) {
return taint_src;
} | AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_003_T_a AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | export default function cross_file_003_T_a(taint_src : string) {
return taint_src;
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_a.ets#L6-L8 | 1183c1238b80171442d21beb3a6f38ce324f5160 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets | arkts | mockItem | mock一下桌面静态图的信息 | private mockItem(): GridLayoutItemInfo {
let mockTemp = new GridLayoutItemInfo();
mockTemp.typeId = CommonConstants.TYPE_IMAGE;
mockTemp.page = this.layoutInfo.length;
mockTemp.bundleName = SHOPPING_BUNDLE + '1';
mockTemp.row = 0;
mockTemp.column = 0;
mockTemp.area = CommonConstants.DEFAULT_... | AST#method_declaration#Left private mockItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GridLayoutItemInfo AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#L... | private mockItem(): GridLayoutItemInfo {
let mockTemp = new GridLayoutItemInfo();
mockTemp.typeId = CommonConstants.TYPE_IMAGE;
mockTemp.page = this.layoutInfo.length;
mockTemp.bundleName = SHOPPING_BUNDLE + '1';
mockTemp.row = 0;
mockTemp.column = 0;
mockTemp.area = CommonConstants.DEFAULT_... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L282-L291 | 00b875a7a3c76a17ecfa0baae4fb5cfc711ed345 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.