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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | stopNetObserve | 停止网络监听 | public stopNetObserve(netType: connection.NetBearType) {
this.connectionMap.get(netType).unregister(() => {
logger.info("Success unregister:" + netType.toString());
})
} | AST#method_declaration#Left public stopNetObserve AST#parameter_list#Left ( AST#parameter#Left netType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | public stopNetObserve(netType: connection.NetBearType) {
this.connectionMap.get(netType).unregister(() => {
logger.info("Success unregister:" + netType.toString());
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L110-L114 | 8a40aeb7eb94aad15131105bd969bece8e646ad1 | gitee |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/view/SuccessDialog.ets | arkts | SuccessDialog | 使用 @CustomDialog 注解来定义自定义对话框组件 | @CustomDialog
export default struct SuccessDialog {
// 使用 @Prop 注解将组件的状态变量与父组件单向绑定
@Prop elapsedTime: number // 通关用时(毫秒)
@Prop stepCounter: number // 步数计数
private controller: CustomDialogController
tryAgain: () => void // 再来一次
resetDifficulty: () => void // 重设难度
// 构建对话框组件的 UI 布局
build() {
Column(... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct SuccessDialog AST#component_body#Left { // 使用 @Prop 注解将组件的状态变量与父组件单向绑定 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right elapsedTime : AST#type_annotation#Left AST#primary_type#Lef... | @CustomDialog
export default struct SuccessDialog {
@Prop elapsedTime: number
@Prop stepCounter: number
private controller: CustomDialogController
tryAgain: () => void
resetDifficulty: () => void
build() {
Column({ space: 10 }) {
Row({ space: 10 }) {
Image($r('app.media.congr... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/SuccessDialog.ets#L24-L75 | 596fec66fd8e3014f158c9f119f3233ba4de0c56 | github |
guyu0327/HarmonyGomoku.git | e615d8f24e08db68c23f0345cde1ff621de4cb07 | entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 注册字体 | aboutToAppear() {
font.registerFont({
familyName: $r('app.string.index_title_font_name'),
familySrc: $r('app.string.index_title_font_src'),
})
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left font AST#expression#Right . registerFont AST#membe... | aboutToAppear() {
font.registerFont({
familyName: $r('app.string.index_title_font_name'),
familySrc: $r('app.string.index_title_font_src'),
})
} | https://github.com/guyu0327/HarmonyGomoku.git/blob/e615d8f24e08db68c23f0345cde1ff621de4cb07/entry/src/main/ets/pages/Index.ets#L7-L12 | 166b2d8fe9f4049d44d5abc8b9be0e7d3e6c7f32 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_audio/src/main/ets/ui/Ef_audio_player/type/index.ets | arkts | 支持的播放的资源url | export type SongItemUrl = string | media.AVFileDescriptor | media.AVDataSrcDescriptor | AST#export_declaration#Left export AST#type_declaration#Left type SongItemUrl = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left media . AVFileDescriptor AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Lef... | export type SongItemUrl = string | media.AVFileDescriptor | media.AVDataSrcDescriptor | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_audio/src/main/ets/ui/Ef_audio_player/type/index.ets#L32-L32 | 2daa4b3b8fd629bf8aa656daef86a8c248b7d246 | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | deleteConfig | 删除配置 | async deleteConfig(index: number): Promise<boolean> {
try {
if (index < 0 || index >= this.configs.length) {
return false;
}
this.configs.splice(index, 1);
await this.saveConfigs();
hilog.info(0x0000, 'LLMConfigManager', 'Config deleted at index: %{public}d', index);
re... | AST#method_declaration#Left async deleteConfig 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 AST#generic_type#Left... | async deleteConfig(index: number): Promise<boolean> {
try {
if (index < 0 || index >= this.configs.length) {
return false;
}
this.configs.splice(index, 1);
await this.saveConfigs();
hilog.info(0x0000, 'LLMConfigManager', 'Config deleted at index: %{public}d', index);
re... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L162-L177 | 5e86df67a320555eaec68ffdb615d1823ae8402d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/AlarmSettingType.ets | arkts | export { AlarmSettingBean };
Alarm setting type enum description. | export enum AlarmSettingType {
/**
* Alarm setting type repeat.
*/
REPEAT,
/**
* Alarm setting type name.
*/
ALARM_NAME,
/**
* Alarm setting type ring duration.
*/
RING_DURATION,
/**
* Alarm setting type interval.
*/
INTERVAL
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AlarmSettingType AST#enum_body#Left { /**
* Alarm setting type repeat.
*/ AST#enum_member#Left REPEAT AST#enum_member#Right , /**
* Alarm setting type name.
*/ AST#enum_member#Left ALARM_NAME AST#enum_member#Right , /**
* Alarm setting type r... | export enum AlarmSettingType {
REPEAT,
ALARM_NAME,
RING_DURATION,
INTERVAL
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/AlarmSettingType.ets#L21-L41 | 53ac1d3e215bb6510a9980a14914d9a692ad3185 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/ApplicationModels/SystemRouter/hspB/src/main/ets/pages/Index.ets | arkts | Index | 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... | @Entry
@Component
export struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width($r('app.string.full_percent'))
}
.height($r('app.string.full_percent'))
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Index AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left stri... | @Entry
@Component
export struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width($r('app.string.full_percent'))
}
.height($r('app.string.full_percent'))
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/SystemRouter/hspB/src/main/ets/pages/Index.ets#L15-L31 | 273dc6919114034f5835afa742a67b79973118dd | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/TaskPriority.ets | arkts | 任务优先级枚举
@author panruiqi
@CreateTime 2025年12月01日 | export enum TaskPriority {
LOW = 'LOW',
NORMAL = 'NORMAL',
HIGH = 'HIGH'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum TaskPriority AST#enum_body#Left { AST#enum_member#Left LOW = AST#expression#Left 'LOW' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NORMAL = AST#expression#Left 'NORMAL' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le... | export enum TaskPriority {
LOW = 'LOW',
NORMAL = 'NORMAL',
HIGH = 'HIGH'
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskPriority.ets#L8-L12 | c88acd276c5b7085ef7809dbad521e86dec0a700 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | createSubWindow | 创建子窗口
@param options 窗口参数
@param windowStage WindowStage
@returns | static async createSubWindow(options: WindowOptions,
windowStage: window.WindowStage = AppUtil.getWindowStage()): Promise<window.Window> {
let windowClass = await windowStage.createSubWindow(options.name);
await windowClass.resize(options.width, options.height);
await windowClass.moveWindowTo(options.x ... | AST#method_declaration#Left static async createSubWindow AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left WindowOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#L... | static async createSubWindow(options: WindowOptions,
windowStage: window.WindowStage = AppUtil.getWindowStage()): Promise<window.Window> {
let windowClass = await windowStage.createSubWindow(options.name);
await windowClass.resize(options.width, options.height);
await windowClass.moveWindowTo(options.x ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L473-L481 | f146f96fcaf1b60cb7f5a30839a9e3ba6204a6c3 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/Comment.ets | arkts | @param {Partial<Comment>} init - 初始化数据 | constructor(init?: Partial<Comment>) {
if (!init) return;
this.score = init.score ?? this.score;
this.content = init.content ?? this.content;
this.images = init.images ?? this.images;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | constructor(init?: Partial<Comment>) {
if (!init) return;
this.score = init.score ?? this.score;
this.content = init.content ?? this.content;
this.images = init.images ?? this.images;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/Comment.ets#L22-L27 | 81a26ace503583f994520c36871be42518341d34 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/AtbashCipher.ets | arkts | Atbash密码实现
Atbash密码是一种替换密码,将字母表中的字母反转(A->Z, B->Y, C->X, ...) | export class AtbashCipher {
private static readonly ALPHABET: string = 'abcdefghijklmnopqrstuvwxyz';
private static readonly REVERSE_ALPHABET: string = 'zyxwvutsrqponmlkjihgfedcba';
/**
* 加密单个字符
*/
private static encryptChar(char: string): string {
const lowerChar: string = char.toLowerCase();
co... | AST#export_declaration#Left export AST#class_declaration#Left class AtbashCipher AST#class_body#Left { AST#property_declaration#Left private static readonly ALPHABET : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'abcdefghijklmnopqrstuvwxyz... | export class AtbashCipher {
private static readonly ALPHABET: string = 'abcdefghijklmnopqrstuvwxyz';
private static readonly REVERSE_ALPHABET: string = 'zyxwvutsrqponmlkjihgfedcba';
private static encryptChar(char: string): string {
const lowerChar: string = char.toLowerCase();
const index: number = A... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/AtbashCipher.ets#L5-L40 | e46456527bd35378e6905d917494a1de4b4d9c8b | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets | arkts | MaterialEdit | 素材编辑组件,
1、图片背景,不需要动
2、素材组件,边框+文字或者图片
3、边框支持拖动和关闭
输入:传入背景图、素材来源
输出:返回素材size和位置 | @Component
export default struct MaterialEdit {
@Link pixelMap: PixelMap;
@Prop text: string;
// 退出的时候,是否是取消操作
@Prop isCancelQuit: boolean;
@Prop selectedMaterialIndex: number;
@Prop isTextMaterial: boolean;
onCancel: () => void = () => {};
onOpen: () => void = () => {};
onClose: () => void = () => {}... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MaterialEdit AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#... | @Component
export default struct MaterialEdit {
@Link pixelMap: PixelMap;
@Prop text: string;
@Prop isCancelQuit: boolean;
@Prop selectedMaterialIndex: number;
@Prop isTextMaterial: boolean;
onCancel: () => void = () => {};
onOpen: () => void = () => {};
onClose: () => void = () => {};
container... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets#L34-L358 | 97673b72ffbf0c5f6d7e797ed63f443322c6a124 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/guide/GuideService.ets | arkts | setRedDot | 设置红点显示状态 | async setRedDot(key: string, show: boolean): Promise<void> {
try {
const redDotKey = `${this.RED_DOT_PREFIX}${key}`;
await StorageManager.setBoolean(redDotKey, show);
Logger.info('GuideService', `Red dot ${show ? 'shown' : 'hidden'}: ${key}`);
} catch (error) {
Logger.error('GuideService... | AST#method_declaration#Left async setRedDot 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 show : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri... | async setRedDot(key: string, show: boolean): Promise<void> {
try {
const redDotKey = `${this.RED_DOT_PREFIX}${key}`;
await StorageManager.setBoolean(redDotKey, show);
Logger.info('GuideService', `Red dot ${show ? 'shown' : 'hidden'}: ${key}`);
} catch (error) {
Logger.error('GuideService... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L91-L99 | 04d043aa03ab2a280a5f4cb67bce9d9f73ea8d2e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/model/DataJson.ets | arkts | 从rawfile中addressbook.json文件中json数据解析成json字符串
@param { string } jsonFileDir - json文件路径 | export function getJsonData(jsonFileDir: string): Contact[] {
// 从本地文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult:string = textDecoder.decodeToString(... | AST#export_declaration#Left export AST#function_declaration#Left function getJsonData AST#parameter_list#Left ( AST#parameter#Left jsonFileDir : 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#Lef... | export function getJsonData(jsonFileDir: string): Contact[] {
const value = getContext().resourceManager.getRawFileContentSync(jsonFileDir);
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult:string = textDecoder.decodeToString(new Uint8Array(value.buffe... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/model/DataJson.ets#L24-L46 | ecd8fa3cf215e5cf0fafb675002d6c6c4453cf19 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | Angel range. | export enum AngelRange {
ANGEL_0_60,
ANGEL_60_120,
ANGEL_120_180,
ANGEL_180_240,
ANGEL_240_300,
ANGEL_300_360
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AngelRange AST#enum_body#Left { AST#enum_member#Left ANGEL_0_60 AST#enum_member#Right , AST#enum_member#Left ANGEL_60_120 AST#enum_member#Right , AST#enum_member#Left ANGEL_120_180 AST#enum_member#Right , AST#enum_member#Left ANGEL_180_240 AST#enum_membe... | export enum AngelRange {
ANGEL_0_60,
ANGEL_60_120,
ANGEL_120_180,
ANGEL_180_240,
ANGEL_240_300,
ANGEL_300_360
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L198-L205 | e45c5d13281a903ddc6222dde5d74bf0f91d8dd9 | gitee | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/ChatPage.ets | arkts | removeEvents | 取消事件监听。 | removeEvents() {
// 【1】
IMClientManager.getInstance().getEmitter().off(UIEvent.UIEVENT_messageAdded, this.meessageAddedEventCallback);
// 【2】
IMClientManager.getInstance().getEmitter().off(UIEvent.UIEVENT_messageUpdate, this.meessageUpdateEventCallback);
// 【3】
IMClientManager.getInstance().getE... | AST#method_declaration#Left removeEvents AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 【1】 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left... | removeEvents() {
IMClientManager.getInstance().getEmitter().off(UIEvent.UIEVENT_messageAdded, this.meessageAddedEventCallback);
IMClientManager.getInstance().getEmitter().off(UIEvent.UIEVENT_messageUpdate, this.meessageUpdateEventCallback);
IMClientManager.getInstance().getEmitter().off(UIEve... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/ChatPage.ets#L152-L167 | 44a083a9c8f04989158d87eec080ed0da859e887 | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | product/oh/base/src/main/ets/pages/index.ets | arkts | uiCheckLoop | 开启text与video的轮播
包含了一个setTimeout, 视频不播放不执行 onCheckAction()
@param running | private uiCheckLoop(running: boolean): void {
this.displayVideo = running;
this.dotTextPlay = running;
if (this.checkIntervalId != null) {
clearInterval(this.checkIntervalId);
this.checkIntervalId = null;
}
if (running) {
this.checkTimes = 0;
this.checkIntervalId = setInterva... | AST#method_declaration#Left private uiCheckLoop AST#parameter_list#Left ( AST#parameter#Left running : 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_... | private uiCheckLoop(running: boolean): void {
this.displayVideo = running;
this.dotTextPlay = running;
if (this.checkIntervalId != null) {
clearInterval(this.checkIntervalId);
this.checkIntervalId = null;
}
if (running) {
this.checkTimes = 0;
this.checkIntervalId = setInterva... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/product/oh/base/src/main/ets/pages/index.ets#L183-L199 | 38f2b66eca2cad0fa3651a82deb08481a56a049f | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/HomeComponent.ets | arkts | titleTextStyle | 标题样式 | @Extend(Text)
function titleTextStyle() {
.fontSize($r('app.float.default_16'))
.fontWeight(Const.FONT_WEIGHT_500)
.width(Const.THOUSANDTH_1000)
.fontFamily($r('app.string.HarmonyHeiTi_Medium'))
.fontColor($r(`app.element.color.titleColor`))
.padding({
top: Const.THOUSANDTH_15,
bottom: Const.THOUSAN... | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function titleTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#r... | @Extend(Text)
function titleTextStyle() {
.fontSize($r('app.float.default_16'))
.fontWeight(Const.FONT_WEIGHT_500)
.width(Const.THOUSANDTH_1000)
.fontFamily($r('app.string.HarmonyHeiTi_Medium'))
.fontColor($r(`app.element.color.titleColor`))
.padding({
top: Const.THOUSANDTH_15,
bottom: Const.THOUSAN... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L23-L35 | 5f166511bd2250f8a15827985cea9bea2cd5a268 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | onBackground | Ability后台隐藏时的回调 | onBackground(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onBackground');
// 应用进入后台时的处理
this.handleBackground();
} | AST#method_declaration#Left onBackground AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#... | onBackground(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onBackground');
this.handleBackground();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L84-L89 | 8c4a365dd3fe386deae987f2d13eda832b234ba1 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/waterripples/Index.ets | arkts | WaterRipplesComponent | 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 { WaterRipplesComponent } from './src/main/ets/WaterRipples'; | AST#export_declaration#Left export { WaterRipplesComponent } from './src/main/ets/WaterRipples' ; AST#export_declaration#Right | export { WaterRipplesComponent } from './src/main/ets/WaterRipples'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/waterripples/Index.ets#L17-L17 | 8beeb32820b04c343c6752b02c0ba8ab54a18a8c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | updateOrCreateParams | 更新key为'content'的变量值
@param { SubWindowParams } params - 页面显示的值 | updateOrCreateParams(params: SubWindowParams): void {
this.Storage.setOrCreate("content", params.sum);
} | AST#method_declaration#Left updateOrCreateParams AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left SubWindowParams 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#... | updateOrCreateParams(params: SubWindowParams): void {
this.Storage.setOrCreate("content", params.sum);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L152-L154 | a93722ddb2f13c0baecf9ea2b88c315d4ed87962 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | requestAudioPermission | 申请录音权限
用法示例:PermissionUtils.requestAudioPermission() { granted => ... }
@param callback 权限申请结果回调 | public async requestAudioPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.MICROPHONE"];
await this.handlePermissionResult('录音权限', callback, permissions);
} | AST#method_declaration#Left public async requestAudioPermission AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation... | public async requestAudioPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.MICROPHONE"];
await this.handlePermissionResult('录音权限', callback, permissions);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L195-L198 | ba2975c476f3c21864544fd4350847fcd56ed3d0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets | arkts | MultiCodeLayout | 多个二维码的位置图片渲染 | @Builder
MultiCodeLayout(arr: number[], index: number) {
Row() {
Image($rawfile('scan_selected2.svg'))
.width(40)
.height(40)
.visibility((this.isMultiSelected && this.multiSelectedIndex !== index) ? Visibility.None : Visibility.Visible)
.scale({ x: this.multiCodeScale, y: th... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MultiCodeLayout AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#pa... | @Builder
MultiCodeLayout(arr: number[], index: number) {
Row() {
Image($rawfile('scan_selected2.svg'))
.width(40)
.height(40)
.visibility((this.isMultiSelected && this.multiSelectedIndex !== index) ? Visibility.None : Visibility.Visible)
.scale({ x: this.multiCodeScale, y: th... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L132-L169 | 0063f236396ad29bf3f64c40159ac8613d95b9fa | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHSubtitles.ets | arkts | parseContent | 解析SRT文本内容为结构化数据 | private parseContent(srtContent: string): SrtSubtitle[] {
// 1. 按空行分割字幕块(处理Windows/Mac/Linux换行符差异:\r\n、\n)
const subtitleBlocks = srtContent.split(/\r?\n\r?\n/).filter(block => block.trim() !== "");
// 2. 逐个解析字幕块
subtitleBlocks.forEach(block => {
// 按换行分割块内内容(序号、时间轴、内容)
const lines = bloc... | AST#method_declaration#Left private parseContent AST#parameter_list#Left ( AST#parameter#Left srtContent : 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#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left... | private parseContent(srtContent: string): SrtSubtitle[] {
const subtitleBlocks = srtContent.split(/\r?\n\r?\n/).filter(block => block.trim() !== "");
subtitleBlocks.forEach(block => {
const lines = block.split(/\r?\n/).filter(line => line.trim() !== "");
if (lines.length < 3) ret... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHSubtitles.ets#L125-L143 | f4c26fa251bb97b5af7aaef3c8cf5a43c8b70807 | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/ChatPage.ets | arkts | onPageShow | 界面显示时被调用。 | onPageShow(): void {
// 本界面显示时,将输入法软键盘避让模式设置为KeyboardAvoidMode.RESIZE(即压缩窗体,而不是将窗体整体上移)
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), true);
// 设置全面屏状态栏颜色
ToolKits.setStatusBarColor(getContext(this), ToolKits.chat_page_title_color, ToolKits.chat_page_title_background_color);
} | AST#method_declaration#Left onPageShow 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 { // 本界面显示时,将输入法软键盘避让模式设置为KeyboardAvoidMode.RESIZE(即压缩窗体,而不是将窗体整体上移) AST#expression_statement#... | onPageShow(): void {
ToolKits.setKeyboardAvoidModeToRESIZE(this.getUIContext(), true);
ToolKits.setStatusBarColor(getContext(this), ToolKits.chat_page_title_color, ToolKits.chat_page_title_background_color);
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/ChatPage.ets#L83-L88 | 168653c425fe39c359fa1657aee3c6b61eaeb59f | github |
FantasyWind/fwrouter | eea785a7bf728862de1f88de487ef3857dee3364 | router/src/main/ets/RouterInterceptorManager.ets | arkts | 路由拦截器管理类。 | export class RouterInterceptorManager implements RouterInterceptor {
private static sInstance: RouterInterceptorManager
public static getInstance(): RouterInterceptorManager {
if (!RouterInterceptorManager.sInstance) {
RouterInterceptorManager.sInstance = new RouterInterceptorManager()
RouterInterc... | AST#export_declaration#Left export AST#class_declaration#Left class RouterInterceptorManager AST#implements_clause#Left implements RouterInterceptor AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private static sInstance : AST#type_annotation#Left AST#primary_type#Left RouterInterceptor... | export class RouterInterceptorManager implements RouterInterceptor {
private static sInstance: RouterInterceptorManager
public static getInstance(): RouterInterceptorManager {
if (!RouterInterceptorManager.sInstance) {
RouterInterceptorManager.sInstance = new RouterInterceptorManager()
RouterInterc... | https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/RouterInterceptorManager.ets#L38-L53 | 0e7dbeaa3ac866de091883b65849c796d0cb563d | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/GetDate.ets | arkts | 日历表上周六对应的序列号,从周日开始算起,取值0~6
根据指定年份和月份获取该月在日历表上的日期排布数据
@param { number } specifiedMonth - 指定月份
@param { number } specifiedYear - 指定年份 | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] {
let currentFirstWeekDay: number = 0; // 初始化指定月的第一天是周几
let currentLastWeekDay: number = 0; // 初始化指定月的最后一天是周几
let currentAllDay: number[] = []; // 初始化指定月的日期排列数组
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDat... | AST#export_declaration#Left export AST#function_declaration#Left function getMonthDate AST#parameter_list#Left ( AST#parameter#Left specifiedMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specifiedYear : AST#type_an... | export function getMonthDate(specifiedMonth: number, specifiedYear: number): number[] {
let currentFirstWeekDay: number = 0;
let currentLastWeekDay: number = 0;
let currentAllDay: number[] = [];
let totalDays = new Date(specifiedYear, specifiedMonth, 0).getDate();
currentFirstWeekDay = new Date(specifiedY... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/GetDate.ets#L35-L55 | a7f90b1a3f3272894497875e4e08056d7cb500ab | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets | arkts | primaryTitle | 【系统】系统内置标题(系统自定义内容弹窗,内置标题)
@param primaryTitle
@returns | primaryTitle(primaryTitle: string) {
this.builderOptions.primaryTitle = primaryTitle
return this;
} | AST#method_declaration#Left primaryTitle AST#parameter_list#Left ( AST#parameter#Left primaryTitle : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statemen... | primaryTitle(primaryTitle: string) {
this.builderOptions.primaryTitle = primaryTitle
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets#L26-L29 | a834779339cf6cf5d6abd24acdf02c9232e30e43 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | Control style of operation element.
@enum { TreeListenType }
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Control style of operation element.
@enum { TreeListenType }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export enum TreeListenType {
/**
* register listener after a node is clicked.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* register listener after a node is clicked.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
NODE_CLICK = 'NodeClick',... | AST#export_declaration#Left export AST#enum_declaration#Left enum TreeListenType AST#enum_body#Left { /**
* register listener after a node is clicked.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* register listener after a node is clicked.
* @syscap SystemCapability.ArkUI.ArkUI.Full... | export enum TreeListenType {
NODE_CLICK = 'NodeClick',
NODE_ADD = 'NodeAdd',
NODE_DELETE = 'NodeDelete',
NODE_MODIFY = 'NodeModify',
NODE_MOVE = 'NodeMove',
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L698-L763 | 3201308cc8bbadec866e4f83105c225b8e9d56eb | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets | arkts | once | 一次性订阅(触发后自动取消)
@param event 事件名称
@param handler 处理函数 | static once<T = void>(event: string, handler: (data?: T) => void): void {
if (typeof handler !== 'function') {
throw new Error('处理器必须为函数');
}
// 初始化一次性事件队列
if (!SimpleEventBus.onceListeners.has(event)) {
SimpleEventBus.onceListeners.set(event, []);
}
// 添加处理器
SimpleEventBus.onc... | AST#method_declaration#Left static once AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotatio... | static once<T = void>(event: string, handler: (data?: T) => void): void {
if (typeof handler !== 'function') {
throw new Error('处理器必须为函数');
}
if (!SimpleEventBus.onceListeners.has(event)) {
SimpleEventBus.onceListeners.set(event, []);
}
SimpleEventBus.onceListeners.get(event)... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L74-L86 | 84b90b89ea26506425cad16ce9089e6afa05d06f | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogBuilder.ets | arkts | TipsDialogBuilder | /** 后续支持,目前,这个二次封装有点麻烦 * 系统PopoverDialog 跟手弹窗 * @param options * @description 在点击区域弹窗,点击区域外弹窗消失 @Builder export function PopoverDialogBuilder(options: IPopoverDialogOptions) { PopoverDialog(options as ESObject) .height(options.style?.height) .width(options.style?.width) .constraintSize({ maxWidth: options.style?.maxW... | @Builder
export function TipsDialogBuilder(options: ITipsDialogOptions) {
TipsDialog(options as ESObject)
.height(options.style?.height)
.width(options.style?.width)
.constraintSize({ maxWidth: options.style?.maxWidth, maxHeight: options.style?.maxHeight })
.backgroundColor(options.style?.backgroundCo... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TipsDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ITipsDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#par... | @Builder
export function TipsDialogBuilder(options: ITipsDialogOptions) {
TipsDialog(options as ESObject)
.height(options.style?.height)
.width(options.style?.width)
.constraintSize({ maxWidth: options.style?.maxWidth, maxHeight: options.style?.maxHeight })
.backgroundColor(options.style?.backgroundCo... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L151-L165 | de50d542c029ca02684a98af1cf96e931d006e42 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets | arkts | getDLPFile | 获取dlp文件的uri和访问时间 | async getDLPFile(): Promise<void> {
try {
let info: Array<dlpPermission.AccessedDLPFileInfo> = await dlpPermission.getDLPFileAccessRecords();
promptAction.showToast({ message: 'getDLPFile:' + decodeURIComponent(JSON.stringify(info)), duration: 2000 });
Logger.info(TAG, 'getDLPFile:', JSON.stringif... | AST#method_declaration#Left async getDLPFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async getDLPFile(): Promise<void> {
try {
let info: Array<dlpPermission.AccessedDLPFileInfo> = await dlpPermission.getDLPFileAccessRecords();
promptAction.showToast({ message: 'getDLPFile:' + decodeURIComponent(JSON.stringify(info)), duration: 2000 });
Logger.info(TAG, 'getDLPFile:', JSON.stringif... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L93-L101 | 7006c6b32ea7946fabf52e8b509b0878b0056c7a | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/float_windows/float_windows_3.5.15.23/entry/src/main/ets/controller/FloatWindowController.ets | arkts | destroyFloatWindow | 自定义销毁悬浮窗方法 | public async destroyFloatWindow() {
console.info(TAG,` destroyWindow`);
if (this.floatWindow) {
await this.floatWindow.destroyWindow();
}
} | AST#method_declaration#Left public async destroyFloatWindow 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 console AST#expression#Right . i... | public async destroyFloatWindow() {
console.info(TAG,` destroyWindow`);
if (this.floatWindow) {
await this.floatWindow.destroyWindow();
}
} | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/float_windows/float_windows_3.5.15.23/entry/src/main/ets/controller/FloatWindowController.ets#L95-L100 | 253009c763d93969122e765fb03de893275c66cf | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PermissionUtil.ets | arkts | _checkAccessToken | 校验应用是否被授予权限 | private static async _checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let tokenId: number = 0;
try {
let bundleInfo: bundleManager.BundleInfo =
bundleManager.ge... | AST#method_declaration#Left private static async _checkAccessToken AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t... | private static async _checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let tokenId: number = 0;
try {
let bundleInfo: bundleManager.BundleInfo =
bundleManager.ge... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PermissionUtil.ets#L76-L97 | 35c401ef847b8fa0f92aa88abdd1949839d9589c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_asynchronous.ets | arkts | decryptMessagePromise | 解密消息 | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptUpdate = await decoder.update(cipherText);
// gc... | AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let decryptUpdate = await decoder.update(cipherText);
le... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_asynchronous.ets#L59-L69 | 0a9a9de419534609a9765a962b5686819345e357 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | getIncome | 获取收入 | public getIncome(): string {
return this.customDayInfo.income.toString();
} | AST#method_declaration#Left public getIncome AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressio... | public getIncome(): string {
return this.customDayInfo.income.toString();
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L519-L521 | 2c5f9bd664d4d08572b25582094b39a9a20b8689 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets | arkts | showConfirmDialog | 确认 提示弹窗
@param params
@returns | static showConfirmDialog(params: ConfirmDialogParams): string {
return PromptActionUtils.getInstance()
.openCustomDialog<ConfirmDialogParams>(wrapBuilder(ConfirmDialogBuilder),
params)
} | AST#method_declaration#Left static showConfirmDialog AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ConfirmDialogParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left s... | static showConfirmDialog(params: ConfirmDialogParams): string {
return PromptActionUtils.getInstance()
.openCustomDialog<ConfirmDialogParams>(wrapBuilder(ConfirmDialogBuilder),
params)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/dialog/AppDialogUtils.ets#L15-L19 | c94992237d1f1ee92df86089bf34ba41ea9c377c | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets | arkts | The refresh state enum. | export const enum RefreshState {
DropDown = 0,
Release = 1,
Refreshing = 2,
Success = 3,
Fail = 4
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum RefreshState AST#enum_body#Left { AST#enum_member#Left DropDown = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Release = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#L... | export const enum RefreshState {
DropDown = 0,
Release = 1,
Refreshing = 2,
Success = 3,
Fail = 4
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L207-L213 | 257950280ec6d9c7df79f37d12521742d1f4b1e6 | gitee | |
dividez/harmonyos-games.git | 78482622646cb5294d06c0aab1571f31b308b24c | features/number/src/main/ets/services/PreferencesUtil.ets | arkts | putPreference | 将用户输入的数据,保存到缓存的Preference实例中 | async putPreference(key: string, data: string) {
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.put(key, data).then(() => {
console.info(`Succeeded in putting value`);
}).catch((err: BusinessError) => {
console.error(`Failed to get p... | AST#method_declaration#Left async putPreference 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 data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | async putPreference(key: string, data: string) {
if (this.preferences === null) {
await this.getPreferencesFromStorage();
}
await this.preferences?.put(key, data).then(() => {
console.info(`Succeeded in putting value`);
}).catch((err: BusinessError) => {
console.error(`Failed to get p... | https://github.com/dividez/harmonyos-games.git/blob/78482622646cb5294d06c0aab1571f31b308b24c/features/number/src/main/ets/services/PreferencesUtil.ets#L27-L40 | a26a164cf6244e4df2470c8c0cd9099c4d1302af | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets | arkts | Defines the popup button options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Defines the popup button options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface PopupButtonOptions {
/**
* Set the button display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Set the button display content.
* @type { ResourceStr }.
* @syscap SystemCapability.Ark... | AST#export_declaration#Left export AST#interface_declaration#Left interface PopupButtonOptions AST#object_type#Left { /**
* Set the button display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Set the button display ... | export interface PopupButtonOptions {
text: ResourceStr;
action?: () => void;
fontSize?: number | string | Resource;
fontColor?: ResourceColor;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets#L111-L176 | b3de682afe3d26836465aa8df3f78b32a702f04f | github | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/PermissionUtils.ets | arkts | check | 检查是否授权 | static check(permissions: Permissions[]): boolean {
// 程序访问控制管理
const atManager = abilityAccessCtrl.createAtManager();
// 获取 bundle 信息
const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
// 提取 tokenID 标识
const tokenID = bundleInfo.... | AST#method_declaration#Left static check AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio... | static check(permissions: Permissions[]): boolean {
const atManager = abilityAccessCtrl.createAtManager();
const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
const tokenID = bundleInfo.appInfo.accessTokenId
const authR... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/PermissionUtils.ets#L10-L21 | 33f5acbf0f268195c416fb410dc1e6a8b4b29441 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ShareImagePage.ets | arkts | ShareImagePage | 图片分享实现思路
1.通过systemShare分享API获取从图库分享过来的图片地址,使用AppStorage存储。
2.将取到的图片路径传入lazyforeach的dataSource中进行渲染 | @AppRouter({ name: "shareimagepage/ShareImagePage" })
@Component
export struct ShareImagePage {
// 聊天item数据数组
@State textDetailData: textDetailData[] = [{
userId: 0,
profilePicture: $r('app.media.photo0'),
shareImageUri: '',
content: $r('app.string.share_image_page_text_detail_data0')
}, {
use... | AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "shareimagepage/ShareImagePage" AST#expression#Right AST#property_assignment#Right } AST#object_lite... | @AppRouter({ name: "shareimagepage/ShareImagePage" })
@Component
export struct ShareImagePage {
@State textDetailData: textDetailData[] = [{
userId: 0,
profilePicture: $r('app.media.photo0'),
shareImageUri: '',
content: $r('app.string.share_image_page_text_detail_data0')
}, {
userId: 1,
p... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ShareImagePage.ets#L33-L212 | f0fc30e86088db18826f591a6f75351266b5a138 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Open Device Identifier (ODID): a developer-level non-permanent device identifier.
A developer can be an enterprise or individual developer.
Example: dff3cdfd-7beb-1e7d-fdf7-1dbfddd7d30c
An ODID will be regenerate in the following scenarios:
Restore a phone to its factory settings.
Uninstall and reinstall all apps of o... | static get ODID(): string; | AST#method_declaration#Left static get AST#ERROR#Left ODID AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get ODID(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L467-L467 | b18949f82f697d1c7964f1d5283ea8301ca86ecc | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | getDefaultAddress | 获取默认地址
@returns {Promise<NetworkResponse<Address | null>>} 默认地址 | async getDefaultAddress(): Promise<NetworkResponse<Address | null>> {
const resp: AxiosResponse<NetworkResponse<Address | null>> =
await NetworkClient.http.get("user/address/default");
return resp.data;
} | AST#method_declaration#Left async getDefaultAddress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left <... | async getDefaultAddress(): Promise<NetworkResponse<Address | null>> {
const resp: AxiosResponse<NetworkResponse<Address | null>> =
await NetworkClient.http.get("user/address/default");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L80-L84 | 5a70327e183b2c0feb9cc9e088897670383e2189 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/zone_actions.ets | arkts | Gets the my_window_id of a zone with alias.
@param alias The alias.
@returns The my_window_id or undefined. | export function window_id_of_zone(alias: string) {
let windowStorages = AppStorage.get('windowStorages') as LocalStorage[];
for (let index = 0; index < windowStorages.length; index++) {
let s = windowStorages[index];
if (s.get('is_zone') as boolean && s.get('my_window_alias') as string == alias) {
ret... | AST#export_declaration#Left export AST#function_declaration#Left function window_id_of_zone AST#parameter_list#Left ( AST#parameter#Left alias : 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 ... | export function window_id_of_zone(alias: string) {
let windowStorages = AppStorage.get('windowStorages') as LocalStorage[];
for (let index = 0; index < windowStorages.length; index++) {
let s = windowStorages[index];
if (s.get('is_zone') as boolean && s.get('my_window_alias') as string == alias) {
ret... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L253-L262 | f41c759774f70dd2910e2af6284a9bee3778c847 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navigationbarchange/Index.ets | arkts | NavigationBarChangeView | 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 { NavigationBarChangeView } from './src/main/ets/view/NavigationBarChange'; | AST#export_declaration#Left export { NavigationBarChangeView } from './src/main/ets/view/NavigationBarChange' ; AST#export_declaration#Right | export { NavigationBarChangeView } from './src/main/ets/view/NavigationBarChange'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationbarchange/Index.ets#L15-L15 | fdd1b6ca87628290acae4ea91e84e30bb0bbb547 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | getLeapMonthDays | 🔧 修复:获取农历年闰月天数 - 使用准确数据 | private static getLeapMonthDays(lunarYear: number): number {
const leapMonth = LunarCalendarFixed.getLeapMonth(lunarYear);
if (leapMonth > 0) {
return AccurateLunarMonthDays.getLeapMonthDays(lunarYear);
}
return 0;
} | AST#method_declaration#Left private static getLeapMonthDays AST#parameter_list#Left ( AST#parameter#Left lunarYear : 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 numb... | private static getLeapMonthDays(lunarYear: number): number {
const leapMonth = LunarCalendarFixed.getLeapMonth(lunarYear);
if (leapMonth > 0) {
return AccurateLunarMonthDays.getLeapMonthDays(lunarYear);
}
return 0;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L262-L268 | 56b570e23f1490b6b4a52f355dc832334a4a1dac | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbUtils.ets | arkts | queryAll | 查询所有数据 | queryAll(tableName: string): Promise<dataRdb.ResultSet> {
return this.getDb().then(dbHelper => {
return dbHelper.queryAll(tableName);
})
} | AST#method_declaration#Left queryAll AST#parameter_list#Left ( AST#parameter#Left tableName : 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#Left Promi... | queryAll(tableName: string): Promise<dataRdb.ResultSet> {
return this.getDb().then(dbHelper => {
return dbHelper.queryAll(tableName);
})
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbUtils.ets#L106-L110 | 872d5c5729030101d9d6ae50aadebec579055432 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setSpaceMin | Sets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum` | public setSpaceMin(mSpaceMin: number): void {
this.mSpaceMin = mSpaceMin;
} | AST#method_declaration#Left public setSpaceMin AST#parameter_list#Left ( AST#parameter#Left mSpaceMin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_... | public setSpaceMin(mSpaceMin: number): void {
this.mSpaceMin = mSpaceMin;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L809-L811 | 6f5add006aed7e79224d6a0f85fb8f48faa269ef | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM3.ets | arkts | hmacSync | 消息认证码计算,同步
@param data 传入的消息
@param symKey 共享对称密钥(SymKey)。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 | static hmacSync(data: string, symKey: cryptoFramework.SymKey = SM3.symKey,
resultCoding: crypto.BhCoding = 'hex'): string {
return CryptoUtil.hmacSync(data, 'SM3', symKey, resultCoding);
} | AST#method_declaration#Left static hmacSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ... | static hmacSync(data: string, symKey: cryptoFramework.SymKey = SM3.symKey,
resultCoding: crypto.BhCoding = 'hex'): string {
return CryptoUtil.hmacSync(data, 'SM3', symKey, resultCoding);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L91-L94 | b082e36fe4c243d10dae284938bdc7eb7ec76a1d | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets | arkts | getDistance | Calculates the distance between the two given points.
@param x1
@param y1
@param x2
@param y2
@return | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
return Math.hypot(x1 - x2, y1 - y2);
} | AST#method_declaration#Left protected getDistance AST#parameter_list#Left ( AST#parameter#Left x1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
return Math.hypot(x1 - x2, y1 - y2);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets#L250-L252 | 08ddf9e53d5f1354d18827a1fa192084e03e5d95 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | time_bar/src/main/ets/components/viewModel/TimeBarModel.ets | arkts | get | Get the currently selected time (millisecond timestamp).
@returns The current time (clamped within valid bounds). | get currentTime(): number {
return this.clampToBounds(this._currentTime);
} | AST#method_declaration#Left get AST#ERROR#Left currentTime AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expr... | get currentTime(): number {
return this.clampToBounds(this._currentTime);
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L79-L81 | c9a01e2308402d9ba9bf720932a6a6a613a53cca | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets | arkts | deleteDB | 删除数据库
@param context
@returns | deleteDB(context: common.UIAbilityContext): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (this.rdbStore === undefined) {
resolve();
}
relationalStore.deleteRdbStore(context, CommonConstants.STORE_CONFIG, (error) => {
if (error) {
Logger.error(`[${Com... | AST#method_declaration#Left deleteDB AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | deleteDB(context: common.UIAbilityContext): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (this.rdbStore === undefined) {
resolve();
}
relationalStore.deleteRdbStore(context, CommonConstants.STORE_CONFIG, (error) => {
if (error) {
Logger.error(`[${Com... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L50-L64 | 40f4956e984ebb577b28f11bdc197a92b16d6f3a | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleDataSet.ets | arkts | setHighLightColor | Sets the color that is used for drawing the highlight indicators. Dont
forget to resolve the color using getResources().getColor(...) or
Color.rgb(...).
@param color | public setHighLightColor(color: number): void {
this.mHighLightColor = color;
} | AST#method_declaration#Left public setHighLightColor AST#parameter_list#Left ( AST#parameter#Left color : 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#primar... | public setHighLightColor(color: number): void {
this.mHighLightColor = color;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleDataSet.ets#L44-L46 | 77d4afa489c720483b0ff1886fb4afc1db3fc06d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/KvUtil.ets | arkts | getKvStore | KVStore数据库实例
获取KVStore数据库
@returns | private static async getKvStore(): Promise<distributedKVStore.SingleKVStore> {
if (!KvUtil.kvStore) {
const kvManager = distributedKVStore.createKVManager({
context: AppUtil.getContext(),
bundleName: AppUtil.getBundleName()
});
const options: distributedKVStore.Options = {
... | AST#method_declaration#Left private static async getKvStore AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . SingleKVSt... | private static async getKvStore(): Promise<distributedKVStore.SingleKVStore> {
if (!KvUtil.kvStore) {
const kvManager = distributedKVStore.createKVManager({
context: AppUtil.getContext(),
bundleName: AppUtil.getBundleName()
});
const options: distributedKVStore.Options = {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L35-L52 | 5b018d5a6b6f54e9311aaaa556adfb3cd78a0892 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/ImageViewUint.ets | arkts | onStridePixel | 旋转角度 | onStridePixel(): void {
this.isShowStridePixel = true;
} | AST#method_declaration#Left onStridePixel 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... | onStridePixel(): void {
this.isShowStridePixel = true;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/ImageViewUint.ets#L43-L45 | 3c2c817a5f6bd7b0162625d10ae8c5338f797e5b | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ScreenUtils.ets | arkts | getSafeArea | 获取安全区域 | static getSafeArea(): { top: number; bottom: number; left: number; right: number } {
// 实际实现需要使用 window.getWindowStage 获取安全区域
return {
top: 0,
bottom: 0,
left: 0,
right: 0
};
} | AST#method_declaration#Left static getSafeArea AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#ERROR#Left AST#expression_statement#Left AST#expression#Left top AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number... | static getSafeArea(): { top: number; bottom: number; left: number; right: number } {
return {
top: 0,
bottom: 0,
left: 0,
right: 0
};
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ScreenUtils.ets#L59-L67 | 97b2c0276f9594d523de7ec3ba26b4be9809c85a | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Utils.ets | arkts | date convert into format of 'Fri Aug 26 2022' | export function dateToStr(date: Date) {
return date.toDateString();
} | AST#export_declaration#Left export AST#function_declaration#Left function dateToStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#state... | export function dateToStr(date: Date) {
return date.toDateString();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/utils/Utils.ets#L45-L47 | 70b7065edc0c3d6d49f7623cb03cff01673cf9b5 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | sendMessage | 发送消息 | private async sendMessage(): Promise<void> {
if (!this.inputText.trim() || this.isLoading) {
return;
}
try {
const messageText = this.inputText.trim();
this.inputText = '';
this.isLoading = true;
this.isTyping = true;
// 滚动到底部
this.scrollToBottom();
// 发送消息... | AST#method_declaration#Left private async sendMessage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#t... | private async sendMessage(): Promise<void> {
if (!this.inputText.trim() || this.isLoading) {
return;
}
try {
const messageText = this.inputText.trim();
this.inputText = '';
this.isLoading = true;
this.isTyping = true;
this.scrollToBottom();
const re... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L503-L547 | f361e82ad58ad20d346a2bd9dd66f6b769611608 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.DownloadFileButton.d.ets | arkts | Enum for DownloadDescription
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export declare enum DownloadLayoutDirection {
/**
* Layout direction is HORIZONTAL.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
HORIZONTAL = 0,
/**
* Layout direction is VERTICAL.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* ... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DownloadLayoutDirection AST#enum_body#Left { /**
* Layout direction is HORIZONTAL.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#enum_member#... | export declare enum DownloadLayoutDirection {
HORIZONTAL = 0,
VERTICAL = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L153-L174 | 8192d110ab072064fa72b1c342ddb8888393c6f3 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets | arkts | getNewsData | 获取数据 | getNewsData(): Array<NewsData> {
// 从本地文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult = textDecoder.decodeWithStream(new Uint8Array(... | AST#method_declaration#Left getNewsData AST#parameter_list#Left ( ) AST#parameter_list#Right : 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 NewsData AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | getNewsData(): Array<NewsData> {
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
const textDecoder = util.TextDecoder.create('utf-8', {
ignoreBOM: true
});
const textDecoderResult = textDecoder.decodeWithStream(new Uint8Array(value.buffer));
const ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets#L449-L467 | 26794debe552c66cb671013106277eb23ed8065b | gitee |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | queueit_sdk/src/main/ets/view/QueueItViewManager.ets | arkts | showQueue | --- Public methods to control the View/State --- | public async showQueue(queueTryPassResult: QueueTryPassResult): Promise<void> {
if (!queueTryPassResult.queueUrl) {
Logger.error(QueueItViewManager.TAG, "Cannot show queue, Queue URL is missing.");
this.queueListener.onError(QueueError.INVALID_RESPONSE, "Missing Queue URL for display");
... | AST#method_declaration#Left public async showQueue AST#parameter_list#Left ( AST#parameter#Left queueTryPassResult : AST#type_annotation#Left AST#primary_type#Left QueueTryPassResult AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_ty... | public async showQueue(queueTryPassResult: QueueTryPassResult): Promise<void> {
if (!queueTryPassResult.queueUrl) {
Logger.error(QueueItViewManager.TAG, "Cannot show queue, Queue URL is missing.");
this.queueListener.onError(QueueError.INVALID_RESPONSE, "Missing Queue URL for display");
... | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/view/QueueItViewManager.ets#L48-L73 | a3da6cefbcce61f1a16838f178de46304b547940 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bridges/PhotoView/AssetUtil.ets | arkts | makeAssetArrayBuffer | 按图片大小生成ArrayBuffer
@param asset 图片
@returns 返回ArrayBuffer | static async makeAssetArrayBuffer(asset: string | AssetModel) {
let assetSize = await AssetUtil.getAssetSize(asset)
let bufferSize = assetSize.width * assetSize.height * 4
return new ArrayBuffer(bufferSize)
} | AST#method_declaration#Left static async makeAssetArrayBuffer AST#parameter_list#Left ( AST#parameter#Left asset : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AssetModel AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST... | static async makeAssetArrayBuffer(asset: string | AssetModel) {
let assetSize = await AssetUtil.getAssetSize(asset)
let bufferSize = assetSize.width * assetSize.height * 4
return new ArrayBuffer(bufferSize)
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/PhotoView/AssetUtil.ets#L41-L45 | d2d484e0eada5dbd478b358e79a9ffba8c00ce1f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPIApplicationScenario/entry/src/main/ets/pages/ObjectUtils.ets | arkts | [End napi_ark_runtime_utils] [Start napi_event_loop_utils] | export function SetTimeout(): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => {
console.info('set timer delay 1s');
// attempt to stop the event loop at napi terminal
resolve();
}, 1000)
})
} | AST#export_declaration#Left export AST#function_declaration#Left function SetTimeout 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 AS... | export function SetTimeout(): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => {
console.info('set timer delay 1s');
resolve();
}, 1000)
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPIApplicationScenario/entry/src/main/ets/pages/ObjectUtils.ets#L21-L29 | 3caec9f68dd98fd20d50a447bc1bb16b3b704bb5 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/BundleUtils.ets | arkts | getBundleAppIdentifier | 获取appIdentifier | static getBundleAppIdentifier() {
// 根据给定的bundle名称获取BundleInfo。
// 使用此方法需要申请 ohos.permission.GET_BUNDLE_INFO权限。
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO;
try {
bundleManager.getBundleInfoForSelf(bundleFlags).then(async (data) => {
//获取appIdentifier
... | AST#method_declaration#Left static getBundleAppIdentifier AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 根据给定的bundle名称获取BundleInfo。 // 使用此方法需要申请 ohos.permission.GET_BUNDLE_INFO权限。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleFlags = AST#expr... | static getBundleAppIdentifier() {
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO;
try {
bundleManager.getBundleInfoForSelf(bundleFlags).then(async (data) => {
let appIdentifier = data.signatureInfo.appIdentifier;
let fingerprint = data.si... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/BundleUtils.ets#L27-L47 | f8f4fa217c439a9e63526e7f337f7eb85e6ee1d9 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/EmitterUtils.ets | arkts | postEventBus | 发布事件
@param eventId 事件ID
@param priority 事件优先级 | static postEventBus(eventId: string, data?: object, priority: emitter.EventPriority = emitter.EventPriority.HIGH) {
LogUtils.debug("EmitterUtils postEventBus",
`eventId=${eventId} data=${JsonUtils.stringify(data)} priority=${priority} `)
emitter.emit(eventId, {
priority: priority
}, { data: data... | AST#method_declaration#Left static postEventBus AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left object AST#primar... | static postEventBus(eventId: string, data?: object, priority: emitter.EventPriority = emitter.EventPriority.HIGH) {
LogUtils.debug("EmitterUtils postEventBus",
`eventId=${eventId} data=${JsonUtils.stringify(data)} priority=${priority} `)
emitter.emit(eventId, {
priority: priority
}, { data: data... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/EmitterUtils.ets#L12-L18 | 37442c6c22b2a93f252a1f8e1ef92c3e9e884d75 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setFont | 设置应用的字体类型。仅支持主线程调用。
@param fontSizeScale | static setFont(font: string){
AppUtil.getApplicationContext().setFont(font);
} | AST#method_declaration#Left static setFont AST#parameter_list#Left ( AST#parameter#Left font : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressi... | static setFont(font: string){
AppUtil.getApplicationContext().setFont(font);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L157-L159 | ae0cf49817ddc51e8fa3fc1c42dda889d16ca279 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | getWindowProperties | 获取当前窗口的属性
@param windowClass 不传该值,获取主窗口的属性
@returns | static getWindowProperties(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowProperties {
return windowClass.getWindowProperties();
} | AST#method_declaration#Left static getWindowProperties AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Lef... | static getWindowProperties(windowClass: window.Window = AppUtil.getMainWindow()): window.WindowProperties {
return windowClass.getWindowProperties();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L294-L296 | b5adf4286ccb44dfa7eb63b84133ae7ca256d56a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clockin/src/main/ets/FeatureComponent.ets | arkts | ClockInPage | 仅用于项目调试,单独使用可删除代码内容 | @AppRouter({ name: "clockin/ClockInPage" })
@Component
export struct ClockInPage {
build() {
ClockInSamplePage()
.height($r("app.string.clock_in_full_size"))
.width($r("app.string.clock_in_full_size"));
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "clockin/ClockInPage" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right ... | @AppRouter({ name: "clockin/ClockInPage" })
@Component
export struct ClockInPage {
build() {
ClockInSamplePage()
.height($r("app.string.clock_in_full_size"))
.width($r("app.string.clock_in_full_size"));
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/FeatureComponent.ets#L21-L30 | a257390cdd4bf5df1f765870f8f7e26e852c187b | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/navigation/GoodsGraph.ets | arkts | register | 注册商品模块导航路由 | register(): void {
RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav));
RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav));
RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav));
RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav));... | AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left... | register(): void {
RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav));
RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav));
RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav));
RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav));... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsGraph.ets#L16-L21 | dc2cccd602847d1e5cfee982f6e5364f1bc89a2c | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/argument_passing/argument_passing_005_T.ets | arkts | Introduction 参数传递-rest参数 | export function argument_passing_005_T(taint_src : string) {
f("a","b",taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_005_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function argument_passing_005_T(taint_src : string) {
f("a","b",taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/argument_passing/argument_passing_005_T.ets#L6-L8 | d50b53ad7c9a4019116a3d5fe0c5c15667acf686 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactEditPage.ets | arkts | saveContact | 保存联系人 | private async saveContact() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'saveContact called');
// 表单验证
if (!this.validateForm()) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Form validation failed');
return;
}
hilog.info(LogConstants.DOMAIN_APP, LogConsta... | AST#method_declaration#Left private async saveContact 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 hilog AST#expression#Righ... | private async saveContact() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'saveContact called');
if (!this.validateForm()) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Form validation failed');
return;
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L177-L284 | d9d834103c162121af6d4df81a47e120d11e8185 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets | arkts | initAddressSelect | 首次加载AddressPickerComponent如果传入了有效的地址信息(如'浙江省', '杭州市', '余杭区')时,在拉起地址选择半模态页面时,会按传入的地址信息进行显示 | initAddressSelect() {
if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') {
this.provinceCityRegion = this.address.province + this.address.city + this.address.region;
this.currentSelectInfo.province = this.address.province;
this.currentSelectInfo.city = this... | AST#method_declaration#Left initAddressSelect AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expressi... | initAddressSelect() {
if (this.address.province !== '' && this.address.city !== '' && this.address.region !== '') {
this.provinceCityRegion = this.address.province + this.address.city + this.address.region;
this.currentSelectInfo.province = this.address.province;
this.currentSelectInfo.city = this... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L121-L157 | b89ae139ebacd2c38713a8a018be9d78103d5b1b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setDialogBackGestureEnabled | 设置模态窗口是否响应手势返回事件,非模态窗口调用返回错误码。
@param enabled 是否响应手势返回事件。true表示响应手势返回事件,触发onBackPress回调;false表示不响应手势返回事件,不触发onBackPress回调。
@param windowClass 不传该值,默认主窗口。
@returns | static async setDialogBackGestureEnabled(enabled: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setDialogBackGestureEnabled(enabled);
} | AST#method_declaration#Left static async setDialogBackGestureEnabled 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#Left windowClass : AST#type_annotation#Left AST#primary_... | static async setDialogBackGestureEnabled(enabled: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setDialogBackGestureEnabled(enabled);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L386-L389 | cf0fa9e28e3f48c4f4d677c9426744ce0ab20815 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/MultiCameraHelpDialog.ets | arkts | MultiCameraHelpDialog | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @CustomDialog
export struct MultiCameraHelpDialog {
build() {
Column() {
Row() {
Image($r('app.media.pic_popup_left')).size({ width: 240, height: 280 })
Image($r('app.media.pic_popup_right')).size({ width: 240, height: 280 })
}
Text('请确保对方设备的WLAN和蓝牙已打开,并在“设置”>“超级终端”>“本机”调整允许被发现的... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct MultiCameraHelpDialog AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_cont... | @CustomDialog
export struct MultiCameraHelpDialog {
build() {
Column() {
Row() {
Image($r('app.media.pic_popup_left')).size({ width: 240, height: 280 })
Image($r('app.media.pic_popup_right')).size({ width: 240, height: 280 })
}
Text('请确保对方设备的WLAN和蓝牙已打开,并在“设置”>“超级终端”>“本机”调整允许被发现的... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/MultiCameraHelpDialog.ets#L16-L28 | 5e4e38a0bea2bf95370b6c9709e5b55415349083 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFMpegUtils.ets | arkts | FFmpeg 命令执行选项接口 | export interface FFmpegCommandOptions {
/**
* FFmpeg 命令参数数组
* 例如:['-i', 'input.mp4', '-c:v', 'libx264', 'output.mp4']
*/
cmds: Array<string>;
/**
* 进度回调函数
* @param progress 进度百分比 (0-100)
*/
onFFmpegProgress: (progress: number) => void;
/**
* 失败回调函数
* @param code 错误码
* @param m... | AST#export_declaration#Left export AST#interface_declaration#Left interface FFmpegCommandOptions AST#object_type#Left { /**
* FFmpeg 命令参数数组
* 例如:['-i', 'input.mp4', '-c:v', 'libx264', 'output.mp4']
*/ AST#type_member#Left cmds : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#typ... | export interface FFmpegCommandOptions {
cmds: Array<string>;
onFFmpegProgress: (progress: number) => void;
onFFmpegFail: (code: number, msg: string) => void;
onFFmpegSuccess: () => void;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFMpegUtils.ets#L11-L35 | 7837a173e20db2c55032356a992d60e7b4d192ca | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/pages/NavPathManager.ets | arkts | 返回到指定栈索引 | export function NavPopToIndex(index: number, animated?: boolean) {
NavPathManager.shared.popTo(index, animated)
} | AST#export_declaration#Left export AST#function_declaration#Left function NavPopToIndex 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 animated ? : AST#type_annotation#Le... | export function NavPopToIndex(index: number, animated?: boolean) {
NavPathManager.shared.popTo(index, animated)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L105-L107 | 1d1e465bcbdeaef773143d058e25ee7c5c46fb58 | github | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/network/RCPUtils.ets | arkts | The RCPUtils provides the capability of accessing the network through RCP. | export class RCPUtils {
rcpSession: rcp.Session;
constructor() {
this.rcpSession = rcp.createSession();
}
/**
* The method of initiating a GET request through RCP.
*/
async getRCPRequest(cacheDir: string): Promise<string> {
let responsePictureUri: string = '';
await this.rcpSession.get('ht... | AST#export_declaration#Left export AST#class_declaration#Left class RCPUtils AST#class_body#Left { AST#property_declaration#Left rcpSession : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Session AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_decl... | export class RCPUtils {
rcpSession: rcp.Session;
constructor() {
this.rcpSession = rcp.createSession();
}
async getRCPRequest(cacheDir: string): Promise<string> {
let responsePictureUri: string = '';
await this.rcpSession.get('https://developer.huawei.com/system/modules/org.opencms.portal.templ... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/RCPUtils.ets#L17-L74 | 176c12444b846cee2f8b9b45c40eddf430c5ece6 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/SubmitForm.ets | arkts | [EndExclude button_to_log_in_or_register] | build() {
// [StartExclude button_to_log_in_or_register]
NavDestination() {
// [EndExclude button_to_log_in_or_register]
Column({ space: 12 }) {
TextInput({ text: this.username, placeholder: 'input your username' })
.id('username')
// [StartExclude button_to_log_in_or_r... | AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude button_to_log_in_or_register] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { // [EndExclude button_to_log_in_or_register] AST#arkts_ui_element#Left AST#ui_eleme... | build() {
NavDestination() {
Column({ space: 12 }) {
TextInput({ text: this.username, placeholder: 'input your username' })
.id('username')
.onChange((value: string) => {
this.username = value;
})
TextInput({ text: thi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/SubmitForm.ets#L30-L65 | 1f212db81466a43495368a1305f5a97cacd3a104 | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/CloudDBService.ets | arkts | 模拟云数据库区域接口 | export interface CloudDBZone {
// 模拟云数据库区域接口
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CloudDBZone AST#object_type#Left { // 模拟云数据库区域接口 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface CloudDBZone {
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L6-L8 | 56f492a587ede8e3a7e9c9d784ba2d6e8441f522 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/common/constants/WorldCommonConstants.ets | arkts | 最佳实践:点击响应优化 | export class CommonConstants {
// font family
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
// opacity
static readonly FIRST_LEVEL_OPACITY: number = ... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // font family AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left stati... | export class CommonConstants {
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
static readonly FIRST_LEVEL_OPACITY: number = 0.9;
static readonly S... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/common/constants/WorldCommonConstants.ets#L19-L68 | 32eabecae6c46b59cffc80611a057b2685a9c24f | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | updateTopBarAlpha | 更新顶部导航栏透明度
@param {number} scrollOffset - 当前滚动增量
@param {number | undefined} absoluteOffset - 当前滚动绝对距离
@returns {void} 无返回值 | updateTopBarAlpha(scrollOffset: number, absoluteOffset?: number): void {
if (absoluteOffset !== undefined) {
this.topBarAlpha = this.clampAlpha(Math.floor(absoluteOffset));
this.totalScrollOffset = this.topBarAlpha;
return;
}
this.totalScrollOffset += scrollOffset;
this.topBarAlpha = ... | AST#method_declaration#Left updateTopBarAlpha AST#parameter_list#Left ( AST#parameter#Left scrollOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left absoluteOffset ? : AST#type_annotation#Left AST#primary_type#Left numb... | updateTopBarAlpha(scrollOffset: number, absoluteOffset?: number): void {
if (absoluteOffset !== undefined) {
this.topBarAlpha = this.clampAlpha(Math.floor(absoluteOffset));
this.totalScrollOffset = this.topBarAlpha;
return;
}
this.totalScrollOffset += scrollOffset;
this.topBarAlpha = ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L187-L197 | 7eb5374bb8beb29f67e563f1769a3bc4538b163d | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/network/BaseNetWorkListView.ets | arkts | buildDefaultEmpty | 默认空数据视图
@returns {void} 无返回值 | @Builder
buildDefaultEmpty(): void {
EmptyData();
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDefaultEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Le... | @Builder
buildDefaultEmpty(): void {
EmptyData();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/network/BaseNetWorkListView.ets#L68-L71 | 74716c7a40095db51f8a1aa99cb50b2eeec9b4fd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/eraser/src/main/ets/pages/EraserMainPage.ets | arkts | drawingArea | 绘制区域 | @Builder
drawingArea() {
Image($r('app.media.eraser_picture'))
.width($r('app.string.eraser_full_size'))
.objectFit(ImageFit.Contain)
.alignRules({
top: { anchor: Constants.TOP_BUTTON_LINE_ID, align: VerticalAlign.Bottom },
middle: { anchor: Constants.CONTAINER_ID, align: Horizon... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right drawingArea 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( ... | @Builder
drawingArea() {
Image($r('app.media.eraser_picture'))
.width($r('app.string.eraser_full_size'))
.objectFit(ImageFit.Contain)
.alignRules({
top: { anchor: Constants.TOP_BUTTON_LINE_ID, align: VerticalAlign.Bottom },
middle: { anchor: Constants.CONTAINER_ID, align: Horizon... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/pages/EraserMainPage.ets#L165-L214 | 3ba731b7343a6d98c5212832f62eafc2ee027e00 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | [StartExclude power_entry_ability] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (error) {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail');
}
hilog.info(DOMAIN, 'testTa... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (error) {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'setColorMode fail');
}
hilog.info(DOMAIN, 'testTa... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets#L10-L17 | 184c94605afb5dbba0f1bc1e1a12b395a5394ee2 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | MultipleImage/entry/src/main/ets/pages/Index.ets | arkts | [End progress_component] DocsCode 2 | build() {
Column() {
Row() {
Image($r('app.media.back'))
.width($r('app.float.image_width'))
.height($r('app.float.image_height'))
.margin({ top: $r('app.float.image_margin_top') })
}
.width(CommonConstants.FULL_PERCENT)
.height($r('app.float.row_image_h... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Image($r('app.media.back'))
.width($r('app.float.image_width'))
.height($r('app.float.image_height'))
.margin({ top: $r('app.float.image_margin_top') })
}
.width(CommonConstants.FULL_PERCENT)
.height($r('app.float.row_image_h... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MultipleImage/entry/src/main/ets/pages/Index.ets#L97-L280 | 5ff00619b259a840edcf9a6c5e973f418d1740bc | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/RowAttribute.ets | arkts | 获取横向末尾 + 垂直居中的 Row 对齐修饰器
@returns {AttributeModifier<RowAttribute>} Row 对齐修饰器
@example
Row() { Text("Hi"); }.attributeModifier(rowEndCenter()); | export function rowEndCenter(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(VerticalAlign.Center);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function rowEndCenter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#p... | export function rowEndCenter(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(VerticalAlign.Center);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L42-L49 | 76d3d539d39aedb2f57af3940a48ea831c9f81fb | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/higher_order_function/higher_order_function_002_F.ets | arkts | Introduction 高阶函数-一阶 | export function higher_order_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
taint.Sink(f22()(_clean,"a"));
} | AST#export_declaration#Left export AST#function_declaration#Left function higher_order_function_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s... | export function higher_order_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
taint.Sink(f22()(_clean,"a"));
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/higher_order_function/higher_order_function_002_F.ets#L6-L10 | d44ccaa4f027b1b601f5a3c057bd85fe3db56150 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/transitionanimation/src/main/ets/model/WaterFlowDataSource.ets | arkts | 实现IDataSource接口的对象,用于瀑布流组件加载数据 | export class WaterFlowDataSource implements IDataSource {
private dataArray: Array<CardData> = [];
private listeners: DataChangeListener[] = [];
constructor() {
this.dataArray = [
new CardData(1, $r("app.media.transitionanimation_image1"), $r("app.string.transition_animation_card_title1"), $r("app.stri... | AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#typ... | export class WaterFlowDataSource implements IDataSource {
private dataArray: Array<CardData> = [];
private listeners: DataChangeListener[] = [];
constructor() {
this.dataArray = [
new CardData(1, $r("app.media.transitionanimation_image1"), $r("app.string.transition_animation_card_title1"), $r("app.stri... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/transitionanimation/src/main/ets/model/WaterFlowDataSource.ets#L19-L120 | 95780cf3341124a1d90eb9deae7d49a5224819f8 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeCategorySection.ets | arkts | HomeCategorySection | @file 首页分类卡片组件
@author Joker.X | @ComponentV2
export struct HomeCategorySection {
/**
* 分类列表
*/
@Param
categories: Category[] = [];
/**
* 分类点击回调
*/
@Param
onCategoryClick: (id: number) => void = () => {
};
/**
* 构建分类卡片
* @returns {void} 无返回值
*/
build(): void {
if (this.categories && this.categories.length > ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeCategorySection AST#component_body#Left { /**
* 分类列表
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right categories : AST#type_annotation#Left AST#primary_type#Left AST#array_ty... | @ComponentV2
export struct HomeCategorySection {
@Param
categories: Category[] = [];
@Param
onCategoryClick: (id: number) => void = () => {
};
build(): void {
if (this.categories && this.categories.length > 0) {
Card({ paddingValue: $r("app.float.space_padding_small") }) {
Grid()... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L10-L116 | 14c0aebf2afb6c83de9917b99b84aff00211c6e3 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/SimulateCurlView.ets | arkts | SimulateCurlView | 组件NodeContainer的id | @Component
export struct SimulateCurlView {
private context: DrawingRenderingContext = new DrawingRenderingContext()
@State
private isOnGesture: boolean = false;
@State
private isOnAnimation: boolean = false;
private isReady = false
controller: TextController = new TextController();
private lastTime: nu... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SimulateCurlView AST#component_body#Left { AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left DrawingRenderingContext AST#primary_type#Right AST#type_annotation#Right = AST#... | @Component
export struct SimulateCurlView {
private context: DrawingRenderingContext = new DrawingRenderingContext()
@State
private isOnGesture: boolean = false;
@State
private isOnAnimation: boolean = false;
private isReady = false
controller: TextController = new TextController();
private lastTime: nu... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/view/SimulateCurlView.ets#L11-L214 | 2140f5480fc1a90058314c791c77431c66995fbf | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getValueLineWidth | When valuePosition is OutsideSlice, indicates line width
@Override | public getValueLineWidth(): number {
return this.mValueLineWidth;
} | AST#method_declaration#Left public getValueLineWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member... | public getValueLineWidth(): number {
return this.mValueLineWidth;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L205-L207 | ea7cc0a8b1a2eeaa5932734b11a2f72a1c5a4fd3 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility7.ets | arkts | onCreate | Sample_004 -> Sample_005 -> Sample_006 -> Sample_007 -> Sample_008 -> Sample_001 | onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){
hilog.info(0x0000, 'StartupTest PageAbility7', '%{public}s', 'Ability onCreate');
if (want.parameters && want.parameters?.keepAlive) {
console.info('StartupTest PageAbility7 keepAlive = true');
keepAlive = true;
}
if (want.param... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){
hilog.info(0x0000, 'StartupTest PageAbility7', '%{public}s', 'Ability onCreate');
if (want.parameters && want.parameters?.keepAlive) {
console.info('StartupTest PageAbility7 keepAlive = true');
keepAlive = true;
}
if (want.param... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility7.ets#L38-L118 | 73ddcd5fdfdc841500d450a61a0cbc8116d28438 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Retrieves the bunch_of_tabs of the specific id window.
@param w The windowClass (window.Window). | export function bunch_of_tabs_of_window(w: window.Window) {
let all_bunch_of_tabs = AppStorage.get('all_bunch_of_tabs') as bunch_of_tabs[];
let tabs = all_bunch_of_tabs[window_index_of_windowClass(w)];
return tabs;
} | AST#export_declaration#Left export AST#function_declaration#Left function bunch_of_tabs_of_window AST#parameter_list#Left ( AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete... | export function bunch_of_tabs_of_window(w: window.Window) {
let all_bunch_of_tabs = AppStorage.get('all_bunch_of_tabs') as bunch_of_tabs[];
let tabs = all_bunch_of_tabs[window_index_of_windowClass(w)];
return tabs;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L532-L536 | 3069007d1e8b69fa7006e71cd1064c8ae48ba2ef | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/MovieCard/entry/src/main/ets/viewmodel/FormBean.ets | arkts | toValuesBucket | Get inserted form data.
@return Return form data | toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
} | AST#method_declaration#Left toValuesBucket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left ... | toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/viewmodel/FormBean.ets#L40-L46 | 0fb1ca1033d8367dea8e97817c0361d7dae0c2c9 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PCProject/entry/src/main/ets/pages/Index.ets | arkts | createFloatWindowBackground | [Start create_float_window_background] | async createFloatWindowBackground() {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
try {
window.getLastWindow(context, (err: BusinessError, topWindow) => {
const errCode: number = err.code;
if (errCode) {
hilog.error(DOMAIN, TAG, '%{public}s',
... | AST#method_declaration#Left async createFloatWindowBackground AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Lef... | async createFloatWindowBackground() {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
try {
window.getLastWindow(context, (err: BusinessError, topWindow) => {
const errCode: number = err.code;
if (errCode) {
hilog.error(DOMAIN, TAG, '%{public}s',
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PCProject/entry/src/main/ets/pages/Index.ets#L29-L53 | d5a90bb94c7e3443ee167566772026959d40c979 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/pages/CameraPage.ets | arkts | [End releasecamera] | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expres... | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CameraPage.ets#L61-L74 | 89df43a3d2a27da99185c86d01e730e94736ab58 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/lineCharts/ColorfulPage.ets | arkts | initialLineChartModel | 初始化折线图数据模型 | private async initialLineChartModel(model: LineChartModel) {
let description: Description | null = model.getDescription();
if (description) {
description.setEnabled(false);
}
model.setMaxVisibleValueCount(50);
model.setPinchZoom(false);
model.setDrawGridBackground(false);
let xAxis: ... | AST#method_declaration#Left private async initialLineChartModel AST#parameter_list#Left ( AST#parameter#Left model : AST#type_annotation#Left AST#primary_type#Left LineChartModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left... | private async initialLineChartModel(model: LineChartModel) {
let description: Description | null = model.getDescription();
if (description) {
description.setEnabled(false);
}
model.setMaxVisibleValueCount(50);
model.setPinchZoom(false);
model.setDrawGridBackground(false);
let xAxis: ... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/lineCharts/ColorfulPage.ets#L68-L149 | e09275f9ee5363585c4a901fccc9f465cf38548b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/ImgLayerUtil.ets | arkts | 分层图片工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | export class ImgLayerUtil {
/**
* 获取分层图片图片
* @param ctx 上下文
* @param fg 分层前景图
* @param bg 分层背景图
*/
public static async getLayerImg(ctx: UIContext, fg: Resource, bg: Resource) {
// 创建分层图标
const foreground = await ImgLayerUtil.getDrawableDescriptor(ctx, fg);
const background = await Im... | AST#export_declaration#Left export AST#class_declaration#Left class ImgLayerUtil AST#class_body#Left { /**
* 获取分层图片图片
* @param ctx 上下文
* @param fg 分层前景图
* @param bg 分层背景图
*/ AST#method_declaration#Left public static async getLayerImg AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annota... | export class ImgLayerUtil {
public static async getLayerImg(ctx: UIContext, fg: Resource, bg: Resource) {
const foreground = await ImgLayerUtil.getDrawableDescriptor(ctx, fg);
const background = await ImgLayerUtil.getDrawableDescriptor(ctx, bg);
return new LayeredDrawableDescriptor(foreground, bac... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/ImgLayerUtil.ets#L22-L50 | d2bbade879366f137badea6bd57a2810a7827a2f | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | getSettings | 获取完整的应用设置
@returns 应用设置 | async getSettings(): Promise<AppSettings> {
if (!this.settings) {
await this.initialize();
}
return this.settings!;
} | AST#method_declaration#Left async getSettings 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 AppSettings AST#primary_type#Right AST#type_annotation#Right > AST#ty... | async getSettings(): Promise<AppSettings> {
if (!this.settings) {
await this.initialize();
}
return this.settings!;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L121-L126 | c2f341ac2f9fb36187356aeb01adefbc5763301d | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.