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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Cart.ets | arkts | @file 购物车模型
@author Joker.X | export class Cart {
/**
* 商品 id
*/
goodsId: number = 0;
/**
* 商品名称
*/
goodsName: string = "";
/**
* 商品主图
*/
goodsMainPic: string = "";
/**
* 规格
*/
spec: CartGoodsSpec[] = [];
constructor(init?: Partial<Cart>) {
if (!init) {
return;
}
this.goodsId = init.goods... | AST#export_declaration#Left export AST#class_declaration#Left class Cart AST#class_body#Left { /**
* 商品 id
*/ AST#property_declaration#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_d... | export class Cart {
goodsId: number = 0;
goodsName: string = "";
goodsMainPic: string = "";
spec: CartGoodsSpec[] = [];
constructor(init?: Partial<Cart>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
this.goodsName = init.goodsName ?? this.goodsName;
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Cart.ets#L7-L34 | cfe776986546ba6cbc4e7868d82b88ab3921a985 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/HttpRequestMonitor/entry/src/main/ets/pages/Index.ets | arkts | sleep | 休眠指定的毫秒数 | function sleep(time: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, time));
} | AST#function_declaration#Left function sleep AST#parameter_list#Left ( AST#parameter#Left time : 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 Pr... | function sleep(time: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, time));
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/HttpRequestMonitor/entry/src/main/ets/pages/Index.ets#L148-L150 | 08176a11834ba72ac77c900f0ad90fcd27cc9b12 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/CacheHelper.ets | arkts | has | 判断是否包含key对应的缓存 | public static has(key: string): boolean {
return CacheHelper.lruCache.contains(key);
} | AST#method_declaration#Left public static has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | public static has(key: string): boolean {
return CacheHelper.lruCache.contains(key);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L55-L57 | c1508c1fc15d7df43c9f6a075ea68df035bd949e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | getRelationColor | 根据关系获取标签颜色 | private getRelationColor(relation: string): string {
const colorMap: Record<string, string> = {
'父亲': this.COLORS.primary,
'母亲': this.COLORS.redPrimary,
'兄弟': this.COLORS.greenPrimary,
'姐妹': this.COLORS.orangePrimary,
'朋友': this.COLORS.primary,
'同事': this.COLORS.gray600,
'同... | AST#method_declaration#Left private getRelationColor AST#parameter_list#Left ( AST#parameter#Left relation : 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 string AST#p... | private getRelationColor(relation: string): string {
const colorMap: Record<string, string> = {
'父亲': this.COLORS.primary,
'母亲': this.COLORS.redPrimary,
'兄弟': this.COLORS.greenPrimary,
'姐妹': this.COLORS.orangePrimary,
'朋友': this.COLORS.primary,
'同事': this.COLORS.gray600,
'同... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4027-L4041 | ff2ed4d3ef26883058a736a4900848acc8fabaa4 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets | arkts | showInfo | print info level log
@param {string} tag - Page or class tag
@param {string} log - Log needs to be printed | static showInfo(tag: string, log: string){
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static showInfo(tag: string, log: string){
console.info(`${TAG} tag: ${tag} --> ${log}`);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets#L28-L30 | edd21cfc5862d5270e954fdcda172f2d1de620ce | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseManager.ets | arkts | initDatabase | 初始化数据库
@param context 应用上下文 | async initDatabase(context: Context): Promise<void> {
try {
const config: relationalStore.StoreConfig = {
name: DatabaseSchema.DATABASE_NAME,
securityLevel: relationalStore.SecurityLevel.S1
};
this.rdbStore = await relationalStore.getRdbStore(context, config);
console.info('... | AST#method_declaration#Left async initDatabase AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context 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#L... | async initDatabase(context: Context): Promise<void> {
try {
const config: relationalStore.StoreConfig = {
name: DatabaseSchema.DATABASE_NAME,
securityLevel: relationalStore.SecurityLevel.S1
};
this.rdbStore = await relationalStore.getRdbStore(context, config);
console.info('... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L45-L69 | e991a62eb1ef1936eb1f258e6111a9d9213587f9 | github |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/network/SearchStockApi.ets | arkts | 搜索上交所或者深交所的股票Api | export class SearchStockApi {
/**
* 搜索股票Api
* @param stockCode
* @param callback
*/
public requestData(stockCode: string, callback: Callback<SearchStockResponse>) {
//发起请求
var market = stockCode.startsWith('0') ? 'sz' : 'sh'
let url = "http://yunhq.sse.com.cn:32041/v1/" + market + "1/list/ex... | AST#export_declaration#Left export AST#class_declaration#Left class SearchStockApi AST#class_body#Left { /**
* 搜索股票Api
* @param stockCode
* @param callback
*/ AST#method_declaration#Left public requestData AST#parameter_list#Left ( AST#parameter#Left stockCode : AST#type_annotation#Left AST#primary_type#Lef... | export class SearchStockApi {
public requestData(stockCode: string, callback: Callback<SearchStockResponse>) {
var market = stockCode.startsWith('0') ? 'sz' : 'sh'
let url = "http://yunhq.sse.com.cn:32041/v1/" + market + "1/list/exchange/equity?select=code,name,open,high,low,volume&_=" + new Date().ge... | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/network/SearchStockApi.ets#L7-L37 | 33a0b5d9179cf3710169d44f6c17f824c66339ee | github | |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | entry/src/main/ets/utils/GlobalSwitchUtil.ets | arkts | requestGlobalSwitch | 系统提供了超级隐私模式,在系统设置打开超级隐私模式后,相机、麦克风、位置将不可用。
在获取相机权限、麦克风权限和位置权限后,如果超级隐私模式开启,需要引导用户关闭超级隐私模式。
@param context
@param permissions | static requestGlobalSwitch(context: Context, permissions: Array<Permissions>) {
const locationPermission = "ohos.permission.LOCATION" as Permissions
const approximatelyPermission = "ohos.permission.APPROXIMATELY_LOCATION" as Permissions
const backgroundPermission = "ohos.permission.LOCATION_IN_BACKGROUND" a... | AST#method_declaration#Left static requestGlobalSwitch AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#... | static requestGlobalSwitch(context: Context, permissions: Array<Permissions>) {
const locationPermission = "ohos.permission.LOCATION" as Permissions
const approximatelyPermission = "ohos.permission.APPROXIMATELY_LOCATION" as Permissions
const backgroundPermission = "ohos.permission.LOCATION_IN_BACKGROUND" a... | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/utils/GlobalSwitchUtil.ets#L14-L28 | 4300925fa4864f36939e3b040c1dcb08311161b2 | gitee |
openharmony-sig/ohos_axios | 75d72897982ea6e10fa99c62c62a65425af0a568 | entry/src/main/ets/pages/Index.ets | arkts | creat | Creat请求 | creat() {
this.clear()
this.showUrl = this.getUrl
const instance = axios.create();
this.startTime = new Date().getTime();
instance.get<string, AxiosResponse<string>, null>(this.getUrl, {
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBod... | AST#method_declaration#Left creat AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expression#Ri... | creat() {
this.clear()
this.showUrl = this.getUrl
const instance = axios.create();
this.startTime = new Date().getTime();
instance.get<string, AxiosResponse<string>, null>(this.getUrl, {
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBod... | https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L375-L395 | 54298dafad0da6c173a8d3df2768949162a6afcc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/managers/AIModelManager.ets | arkts | 支持的AI模型提供商 | export enum AIProvider {
ZHIPU = 'zhipu', // 智谱AI (原CHATGLM)
DEEPSEEK = 'deepseek', // DeepSeek
KIMI = 'kimi', // Kimi月之暗面
CUSTOM = 'custom' // 自定义
} | AST#export_declaration#Left export AST#enum_declaration#Left enum AIProvider AST#enum_body#Left { AST#enum_member#Left ZHIPU = AST#expression#Left 'zhipu' AST#expression#Right AST#enum_member#Right , // 智谱AI (原CHATGLM) AST#enum_member#Left DEEPSEEK = AST#expression#Left 'deepseek' AST#expression#Right AST#enum_member#R... | export enum AIProvider {
ZHIPU = 'zhipu',
DEEPSEEK = 'deepseek',
KIMI = 'kimi',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/AIModelManager.ets#L14-L19 | a2d7ecf60d06f7a3335f052ba888f5c3c01c6006 | github | |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | entry/src/main/ets/pages/View/FestivalInfo.ets | arkts | aboutToAppear | private controller : FunctionController = new FunctionController(); private agentId : string = 'agent1ecc9bc0f8bb420f82b18a4320d8b8aa' | aboutToAppear(): void {
this.festivalDetailInfo = FestivalDetailData[this.festivalName];
// this.checkAgentSupport();
// this.initListeners();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | aboutToAppear(): void {
this.festivalDetailInfo = FestivalDetailData[this.festivalName];
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/View/FestivalInfo.ets#L59-L63 | 4cee19825cc81eda276b1b67bc334132825eb259 | github |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/request/Home.ets | arkts | 请求Banner数据
@returns | export function getBanner(): Promise<IBannerModel[]> {
return new Promise((resolve: Function, reject: Function) => {
get(API.banner).then((data: Response) => {
console.log("Tag", "data " + data)
if (data.data && data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
... | AST#export_declaration#Left export AST#function_declaration#Left function getBanner AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IBannerMode... | export function getBanner(): Promise<IBannerModel[]> {
return new Promise((resolve: Function, reject: Function) => {
get(API.banner).then((data: Response) => {
console.log("Tag", "data " + data)
if (data.data && data.errorCode === API.SERVER_CODE_SUCCESS) {
resolve(data.data);
} else {
... | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/request/Home.ets#L11-L26 | 8fccf274181c331005ce02eb2db155acc4b6a07a | github | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | drawPointer | 绘制时针、分针、秒针。
@param degree 指针转动的角度。
@param pointerImgRes 指针图片地址。 | private drawPointer(degree: number, pointerImgRes: string): void {
this.renderContext.save();
let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE;
this.renderContext.rotate(theta);
this.renderContext.beginPath();
let secondImg = new ImageBit... | AST#method_declaration#Left private drawPointer AST#parameter_list#Left ( AST#parameter#Left degree : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pointerImgRes : AST#type_annotation#Left AST#primary_type#Left string AST#... | private drawPointer(degree: number, pointerImgRes: string): void {
this.renderContext.save();
let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE;
this.renderContext.rotate(theta);
this.renderContext.beginPath();
let secondImg = new ImageBit... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L132-L146 | 49b36571c3e7b572090180a7f7d838ac08c4f24c | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets | arkts | decodePKCS1 | 解密
@param decodeStr 待解密的字符串
@param priKey RSA私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false | static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem);
} | AST#method_declaration#Left static decodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L110-L113 | c7a7705555d3c074d8018598829466d3069e4162 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets | arkts | validateInput | 验证输入 | validateInput(): boolean {
let isValid = true;
// 验证昵称
if (!this.userInfo.nickname || this.userInfo.nickname.trim() === '') {
this.nicknameError = '昵称不能为空';
isValid = false;
} else {
this.nicknameError = '';
}
// 验证邮箱
if (this.userInfo.email && this.userInfo.email... | AST#method_declaration#Left validateInput AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isValid = ... | validateInput(): boolean {
let isValid = true;
if (!this.userInfo.nickname || this.userInfo.nickname.trim() === '') {
this.nicknameError = '昵称不能为空';
isValid = false;
} else {
this.nicknameError = '';
}
if (this.userInfo.email && this.userInfo.email.trim() !== ''... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L112-L150 | dbb8c007e8754ae1366bf13954e11e28609e574d | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/http/Request.ets | arkts | 导出 axios 实例 | export default service | AST#export_declaration#Left export default AST#expression#Left service AST#expression#Right AST#export_declaration#Right | export default service | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/http/Request.ets#L116-L116 | 47fcd596820456b5e04d99cdaa10724c14fea2a3 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/BarHighlighter.ets | arkts | getStackedHighlight | This method creates the Highlight object that also indicates which value of a stacked BarEntry has been
selected.
@param high the Highlight to work with looking for stacked values
@param set
@param xVal
@param yVal
@return | public getStackedHighlight(high: Highlight, set: IBarDataSet, xVal: number, yVal: number): Highlight | null {
let entry: BarEntry | null = set.getEntryForXValue(xVal, yVal);
if (entry == null)
return null;
// not stacked
if (entry.getYVals() == null) {
return high;
} else {
let ... | AST#method_declaration#Left public getStackedHighlight AST#parameter_list#Left ( AST#parameter#Left high : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left set : AST#type_annotation#Left AST#primary_type#Left IBarDataSet A... | public getStackedHighlight(high: Highlight, set: IBarDataSet, xVal: number, yVal: number): Highlight | null {
let entry: BarEntry | null = set.getEntryForXValue(xVal, yVal);
if (entry == null)
return null;
if (entry.getYVals() == null) {
return high;
} else {
let ranges: Range[... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/BarHighlighter.ets#L65-L105 | 2fa91aafa5e94504740dbf143745faa8212ed08b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Transformer.ets | arkts | generateTransformedValuesLine | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the LINECHART.
@param data
@return | public generateTransformedValuesLine(data: ILineDataSet,
phaseX: number, phaseY: number,
min: number, max: number): number[] {
const count: number = Math.floor((((max - min) * phaseX) + 1) * 2);
if (this.valuePointsForGenerateTransf... | AST#method_declaration#Left public generateTransformedValuesLine AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Le... | public generateTransformedValuesLine(data: ILineDataSet,
phaseX: number, phaseY: number,
min: number, max: number): number[] {
const count: number = Math.floor((((max - min) * phaseX) + 1) * 2);
if (this.valuePointsForGenerateTransf... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L180-L207 | 83716d3137d94f786a24b41e3cad687fd1fddaf8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets | arkts | 待办可选事项 | build() {
Column() {
Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) {
Text($r('app.string.pendingitems_todo'))
.fontSize($r('sys.float.ohos_id_text_size_headline7'))
Blank()
Image($r('app.media.pendingitems_ic_public_add_filled'))
.id('add_items')
.width(ST... | 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#component_parameters#Left { AST#component_par... | build() {
Column() {
Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) {
Text($r('app.string.pendingitems_todo'))
.fontSize($r('sys.float.ohos_id_text_size_headline7'))
Blank()
Image($r('app.media.pendingitems_ic_public_add_filled'))
.id('add_items')
.width(ST... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets#L47-L129 | 269bb7d6c4423a9742b508735da0ec577cf3ddc5 | gitee | |
Leeson-Wong/ark-layer.git | 9efa3553414a6b1eee890e3858c8cdcb308535d7 | core/PhaseConfig.ets | arkts | 阶段配置接口
用于定义 Service 加载阶段的配置 | export interface PhaseConfig {
name: string // 阶段名称,用于标识和日志
priority: number // 优先级,数字越小越先加载
waitForComplete: boolean // 是否等待该阶段所有节点完成才进入下一阶段
description?: string // 阶段描述(可选)
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PhaseConfig AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 阶段名称,用于标识和日志 AST#type_member#Left priority : AST#type... | export interface PhaseConfig {
name: string
priority: number
waitForComplete: boolean
description?: string
} | https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseConfig.ets#L5-L10 | 918538bf99072288c6a42bf741dac13f7b5601cc | github | |
0dot618/my_PCB_detection_harmony_app.git | 58217366ac936b5f4c246191701b333f4d3c5513 | MyApplication2/entry/src/main/ets/pages/Detect.ets | arkts | DetectBuilder | @Entry | @Builder
export function DetectBuilder(name: string, param: Object) {
Detect()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DetectBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param :... | @Builder
export function DetectBuilder(name: string, param: Object) {
Detect()
} | https://github.com/0dot618/my_PCB_detection_harmony_app.git/blob/58217366ac936b5f4c246191701b333f4d3c5513/MyApplication2/entry/src/main/ets/pages/Detect.ets#L41-L44 | e7d4adc315e112950b28528ccbd4f841efc59852 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets | arkts | NodeController的子类MyNodeController | export class MyNodeController extends NodeController {
private rootNode: FrameNode | null = null; // 根节点
rootRenderNode: RenderNode | null = null; // 从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例
width: number = 0; // 实例绑定的NodeContainer组件的宽,单位px
height: number = 0; // 实例绑定的NodeContainer组件的宽,单位px
... | AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left ... | export class MyNodeController extends NodeController {
private rootNode: FrameNode | null = null;
rootRenderNode: RenderNode | null = null;
width: number = 0;
height: number = 0;
makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L49-L76 | 611015d379af4631797da70af02f35df850ef113 | gitee | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getToken | 获取date日期对应的浏览历史 | async getToken() {
return 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCIsXCJiaXJ0aGRheVwiOlwiMTk5MC0xMC04XCIsXCJjcmVhdGVEYXRlXCI6MTU2NTcwMTMxNjAwMCxcImRpc2FibGVkXCI6MCxcImVtYWlsXCI6XCIyNzUwMTg3MjNAcXEuY29tXCIsXCJwZXJtaXNzaW9uXCI6MCxcInJv... | AST#method_declaration#Left async getToken AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCI... | async getToken() {
return 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCIsXCJiaXJ0aGRheVwiOlwiMTk5MC0xMC04XCIsXCJjcmVhdGVEYXRlXCI6MTU2NTcwMTMxNjAwMCxcImRpc2FibGVkXCI6MCxcImVtYWlsXCI6XCIyNzUwMTg3MjNAcXEuY29tXCIsXCJwZXJtaXNzaW9uXCI6MCxcInJv... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L71-L75 | 72f166aabcf65eaf40d24fd0f10dcc731e7d2cf8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/RankingDemo/entry/src/main/ets/model/DataModel.ets | arkts | rankData1 | the Mock file instead of network data. | export { rankData1, rankData2 } | AST#export_declaration#Left export { rankData1 , rankData2 } AST#export_declaration#Right | export { rankData1, rankData2 } | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/model/DataModel.ets#L21-L21 | be2f79d75db55a6b95b622810e7a5847865db711 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ThreadUtils.ets | arkts | isMainThread | 判断当前是否为主线程 | static isMainThread(): boolean {
return process.tid === process.pid; // 主线程时两者相等
} | AST#method_declaration#Left static isMainThread AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | static isMainThread(): boolean {
return process.tid === process.pid;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ThreadUtils.ets#L9-L11 | 213499b9d853748f05d811aaf302bb84e3a925d2 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets | arkts | delete | /删除Plan | public static async delete(plan: Plan): Promise<void> {
//删除Plan
//事务执行Delete(Plan+Piece+Box+Learn)
await PlanDbAccess.shared.deletePlanTransaction(plan.asDBPlan());
//发送通知
SimpleEventBus.emit(PlanManagerNotification.namePlanUpdated, plan.planId)
} | AST#method_declaration#Left public static async delete AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan 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... | public static async delete(plan: Plan): Promise<void> {
await PlanDbAccess.shared.deletePlanTransaction(plan.asDBPlan());
SimpleEventBus.emit(PlanManagerNotification.namePlanUpdated, plan.planId)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L239-L246 | 6a14539fffbf84d614d05b15b58bfd694279b580 | github |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter6/entry/src/main/ets/pages/Index.ets | arkts | futureWeatherView | 未来天气组件代码块 | @Builder
futureWeatherView(){
Scroll(this.scroller) {
Row({ space: 15 }) {
this.futureWeatherItem('现在', '⛅️', '25°C')
this.futureWeatherItem('18时', '☀️️', '26°C')
this.futureWeatherItem('19时', '💨️', '22°C')
this.futureWeatherItem('20时', '⛅️', '23°C')
this.futureWeath... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right futureWeatherView 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 Scroll ( AST#expression#Left AST#member_expression#Left ... | @Builder
futureWeatherView(){
Scroll(this.scroller) {
Row({ space: 15 }) {
this.futureWeatherItem('现在', '⛅️', '25°C')
this.futureWeatherItem('18时', '☀️️', '26°C')
this.futureWeatherItem('19时', '💨️', '22°C')
this.futureWeatherItem('20时', '⛅️', '23°C')
this.futureWeath... | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L46-L62 | dbbaff994f96122eab7af916716d2ad4714dc127 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | verify2048PKCS1 | 2048位验签-PKCS1
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey 2048位RSA公钥
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static async verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | AST#method_declaration#Left static async verify2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left strin... | static async verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L145-L147 | 2d10737bdaaa52b281e4dfb6804d435826ab3460 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/Index.ets | arkts | VideoListAutoplayComponent | 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 { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay'; | AST#export_declaration#Left export { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay' ; AST#export_declaration#Right | export { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/Index.ets#L16-L16 | 0227f5e2b74b5fb88d2e8033df3bb531fd90db1e | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/viewmodel/TopicViewModel.ets | arkts | resetPagination | 重置分页状态,用于下拉刷新 | resetPagination(): void {
this.nextPageUrl = null;
} | AST#method_declaration#Left resetPagination 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#me... | resetPagination(): void {
this.nextPageUrl = null;
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/viewmodel/TopicViewModel.ets#L10-L12 | 9f914c2454d1fa8e05d6ff50d95319b335e6feef | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/goods/VHGoodsComponent.ets | arkts | getCouponsAvailableHttp | 获取可用优惠券列表(核心修复:遍历选中首张满足门槛的优惠券) | getCouponsAvailableHttp() {
VHSaaSDK.getInstance()
.getCouponAvailableList(this.CouponsWebinarId, {
onSucceed: (data) => {
this.CouponsAvailable = data || [];
this.Index = -1; // 重置为未选中状态
const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price;
... | AST#method_declaration#Left getCouponsAvailableHttp AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#... | getCouponsAvailableHttp() {
VHSaaSDK.getInstance()
.getCouponAvailableList(this.CouponsWebinarId, {
onSucceed: (data) => {
this.CouponsAvailable = data || [];
this.Index = -1;
const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price;
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L935-L960 | 09561c06a510fc1070c5824c858ec9ce8a31035a | gitee |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | setting/src/main/ets/utils/ValidatorUtils.ets | arkts | getInputType | 判断输入类型 | static getInputType(text: string): 'phone' | 'email' | 'unknown' {
if (ValidatorUtils.isPhoneNumber(text)) {
return 'phone';
} else if (ValidatorUtils.isEmail(text)) {
return 'email';
}
return 'unknown';
} | AST#method_declaration#Left static getInputType AST#parameter_list#Left ( AST#parameter#Left text : 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 : 'phone' | 'email' | 'unknown' AST#ERROR#Right AST#blo... | static getInputType(text: string): 'phone' | 'email' | 'unknown' {
if (ValidatorUtils.isPhoneNumber(text)) {
return 'phone';
} else if (ValidatorUtils.isEmail(text)) {
return 'email';
}
return 'unknown';
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/utils/ValidatorUtils.ets#L25-L32 | ae2c66629c0da539ca1744389f1e0803997678c7 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | products/entry/src/main/ets/pages/lifecycle/Lifecycle2View.ets | arkts | Lifecycle2View | @author: HZWei
@date: 2024/11/7
@desc: | @Route({ name: RouterConstants.LIFECYCLE2_VIEW })
@Component
export struct Lifecycle2View {
private hash: number = util.getHash(this)
private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE2_VIEW} ${this.hash}: `
// 1、初始化生命周期注册对象,并使用@Lifecycle修饰
@Lifecycle
lifecycle: LifecycleRegistry = LifecycleRegis... | AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . LIFECYCLE2_VIEW AS... | @Route({ name: RouterConstants.LIFECYCLE2_VIEW })
@Component
export struct Lifecycle2View {
private hash: number = util.getHash(this)
private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE2_VIEW} ${this.hash}: `
@Lifecycle
lifecycle: LifecycleRegistry = LifecycleRegistry.create(this);
@State count... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/Lifecycle2View.ets#L11-L59 | d7107dc715cf2373825d32b1e90b012ca615625e | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | isDrawSteppedEnabled | @Deprecated | public isDrawSteppedEnabled(): boolean {
return this.mMode == Mode.STEPPED;
} | AST#method_declaration#Left public isDrawSteppedEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#me... | public isDrawSteppedEnabled(): boolean {
return this.mMode == Mode.STEPPED;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L249-L251 | c6456d6b198744167dc400a41b1b60ac6160e1d3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | isTransparent | 窗口是否透明。默认为false。true表示透明;false表示不透明。
@param windowClass 不传该值,默认主窗口。
@returns | static isTransparent(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isTransparent;
} | AST#method_declaration#Left static isTransparent 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#Left AST#... | static isTransparent(windowClass: window.Window = AppUtil.getMainWindow()): boolean {
return WindowUtil.getWindowProperties(windowClass).isTransparent;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L355-L357 | 1c02f4a73a9d055ded14a5ff88e048c60eb4a5f7 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | strToBuffer | 字符串转ArrayBuffer
@param str
@returns | static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer {
const buf = buffer.from(src, encoding);
return buf.buffer;
} | AST#method_declaration#Left static strToBuffer AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L... | static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer {
const buf = buffer.from(src, encoding);
return buf.buffer;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L336-L339 | c175b4be32ac966140455ccc5daea4ebe2a231e2 | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/model/userModel.ets | arkts | loadUsers | 从 Preferences 中加载所有用户到 userData 数组 | async loadUsers() {
try {
const usersStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString();
this.userData = JSON.parse(usersStr);
Logger.info(CommonConstants.TAG, `Loaded ${this.userData.length} users.`);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to load... | AST#method_declaration#Left async loadUsers AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left usersStr = AST#expression#Left AST#call... | async loadUsers() {
try {
const usersStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString();
this.userData = JSON.parse(usersStr);
Logger.info(CommonConstants.TAG, `Loaded ${this.userData.length} users.`);
} catch (err) {
Logger.error(CommonConstants.TAG, `Failed to load... | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L47-L56 | f1fd3a62ea286a43674f92311b6c55e783c1d74c | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onTouchStart | Touch start.
@param x
@param y | onTouchStart(x: number, y: number): void {
if (this.state !== CropTouchState.NONE) {
Logger.debug(TAG, 'onTouchStart: touch state is not none!');
return;
}
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
}
Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`);
if (this... | AST#method_declaration#Left onTouchStart AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#t... | onTouchStart(x: number, y: number): void {
if (this.state !== CropTouchState.NONE) {
Logger.debug(TAG, 'onTouchStart: touch state is not none!');
return;
}
if (this.isWaitingRefresh) {
this.clearDelayRefresh();
}
Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`);
if (this... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L212-L230 | 3217da589f6f0a7b7af53ac74a6fc4d9b7d7a11f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | decodedFromBase64 | 将Base64字符串解码
@param str Base64编码的字符串
@returns 解码后的原始字符串或null | static decodedFromBase64(str: string | null): string | null {
return new Base64Encoder(str).decodedString();
} | AST#method_declaration#Left static decodedFromBase64 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ... | static decodedFromBase64(str: string | null): string | null {
return new Base64Encoder(str).decodedString();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L24-L26 | dc732444800a77f8d895d9f807518a751e65c0d6 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/array_lib_func_004_F.ets | arkts | Introduction 库函数-array_pop | export function array_lib_func_004_F(taint_src : string) {
let arr : string[] = ["a","b","_"];
let t = arr.pop();
taint.Sink(t!);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function array_lib_func_004_F(taint_src : string) {
let arr : string[] = ["a","b","_"];
let t = arr.pop();
taint.Sink(t!);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_004_F.ets#L6-L10 | 6835d3d2562fbd9f5590c15a6aee82e50e3b451c | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/animation/AnimationUtils.ets | arkts | fade | 淡入淡出转场配置 | static fade(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
} | AST#method_declaration#Left static fade AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PageTransitionConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#objec... | static fade(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L85-L90 | 848ad339ef68eec4e7da50156bcdf6f6843ac66e | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/models/ThemeModel.ets | arkts | loadSavedTheme | 加载保存的主题设置 | private async loadSavedTheme(): Promise<void> {
try {
// TODO: 从持久化存储中加载主题设置
// const savedThemeType = await StorageUtils.getString(ThemeManager.STORAGE_KEY);
// if (savedThemeType && Object.values(ThemeType).includes(savedThemeType as ThemeType)) {
// const theme = THEME_CONFIGS.find(t =>... | AST#method_declaration#Left private async loadSavedTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | private async loadSavedTheme(): Promise<void> {
try {
} catch (error) {
console.error('Failed to load saved theme:', error);
}
this.currentTheme = THEME_CONFIGS[0];
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L163-L180 | fd6644a0196dd9166cbc8c17d91379e2944aaeca | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toNotificationSetting | 跳转通知设置页面 | static toNotificationSetting(): Promise<void> {
const parameters: Record<string, Record<string, string>> = {
'pushParams': {
'bundleName': AppUtil.getContext().abilityInfo.bundleName // 应用包名
}
};
return WantUtil.toSetting(WantUtil.URI_NOTIFICATION,parameters);
} | AST#method_declaration#Left static toNotificationSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | static toNotificationSetting(): Promise<void> {
const parameters: Record<string, Record<string, string>> = {
'pushParams': {
'bundleName': AppUtil.getContext().abilityInfo.bundleName
}
};
return WantUtil.toSetting(WantUtil.URI_NOTIFICATION,parameters);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L118-L125 | 2f8231ce70c211550f89f6fbe879097ff92779f6 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SegmentButtonV2.d.ets | arkts | The callback function that will be invoked when the selectedIndex of the segmented button is changed.
@typedef { function } OnSelectedIndexChange
@param { number } selectedIndex - the index of selected item
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export type OnSelectedIndexChange = (selectedIndex: number) => void; | AST#export_declaration#Left export AST#type_declaration#Left type OnSelectedIndexChange = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left selectedIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Righ... | export type OnSelectedIndexChange = (selectedIndex: number) => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L157-L157 | dc716d0dd13156e51f941ed14657c9920dd32979 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | isDefaultNetMetered | 检查当前网络上的数据流量使用是否被计量
@returns | static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
} | AST#method_declaration#Left static async isDefaultNetMetered AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Rig... | static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L37-L39 | d1453549d53fdeceae09c78074440e45520618e6 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 用户模型 | export interface User {
id: number;
username: string;
nickname: string;
avatar: string;
email?: string;
bio?: string;
followersCount?: number;
followingCount?: number;
createdAt?: string;
isFollowed?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface User AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation#Left AST#pr... | export interface User {
id: number;
username: string;
nickname: string;
avatar: string;
email?: string;
bio?: string;
followersCount?: number;
followingCount?: number;
createdAt?: string;
isFollowed?: boolean;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L149-L160 | 4b08eacf593a67212701a5eb84a7ca2667911f0c | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/model/DialogOptions.ets | arkts | TODO 输入弹出框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class InputOptions extends BaseContentOptions {
inputType?: InputType; //输入框类型。默认值:InputType.Normal
showPassword?: boolean; //是否显示密码(inputType为InputType.Password起作用)
showPasswordIcon?: boolean; //是否显示密码图标(inputType为InputType.Password起作用)
passwordIcon?: PasswordIcon; //设置当密码输入模式时,输入框末尾的图标。支持jpg、png、bmp、he... | AST#export_declaration#Left export AST#class_declaration#Left class InputOptions extends AST#type_annotation#Left AST#primary_type#Left BaseContentOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left inputType ? : AST#type_annotation#Left AST#primary_type#Left Inp... | export class InputOptions extends BaseContentOptions {
inputType?: InputType;
showPassword?: boolean;
showPasswordIcon?: boolean;
passwordIcon?: PasswordIcon;
passwordRules?: string;
cancelButton?: CancelButtonOptions;
text: string = "";
fontColor?: ResourceColor;
fontSize?: Length;
placeh... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/DialogOptions.ets#L116-L136 | b74bf846d8a3902fa2b99d12d91edd107ded580b | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets | arkts | onlyGroupUpdateName | 校验唯一性,同时进行更新 | async onlyGroupUpdateName(newName: string, id: number) {
return await BookGroupsDao.onlyGroupUpdateName(id,newName)
} | AST#method_declaration#Left async onlyGroupUpdateName AST#parameter_list#Left ( AST#parameter#Left newName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | async onlyGroupUpdateName(newName: string, id: number) {
return await BookGroupsDao.onlyGroupUpdateName(id,newName)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L13-L15 | 5520d3e7c86517beb81fc76d14fa337a9978b691 | github |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/common/bean/FarmBean.ets | arkts | save_db | --------------------json转化部分(finished)------------------// 废弃,生成一个test+farmId.json的json文件用于存储农田信息,在FarmBean文件夹下
Json_save(){
let context = getContext(this) as common.UIAbilityContext;
let filesDir = context.filesDir;
let filenames : string[];
let dirPath_cache = filesDir + '/FarmBean';
fs.access(dirPath_cache).then((... | save_db(){
DistributedUtil.putStoreData(this.fieldId.toString(),this.to_JSON());
console.info('successfully save in db')
} | AST#method_declaration#Left save_db 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 DistributedUtil AST#expression#Right . putStoreData AST#... | save_db(){
DistributedUtil.putStoreData(this.fieldId.toString(),this.to_JSON());
console.info('successfully save in db')
} | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/bean/FarmBean.ets#L127-L130 | 9c48c4bc248908186c725cb5fc35efdb4ffedc2d | github |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageUtils.ets | arkts | countNonEmpty | 统计非空消息数量
@param messages 消息数组
@returns 非空消息的数量
使用示例:
```typescript
const people = [person1, emptyPerson, person3]
const nonEmptyCount = MessageUtils.countNonEmpty(people)
// nonEmptyCount: 2
``` | static countNonEmpty<T extends Message>(messages: T[]): number {
return messages.filter(m => !m.isEmpty()).length
} | AST#method_declaration#Left static countNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages... | static countNonEmpty<T extends Message>(messages: T[]): number {
return messages.filter(m => !m.isEmpty()).length
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L364-L366 | 2eaa5efe007031d9f333660b5a9f874600a0afb5 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets | arkts | clipIfNeedsFull | /对于太长的翻译,截取指定长度[按“;”分隔]的 部分 | public static clipIfNeedsFull(
srcStr: string | null,
seperator: string,
subSeperator: string,
maxParts: number
): string | null {
if (srcStr === null) {
return null;
}
const tempList: Array<string> = [];
return StringDealUtilityForBaseWord.dealInternal(
srcStr,
se... | AST#method_declaration#Left public static clipIfNeedsFull AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramete... | public static clipIfNeedsFull(
srcStr: string | null,
seperator: string,
subSeperator: string,
maxParts: number
): string | null {
if (srcStr === null) {
return null;
}
const tempList: Array<string> = [];
return StringDealUtilityForBaseWord.dealInternal(
srcStr,
se... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets#L98-L124 | 240af357dc8e8126ef335cbad95a2beb783f0f2e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets | arkts | Fits tools with different sizes and lengths. | export default class DimensionUtil {
/**
* Obtains the screen horizontal adaptation value.
*
* @return number
*/
static adaptDimension(value: number): number {
let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display;
let widthScale = deviceDisplay.width / DES... | AST#export_declaration#Left export default AST#class_declaration#Left class DimensionUtil AST#class_body#Left { /**
* Obtains the screen horizontal adaptation value.
*
* @return number
*/ AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotati... | export default class DimensionUtil {
static adaptDimension(value: number): number {
let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display;
let widthScale = deviceDisplay.width / DESIGN_WIDTH;
let virtualHeight = widthScale * DESIGN_HEIGHT;
let designDim = Math... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L33-L77 | bafd26ce55753d82aee56c752b0b8819b8fabc87 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/select/Cascade.ets | arkts | Cascade | @Author csx
@DateTime 2024/3/26 10:02:02
@TODO Cascade 级联选择器
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | @Component
export struct Cascade {
//反会给上一级的数据
@Link callCity: string
//是否显示
@Link show: boolean
//显示城市
@State private showCity: boolean = false
//显示区域
@State private showArea: boolean = false
private provinceList: Array<City> = new Array();
//点击选择的数据
@State private selectData: cascadeCity = new c... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Cascade AST#component_body#Left { //反会给上一级的数据 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right callCity : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#typ... | @Component
export struct Cascade {
@Link callCity: string
@Link show: boolean
@State private showCity: boolean = false
@State private showArea: boolean = false
private provinceList: Array<City> = new Array();
@State private selectData: cascadeCity = new cascadeCity();
@State private curr... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L62-L329 | 25dd1a2cd677438e48ac80bc60adb4ebacd9d7c9 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/common/utils/Logger.ets | arkts | constructor.
@param Prefix identifies the log tag.
@param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. | constructor(prefix: string = 'MyApp', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'MyApp' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotati... | constructor(prefix: string = 'MyApp', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/Logger.ets#L29-L32 | 585fc8eb7e59817e50bca8c90c9237660b6959a5 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | getString | 获取string类型的缓存值
@param key
@returns | static async getString(key: string, defValue: string = "",
preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<string> {
let value = await PreferencesUtil.get(key, defValue, preferenceName);
return value as string;
} | AST#method_declaration#Left static async getString 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 defValue : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static async getString(key: string, defValue: string = "",
preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<string> {
let value = await PreferencesUtil.get(key, defValue, preferenceName);
return value as string;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L139-L143 | daadb00d6c593ba26228c7b0a0e540964c7fb792 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomTabBar.ets | arkts | CustomTabBar | 非选中状态的外边距初始值 | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
build() {
Row() {
ForEach(TabsInfo, (item: TabBarData) => {
this.TabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.p... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#ty... | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
build() {
Row() {
ForEach(TabsInfo, (item: TabBarData) => {
this.TabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.p... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomTabBar.ets#L26-L78 | e451e2067372cb3d9271a4471fbc0df6b52f82be | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets | arkts | MyRenderNode类,初始化画笔和绘制路径 | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path(); // 新建路径对象,用于绘制手指移动轨迹
pen: drawing.Pen = new drawing.Pen(); // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制
blendMode: drawing.BlendMode = drawing.BlendMode.SRC_OVER; // 画笔的颜色混合模式
lineStrokeWidth: number = 0; // 画笔线宽
constructor() {
su... | AST#export_declaration#Left export AST#class_declaration#Left class MyRenderNode extends AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left path : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type... | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path();
pen: drawing.Pen = new drawing.Pen();
blendMode: drawing.BlendMode = drawing.BlendMode.SRC_OVER;
lineStrokeWidth: number = 0;
constructor() {
super();
const pen_color: common2D.Color = {
alpha: 0xFF... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets#L23-L61 | 1be48da295bc8a57d9d7946ec75bd5c340c9d8eb | gitee | |
CMoments/HarmonOS-arkTS-YunShangChuanDa.git | 895985b9b6013c906bf88eaea6e32e03ddf2a9db | project code/entry/src/main/ets/components/NewsPage.ets | arkts | tabBar | 当前选中的tab是第几个 | @Builder
tabBar(item: TabModel) {
Column() {
Row() {
Text(item.name)
.fontColor(this.tabModels[this.currentSelect].name == item.name ? '#ff4e4949' : Color.Grey)
.fontSize(20)
.fontWeight(700)
.textAlign(TextAlign.Center)
/*.decoration(this.tabModel... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBar AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
tabBar(item: TabModel) {
Column() {
Row() {
Text(item.name)
.fontColor(this.tabModels[this.currentSelect].name == item.name ? '#ff4e4949' : Color.Grey)
.fontSize(20)
.fontWeight(700)
.textAlign(TextAlign.Center)
.width('100%')
... | https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/components/NewsPage.ets#L23-L46 | d56e4907055fa170d57d05fb7ae08acf31275874 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/pages/Index.ets | arkts | notifyTaskUpdate | 通知任务列表更新 | notifyTaskUpdate() {
this.taskUpdateSignal++;
console.info('Index: notifyTaskUpdate called, taskUpdateSignal = ' + this.taskUpdateSignal);
} | AST#method_declaration#Left notifyTaskUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskUpdateSignal ... | notifyTaskUpdate() {
this.taskUpdateSignal++;
console.info('Index: notifyTaskUpdate called, taskUpdateSignal = ' + this.taskUpdateSignal);
} | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/pages/Index.ets#L72-L75 | bf0fb3d6bcf824726ca4070ff29d7c6ba7d93427 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showSuccess | 显示成功提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showSuccess(message: string | ResourceStr): void {
IBestToast.show({
type: "success",
message: message
});
} | AST#method_declaration#Left static showSuccess AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#R... | static showSuccess(message: string | ResourceStr): void {
IBestToast.show({
type: "success",
message: message
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L22-L27 | 58bd26e6a845ea5bd34da36d2c5c9f3256baa3d2 | github |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets | arkts | addSchedule | 创建日程 | static async addSchedule(postData:AddScheduleModel) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
... | AST#method_declaration#Left static async addSchedule AST#parameter_list#Left ( AST#parameter#Left postData : AST#type_annotation#Left AST#primary_type#Left AddScheduleModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#v... | static async addSchedule(postData:AddScheduleModel) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/schedule`,
{
method: RequestMethod.POST,
header: {
'Content-Type': 'application/json'
},
... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L428-L451 | 6162925fe2afd74d8c36cdc8c2df9a451e96a475 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets | arkts | createEngine | 调用speechRecognizer.createEngine接口创建引擎 | private createEngine() {
let extraParams: Record<string, Object> = {
'locate': 'CN',
'recognizerMode': 'short'
}
let createEngineParams: speechRecognizer.CreateEngineParams = {
language: 'zh-CN',
online: 1,
extraParams: extraParams
}
speechRecognizer.createEngine(crea... | AST#method_declaration#Left private createEngine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extraParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#... | private createEngine() {
let extraParams: Record<string, Object> = {
'locate': 'CN',
'recognizerMode': 'short'
}
let createEngineParams: speechRecognizer.CreateEngineParams = {
language: 'zh-CN',
online: 1,
extraParams: extraParams
}
speechRecognizer.createEngine(crea... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets#L118-L138 | 7c675b850b611a3d710a75113a00b4390e7ab75b | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/goods/GoodsParam.ets | arkts | @file 商品模块导航参数定义
@author Joker.X
商品分类参数 | export interface GoodsCategoryParam {
/**
* 类型 ID(可选)
*/
typeId?: string;
/**
* 是否精选
*/
featured?: boolean;
/**
* 是否推荐
*/
recommend?: boolean;
/**
* 关键词(可选)
*/
keyword?: string;
/**
* 最小金额(可选)
*/
minPrice?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GoodsCategoryParam AST#object_type#Left { /**
* 类型 ID(可选)
*/ AST#type_member#Left typeId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 是否精选
*... | export interface GoodsCategoryParam {
typeId?: string;
featured?: boolean;
recommend?: boolean;
keyword?: string;
minPrice?: string;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsParam.ets#L9-L30 | 353b8688f3c3845184b2d14fb88a77918a340557 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | CustomError | 自定义错误状态
@returns {void} 无返回值 | @Builder
private CustomError(): void {
Column() {
EmptyNetwork({
onAction: (): void => this.onRetry()
});
}
.height(300)
.width(P100);
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CustomError AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e... | @Builder
private CustomError(): void {
Column() {
EmptyNetwork({
onAction: (): void => this.onRetry()
});
}
.height(300)
.width(P100);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L221-L230 | 6b20a1b92e6f368b0c1f782db6193f672066d807 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | mkdtemp | 创建临时目录,使用Promise异步回调。
@param prefix string 用随机产生的字符串替换以“XXXXXX”结尾目录路径。
@returns | static mkdtemp(prefix: string): Promise<string> {
return fs.mkdtemp(prefix);
} | AST#method_declaration#Left static mkdtemp AST#parameter_list#Left ( AST#parameter#Left prefix : 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 Pr... | static mkdtemp(prefix: string): Promise<string> {
return fs.mkdtemp(prefix);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L837-L839 | 8fa915a7697e9461adfa84595c306ecba764abfc | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | delay | 工具方法:延迟 | private delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
} | AST#method_declaration#Left private delay AST#parameter_list#Left ( AST#parameter#Left ms : 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 Promise... | private delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L677-L679 | bdc464363e2cf5bf2abc6fd86ee8f6d19c8ea6d2 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | selectRefundReason | 选择退款原因
@param {DictItem | null} reason - 退款原因
@returns {void} 无返回值 | selectRefundReason(reason: DictItem | null): void {
this.selectedRefundReason = reason;
} | AST#method_declaration#Left selectRefundReason AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DictItem AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right )... | selectRefundReason(reason: DictItem | null): void {
this.selectedRefundReason = reason;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L106-L108 | 06ae8804243824f45ebb525a4d199dbf56ae6e2f | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets | arkts | getDecimalDigits | Returns the number of decimal digits this formatter uses or -1, if unspecified.
@return | public getDecimalDigits(): number {
return this.digits;
} | AST#method_declaration#Left public getDecimalDigits 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 getDecimalDigits(): number {
return this.digits;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets#L58-L60 | 69c5a7a8b012f7daa2014d973c107f815a45f76a | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取用户关注列表
@param userId 用户ID
@param page 页码
@param size 每页大小
@returns 关注列表 | export function getUserFollowings(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<UserInfo>> {
try {
console.info(`获取用户关注列表, userId: ${userId}, page: ${page}, size: ${size}`);
const params = {} as QueryParams;
params.page = page;
params.size = size;
return request<P... | AST#export_declaration#Left export AST#function_declaration#Left function getUserFollowings AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Lef... | export function getUserFollowings(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<UserInfo>> {
try {
console.info(`获取用户关注列表, userId: ${userId}, page: ${page}, size: ${size}`);
const params = {} as QueryParams;
params.page = page;
params.size = size;
return request<P... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1441-L1463 | 08c31251933b67a9f4f292f1036553511a8a7b83 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets | arkts | add1stItem | 增加数据 | public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
} | AST#method_declaration#Left public add1stItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expres... | public add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length);
this.notifyDataAdd(0);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L88-L91 | 947f801135e882759c319fed2a29ba163ee91911 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/SocketFactory.ets | arkts | createSocket | 根据协议类型创建对应的Socket
@param socketType | public static createSocket(socketType: SocketType): Socket {
switch (socketType) {
case SocketType.UDP:
return new UdpSocket();
case SocketType.TCP:
return new TcpSocket();
case SocketType.TLS:
return new TlsSocket();
}
} | AST#method_declaration#Left public static createSocket AST#parameter_list#Left ( AST#parameter#Left socketType : AST#type_annotation#Left AST#primary_type#Left SocketType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Sock... | public static createSocket(socketType: SocketType): Socket {
switch (socketType) {
case SocketType.UDP:
return new UdpSocket();
case SocketType.TCP:
return new TcpSocket();
case SocketType.TLS:
return new TlsSocket();
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/SocketFactory.ets#L30-L39 | 2e3e060c6bdf8987f0917a5719a7c1af14a29f30 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | featureVersion | Feature版本号,标识规划的新特性版本。 | static featureVersion(): string {
return deviceInfo.featureVersion + ''
} | AST#method_declaration#Left static featureVersion 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#binary_ex... | static featureVersion(): string {
return deviceInfo.featureVersion + ''
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L154-L156 | d29fb45a1beb6471c848cfaadb83b70231469506 | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getMovieSeachKeyWord | 获取date日期对应的浏览历史 | async getMovieSeachKeyWord():Promise<Array<string>> {
let movieSearchKeyWord = <string> await this.getPreference('movieSearchKeyWord');
if(movieSearchKeyWord){
return JSON.parse(movieSearchKeyWord)
}else {
return []
}
} | AST#method_declaration#Left async getMovieSeachKeyWord 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 Array AST#type_arguments#Left < AST#ty... | async getMovieSeachKeyWord():Promise<Array<string>> {
let movieSearchKeyWord = <string> await this.getPreference('movieSearchKeyWord');
if(movieSearchKeyWord){
return JSON.parse(movieSearchKeyWord)
}else {
return []
}
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L94-L101 | 984e9879ed0e2a9002d9cecc4054dca31fb08596 | github |
yanweiguo198-commits/Harmony-Calendar-App.git | 9ebdfbe588dfc230231af619a6eeb89b3c7fc39f | entry/src/main/ets/pages/Index.ets | arkts | openDialog | 打开弹窗的方法 | openDialog(event?: CalendarEvent) {
this.editingEvent = event; // 如果 event 有值就是编辑,没值就是新建
this.dialogController = new CustomDialogController({
builder: AddEventDialog({
selectedDate: this.currentDate,
editEvent: this.editingEvent, // 把要编辑的事件传进去
onSave: (savedEvent: CalendarEvent) =... | AST#method_declaration#Left openDialog AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left CalendarEvent 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#ex... | openDialog(event?: CalendarEvent) {
this.editingEvent = event;
this.dialogController = new CustomDialogController({
builder: AddEventDialog({
selectedDate: this.currentDate,
editEvent: this.editingEvent,
onSave: (savedEvent: CalendarEvent) => {
this.handleSaveEvent(sav... | https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/pages/Index.ets#L24-L41 | bda9d34611a2db1d91d0f66266716fb98ccd0ded | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | dateOn | / 获取指定dayOf的日期 | dateOn(dayOf: DayOf): Date | null {
if (this.startDate !== null) {
return this.addDays(this.startDate, dayOf.num);
}
return null;
} | AST#method_declaration#Left dateOn AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#prima... | dateOn(dayOf: DayOf): Date | null {
if (this.startDate !== null) {
return this.addDays(this.startDate, dayOf.num);
}
return null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L119-L124 | e63324b729d9eeaa190dc2cfc961aa3a636e0593 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets | arkts | Represents an attachment in a message. | export class MessageAttachment {
// 应用约束2: 显式声明类属性(ArkTS要求类属性必须在类体中显式声明)
// 应用约束7: 使用private/readonly修饰符替代#私有字段
readonly client: Client;
message: Message;
id: string; // 假设Snowflake类型为string
filename: string;
filesize: number;
url: string;
proxyURL: string;
height: number | null;
width: number | n... | AST#export_declaration#Left export AST#class_declaration#Left class MessageAttachment AST#class_body#Left { // 应用约束2: 显式声明类属性(ArkTS要求类属性必须在类体中显式声明) // 应用约束7: 使用private/readonly修饰符替代#私有字段 AST#property_declaration#Left readonly client : AST#type_annotation#Left AST#primary_type#Left Client AST#primary_type#Right AST#type... | export class MessageAttachment {
readonly client: Client;
message: Message;
id: string;
filename: string;
filesize: number;
url: string;
proxyURL: string;
height: number | null;
width: number | null;
constructor(message: Message, data: MessageAttachmentData) {
this.client = messa... | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets#L4-L32 | 160a89fa1e134efb8227cf255e5ca4fe1041dffc | github | |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/client/CustomOptions.ets | arkts | 自定义连接选项 | export class CustomOptions {
/**
* 是否使用自动重连功能
*/
private _reConnect: boolean = true;
public set reConnect(value: boolean) {
this._reConnect = value;
}
public get reConnect(): boolean {
return this._reConnect;
}
/**
* 退避系数, 默认为1000,单位毫秒
*/
private _backoff: number = IoTUtil.DEFAULT... | AST#export_declaration#Left export AST#class_declaration#Left class CustomOptions AST#class_body#Left { /**
* 是否使用自动重连功能
*/ AST#property_declaration#Left private _reConnect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_l... | export class CustomOptions {
private _reConnect: boolean = true;
public set reConnect(value: boolean) {
this._reConnect = value;
}
public get reConnect(): boolean {
return this._reConnect;
}
private _backoff: number = IoTUtil.DEFAULT_BACKOFF;
public set backoff(value: number) {
this.... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/CustomOptions.ets#L21-L109 | a4c5a86fbeb9214e7b17c7cd2a769cc3f5bc74eb | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Chip.d.ets | arkts | Defines localized label margin.
@interface LocalizedLabelMarginOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface LocalizedLabelMarginOptions {
/**
* start localized label margin length.
*
* @type { ?LengthMetrics }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
start?: LengthMetrics;
/**
* end localized label margin length.
*
... | AST#export_declaration#Left export AST#interface_declaration#Left interface LocalizedLabelMarginOptions AST#object_type#Left { /**
* start localized label margin length.
*
* @type { ?LengthMetrics }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#... | export interface LocalizedLabelMarginOptions {
start?: LengthMetrics;
end?: LengthMetrics;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L504-L527 | 0e9b15f3d24d7b3e392cdd7ed5fc553411eaef89 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/PureTabsExt/entry/src/main/ets/view/OutTabComponent.ets | arkts | tabBuilder | [StartExclude tabs_clip] | @Builder
tabBuilder(index: number, name: string | Resource, icon: Resource) {
Column() {
SymbolGlyph(icon).fontColor([this.selectedIndex === index
? $r('app.color.out_tab_bar_font_active_color')
: $r('app.color.out_tab_bar_font_inactive_color')])
.fontSize(25)
Text(name)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder 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 name : AST#type_annotation#Left AST... | @Builder
tabBuilder(index: number, name: string | Resource, icon: Resource) {
Column() {
SymbolGlyph(icon).fontColor([this.selectedIndex === index
? $r('app.color.out_tab_bar_font_active_color')
: $r('app.color.out_tab_bar_font_inactive_color')])
.fontSize(25)
Text(name)
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/OutTabComponent.ets#L35-L56 | e2e3f0086e3198e37b9b70577dbf609119715641 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | getCurrentParams | 获取当前页面参数 | getCurrentParams(): RouteParams {
try {
const state = router.getState();
return state.params as RouteParams || {};
} catch (error) {
hilog.error(0x0001, 'BirthdayReminder',
`Failed to get current params: ${error}`);
return {};
}
} | AST#method_declaration#Left getCurrentParams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statemen... | getCurrentParams(): RouteParams {
try {
const state = router.getState();
return state.params as RouteParams || {};
} catch (error) {
hilog.error(0x0001, 'BirthdayReminder',
`Failed to get current params: ${error}`);
return {};
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L199-L208 | 825d97d0c8d06221fb9434bad2e634c050752e32 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param sm4Key SM4密钥
@returns | static async encodeECB(str: string, sm4Key: string): Promise<string> {
return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128);
} | AST#method_declaration#Left static async encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeECB(str: string, sm4Key: string): Promise<string> {
return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L41-L43 | 8f4563f5d2152566ccfad31e210eec7a8b89aba2 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/container/queue_field_sensitive_001_T.ets | arkts | Introduction Queue域敏感 | export function queue_field_sensitive_001_T(taint_src : string) {
let s = new Queue<string>();
s.add(taint_src);
s.add("clean");
taint.Sink(s.getFirst());
} | AST#export_declaration#Left export AST#function_declaration#Left function queue_field_sensitive_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s... | export function queue_field_sensitive_001_T(taint_src : string) {
let s = new Queue<string>();
s.add(taint_src);
s.add("clean");
taint.Sink(s.getFirst());
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/queue_field_sensitive_001_T.ets#L7-L12 | ae97ed4f7e293b47bee54f6de6c07a019ac144f1 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationService.ets | arkts | updateSettings | 更新通知设置 | public updateSettings(newSettings: Partial<NotificationSettings>): void {
if (newSettings.enabled !== undefined) this.settings.enabled = newSettings.enabled;
if (newSettings.soundEnabled !== undefined) this.settings.soundEnabled = newSettings.soundEnabled;
if (newSettings.vibrationEnabled !== undefined) thi... | AST#method_declaration#Left public updateSettings AST#parameter_list#Left ( AST#parameter#Left newSettings : 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 NotificationSettings AST#primary_type#Right AST#type_annotati... | public updateSettings(newSettings: Partial<NotificationSettings>): void {
if (newSettings.enabled !== undefined) this.settings.enabled = newSettings.enabled;
if (newSettings.soundEnabled !== undefined) this.settings.soundEnabled = newSettings.soundEnabled;
if (newSettings.vibrationEnabled !== undefined) thi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L95-L109 | 13f4f6558eccbe10765a455e7c7413858f8f6532 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | getInstance | 获取DatabaseService单例实例 | static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Lef... | static getInstance(): DatabaseService {
if (!DatabaseService.instance) {
DatabaseService.instance = new DatabaseService();
}
return DatabaseService.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L39-L44 | 0197233d281b847869c966b76dc30cfd81735fa2 | github |
dou101101/ZenFocus-HarmonyOS.git | 9364599b8b20bc6377fc55ac68b991b61ceb8496 | MyApplication/entry/src/main/ets/pages/Index.ets | arkts | getTreeIcon | === 视觉辅助函数 === | getTreeIcon(progress: number): string {
if (progress < 0.2) return '🌱'; // 幼苗
if (progress < 0.5) return '🌿'; // 树苗
if (progress < 0.8) return '🌳'; // 大树
return '🌸'; // 开花/结果 (完成态)
} | AST#method_declaration#Left getTreeIcon AST#parameter_list#Left ( AST#parameter#Left progress : 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 string AST#primary_type#R... | getTreeIcon(progress: number): string {
if (progress < 0.2) return '🌱';
if (progress < 0.5) return '🌿';
if (progress < 0.8) return '🌳';
return '🌸';
} | https://github.com/dou101101/ZenFocus-HarmonyOS.git/blob/9364599b8b20bc6377fc55ac68b991b61ceb8496/MyApplication/entry/src/main/ets/pages/Index.ets#L351-L356 | 23f6ad06905d6a73d2ab834ee1863086a5f52114 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | getSolarMonthDays | 获取公历年某月的天数 | private static getSolarMonthDays(year: number, month: number): number {
if (month === 2 && LunarCalendarFixed.isLeapYear(year)) {
return 29;
}
return SOLAR_MONTH[month - 1];
} | AST#method_declaration#Left private static getSolarMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number A... | private static getSolarMonthDays(year: number, month: number): number {
if (month === 2 && LunarCalendarFixed.isLeapYear(year)) {
return 29;
}
return SOLAR_MONTH[month - 1];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L242-L247 | 4670cfbd78f22db97725f6e7949a0bfc33a1e899 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | buildImportResult | 构建导入结果页面 | @Builder
buildImportResult() {
if (this.importResult) {
Column({ space: 24 }) {
// 结果概览
Column({ space: 16 }) {
Text('导入结果')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Row({ space: 20 }) {
this.buildResultCard(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildImportResult AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressi... | @Builder
buildImportResult() {
if (this.importResult) {
Column({ space: 24 }) {
Column({ space: 16 }) {
Text('导入结果')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
Row({ space: 20 }) {
this.buildResultCard('总数', t... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L683-L767 | a2a4caa31702cdfb3f488738e49583f1f141922f | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets | arkts | loadKey | 加载私钥文件内容 | loadKey() {
try {
this.privateKey = this.readStringFromFile(keyFileUri)
this.keyLoaded = true
}
catch (e) {
this.msgHistory += 'readText failed ' + e.message + "\r\n";
}
} | AST#method_declaration#Left loadKey AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#... | loadKey() {
try {
this.privateKey = this.readStringFromFile(keyFileUri)
this.keyLoaded = true
}
catch (e) {
this.msgHistory += 'readText failed ' + e.message + "\r\n";
}
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L320-L328 | 9b77712fe698ab7742f657338150e6dc1abaa561 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets | arkts | 省、市、区共用的地址列表类 | export class CommonAddressList {
code: string; // 存放省、市、区id
name: string; // 存放省、市、区名
constructor(code: string = '', name: string = '') {
this.code = code;
this.name = name;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class CommonAddressList AST#class_body#Left { AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 存放省、市、区id AST#property_declaration#L... | export class CommonAddressList {
code: string;
name: string;
constructor(code: string = '', name: string = '') {
this.code = code;
this.name = name;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L19-L27 | efb33951f99e45d4d1765e41009d230e2089d869 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets | arkts | getFirstDayData | 周视图切换时,将当前周数据的第一天(周日)日期数据传出去 | getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
} | AST#method_declaration#Left getFirstDayData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expr... | getFirstDayData() {
if (this.weekDays && this.weekDays[0][0].dayInfo) {
this.onWeekSwitch({
date: this.weekDays[0][0].dayInfo.date,
month: this.weekDays[0][0].dayInfo.month,
year: this.weekDays[0][0].dayInfo.year
})
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L61-L69 | d2d0691e80213af81c59af7a3ead9deed43411ea | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets | arkts | getX | returns the x-value of the highlighted value
@return | public getX(): number {
return this.mX;
} | AST#method_declaration#Left public getX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L... | public getX(): number {
return this.mX;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L105-L107 | 040d699c75787a57f6fb85f0453b11e46fbf4875 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/view/AvatarComponent.ets | arkts | getEmotionOpacity | 根据状态返回透明度 | private getEmotionOpacity(): number {
if (this.isThinking) {
return 0.85; // 思考时稍微透明
}
return 1.0;
} | AST#method_declaration#Left private getEmotionOpacity 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#if_statement#Left if ( AST#expression#Left AST#member_expr... | private getEmotionOpacity(): number {
if (this.isThinking) {
return 0.85;
}
return 1.0;
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/AvatarComponent.ets#L584-L589 | 811b3ce12c58e2d97743af91d7e1fd997966f067 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets | arkts | aboutToAppear | 右下列表横向滚动到的第一个listItem索引号 | aboutToAppear(): void {
// 加载数据
this.loadShowData();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 加载数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#ex... | aboutToAppear(): void {
this.loadShowData();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L53-L56 | 4389457faf8b651bcb59134acceec9b74e3f60d8 | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/common/utils/Logger.ets | arkts | debug | Outputs debug-level logs.
@param args Indicates the log parameters. | debug(...args: string[]) {
hilog.debug(this.domain, this.prefix, this.format, args);
} | AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AS... | debug(...args: string[]) {
hilog.debug(this.domain, this.prefix, this.format, args);
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/common/utils/Logger.ets#L38-L40 | 1489fbbe994fb07684d5ed1d9cf65a7790e4454c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionParameter.ets | arkts | initAlertTitle | Alert标题,初始化参数
@param options | static initAlertTitle(options: AlertOptions | CustomContentOptions | BaseInputOptions) {
if (options.primaryTitle || options.title) {
options.primaryTitle = options.primaryTitle ?? options.title; //弹框一级标题。
}
} | AST#method_declaration#Left static initAlertTitle AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AlertOptions AST#primary_type#Right | AST#primary_type#Left CustomContentOptions AST#primary_type#Right | AST#primary_type#Left BaseInputOptions AST... | static initAlertTitle(options: AlertOptions | CustomContentOptions | BaseInputOptions) {
if (options.primaryTitle || options.title) {
options.primaryTitle = options.primaryTitle ?? options.title;
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L277-L281 | e0f3dd69ae28c4126794938fb1ae290a5dfaf9f7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | sendData | 发送数据
@param data
@param address
@param port | async sendData(data: string, address: string, port: number): Promise<void> {
let options: socket.UDPSendOptions = {
address: {
address: address,
port: port,
family: 1,
},
data: data,
};
if (!this.udpSocket) {
return;
}
Logger.info(`${TAG} tls sendData... | AST#method_declaration#Left async sendData 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 address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | async sendData(data: string, address: string, port: number): Promise<void> {
let options: socket.UDPSendOptions = {
address: {
address: address,
port: port,
family: 1,
},
data: data,
};
if (!this.udpSocket) {
return;
}
Logger.info(`${TAG} tls sendData... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L69-L88 | da8c7a5fcc8ec7cf759f80835858832b0bb25baa | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImageViewer/entry/src/main/ets/utils/FuncUtils.ets | arkts | 计算旋转角度
@param angle {number} 旋转角度
@returns {number} 最终需要旋转的角度 | export function simplestRotationQuarter(angle: number): number {
// 一个完整的圆的角度是360度
const FULL_CIRCLE: number = 360;
// 每个象限的角度是90度
const QUADRANT_DEGREES: number = 90;
// 为了正确处理角度在象限边界的情况,使用44.5作为偏移量。
// 这个值是为了确保当角度正好处于两个象限的边界上时(如45, 135, 225, 315度),它会被归入正确的象限。
const BOUNDARY_OFFSET: number = 44.5;
// ... | AST#export_declaration#Left export AST#function_declaration#Left function simplestRotationQuarter AST#parameter_list#Left ( AST#parameter#Left angle : 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_annotati... | export function simplestRotationQuarter(angle: number): number {
const FULL_CIRCLE: number = 360;
const QUADRANT_DEGREES: number = 90;
const BOUNDARY_OFFSET: number = 44.5;
let normalizedAngle: number = angle % FULL_CIRCLE;
const QUADRANT: number = Math.floor((Math.abs(normalizedAngle) + B... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/utils/FuncUtils.ets#L38-L62 | f151314afaef1466c4e835c696a2dc1457656302 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DialogUtils.ets | arkts | initPrimaryButton | 两个按钮,初始化参数
@param options | private static initPrimaryButton(options: PrimaryDialogOptions) {
//当PrimaryButton和SecondaryButton同时为空时,使用默认按钮
if (!options.primaryButton && !options.secondaryButton) {
options.primaryButton = DialogUtils.defaultConfig.primaryButton
options.secondaryButton = DialogUtils.defaultConfig.secondaryButton... | AST#method_declaration#Left private static initPrimaryButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left PrimaryDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //当Prim... | private static initPrimaryButton(options: PrimaryDialogOptions) {
if (!options.primaryButton && !options.secondaryButton) {
options.primaryButton = DialogUtils.defaultConfig.primaryButton
options.secondaryButton = DialogUtils.defaultConfig.secondaryButton
}
if (options.primaryButton) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L262-L316 | 1ac23032da0a657e8f447f6dd5e8801fe08d623c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/timeto/TimeToManager.ets | arkts | getLastResultByName | 获取指定 typeName 的上次执行结果 | public static getLastResultByName(typeName: string): boolean | undefined {
try {
const prefs = TimeToManager._getPrefs();
const raw = prefs.getSync(TimeToKeys.lastResult(typeName), null);
if (raw === null || raw === undefined) {
return undefined;
}
if (typeof raw ... | AST#method_declaration#Left public static getLastResultByName AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#p... | public static getLastResultByName(typeName: string): boolean | undefined {
try {
const prefs = TimeToManager._getPrefs();
const raw = prefs.getSync(TimeToKeys.lastResult(typeName), null);
if (raw === null || raw === undefined) {
return undefined;
}
if (typeof raw ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L92-L114 | 84971def0c9c195986d110e35a31ae0cdf60b8dc | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsCommentsCard.ets | arkts | GoodsCommentsCard | @file 商品评论卡片组件
@author Joker.X | @ComponentV2
export struct GoodsCommentsCard {
/**
* 评论列表
*/
@Param
comments: Comment[] = [];
/**
* 点击查看全部回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建商品评论卡片
* @returns {void} 无返回值
*/
build(): void {
ColumnStart({
widthValue: P100,
paddingValue:... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsCommentsCard AST#component_body#Left { /**
* 评论列表
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right comments : AST#type_annotation#Left AST#primary_type#Left AST#array_type#L... | @ComponentV2
export struct GoodsCommentsCard {
@Param
comments: Comment[] = [];
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.spac... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsCommentsCard.ets#L11-L86 | cc955c6bbda8dee28b895c84319cca3f5a29ac39 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.