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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_json/src/main/ets/json/JSONObject.ets | arkts | parseNestedObject | 递归解析字符串
@param nestedJson 待解析的json
@param convertDateStr 是否将日期字符串转换为日期对象
@returns 解析后的结果 | private static parseNestedObject<U>(nestedJson: Record<string, JSONValue>, convertDateStr: boolean = true): U {
let nestedData: Record<string, JSONValue> = {};
for (let key of Object.entries(nestedJson)) {
if (typeof nestedJson[key[0]] === 'object' && nestedJson[key[0]] !== null) {
if (nestedJson[... | AST#method_declaration#Left private static parseNestedObject AST#type_parameters#Left < AST#type_parameter#Left U AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left nestedJson : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#... | private static parseNestedObject<U>(nestedJson: Record<string, JSONValue>, convertDateStr: boolean = true): U {
let nestedData: Record<string, JSONValue> = {};
for (let key of Object.entries(nestedJson)) {
if (typeof nestedJson[key[0]] === 'object' && nestedJson[key[0]] !== null) {
if (nestedJson[... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONObject.ets#L69-L94 | 680c2098ab302fd56bb0e62e81c26e8ddfee4912 | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | startDrawTask | 启动绘画任务。 | private startDrawTask(): void {
this.renderContext.translate(
this.canvasSize / 2,
this.canvasSize / 2);
this.drawClockArea();
this.drawInterval = setInterval(() => {
this.drawClockArea();
}, 40);
} | AST#method_declaration#Left private startDrawTask 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#ex... | private startDrawTask(): void {
this.renderContext.translate(
this.canvasSize / 2,
this.canvasSize / 2);
this.drawClockArea();
this.drawInterval = setInterval(() => {
this.drawClockArea();
}, 40);
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L75-L83 | 359cc929497d84512b2377ced630853a4ba1282f | github |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/model/TaskTimeRange.ets | arkts | 1-低, 2-中, 3-高 | constructor(id: string, taskName: string, startTime: Date, endTime: Date) {
this.id = id;
this.taskName = taskName;
this.startTime = startTime;
this.endTime = endTime;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left taskName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | constructor(id: string, taskName: string, startTime: Date, endTime: Date) {
this.id = id;
this.taskName = taskName;
this.startTime = startTime;
this.endTime = endTime;
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/model/TaskTimeRange.ets#L11-L16 | e39711fd1f095c6e08cf6dccf4582231748d328c | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/DemoCounterState.ets | arkts | decrement | 计数减一(或自定义步长)
@param {number} step - 步长,默认 1
@returns {void} 无返回值
@example
getDemoCounterState().decrement(); // -1 | decrement(step: number = 1): void {
if (this.count - step < 0) {
this.count = 0;
return;
}
this.count -= step;
} | AST#method_declaration#Left decrement AST#parameter_list#Left ( AST#parameter#Left step : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | decrement(step: number = 1): void {
if (this.count - step < 0) {
this.count = 0;
return;
}
this.count -= step;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/DemoCounterState.ets#L42-L48 | e023d46ec4c3c07d078ea1b63b183d3d52fd42bf | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | setDrawOrder | Sets the order in which the provided data objects should be drawn. The
earlier you place them in the provided array, the further they will be in
the background. e.g. if you provide new DrawOrer[] { DrawOrder.BAR,
DrawOrder.LINE }, the bars will be drawn behind the lines.
@param order | public setDrawOrder(order: DrawOrder[]): void {
if (order == null || order.length <= 0)
return;
this.mDrawOrder = order;
} | AST#method_declaration#Left public setDrawOrder AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DrawOrder [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation... | public setDrawOrder(order: DrawOrder[]): void {
if (order == null || order.length <= 0)
return;
this.mDrawOrder = order;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L239-L243 | 4fad4580bebc31b21c739d618ef59a38cea1ae4b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | resetAxisMinimum | By calling this method, any custom minimum value that has been previously set is reset,
and the calculation is
done automatically. | public resetAxisMinimum(): void {
this.mCustomAxisMin = false;
} | AST#method_declaration#Left public resetAxisMinimum 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#Lef... | public resetAxisMinimum(): void {
this.mCustomAxisMin = false;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L711-L713 | 1c5ded0bab02cc8e10ade07b1cc95b07e232e5b3 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerComponent.ets | arkts | resetTimer | 重置计时 | private resetTimer() {
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
this.isRunning = false;
this.isPaused = false;
// 根据当前模式重置时间
this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds;
this.getTimeDigits(this.currentSeconds);
this.cl... | AST#method_declaration#Left private resetTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressio... | private resetTimer() {
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
this.isRunning = false;
this.isPaused = false;
this.currentSeconds = this.isIncrementing ? 0 : this.totalSeconds;
this.getTimeDigits(this.currentSeconds);
this.closeDialog();
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L165-L177 | 21d1bece21d39763af13f6e671eec424a180e155 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TCPBaseTLSClient/entry/src/main/ets/pages/Index.ets | arkts | connect2Server | 连接服务端 | async connect2Server() {
//服务端地址
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
let tcpSocket = socket.constructTCPSocketInstance()
await tcpSocket.connect({ address: serverAddress })
.then(async () => {
this.msgHistory += 'TCP连接成功 ' + ... | AST#method_declaration#Left async connect2Server AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //服务端地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left serverAddress : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . NetAd... | async connect2Server() {
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
let tcpSocket = socket.constructTCPSocketInstance()
await tcpSocket.connect({ address: serverAddress })
.then(async () => {
this.msgHistory += 'TCP连接成功 ' + "\r\n";... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TCPBaseTLSClient/entry/src/main/ets/pages/Index.ets#L146-L183 | 8a1343a8d3945c0cb796a9f5648b13dd8717de24 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets | arkts | getPixelMapData | 一键截图循环滚动截图。 | async getPixelMapData() {
// 记录滚动量数组
this.scrollOffsets.push(this.scroller.currentOffset().yOffset);
// 调用组件截图接口获取当前截图
componentSnapshot.get(Constants.COMPONENT_ID, async (error: Error, pixmap: PixelMap) => {
if (this.listWidth === 0) {
let imageInfo = pixmap.getImageInfoSync();
th... | AST#method_declaration#Left async getPixelMapData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 记录滚动量数组 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#... | async getPixelMapData() {
this.scrollOffsets.push(this.scroller.currentOffset().yOffset);
componentSnapshot.get(Constants.COMPONENT_ID, async (error: Error, pixmap: PixelMap) => {
if (this.listWidth === 0) {
let imageInfo = pixmap.getImageInfoSync();
this.listWidth = imageInfo.si... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mainpage/ScrollableComponentPage.ets#L242-L275 | 04e57a4710228de11ac137f77ed152513ad2888b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/FontConstants.ets | arkts | @author 2008
@datetime 2024/6/28 22:29
@className: FontConstants
通用字体大小样式 | export default class FontConstants{
//字体大小
static readonly FONT_SIZE_12: number = 12;
static readonly FONT_SIZE_14: number = 14;
static readonly FONT_SIZE_16: number = 16;
static readonly FONT_SIZE_18: number = 18;
static readonly FONT_SIZE_20: number = 20;
static readonly FONT_SIZE_22: number = 22;
sta... | AST#export_declaration#Left export default AST#class_declaration#Left class FontConstants AST#class_body#Left { //字体大小 AST#property_declaration#Left static readonly FONT_SIZE_12 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expressi... | export default class FontConstants{
static readonly FONT_SIZE_12: number = 12;
static readonly FONT_SIZE_14: number = 14;
static readonly FONT_SIZE_16: number = 16;
static readonly FONT_SIZE_18: number = 18;
static readonly FONT_SIZE_20: number = 20;
static readonly FONT_SIZE_22: number = 22;
static re... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/FontConstants.ets#L7-L22 | 5312a96efff88b725a6f04de8b09941299dd4434 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/base/BaseSheetOptions.ets | arkts | TODO 半模态工具类,Base参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface BaseSheetOptions extends SheetOptions {
uiContext?: UIContext; //在UIContext实例对应的窗口中显示半模态。说明:使用openBindSheet启动的半模态页面,不支持设置、更新该属性。
dialogId?: string; //弹框id,具有唯一性
targetId?: number | string; //需要绑定组件的ID,若不指定则不绑定任何组件。string类型:传入组件的id,number类型:传入组件的UniqueId this.getUniqueId()。
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BaseSheetOptions AST#extends_clause#Left extends SheetOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation... | export interface BaseSheetOptions extends SheetOptions {
uiContext?: UIContext;
dialogId?: string;
targetId?: number | string;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/BaseSheetOptions.ets#L23-L29 | e249db68533d887c193a6575e03f774a454ff797 | gitee | |
huazheleyoushang/harmony_template.git | 9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8 | entry/src/main/ets/common/constants/StyleConstants.ets | arkts | 通用静态样式 | export default class StyleConstants {
// head aspect ratio.
static readonly HEAD_ASPECT_RATIO: number = 1;
// 2行最小高度
static readonly DOUBLE_ROW_MIN: number = 28;
// Unit 单位
static readonly UNIT_FP: string = 'fp';
// 全屏宽度
static readonly FULL_WIDTH: string = '100%';
// 全屏高度
static readonly FULL_... | AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { // head aspect ratio. AST#property_declaration#Left static readonly HEAD_ASPECT_RATIO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression... | export default class StyleConstants {
static readonly HEAD_ASPECT_RATIO: number = 1;
static readonly DOUBLE_ROW_MIN: number = 28;
static readonly UNIT_FP: string = 'fp';
static readonly FULL_WIDTH: string = '100%';
static readonly FULL_HEIGHT: string = '100%';
static readonly TITLE_B... | https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/common/constants/StyleConstants.ets#L4-L105 | e31c7cf9063cea68cbccf7b1a46b501f7e959a93 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestUpload.ets | arkts | getFilesAndData | 获取上传文件数据 | private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> {
logger.info(TAG, `getFilesAndData begin`);
let files: Array<request.agent.FormItem> = [];
for (let i = 0; i < fileUris.length; i++) {
logger.info(TAG, `getFilesAndData fileUri = ${fileUri... | AST#method_declaration#Left private async getFilesAndData AST#parameter_list#Left ( AST#parameter#Left cacheDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileUris : AST#type_annotation#Left AST#primary_type#Left AST#... | private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> {
logger.info(TAG, `getFilesAndData begin`);
let files: Array<request.agent.FormItem> = [];
for (let i = 0; i < fileUris.length; i++) {
logger.info(TAG, `getFilesAndData fileUri = ${fileUri... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/uploadanddownload/RequestUpload.ets#L129-L146 | 8a437ce6b105856a0176ab449d099cdb0fcb25f3 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PhotoPickerComponent | Declare struct PhotoPickerComponent
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | @Component
export declare struct PhotoPickerComponent {
/**
* PickerOptions
*
* @type { ?PickerOptions }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
pickerOptions?: PickerOptions;
/**
* Callback when select photos o... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct PhotoPickerComponent AST#component_body#Left { /**
* PickerOptions
*
* @type { ?PickerOptions }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Co... | @Component
export declare struct PhotoPickerComponent {
pickerOptions?: PickerOptions;
onSelect?: (uri: string) => void;
onDeselect?: (uri: string) => void;
onItemClicked?: (itemInfo: ItemInfo, clickType: ClickType) => boolean;
onEnterPhotoBrowser?: (photoBrowserInfo: PhotoB... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L27-L147 | ce4cafd999bb5187d9d4a9c10fca9105a32e878f | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BptaUseResources/entry/src/main/ets/pages/music/Recording.ets | arkts | onForeground | ... | onForeground(): void {
//Apply for the resources required by the system, or reapply for the resources released in onBackground ()
audio.createAudioCapturer(audioCapturerOptions, (err, data) => {
if (err) {
console.error(`InvokecreateAudioCapturerfailed,codeis${err.code},messageis${err.message}`);
... | AST#method_declaration#Left onForeground 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 { //Apply for the resources required by the system, or reapply for the resources released in... | onForeground(): void {
audio.createAudioCapturer(audioCapturerOptions, (err, data) => {
if (err) {
console.error(`InvokecreateAudioCapturerfailed,codeis${err.code},messageis${err.message}`);
} else {
console.info('InvokecreateAudioCapturersucceeded.');
}
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/music/Recording.ets#L41-L50 | 73493c8321064721c6fc38bcaeda3b1fc14ad558 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/controller/MapController.ets | arkts | calLandmarksPosition | Calculating Landmark Locations. | calLandmarksPosition(data: AddressItem): void {
data.locations = data.locations.map((item: Location) => {
item.positionX = item.oriPositionX * this.mapMultiples() -
Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF;
item.positionY = item.oriPositionY * this.mapMultiples() -
... | AST#method_declaration#Left calLandmarksPosition AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AddressItem 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#primar... | calLandmarksPosition(data: AddressItem): void {
data.locations = data.locations.map((item: Location) => {
item.positionX = item.oriPositionX * this.mapMultiples() -
Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF;
item.positionY = item.oriPositionY * this.mapMultiples() -
... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L121-L129 | 6e8bb5fe142cb651205f1e02a82c2f312c549d01 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DialogUtils.ets | arkts | TODO 弹窗工具类(AlertDialog)
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class DialogUtils {
public static readonly CACHE_LABEL = "CACHE_LABEL_DialogUtils";
private static defaultConfig: DialogConfig = new DialogConfig(); //默认样式
private static caches: Array<ActionCoreArg> = new Array<ActionCoreArg>();
/**
* 显示弹框(一个按钮的)
* @param options
*/
static showConfirmDialog... | AST#export_declaration#Left export AST#class_declaration#Left class DialogUtils AST#class_body#Left { AST#property_declaration#Left public static readonly CACHE_LABEL = AST#expression#Left "CACHE_LABEL_DialogUtils" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private static defaul... | export class DialogUtils {
public static readonly CACHE_LABEL = "CACHE_LABEL_DialogUtils";
private static defaultConfig: DialogConfig = new DialogConfig();
private static caches: Array<ActionCoreArg> = new Array<ActionCoreArg>();
static showConfirmDialog(options: ConfirmDialogOptions) {
DialogUtils.in... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L40-L380 | 7038cdcd9bd29ac31dbd36e93a9d748a9fc5d44f | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/constants/AppConstants.ets | arkts | UI相关常量 | export class UIConstants {
// 页面路由
static readonly HOME_PAGE = 'pages/main/HomePage';
static readonly CONTACTS_PAGE = 'pages/main/ContactsPage';
static readonly CALENDAR_PAGE = 'pages/main/CalendarPage';
static readonly GREETINGS_PAGE = 'pages/main/GreetingsPage';
static readonly SETTINGS_PAGE = 'pages/main... | AST#export_declaration#Left export AST#class_declaration#Left class UIConstants AST#class_body#Left { // 页面路由 AST#property_declaration#Left static readonly HOME_PAGE = AST#expression#Left 'pages/main/HomePage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CONTACTS_P... | export class UIConstants {
static readonly HOME_PAGE = 'pages/main/HomePage';
static readonly CONTACTS_PAGE = 'pages/main/ContactsPage';
static readonly CALENDAR_PAGE = 'pages/main/CalendarPage';
static readonly GREETINGS_PAGE = 'pages/main/GreetingsPage';
static readonly SETTINGS_PAGE = 'pages/main/Settin... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L103-L157 | 7b690caffd4aef8a584c42981c3d97996d0ced5d | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinJ.ets | arkts | SpinJ | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinJ {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local scaleSize: number = this.spinSize * 0.75;
@Local tran1: number = 0;
private oldSize: number = this.spinSize;
aboutToAppear(): void {
this.oldSize = this.spinSize;
this.scaleSi... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinJ AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinJ {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local scaleSize: number = this.spinSize * 0.75;
@Local tran1: number = 0;
private oldSize: number = this.spinSize;
aboutToAppear(): void {
this.oldSize = this.spinSize;
this.scaleSi... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinJ.ets#L21-L132 | 014655ec4de333d82fc39964ac0e7137db42303e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Language/LanguageManager.ets | arkts | applySavedLanguage | 在 App 启动时调用,应用用户保存的语言(若存在) | static async applySavedLanguage(): Promise<void> {
try {
const prefs = await preferences.getPreferences(getAppContext(), PREF_NAME);
const savedLang = (await prefs.get(KEY_LANG, "")) as string;
if (savedLang === "" ) {
// 未保存,使用默认(不强制设置,保持系统/资源默认)
return;
}
// savedLang... | AST#method_declaration#Left static async applySavedLanguage 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 >... | static async applySavedLanguage(): Promise<void> {
try {
const prefs = await preferences.getPreferences(getAppContext(), PREF_NAME);
const savedLang = (await prefs.get(KEY_LANG, "")) as string;
if (savedLang === "" ) {
return;
}
i18n.System.setAppPreferredLangua... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Language/LanguageManager.ets#L66-L79 | 101f9015579b7f48c7aeee6aae0b4220f048b105 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setGranularity | Set a minimum interval for the axis when zooming in. The axis is not allowed to go below
that limit. This can be used to avoid label duplicating when zooming in.
@param granularity | public setGranularity(granularity: number): void {
this.mGranularity = granularity;
// set this to true if it was disabled, as it makes no sense to call this method with granularity disabled
this.mGranularityEnabled = true;
} | AST#method_declaration#Left public setGranularity AST#parameter_list#Left ( AST#parameter#Left granularity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pri... | public setGranularity(granularity: number): void {
this.mGranularity = granularity;
this.mGranularityEnabled = true;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L426-L430 | 7e1df9a4cf306097eb0cdeb38a6d0e5fbf1a7ff9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getStringArrayValue | 获取指定资源ID对应的字符串数组
@param resId 资源ID值/资源信息 | static async getStringArrayValue(resId: number | Resource): Promise<Array<string>> {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringArrayValue(resId);
} else {
return ResUtil.getResourceManager().getStringArrayValue(resId);
}
} | AST#method_declaration#Left static async getStringArrayValue AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#pa... | static async getStringArrayValue(resId: number | Resource): Promise<Array<string>> {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getStringArrayValue(resId);
} else {
return ResUtil.getResourceManager().getStringArrayValue(resId);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L162-L168 | bdd04b5821b17a9c39cf5d40e93fbdd9338a1d46 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets | arkts | splitTask | [Start postProcess_start] [Start execImageProcessing]
Each task processes a portion of the pixel data and adds the task to the task group. | function splitTask(buffers: ArrayBuffer[], type: AdjustId, value: number): taskpool.TaskGroup {
// Creating a Task Group
let group: taskpool.TaskGroup = new taskpool.TaskGroup();
for (const buffer of buffers) {
try {
group.addTask(imageProcessing, {
// Add a task to a task group
value: v... | AST#function_declaration#Left function splitTask AST#parameter_list#Left ( AST#parameter#Left buffers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ArrayBuffer [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annota... | function splitTask(buffers: ArrayBuffer[], type: AdjustId, value: number): taskpool.TaskGroup {
let group: taskpool.TaskGroup = new taskpool.TaskGroup();
for (const buffer of buffers) {
try {
group.addTask(imageProcessing, {
value: value,
buffer: buffer,
type: type
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets#L335-L351 | 337e0f01082f340b457176047cc7f696d5455b4c | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/MePage.ets | arkts | getDisplayName | 获取展示昵称
@returns {ResourceStr} 展示昵称 | private getDisplayName(): ResourceStr {
const userInfo: User = this.getCurrentUser();
if (this.isLoggedIn() && userInfo.nickName) {
return userInfo.nickName;
}
return $r("app.string.not_logged_in");
} | AST#method_declaration#Left private getDisplayName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#... | private getDisplayName(): ResourceStr {
const userInfo: User = this.getCurrentUser();
if (this.isLoggedIn() && userInfo.nickName) {
return userInfo.nickName;
}
return $r("app.string.not_logged_in");
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L222-L228 | 6f169471029083a847259c4dd7e4bcd39c8bd700 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets | arkts | changeItem | Item交换位置
@param index
@param newIndex | changeItem(index: number, newIndex: number): void {
const tmp: Array<T> = this.deductionData.splice(index, 1);
this.deductionData.splice(newIndex, 0, tmp[0]);
const tmp2: Array<ListItemModifier> = this.modifier.splice(index, 1);
this.modifier.splice(newIndex, 0, tmp2[0]);
} | AST#method_declaration#Left changeItem 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 newIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | changeItem(index: number, newIndex: number): void {
const tmp: Array<T> = this.deductionData.splice(index, 1);
this.deductionData.splice(newIndex, 0, tmp[0]);
const tmp2: Array<ListItemModifier> = this.modifier.splice(index, 1);
this.modifier.splice(newIndex, 0, tmp2[0]);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets#L163-L168 | 0578fb1066f3779e82c84fc66fa0716d45f1d87f | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.collections.d.ets | arkts | flipBitByIndex | Flips the bit value by index in a bit vector.(Flip 0 to 1, flip 1 to 0)
@param { number } index - The index in the bit vector.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Mandatory parameters are left unspecified.
2.Incorrect parameter types.
@throws { BusinessError } 10200001 - The value of in... | flipBitByIndex(index: number): void; | AST#method_declaration#Left flipBitByIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | flipBitByIndex(index: number): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12462-L12462 | daa8ba4ad44ae3a538eaefdce4796a8f633a3184 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | encodePKCS1 | 加密
@param encodeStr 待加密的字符串
@param pubKey RSA公钥 | static async encodePKCS1(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async encodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static async encodePKCS1(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L51-L53 | 68a337175e7a9a11193e9b6679aa325ddfacdad2 | gitee |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/recents/src/main/ets/default/view/RecentMissionsDoubleLayout.ets | arkts | RecentMissionsDoubleLayout | Double-line display of recent task list (pad adaptation). | @Component
export struct RecentMissionsDoubleLayout {
@Link recentMissionsDoubleList: RecentMissionInfo[];
@Link isClickSubComponent: boolean;
private mRecentMissionsViewModel?: RecentMissionsViewModel;
aboutToAppear(): void {
Log.showInfo(TAG, 'aboutToAppear start');
this.mRecentMissionsViewModel = Re... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RecentMissionsDoubleLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right recentMissionsDoubleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type... | @Component
export struct RecentMissionsDoubleLayout {
@Link recentMissionsDoubleList: RecentMissionInfo[];
@Link isClickSubComponent: boolean;
private mRecentMissionsViewModel?: RecentMissionsViewModel;
aboutToAppear(): void {
Log.showInfo(TAG, 'aboutToAppear start');
this.mRecentMissionsViewModel = Re... | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/recents/src/main/ets/default/view/RecentMissionsDoubleLayout.ets#L28-L111 | 84b03d69f0eeae9f7d04aec38654e96faa682114 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets | arkts | addData | 在index位置增加data | public addData(index: number, data: string): 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 string AST#primary_type#Ri... | public addData(index: number, data: string): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets#L85-L88 | 9430992d745c8ebe934399d51dc4df29bea65da0 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/VideoShow/VideoComponent/index.ets | arkts | LivePage | Copyright (c) 2022 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 { LivePage } from './src/main/ets/components/pages/LivePage' | AST#export_declaration#Left export { LivePage } from './src/main/ets/components/pages/LivePage' AST#export_declaration#Right | export { LivePage } from './src/main/ets/components/pages/LivePage' | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoShow/VideoComponent/index.ets#L16-L16 | 4b9d2558e1cfd5d52cab5ec093f73a86eaf47675 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | detectLanguage | 检测语言 | private async detectLanguage(): Promise<void> {
try {
this.detectionResult = await this.languageDetector.detectBestLanguage();
this.detectedLanguages = [
this.detectionResult.detectedLanguage,
...this.detectionResult.alternatives
].filter(lang => lang !== this.currentLanguage);
... | AST#method_declaration#Left private async detectLanguage 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 > AS... | private async detectLanguage(): Promise<void> {
try {
this.detectionResult = await this.languageDetector.detectBestLanguage();
this.detectedLanguages = [
this.detectionResult.detectedLanguage,
...this.detectionResult.alternatives
].filter(lang => lang !== this.currentLanguage);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L560-L573 | 898e6e5a16da5a9f244a01b4e589f0c928642382 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SyncTypes.ets | arkts | 备份相关 | export interface BackupInfo {
id: string;
name: string;
description?: string;
userId: string;
createdAt: string;
size: number; // 字节数
dataTypes: DataType[];
version: string;
checksum: string;
encrypted: boolean;
autoGenerated: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BackupInfo 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#Left AST#... | export interface BackupInfo {
id: string;
name: string;
description?: string;
userId: string;
createdAt: string;
size: number;
dataTypes: DataType[];
version: string;
checksum: string;
encrypted: boolean;
autoGenerated: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L130-L142 | 65af0dae00cf5d32b49a74b44f421c2b891bbde3 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/validation/ValidationUtil.ets | arkts | isValidImageCode | 验证图形验证码是否有效(4位数字或字母)
@param {string} code - 验证码
@returns {boolean} 是否有效 | static isValidImageCode(code: string): boolean {
if (code.length !== 4) {
return false;
}
for (let i = 0; i < code.length; i += 1) {
const current: string = code[i];
const isNumber: boolean = current >= "0" && current <= "9";
const isUpper: boolean = current >= "A" && current <= "Z";... | AST#method_declaration#Left static isValidImageCode AST#parameter_list#Left ( AST#parameter#Left code : 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#prima... | static isValidImageCode(code: string): boolean {
if (code.length !== 4) {
return false;
}
for (let i = 0; i < code.length; i += 1) {
const current: string = code[i];
const isNumber: boolean = current >= "0" && current <= "9";
const isUpper: boolean = current >= "A" && current <= "Z";... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L48-L62 | d92703bc4a4454e3ddda65cd767a6e8f433eef33 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | writeDataSync | 向path写入数据
@param path 文件绝对路径
@param content 文件内容 | writeDataSync(path: string, content: ArrayBuffer | string): boolean {
try {
let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC).fd
fs.writeSync(fd, content)
fs.closeSync(fd)
return true
}
catch (err) {
LogUtil.error('FileUtils writeDataSy... | AST#method_declaration#Left writeDataSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Array... | writeDataSync(path: string, content: ArrayBuffer | string): boolean {
try {
let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC).fd
fs.writeSync(fd, content)
fs.closeSync(fd)
return true
}
catch (err) {
LogUtil.error('FileUtils writeDataSy... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L74-L85 | f5c9afb0f77c8bcd5e1f8571ccce4384c505f36b | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | getCustomUserAgent | Get custom user agent.
@returns { string } Get custom User agent information.
@throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a
AtomicServiceWeb component.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | getCustomUserAgent(): string; | AST#method_declaration#Left getCustomUserAgent 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 | getCustomUserAgent(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L367-L367 | 926b21be318a5fed20bd4b7adfcc1e3642cedd28 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Renames a file in a sync way.
@param file_name The old file name.
@param rename The new file name.
@returns True if success, false otherwise. | export function sandbox_rename_sync(file_name: string, rename: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_old_directory = filesDir + '/' + file_name;
let full_new_directory = filesDir + '/' + rename;
try {
fs.renameSync(full_old_directory... | AST#export_declaration#Left export AST#function_declaration#Left function sandbox_rename_sync AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rename : AST#type_annotat... | export function sandbox_rename_sync(file_name: string, rename: string, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_old_directory = filesDir + '/' + file_name;
let full_new_directory = filesDir + '/' + rename;
try {
fs.renameSync(full_old_directory... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L377-L389 | 67d2b4a0da4e04c513bbc4e38b3504e965642301 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 设置导入导出接口 | export interface SettingsBackup {
version: string;
exportedAt: string;
settings: AppSettings;
checksum: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsBackup AST#object_type#Left { AST#type_member#Left version : 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 exportedAt : AST#type_annot... | export interface SettingsBackup {
version: string;
exportedAt: string;
settings: AppSettings;
checksum: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L481-L486 | 85cebd3eae153309081a35570155d6652f67d563 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/PrefUtil.ets | arkts | delValue | 根据KEY删除
@param key | static delValue(key: string): void {
console.info('PrefUtil delValue {' + key + '} start')
const defStore = PrefUtil.getStore()
defStore?.deleteSync(key)
defStore?.flush()
} | AST#method_declaration#Left static delValue AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | static delValue(key: string): void {
console.info('PrefUtil delValue {' + key + '} start')
const defStore = PrefUtil.getStore()
defStore?.deleteSync(key)
defStore?.flush()
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L99-L104 | 6222a5f80ebf8a2b94875634401dc5a344f9630c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | setPosition | sets the position of the y-labels
@param pos | public setPosition(pos: YAxisLabelPosition): void {
this.mPosition = pos;
} | AST#method_declaration#Left public setPosition AST#parameter_list#Left ( AST#parameter#Left pos : AST#type_annotation#Left AST#primary_type#Left YAxisLabelPosition 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#pr... | public setPosition(pos: YAxisLabelPosition): void {
this.mPosition = pos;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L236-L238 | 37c1dab1fbfa1c1c11f7be3be32f10b5d03db3fd | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageRegistry.ets | arkts | fromJson | 从 JSON 创建消息
⚠️ 注意:需要预先调用 register() 注册类型
@param typeName 消息类型名称
@param json JSON 对象
@returns 创建的消息对象,如果类型未注册则返回 null
使用示例:
```typescript
MessageRegistry.register(Person)
const json = { name: 'Alice', age: 30 }
const person = MessageRegistry.fromJson('test.Person', json)
``` | static fromJson(typeName: string, json: Record<string, Object>): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered.`)
return null
}
return ctor.fromJson(json)
} | AST#method_declaration#Left static fromJson AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | static fromJson(typeName: string, json: Record<string, Object>): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered.`)
return null
}
return ctor.fromJson(json)
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L208-L215 | 32db9ac5374318f0989e4a6e00b00bef045ae826 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets | arkts | cancelCallback | TODO: 知识点: 关闭日志回调 | cancelCallback() : void {
testNapi.cancelLogCallback();
} | AST#method_declaration#Left cancelCallback 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... | cancelCallback() : void {
testNapi.cancelLogCallback();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets#L31-L33 | 9348fa56395684058cc505c0483d32c2ed244f87 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | getColorThemeByType | 根据主题类型获取颜色主题 | private getColorThemeByType(type: ThemeType): ColorTheme | null {
const typeMap = {
[ThemeType.DEFAULT]: 'default_light',
[ThemeType.SPRING]: 'spring_light',
[ThemeType.SUMMER]: 'summer_light',
[ThemeType.AUTUMN]: 'autumn_light',
[ThemeType.WINTER]: 'winter_light',
[ThemeType.BIR... | AST#method_declaration#Left private getColorThemeByType AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ThemeType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_... | private getColorThemeByType(type: ThemeType): ColorTheme | null {
const typeMap = {
[ThemeType.DEFAULT]: 'default_light',
[ThemeType.SPRING]: 'spring_light',
[ThemeType.SUMMER]: 'summer_light',
[ThemeType.AUTUMN]: 'autumn_light',
[ThemeType.WINTER]: 'winter_light',
[ThemeType.BIR... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L787-L799 | 34afcdecfad254ed778e622884ad88b4a184e688 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets | arkts | divideImage2Group | 将选择的头像列表组装为二位数组,用于填充九宫格组件
@param images
@returns | function divideImage2Group(personGroup: (ResourceStr | image.PixelMap)[]): GroupAvatarModel[][] {
let imageGroup: GroupAvatarModel[][] = [];
if (personGroup.length <= 4) {
// 人数少于等于4时,显示两行两列
imageGroup = divideGroupBySize(personGroup, 2);
} else if (personGroup.length <= 9) {
// 人数大于4时,显示三行三列
imag... | AST#function_declaration#Left function divideImage2Group AST#parameter_list#Left ( AST#parameter#Left personGroup : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left AST#qualifi... | function divideImage2Group(personGroup: (ResourceStr | image.PixelMap)[]): GroupAvatarModel[][] {
let imageGroup: GroupAvatarModel[][] = [];
if (personGroup.length <= 4) {
imageGroup = divideGroupBySize(personGroup, 2);
} else if (personGroup.length <= 9) {
imageGroup = divideGroupBySize(personG... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/utils/ImageCombination.ets#L85-L98 | e25a91c2ebf2ef5601072d4ac2deb41a0d4d26a4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | 构建页面UI | build() {
Column() {
// 主内容区域
this.buildMainContent()
// 底部导航栏
this.buildBottomNavigation()
}
.width('100%')
.height('100%')
.backgroundColor(this.themeSettings?.mode === 'dark' ? '#1a1a1a' : '#f5f5f5')
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 主内容区域 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | build() {
Column() {
this.buildMainContent()
this.buildBottomNavigation()
}
.width('100%')
.height('100%')
.backgroundColor(this.themeSettings?.mode === 'dark' ? '#1a1a1a' : '#f5f5f5')
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L94-L105 | 61db99e18d202e1e2fa79f8ca608a7c558cd4332 | github | |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 问答数据
@param date
@returns | export function getWendaData(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `wenda/list/${page}/json`,
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getWendaData AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#... | export function getWendaData(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `wenda/list/${page}/json`,
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L229-L233 | aa322ee5cc45403a538ab9b414d18012149c3466 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isBoolean | 判断是否是Boolean类型 | static isBoolean(value: Object): boolean {
return typeof value === 'boolean';
} | AST#method_declaration#Left static isBoolean AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static isBoolean(value: Object): boolean {
return typeof value === 'boolean';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L33-L35 | ab1838eb10e4ea96e840ecde47c5fcfb424150d3 | gitee |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/pages/SettingPage.ets | arkts | signItem | 个性签名组件。
@param text 个性签名
@param prompt 点击后的提示语 | @Builder signItem(text: ResourceStr, prompt: ResourceStr) {
Text(text)
.width("100%")
.fontSize($r("sys.float.ohos_id_text_size_body2"))
.fontColor(Color.Grey)
.margin($r("app.integer.listitem_overflow_default_margin"))
.width('100%')
.clickEffect({ level: ClickEffectLevel.HEAVY ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right signItem AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left prompt : AST#type_annotation#Left... | @Builder signItem(text: ResourceStr, prompt: ResourceStr) {
Text(text)
.width("100%")
.fontSize($r("sys.float.ohos_id_text_size_body2"))
.fontColor(Color.Grey)
.margin($r("app.integer.listitem_overflow_default_margin"))
.width('100%')
.clickEffect({ level: ClickEffectLevel.HEAVY ... | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/pages/SettingPage.ets#L188-L200 | 657622e4fc6fb9f0f6d3152306c2776d7f7ff189 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LogUtil.ets | arkts | levelLog | 日志打印 | private static levelLog(msg: string, level: hilog.LogLevel) {
if (LogUtil.isHilog) { //hilog打印日志
switch (level) {
case hilog.LogLevel.DEBUG:
hilog.debug(LogUtil.domain, LogUtil.tag, msg);
break
case hilog.LogLevel.INFO:
hilog.info(LogUtil.domain, LogUtil.tag, msg)... | AST#method_declaration#Left private static levelLog AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type... | private static levelLog(msg: string, level: hilog.LogLevel) {
if (LogUtil.isHilog) {
switch (level) {
case hilog.LogLevel.DEBUG:
hilog.debug(LogUtil.domain, LogUtil.tag, msg);
break
case hilog.LogLevel.INFO:
hilog.info(LogUtil.domain, LogUtil.tag, msg); | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L191-L198 | ff5a56a09947ca7117b15216ac7c6b4956a8640e | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/ResPath.ets | arkts | get | 洪恩
获取所有封面图片资源 | static get allImages(): ResPath[] {
return [
]
} | AST#method_declaration#Left static get AST#ERROR#Left all Image s AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResPath [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#sta... | static get allImages(): ResPath[] {
return [
]
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/ResPath.ets#L90-L94 | 6bc3d9dd3e0286478906259eba11b7d3e5142b6e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinT.ets | arkts | SpinT | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinT {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local rotate7: number = 0;
@Local scale1: number = 1;
@Local scale2: number = 1;
@Local scale3: number = 1;
@Local scale4: number = 1;
@Local... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinT AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinT {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local rotate7: number = 0;
@Local scale1: number = 1;
@Local scale2: number = 1;
@Local scale3: number = 1;
@Local scale4: number = 1;
@Local... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinT.ets#L22-L319 | 389af9f541e83cbd2d0949169df8cd0e1545815f | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets | arkts | WaterFlowView | 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... | @Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WaterFlowView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_a... | @Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets#L16-L38 | 2eca8d279fd9f99cbd1e3034126ca71a8a8fab26 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | playAnimation | 播放AR动画 | async playAnimation(animationName: string, modelId?: string): Promise<void> {
try {
if (modelId) {
await this.playModelAnimation(modelId, animationName);
} else {
await this.playSceneAnimation(animationName);
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, ... | AST#method_declaration#Left async playAnimation AST#parameter_list#Left ( AST#parameter#Left animationName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left modelId ? : AST#type_annotation#Left AST#primary_type#Left string A... | async playAnimation(animationName: string, modelId?: string): Promise<void> {
try {
if (modelId) {
await this.playModelAnimation(modelId, animationName);
} else {
await this.playSceneAnimation(animationName);
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L477-L491 | 9a322610dcd42fa759c7e6ef6f98eae56b98ff96 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets | arkts | getUserCouponList | 获取用户优惠券列表
@param {Record<string, Unknown>} params - 查询参数
@returns {Promise<NetworkResponse<Coupon[]>>} 优惠券列表 | async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> {
const resp: AxiosResponse<NetworkResponse<Coupon[]>> =
await NetworkClient.http.post("market/coupon/user/list", params);
return resp.data;
} | AST#method_declaration#Left async getUserCouponList AST#parameter_list#Left ( AST#parameter#Left params : 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#typ... | async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> {
const resp: AxiosResponse<NetworkResponse<Coupon[]>> =
await NetworkClient.http.post("market/coupon/user/list", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets#L38-L42 | 8f1fa1ff2deacd72cfe3231d60e0b4475981c8fe | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuHoverScale.ets | arkts | BindContextMenuHoverScaleBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindContextMenuHoverScaleBuilder(name: string, param: Object) {
BindContextMenuHoverScaleExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuHoverScaleBuilder 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#par... | @Builder
export function BindContextMenuHoverScaleBuilder(name: string, param: Object) {
BindContextMenuHoverScaleExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuHoverScale.ets#L16-L19 | 31ae8626b4b94fa3ccdab3323a1d499e51bd34dd | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | HDRVivid/AVRecorder/entry/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
/**
* ShowToast duration.
*/
static readonly SHOW_TOAST_DURATION: number = 4000;
/**
* ShowToast bottom.
*/
static readonly SHOW_TOAST_BOTTOM: number = 108;
/**
* Image size.
*/
static readonly IMAGE_SIZE: number = 200;
/**
* The full percentage of co... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* ShowToast duration.
*/ AST#property_declaration#Left static readonly SHOW_TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ex... | export class CommonConstants {
static readonly SHOW_TOAST_DURATION: number = 4000;
static readonly SHOW_TOAST_BOTTOM: number = 108;
static readonly IMAGE_SIZE: number = 200;
static readonly FULL_PERCENT: string = '100%';
static readonly NINETY_PERCENT: string = '90%';
static readonly ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/common/CommonConstants.ets#L16-L51 | de42c52a57b5cda571b1dbd7300efc72330e97f2 | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/EditSchedule.ets | arkts | getFolders | 当 allFolders 改变时触发。
获取当前用户拥有的所有文件夹。 | public getFolders(): void {
this.folders = ArrayUtil.subArray(this.allFolders,
(value: Folder): boolean => value.owner === this.folder.owner && value.folderType === FolderType.NORMAL);
} | AST#method_declaration#Left public getFolders 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#... | public getFolders(): void {
this.folders = ArrayUtil.subArray(this.allFolders,
(value: Folder): boolean => value.owner === this.folder.owner && value.folderType === FolderType.NORMAL);
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L179-L182 | 916132c628ce6bd7fc861054c4b4e1a4ba029d0e | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/dialogv2/source/dialogv2.ets | arkts | getContentPadding | get dialog content padding
@returns content padding | private getContentPadding(): Padding | LocalizedPadding {
if (this.contentAreaPadding) {
return this.contentAreaPadding;
}
if ((this.primaryTitle || this.secondaryTitle) && this.buttons && this.buttons.length > 0) {
return {
top: 0,
right: $r('sys.float.alert_content_default_padd... | AST#method_declaration#Left private getContentPadding AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AS... | private getContentPadding(): Padding | LocalizedPadding {
if (this.contentAreaPadding) {
return this.contentAreaPadding;
}
if ((this.primaryTitle || this.secondaryTitle) && this.buttons && this.buttons.length > 0) {
return {
top: 0,
right: $r('sys.float.alert_content_default_padd... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1221-L1254 | cd6b1a6f376a2b93471bf7c788565dd4bda90500 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | getDayOffset | 计算某日与1900年1月1日的天数差 | private static getDayOffset(year: number, month: number, day: number): number {
let offset = 0;
// 计算年份差
for (let y = 1900; y < year; y++) {
offset += LunarCalendarFixed.isLeapYear(y) ? 366 : 365;
}
// 计算月份差
for (let m = 1; m < month; m++) {
offset += LunarCalendarFixed.get... | AST#method_declaration#Left private static getDayOffset 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#pr... | private static getDayOffset(year: number, month: number, day: number): number {
let offset = 0;
for (let y = 1900; y < year; y++) {
offset += LunarCalendarFixed.isLeapYear(y) ? 366 : 365;
}
for (let m = 1; m < month; m++) {
offset += LunarCalendarFixed.getSolarMonthDays(y... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L465-L482 | e8b9866e812580079f67645fd1687582bb673a2d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/BatteryStatsDataSource.ets | arkts | Provides data sources required by the LazyForEach interface. | export class BatteryStatsDataSource implements IDataSource {
private listItems: Array<BatteryStatsModel> = [];
private listener: DataChangeListener | null = null;
constructor(list: Array<BatteryStatsModel>) {
this.listItems = list;
}
totalCount(): number {
return this.listItems.length;
}
onData... | AST#export_declaration#Left export AST#class_declaration#Left class BatteryStatsDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listItems : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#... | export class BatteryStatsDataSource implements IDataSource {
private listItems: Array<BatteryStatsModel> = [];
private listener: DataChangeListener | null = null;
constructor(list: Array<BatteryStatsModel>) {
this.listItems = list;
}
totalCount(): number {
return this.listItems.length;
}
onData... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/BatteryStatsDataSource.ets#L21-L55 | bc2d81b92410c66243914e661dad8968775661b4 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 快速操作配置接口 | export interface QuickActionConfig {
id: string;
name: string;
icon: string;
color: string;
action: (contact: Contact) => void;
visible: (contact: Contact) => boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface QuickActionConfig 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#Le... | export interface QuickActionConfig {
id: string;
name: string;
icon: string;
color: string;
action: (contact: Contact) => void;
visible: (contact: Contact) => boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L342-L349 | 6a24adaf09f88377ea80a8c8273f1cb6e99e1f76 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/WorldClockViewModel.ets | arkts | queryCitiesTasker | 刷新城市任务。
@param callback (cities: Array<CityItem>) => void | public queryCitiesTasker(callback: (cities: Array<CityItem>) => void) {
let that = this;
that.queryDatabaseCities(callback);
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.addPreferencesListener({
onDataChanged() {
that.queryDatabaseCi... | AST#method_declaration#Left public queryCitiesTasker AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left cities : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type... | public queryCitiesTasker(callback: (cities: Array<CityItem>) => void) {
let that = this;
that.queryDatabaseCities(callback);
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.addPreferencesListener({
onDataChanged() {
that.queryDatabaseCi... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/WorldClockViewModel.ets#L101-L110 | 41c4d57f26b0aa93727a3b6aeabb3eb4d8d200f2 | github |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘50%’ | export const THOUSANDTH_560: string = '56%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_560 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '56%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_560: string = '56%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L57-L57 | fdaa39ebead11dfe96fe59989f0990a856049f03 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/eraser/Index.ets | arkts | EraserMainPage | 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 { EraserMainPage } from './src/main/ets/pages/EraserMainPage'; | AST#export_declaration#Left export { EraserMainPage } from './src/main/ets/pages/EraserMainPage' ; AST#export_declaration#Right | export { EraserMainPage } from './src/main/ets/pages/EraserMainPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/Index.ets#L15-L15 | 3b233537428cb6e566d4f724d95f19fd516e8c2c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/ReminderScheduler.ets | arkts | createWeeklySummaryReminder | 创建周总结提醒 | async createWeeklySummaryReminder(): Promise<string> {
try {
const settings = await this.settingsService.getSettings();
const reminderId = this.generateReminderId(ReminderType.WEEKLY_SUMMARY, 'weekly');
// 每周日晚上8点提醒
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
... | AST#method_declaration#Left async createWeeklySummaryReminder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig... | async createWeeklySummaryReminder(): Promise<string> {
try {
const settings = await this.settingsService.getSettings();
const reminderId = this.generateReminderId(ReminderType.WEEKLY_SUMMARY, 'weekly');
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
reminderTy... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L272-L313 | 1a9eec66937bc554d04e22be7b19e2f0c5e3174a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildMainContent | 构建主内容区域 | @Builder
buildMainContent() {
Column({ space: 16 }) {
// 内容显示
if (this.currentTabIndex === 0) {
// 首页 - 欢迎横幅
Column({ space: 8 }) {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMainContent 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
buildMainContent() {
Column({ space: 16 }) {
if (this.currentTabIndex === 0) {
Column({ space: 8 }) {
Row() {
Column({ space: 8 }) {
Text('生日提醒')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.f... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L206-L382 | b80bf4b63aff664ffee1926491198a683ae5a3d7 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets | arkts | initLoopback | Initialize the audio loopback | async initLoopback() {
let isSupported = audio.getAudioManager().getStreamManager().isAudioLoopbackSupported(this.mode);
if (isSupported) {
audio.createAudioLoopback(this.mode).then((loopback) => {
Logger.info('Invoke createAudioLoopback succeeded.');
this.audioLoopback = loopback;
... | AST#method_declaration#Left async initLoopback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isSupported = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#e... | async initLoopback() {
let isSupported = audio.getAudioManager().getStreamManager().isAudioLoopbackSupported(this.mode);
if (isSupported) {
audio.createAudioLoopback(this.mode).then((loopback) => {
Logger.info('Invoke createAudioLoopback succeeded.');
this.audioLoopback = loopback;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets#L60-L78 | cc97c9eedd91e75e945d63b0ee320369d334c6bb | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/primitives/primitives_number_001_T.ets | arkts | Introduction 基础数据类型-number | export function primitives_number_001_T(taint_src : number) : void {
taint.Sink(taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function primitives_number_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno... | export function primitives_number_001_T(taint_src : number) : void {
taint.Sink(taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/primitives/primitives_number_001_T.ets#L7-L9 | 6fba1f8535e8259f86df7b9f19331afa97c014a3 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets | arkts | 创建web实例,如果已经存在web实例,复用
@param url
@param uiContext | export function createNWeb(url: string, uiContext: UIContext): void {
if (currentNode.webController && currentNode.nWebController && currentNode.url !== url ||
!currentNode.lastNetAvailable) {
loadUrl(url);
currentNode.lastNetAvailable = connection.hasDefaultNetSync();
return;
}
clearHelperWeb();
... | AST#export_declaration#Left export AST#function_declaration#Left function createNWeb AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST... | export function createNWeb(url: string, uiContext: UIContext): void {
if (currentNode.webController && currentNode.nWebController && currentNode.url !== url ||
!currentNode.lastNetAvailable) {
loadUrl(url);
currentNode.lastNetAvailable = connection.hasDefaultNetSync();
return;
}
clearHelperWeb();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets#L125-L141 | 59a205ecaf40011349e9f2ca5be2e20070392f4e | gitee | |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/pages/Index.ets | arkts | generateDailyQuote | ★★★ 修改点1:逻辑改为“每次都刷新” ★★★ | generateDailyQuote() {
// 之前我们判断了日期,现在直接移除判断,每次进来都随机
const index = Math.floor(Math.random() * this.quotes.length);
const newQuote = this.quotes[index];
// 更新显示
this.todayQuote = newQuote;
// 顺便更新一下本地存储(虽然现在不依赖它来“锁住”语录了,但保持数据最新也不错)
this.appQuoteContent = newQuote;
this.appQuoteDate = ne... | AST#method_declaration#Left generateDailyQuote AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 之前我们判断了日期,现在直接移除判断,每次进来都随机 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#me... | generateDailyQuote() {
const index = Math.floor(Math.random() * this.quotes.length);
const newQuote = this.quotes[index];
this.todayQuote = newQuote;
this.appQuoteContent = newQuote;
this.appQuoteDate = new Date().toDateString();
} | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/Index.ets#L80-L91 | 1199a438b4453f5e3b4a9d6dee246c1c06676e62 | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/ime/popup/PopupSet.ets | arkts | initPopupList | Initializes the list of popup keys based on the specified key hint configuration.
@param keyHintConfiguration The key hint configuration to use.
@returns The initialized popup keys. | private initPopupList(keyHintConfiguration: KeyHintConfiguration): PopupKeys<T> {
// Retrieve local copies of relevant properties
const localMain = this.main;
const localRelevant = this.relevant;
const localSymbolHint = this.symbolHint;
const localNumberHint = this.numberHint;
// Check if symbo... | AST#method_declaration#Left private initPopupList AST#parameter_list#Left ( AST#parameter#Left keyHintConfiguration : AST#type_annotation#Left AST#primary_type#Left KeyHintConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#L... | private initPopupList(keyHintConfiguration: KeyHintConfiguration): PopupKeys<T> {
const localMain = this.main;
const localRelevant = this.relevant;
const localSymbolHint = this.symbolHint;
const localNumberHint = this.numberHint;
if (localSymbolHint !== null && keyHintConfiguration.symbol... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/popup/PopupSet.ets#L146-L178 | 49f14be4457f48d76bd86a3cf1b2470896d79899 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DES.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey 3DES密钥
@param iv iv偏移量字符串
@returns | static async decodeCBC(str: string, desKey: string, iv: string): Promise<string> {
return CryptoUtil.decodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192);
} | AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async decodeCBC(str: string, desKey: string, iv: string): Promise<string> {
return CryptoUtil.decodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DES.ets#L74-L76 | 2be4a7226b7accb8e2ab8b0e946cfb94d34d93e3 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/navigation/MainGraph.ets | arkts | @file 主模块导航图
@author Joker.X | export class MainGraph implements RouteGraph {
/**
* 注册主模块导航路由
*/
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
RouteBuild.register(MainRoutes.Home, wrapBuilder(HomeNav));
RouteBuild.register(MainRoutes.Category, wrapBuilder(CategoryNav));
RouteBuild.register(M... | AST#export_declaration#Left export AST#class_declaration#Left class MainGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册主模块导航路由
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left A... | export class MainGraph implements RouteGraph {
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
RouteBuild.register(MainRoutes.Home, wrapBuilder(HomeNav));
RouteBuild.register(MainRoutes.Category, wrapBuilder(CategoryNav));
RouteBuild.register(MainRoutes.Cart, wrapBuil... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/navigation/MainGraph.ets#L13-L24 | 8eb3d63788570e0729340e7865cd6043af60b5fc | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets | arkts | clear | 清除栈中的所有页面 | public static clear(animated?: boolean) {
try {
RouterModule._stack.clear(animated);
} catch (err) {
Logger.error(
TAG,
'navigation stack clear failed::' + JSON.stringify(err),
);
}
} | AST#method_declaration#Left public static clear AST#parameter_list#Left ( AST#parameter#Left animated ? : 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#block_statement#Left { AST#statement#Left AST#try_statement... | public static clear(animated?: boolean) {
try {
RouterModule._stack.clear(animated);
} catch (err) {
Logger.error(
TAG,
'navigation stack clear failed::' + JSON.stringify(err),
);
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/commons/commonlib/src/main/ets/utils/router/Router.ets#L70-L79 | c46f9ef1b1c2e80a921d7744811a8b431baa972e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/CacheHelper.ets | arkts | put | 添加缓存到lruCache中 | public static put(key: string, value: Object) {
CacheHelper.lruCache.put(key, value);
} | AST#method_declaration#Left public static 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#primary_type#Left Object AST#primary_type#... | public static put(key: string, value: Object) {
CacheHelper.lruCache.put(key, value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L39-L41 | 4eb338db594a057bc56de90e4855042371f70614 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | setInverted | If this is set to true, the y-axis is inverted which means that low values are on top of
the chart, high values
on bottom.
@param enabled | public setInverted(enabled: boolean): void {
this.mInverted = enabled;
} | AST#method_declaration#Left public setInverted AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public setInverted(enabled: boolean): void {
this.mInverted = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L303-L305 | 0c63f9315dde5e3d1556ce3ad53a79be8e87f67d | gitee |
xixi-cquer/BiJiDaiBan.git | 206dc33a837acbe6fc837feff848427e83946534 | entry/src/main/ets/common/constants/Constants.ets | arkts | The RefreshConstant constants. | export const enum RefreshConstant {
DELAY_PULL_DOWN_REFRESH = 50,
CLOSE_PULL_DOWN_REFRESH_TIME = 150,
DELAY_SHRINK_ANIMATION_TIME = 500
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum RefreshConstant AST#enum_body#Left { AST#enum_member#Left DELAY_PULL_DOWN_REFRESH = AST#expression#Left 50 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CLOSE_PULL_DOWN_REFRESH_TIME = AST#expression#Left 150 AST#expression#Right... | export const enum RefreshConstant {
DELAY_PULL_DOWN_REFRESH = 50,
CLOSE_PULL_DOWN_REFRESH_TIME = 150,
DELAY_SHRINK_ANIMATION_TIME = 500
} | https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/common/constants/Constants.ets#L159-L163 | 1cc42ed037250b1b9f5acc626598c55de5f9d30e | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets | arkts | 样式工具类 | export class StyleUtils {
/**
* 获取公历日期字体颜色(仅用于月视图和周视图)
* @param day 日期信息
* @param month 月份
* @param currentSelectDay 当前选择的日期
* @param calendarViewType 日历视图类型
* @param CalendarStyle 自定义日历样式
* @returns 返回颜色
*/
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType... | AST#export_declaration#Left export AST#class_declaration#Left class StyleUtils AST#class_body#Left { /**
* 获取公历日期字体颜色(仅用于月视图和周视图)
* @param day 日期信息
* @param month 月份
* @param currentSelectDay 当前选择的日期
* @param calendarViewType 日历视图类型
* @param CalendarStyle 自定义日历样式
* @returns 返回颜色
*/ AST#method_de... | export class StyleUtils {
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType,
CalendarStyle: CalendarStyle): Color | number | string | Resource {
const IS_SELECT_DAY: boolean =
currentSelectDay.year === day.dayInfo.year && currentSelectDay.month ===... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets#L23-L133 | af894428e1bb7e76323378ddd2c485b1b014a421 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets | arkts | receiveMessageFromClient | 获取客户端消息 | async receiveMessageFromClient(message: string): Promise<void> {
sendProcessMessage("模拟服务端接收到数据,开始解密...", MessagePosition.Left);
// 解密
let decryptedMessage = await aesGcmDecrypt(message, this.aesKey);
sendProcessMessage(`模拟服务端解密成功,解密结果:${decryptedMessage}`, MessagePosition.Left);
// 存储
this.mess... | AST#method_declaration#Left async receiveMessageFromClient AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen... | async receiveMessageFromClient(message: string): Promise<void> {
sendProcessMessage("模拟服务端接收到数据,开始解密...", MessagePosition.Left);
let decryptedMessage = await aesGcmDecrypt(message, this.aesKey);
sendProcessMessage(`模拟服务端解密成功,解密结果:${decryptedMessage}`, MessagePosition.Left);
this.messageStorage... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/server/LocalMockServer.ets#L69-L76 | a8013d6d8a72a2e3264ca067244b90db215f1527 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/Index.ets | arkts | CustomScanPage | 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 { CustomScanPage } from './src/main/ets/pages/CustomScanPage'; | AST#export_declaration#Left export { CustomScanPage } from './src/main/ets/pages/CustomScanPage' ; AST#export_declaration#Right | export { CustomScanPage } from './src/main/ets/pages/CustomScanPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/Index.ets#L16-L16 | 4db895d39b8bb35500b8118047b4d0f24de4bc37 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/select/selectLevel7.ets | arkts | SelectLevel7Builder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function SelectLevel7Builder(name: string, param: Object) {
SelectLevel7Example()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectLevel7Builder 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 p... | @Builder
export function SelectLevel7Builder(name: string, param: Object) {
SelectLevel7Example()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectLevel7.ets#L16-L19 | a63338bf6bf9bd55f0d07fd747318745bf380a52 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseManager.ets | arkts | getInstance | 获取DatabaseManager单例实例 | static getInstance(): DatabaseManager {
if (!DatabaseManager.instance) {
DatabaseManager.instance = new DatabaseManager();
}
return DatabaseManager.instance;
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Lef... | static getInstance(): DatabaseManager {
if (!DatabaseManager.instance) {
DatabaseManager.instance = new DatabaseManager();
}
return DatabaseManager.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L34-L39 | f2c1b64aa2e037bee6d67d1fd5915afdd970baa1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWeb.ets | arkts | aboutToAppear | 下载任务的状态会通过该类的回调接口通知给用户。 | aboutToAppear(): void {
this.defaultMethodsNames = ObjectUtils.getMethodsNames(new ArkJsObject());
if (Array.isArray(this.arkJsObject)) {
if (this.arkJsObject.length > 0) {
this.arkJsObjects = this.arkJsObject;
}
} else {
this.arkJsObjects = [this.arkJsObject];
}
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | aboutToAppear(): void {
this.defaultMethodsNames = ObjectUtils.getMethodsNames(new ArkJsObject());
if (Array.isArray(this.arkJsObject)) {
if (this.arkJsObject.length > 0) {
this.arkJsObjects = this.arkJsObject;
}
} else {
this.arkJsObjects = [this.arkJsObject];
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWeb.ets#L28-L37 | bd3050992dd9f8292aca394ba974d8347e69863a | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets | arkts | unit | export const PER_DAY: string = '/ 天'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PER_DAY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/ 天' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R... | export const PER_DAY: string = '/ 天'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L71-L71 | e5f4ac03b70bd1738ad584fd3e110b2358f95f51 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | export type ColorStop = [Color | string | number,number]; | export type ChartColorStop = [string, number]; | AST#export_declaration#Left export AST#type_declaration#Left type ChartColorStop = AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#prima... | export type ChartColorStop = [string, number]; | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L387-L387 | 6d1112c6616a51d6daa846352bec12502f717230 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/common/constants/AppConstant.ets | arkts | 最佳实践:点击响应优化 | export class AppConstant {
static readonly CITYS: Array<string> = [
"阿城市", "阿尔山市", "阿克苏市", "阿勒泰市", "阿图什市", "安达市", "安国市", "安康市", "安陆市", "安宁市",
"安庆市", "安丘市", "安顺市", "安阳市", "鞍山市", "澳门",
'贵阳市', '清镇市', '开阳县', '修文县', '息烽县', '水城县', '盘 县', '遵义市', '赤水市',
'仁怀市', '遵义县', '绥阳县', '桐梓县', '习水县', '凤冈县', '正安县', '余庆县', ... | AST#export_declaration#Left export AST#class_declaration#Left class AppConstant AST#class_body#Left { AST#property_declaration#Left static readonly CITYS : 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#prima... | export class AppConstant {
static readonly CITYS: Array<string> = [
"阿城市", "阿尔山市", "阿克苏市", "阿勒泰市", "阿图什市", "安达市", "安国市", "安康市", "安陆市", "安宁市",
"安庆市", "安丘市", "安顺市", "安阳市", "鞍山市", "澳门",
'贵阳市', '清镇市', '开阳县', '修文县', '息烽县', '水城县', '盘 县', '遵义市', '赤水市',
'仁怀市', '遵义县', '绥阳县', '桐梓县', '习水县', '凤冈县', '正安县', '余庆县', ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/common/constants/AppConstant.ets#L19-L929 | e995f4aebd6267a7f1335420f4fb00283dc3dfe3 | gitee | |
changweizhang/ChatUI | 36df7ce41aeb281d8472ca9182f449da6dc109f7 | chatui/src/main/ets/components/ChatDataSource.ets | arkts | notifyDataChange | 通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件 | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | https://github.com/changweizhang/ChatUI/blob/36df7ce41aeb281d8472ca9182f449da6dc109f7/chatui/src/main/ets/components/ChatDataSource.ets#L68-L72 | 1422ef619c845ae32f137aaee903ba11c879cb66 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x4.ets | arkts | buildBirthdayItem | 构建单个生日项 | @Builder
buildBirthdayItem(item: any) {
Row() {
// 头像
if (item.avatar) {
Image(item.avatar)
.width('32vp')
.height('32vp')
.borderRadius(16)
} else {
Circle({ width: 32, height: 32 })
.fill(item.isToday ? '#FF5722' : (item.isTomorrow ? '#21... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#... | @Builder
buildBirthdayItem(item: any) {
Row() {
if (item.avatar) {
Image(item.avatar)
.width('32vp')
.height('32vp')
.borderRadius(16)
} else {
Circle({ width: 32, height: 32 })
.fill(item.isToday ? '#FF5722' : (item.isTomorrow ? '#2196F3'... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L99-L166 | c60c724ec3308e68252125a6418d48c4db87aeaf | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/International/International/entry/src/main/ets/component/OperationView.ets | arkts | OperationView | Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l... | @Component
export default struct OperationView {
private operationKey: string | Resource = '';
private showArrow: boolean = true;
private handleClick: () => void = ()=>{};
build() {
Row() {
Text(this.operationKey)
.fontSize(16)
.fontColor(Color.Black)
.height('100%')
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct OperationView AST#component_body#Left { AST#property_declaration#Left private operationKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#... | @Component
export default struct OperationView {
private operationKey: string | Resource = '';
private showArrow: boolean = true;
private handleClick: () => void = ()=>{};
build() {
Row() {
Text(this.operationKey)
.fontSize(16)
.fontColor(Color.Black)
.height('100%')
.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/International/International/entry/src/main/ets/component/OperationView.ets#L16-L43 | f71204dcc1580d169a3be9481682ae5c63f4a1c4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/mock/MockData.ets | arkts | 图片数据 | export const IMAGES: Resource[] = [
$r('app.media.cube_animation_picture1'),
$r('app.media.cube_animation_picture2'),
$r('app.media.cube_animation_picture3'),
$r('app.media.cube_animation_picture4')
]; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IMAGES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression... | export const IMAGES: Resource[] = [
$r('app.media.cube_animation_picture1'),
$r('app.media.cube_animation_picture2'),
$r('app.media.cube_animation_picture3'),
$r('app.media.cube_animation_picture4')
]; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/mock/MockData.ets#L60-L65 | cc49a480708d061306ef2c3597371c4b8d18c0b1 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets | arkts | ============================================================ MARK: - DetailItemManager | export class DetailItemManager {
private static instance: DetailItemManager
private context : Context | null = null
private itemOrders: ItemOrder[] = []
// MARK: - 单例
static get shared(): DetailItemManager {
if (!this.instance) {
this.instance = new DetailItemManager()
this.instance.ini... | AST#export_declaration#Left export AST#class_declaration#Left class DetailItemManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DetailItemManager AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#proper... | export class DetailItemManager {
private static instance: DetailItemManager
private context : Context | null = null
private itemOrders: ItemOrder[] = []
static get shared(): DetailItemManager {
if (!this.instance) {
this.instance = new DetailItemManager()
this.instance.init()
}
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L62-L105 | f8755b7ce30c2d33955e5c714ab481e734c74f22 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/context/ContextUtil.ets | arkts | getAppCtx | 获取应用级别的上下文的能力
@returns {common.ApplicationContext} | static getAppCtx(): common.ApplicationContext {
return ContextUtil.context.getApplicationContext();
} | AST#method_declaration#Left static getAppCtx AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . ApplicationContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left A... | static getAppCtx(): common.ApplicationContext {
return ContextUtil.context.getApplicationContext();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/context/ContextUtil.ets#L59-L61 | 649e2154a83a4182eeff9c69f9ff6fbc1648a6e9 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets | arkts | aboutToDisappear | [End get_list_view_error] | aboutToDisappear(): void {
this.newsData = [];
} | AST#method_declaration#Left aboutToDisappear 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#m... | aboutToDisappear(): void {
this.newsData = [];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets#L247-L249 | 5fd046dffec5fbcc261bbf1d309e5c6937327157 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets | arkts | showFileContent | 显示指定文件的内容 | showFileContent(filePath: string) {
let content = fs.readTextSync(filePath)
this.msgHistory += "下载文件内容:" + content + "\r\n"
} | AST#method_declaration#Left showFileContent AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration... | showFileContent(filePath: string) {
let content = fs.readTextSync(filePath)
this.msgHistory += "下载文件内容:" + content + "\r\n"
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPDownloadFileDemo/entry/src/main/ets/pages/Index.ets#L127-L130 | d2b08380b4530314fee204e459f8b0249714d15b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/AxisRenderer.ets | arkts | computeAxisValues | Sets up the axis values. Computes the desired number of labels between the two given extremes.
@return | protected computeAxisValues(min: number, max: number, customYAxisLabels?: number[]) {
let yMin = min;
let yMax = max;
if (this.mAxis) {
let labelCount = this.mAxis.getLabelCount();
let range = Math.abs(yMax - yMin);
if (labelCount == 0 || range <= 0 || range == Number.POSITIVE_INFINITY) ... | AST#method_declaration#Left protected computeAxisValues AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | protected computeAxisValues(min: number, max: number, customYAxisLabels?: number[]) {
let yMin = min;
let yMax = max;
if (this.mAxis) {
let labelCount = this.mAxis.getLabelCount();
let range = Math.abs(yMax - yMin);
if (labelCount == 0 || range <= 0 || range == Number.POSITIVE_INFINITY) ... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/AxisRenderer.ets#L161-L312 | fe372f808fd6d8905474aa168036954c78bc9cd5 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | onPlaybackStart | 播放开始
@param id
@returns | public onPlaybackStart(id: string): Promise<void> {
return this.requireApi().onPlaybackStart(id)
} | AST#method_declaration#Left public onPlaybackStart AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | public onPlaybackStart(id: string): Promise<void> {
return this.requireApi().onPlaybackStart(id)
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L170-L172 | 45303b4d30805266b24da18a91400edabfd2b5c0 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets | arkts | getFirstLvMenu | 底部一级菜单 | @Builder
getFirstLvMenu() {
Row() {
Column() {
Image($r('app.media.ic_adjust'))
.width($r('app.float.size_30'))
.height($r('app.float.size_30'))
Text($r('app.string.edit_picture_js'))
.fontColor(Color.White)
.fontSize($r('app.float.size_16'))
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getFirstLvMenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
getFirstLvMenu() {
Row() {
Column() {
Image($r('app.media.ic_adjust'))
.width($r('app.float.size_30'))
.height($r('app.float.size_30'))
Text($r('app.string.edit_picture_js'))
.fontColor(Color.White)
.fontSize($r('app.float.size_16'))
}
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L225-L269 | 2862ecfe3c6d182462851efc367c9f38f692c023 | gitee |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/pages/Index.ets | arkts | onIndexChange | 切换改变的监听 | onIndexChange() {
this.controller.changeIndex(this.bottomTabIndex);
} | AST#method_declaration#Left onIndexChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left thi... | onIndexChange() {
this.controller.changeIndex(this.bottomTabIndex);
} | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/pages/Index.ets#L34-L36 | e72333926e7179ccdb712321d0a19064f0c5ed81 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets | arkts | [End streams_file] 使用文件哈希流 | export function hashFileWithStream() {
const filePath = `${filesDir}/test.txt`;
// 创建文件可读流
const rs = fs.createReadStream(filePath);
// 创建哈希流
const hs = hash.createHash('sha256');
rs.on('data', (emitData) => {
const data = emitData?.data;
// 0 表示获取字符串中第一个字符的 字符编码 (即 Unicode 编码点)的值
hs.update(new ... | AST#export_declaration#Left export AST#function_declaration#Left function hashFileWithStream AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath = AST#expression#Left AST#template_literal#Left ` AST#... | export function hashFileWithStream() {
const filePath = `${filesDir}/test.txt`;
const rs = fs.createReadStream(filePath);
const hs = hash.createHash('sha256');
rs.on('data', (emitData) => {
const data = emitData?.data;
hs.update(new Uint8Array(data?.split('').map((x: string) => x.charCodeAt(0... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets#L178-L194 | 5793b9ed2dd47b8d124b441f04be7c593200663a | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | createNotificationChannels | 创建通知渠道 | private async createNotificationChannels(): Promise<void> {
try {
// 生日提醒渠道
await notificationManager.addSlot({
type: notificationManager.SlotType.CONTENT_INFORMATION,
slotId: NotificationConstants.BIRTHDAY_CHANNEL_ID,
name: NotificationConstants.BIRTHDAY_CHANNEL_NAME,
de... | AST#method_declaration#Left private async createNotificationChannels 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_annotatio... | private async createNotificationChannels(): Promise<void> {
try {
await notificationManager.addSlot({
type: notificationManager.SlotType.CONTENT_INFORMATION,
slotId: NotificationConstants.BIRTHDAY_CHANNEL_ID,
name: NotificationConstants.BIRTHDAY_CHANNEL_NAME,
description... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L99-L147 | 81dd8e711ebf67b67f424e620a3e980505192365 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | 构造函数,初始化 ORM 并确保搜索历史表已迁移
@returns {SearchHistoryLocalDataSourceImpl} 实例 | constructor() {
this.ensureMigrated();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ensure... | constructor() {
this.ensureMigrated();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L24-L26 | a64f7a831f106d1c0aab7038ef461621e306ffcb | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.