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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/ConfigService.ets | arkts | updateConfig | 更新系统配置
@param config 配置对象
@returns 更新结果 | static async updateConfig(config: AgvConfig): Promise<Object> {
try {
console.info('[ConfigService] 📝 更新系统配置');
const response = await HttpUtil.put('/agv/config', config);
console.info('[ConfigService] ✅ 系统配置更新成功');
return response;
} catch (error) {
console.error('[ConfigService]... | AST#method_declaration#Left static async updateConfig AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AgvConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi... | static async updateConfig(config: AgvConfig): Promise<Object> {
try {
console.info('[ConfigService] 📝 更新系统配置');
const response = await HttpUtil.put('/agv/config', config);
console.info('[ConfigService] ✅ 系统配置更新成功');
return response;
} catch (error) {
console.error('[ConfigService]... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L79-L89 | ad13dbb9578892726d49ecd2f45130826b881cd5 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | decodeAsym | 非对称解密
@param decodeStr 待解密的字符串
@param priKey 给定秘钥规格私钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格 | static async decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//将私钥转换
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
//生成解密器
let encoder = crypto.createCipher(symEncryptName);
//初始化解密环境
... | AST#method_declaration#Left static async decodeAsym 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#primar... | static async decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
let encoder = crypto.createCipher(symEncryptName);
await encoder.init(cryp... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L318-L331 | d726aee20b311ad911615d593e71ae4df4f5d22d | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets | arkts | GetWindowAvoidArea | 获取系统状态栏,导航栏高度
@param context
@returns | async GetWindowAvoidArea() {
try {
let mainWindow = await window.getLastWindow(this.context);
let avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM; // 系统默认区域,包括状态栏,导航栏
let avoidArea = mainWindow.getWindowAvoidArea(avoidAreaType);
console.log('getWindowAvoidArea ', JSON.stringify... | AST#method_declaration#Left async GetWindowAvoidArea 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 let AST#variable_declarator#Left mainWindow = AST#expression#Left... | async GetWindowAvoidArea() {
try {
let mainWindow = await window.getLastWindow(this.context);
let avoidAreaType = window.AvoidAreaType.TYPE_SYSTEM;
let avoidArea = mainWindow.getWindowAvoidArea(avoidAreaType);
console.log('getWindowAvoidArea ', JSON.stringify(avoidArea));
... | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets#L82-L92 | c971958af0ec0b9e71608eb2c7f3a70ec47a1e1b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHASync.ets | arkts | digestSHA1 | SHA1摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA1', resultCoding);
} | AST#method_declaration#Left static digestSHA1 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 resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ... | static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA1', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L35-L37 | 2534b20ef2308474fb265a5370827cbb31a21c88 | gitee |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/review/ReviewCardComponents.ets | arkts | EfficiencyTrendCard | 效率分析卡片 | @Builder
export function EfficiencyTrendCard(
aheadCount: number,
onTimeCount: number,
delayedCount: number
) {
Column({ space: 16 }) {
Row() {
Text('效率分析')
.fontSize(18)
.fontWeight(FontWeight.Bold)
Blank()
SymbolGlyph($r('sys.symbol.text_clipboard'))
.fontSize(20)... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function EfficiencyTrendCard AST#parameter_list#Left ( AST#parameter#Left aheadCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#... | @Builder
export function EfficiencyTrendCard(
aheadCount: number,
onTimeCount: number,
delayedCount: number
) {
Column({ space: 16 }) {
Row() {
Text('效率分析')
.fontSize(18)
.fontWeight(FontWeight.Bold)
Blank()
SymbolGlyph($r('sys.symbol.text_clipboard'))
.fontSize(20)... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/review/ReviewCardComponents.ets#L205-L276 | 65d1f78a226fe88f74031239110af458965f6542 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/SetAppFontSize/entry/src/main/ets/viewmodel/SetViewModel.ets | arkts | Set view model, providing page display data. | export class SetViewModel {
chatArr: Array<ChatData> = [];
initChatData(): Array<ChatData> {
if (this.chatArr.length === 0) {
this.chatArr = new Array();
let chatData = new ChatData();
chatData.itemDirection = ItemDirection.RIGHT;
chatData.content = $r('app.string.set_chat_content1');
... | AST#export_declaration#Left export AST#class_declaration#Left class SetViewModel AST#class_body#Left { AST#property_declaration#Left chatArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ChatData AST#primary_type#Rig... | export class SetViewModel {
chatArr: Array<ChatData> = [];
initChatData(): Array<ChatData> {
if (this.chatArr.length === 0) {
this.chatArr = new Array();
let chatData = new ChatData();
chatData.itemDirection = ItemDirection.RIGHT;
chatData.content = $r('app.string.set_chat_content1');
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/viewmodel/SetViewModel.ets#L23-L69 | d887c35502b1680c68c25b005f81776d1e04e5c9 | gitee | |
Susuperli/ArkTsPlugin.git | d0a7d0cae1ef3bb3bd4a0af9a38cb353fa9da65f | examples/sample.ets | arkts | createResponse | Generic function example | function createResponse<T>(data: T, success: boolean = true): ApiResponse<T> {
return {
data,
success,
timestamp: Date.now(),
message: success ? 'Operation successful' : 'Operation failed'
};
} | AST#function_declaration#Left function createResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parame... | function createResponse<T>(data: T, success: boolean = true): ApiResponse<T> {
return {
data,
success,
timestamp: Date.now(),
message: success ? 'Operation successful' : 'Operation failed'
};
} | https://github.com/Susuperli/ArkTsPlugin.git/blob/d0a7d0cae1ef3bb3bd4a0af9a38cb353fa9da65f/examples/sample.ets#L191-L198 | 99b6b347c8c2f88c7dbfc5cf290538ac5d1c2cf6 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getHighlightsAtXValue | Returns a list of Highlight objects representing the entries closest to the given xVal.
The returned list contains two objects per DataSet (closest rounding up, closest rounding down).
@param xVal the transformed x-value of the x-touch position
@param x touch position
@param y touch position
@return | protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> | null {
this.mHighlightBuffer.clear();
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> | null = this.getData();
if (data == null)
return this.mHighlightBuffer;
fo... | AST#method_declaration#Left protected getHighlightsAtXValue AST#parameter_list#Left ( AST#parameter#Left xVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> | null {
this.mHighlightBuffer.clear();
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> | null = this.getData();
if (data == null)
return this.mHighlightBuffer;
fo... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/ChartHighlighter.ets#L149-L172 | b7b526de1e78935ea59f9dfd88faa0d6c971cbe7 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | setCarts | 保存选中的购物车项
@param {Cart[]} carts 购物车列表
@returns {Promise<void>} Promise<void> | async setCarts(carts: Cart[]): Promise<void> {
const jsonStr: string = JSON.stringify(carts);
await this.prefs.set(OrderCacheStoreDataSourceImpl.KEY_CARTS, jsonStr);
} | AST#method_declaration#Left async setCarts AST#parameter_list#Left ( AST#parameter#Left carts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#... | async setCarts(carts: Cart[]): Promise<void> {
const jsonStr: string = JSON.stringify(carts);
await this.prefs.set(OrderCacheStoreDataSourceImpl.KEY_CARTS, jsonStr);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L97-L100 | 7ed6db739415c03c063ca0457b5590d10e5f79ff | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets | arkts | drawMask | Draw mask.
@param ctx
@param outer
@param inner
@param isShow | static drawMask(ctx: CanvasRenderingContext2D, outer: RectF, inner: RectF, isShow: boolean) {
// ctx.fillStyle = DrawingUtils.DEFAULT_MASK_STYLE;
if (isShow) {
ctx.fillStyle = CommonConstants.DEFAULT_MASK_STYLE;
} else {
ctx.fillStyle = `rgba(0, 0, 0, 1)`;
}
ctx.fillRect(outer.left, oute... | AST#method_declaration#Left static drawMask AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outer : AST#type_annotation#Left AST#primary_type#Left RectF AS... | static drawMask(ctx: CanvasRenderingContext2D, outer: RectF, inner: RectF, isShow: boolean) {
if (isShow) {
ctx.fillStyle = CommonConstants.DEFAULT_MASK_STYLE;
} else {
ctx.fillStyle = `rgba(0, 0, 0, 1)`;
}
ctx.fillRect(outer.left, outer.top, outer.getWidth(), inner.top - outer.top);
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets#L28-L39 | 39b57c83ff24ea856885e1bf3015091fed56f18c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | stopCustomScan | 停止自定义扫码
@returns {void} | stopCustomScan(): void {
// 关闭相机闪光灯
this.tryCloseFlashLight();
// 关闭自定义扫码
try {
this.isScanLine = false;
customScan.stop().then(() => {
}).catch((error: BusinessError) => {
logger.error('customScan stop failed error: ' + JSON.stringify(error));
})
} catch (error) {
... | AST#method_declaration#Left stopCustomScan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 关闭相机闪光灯 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expre... | stopCustomScan(): void {
this.tryCloseFlashLight();
try {
this.isScanLine = false;
customScan.stop().then(() => {
}).catch((error: BusinessError) => {
logger.error('customScan stop failed error: ' + JSON.stringify(error));
})
} catch (error) {
logger.error('s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L341-L355 | 9ed13ddcd306315ef66b25d5be9405dccc2ac046 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CustomerServiceRepository.ets | arkts | @file 客服仓库,封装客服相关请求
@author Joker.X | export class CustomerServiceRepository {
/**
* 客服网络数据源
*/
private networkDataSource: CustomerServiceNetworkDataSource;
/**
* 构造函数
* @param networkDataSource 客服网络数据源
*/
constructor(networkDataSource?: CustomerServiceNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new Custom... | AST#export_declaration#Left export AST#class_declaration#Left class CustomerServiceRepository AST#class_body#Left { /**
* 客服网络数据源
*/ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left CustomerServiceNetworkDataSource AST#primary_type#Right AST#type_annotation#... | export class CustomerServiceRepository {
private networkDataSource: CustomerServiceNetworkDataSource;
constructor(networkDataSource?: CustomerServiceNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new CustomerServiceNetworkDataSourceImpl();
}
async createSession(): Promise<Netw... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L8-L63 | a750d52dab9d393c87e2449fd87b529ce673a477 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | number类型Callback | export declare type NumberCalBack = (index: number) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type NumberCalBack = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#R... | export declare type NumberCalBack = (index: number) => void; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L9-L9 | 197205d2c4bbb446a8a4340a93da168ab160e391 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets | arkts | CodeLayout | 二维码位置组件 | @Component
export struct CodeLayout {
@Consume('subPageStack') subPageStack: NavPathStack;
@ObjectLink xComponentSize: XComponentSize;
@Prop navHeight: number;
@State scanResults: ScanResults = {
code: 0,
data: [],
size: 0,
uri: ''
}
@Prop foldStatus: number = -1; // 折叠状态
@State multiCodeS... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CodeLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'subPageStack' AST#expression#Right ) AST#decorator#Right subPageStack : AST#type_annotation#Left A... | @Component
export struct CodeLayout {
@Consume('subPageStack') subPageStack: NavPathStack;
@ObjectLink xComponentSize: XComponentSize;
@Prop navHeight: number;
@State scanResults: ScanResults = {
code: 0,
data: [],
size: 0,
uri: ''
}
@Prop foldStatus: number = -1;
@State multiCodeScanLoca... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L45-L346 | cc67f8e0082eb3939f6b6377b45d035216a21fb4 | gitee |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/Constants.ets | arkts | 获取天气图标 | export function getWeatherIcon(weatherText: string): string {
const iconKeys = Object.keys(WEATHER_ICONS);
for (let i = 0; i < iconKeys.length; i++) {
const key = iconKeys[i];
if (weatherText.includes(key)) {
return WEATHER_ICONS[key];
}
}
return '🌤️';
} | AST#export_declaration#Left export AST#function_declaration#Left function getWeatherIcon AST#parameter_list#Left ( AST#parameter#Left weatherText : 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#... | export function getWeatherIcon(weatherText: string): string {
const iconKeys = Object.keys(WEATHER_ICONS);
for (let i = 0; i < iconKeys.length; i++) {
const key = iconKeys[i];
if (weatherText.includes(key)) {
return WEATHER_ICONS[key];
}
}
return '🌤️';
} | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/Constants.ets#L53-L62 | c8cf6ceeecda92b9ffae1f636ba6dfd3897a13fb | github | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/review/ReviewCardComponents.ets | arkts | TimeDistributionChart | 时间分布图表卡片 | @Builder
export function TimeDistributionChart(distribution: TimeDistributionItem[], maxHours: number) {
Column({ space: 12 }) {
Row() {
Text('时间分布')
.fontSize(18)
.fontWeight(FontWeight.Bold)
Blank()
SymbolGlyph($r('sys.symbol.doc_text_fill'))
.fontSize(20)
.font... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TimeDistributionChart AST#parameter_list#Left ( AST#parameter#Left distribution : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TimeDistributionItem [ ] AST#array_type#Right AST#primary_type#Right... | @Builder
export function TimeDistributionChart(distribution: TimeDistributionItem[], maxHours: number) {
Column({ space: 12 }) {
Row() {
Text('时间分布')
.fontSize(18)
.fontWeight(FontWeight.Bold)
Blank()
SymbolGlyph($r('sys.symbol.doc_text_fill'))
.fontSize(20)
.font... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/review/ReviewCardComponents.ets#L147-L200 | 79581c8078769d2c21e07f76e057d892fb2a464e | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getLocalizedString | 获取本地化字符串
@param stringResId 字符串资源ID
@returns 本地化字符串 | static getLocalizedString(context: common.Context, stringResId: number): string {
return context.resourceManager.getStringSync(stringResId);
} | AST#method_declaration#Left static getLocalizedString AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stringRe... | static getLocalizedString(context: common.Context, stringResId: number): string {
return context.resourceManager.getStringSync(stringResId);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L422-L424 | 2212e0a3168cffa6c9350b42a4a9333505fdb7e1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildGreetingLibrary | 祝福语库 | @Builder
buildGreetingLibrary() {
Column({ space: 16 }) {
Row() {
Text('📚 祝福语库')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`${this.selectedGreetingCategory}祝福语`)
.fontSize(14)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingLibrary AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen... | @Builder
buildGreetingLibrary() {
Column({ space: 16 }) {
Row() {
Text('📚 祝福语库')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`${this.selectedGreetingCategory}祝福语`)
.fontSize(14)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3227-L3263 | 0745fc61162d7d221bd53af04a52cbe3a71effda | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | encryptGCM | 加密(GCM模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。
@returns | static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.Cry... | AST#method_declaration#Left static async encryptGCM AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.Cry... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L36-L44 | 5794d18ea5c2db4a465bef01689cc7bcb08295a6 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | setCanvasReady | Set Canvas ready.
@param state | setCanvasReady(state: boolean): void {
this.canvasReady = state;
} | AST#method_declaration#Left setCanvasReady AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Ri... | setCanvasReady(state: boolean): void {
this.canvasReady = state;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L109-L111 | c0278e664b70eaf703c9ee00765e30ac06c53ee5 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | loadMoreEpisodes | 加载更多单集 | async loadMoreEpisodes() {
this.episodesPage++;
await this.loadAllEpisodes();
} | AST#method_declaration#Left async loadMoreEpisodes 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 . episodesPag... | async loadMoreEpisodes() {
this.episodesPage++;
await this.loadAllEpisodes();
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L201-L204 | 8ea5fb26939e6609559afb73c65cdb88a7177326 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | updateWeeklyTrend | 更新周趋势数据 | private updateWeeklyTrend(): void {
const weekTrend: number[] = [];
const today = new Date();
for (let i = 6; i >= 0; i--) {
const checkDate = new Date(today);
checkDate.setDate(today.getDate() - i);
const dateKey = DateUtils.formatDate(checkDate, 'yyyy-MM-dd');
const dayStats = th... | AST#method_declaration#Left private updateWeeklyTrend AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left... | private updateWeeklyTrend(): void {
const weekTrend: number[] = [];
const today = new Date();
for (let i = 6; i >= 0; i--) {
const checkDate = new Date(today);
checkDate.setDate(today.getDate() - i);
const dateKey = DateUtils.formatDate(checkDate, 'yyyy-MM-dd');
const dayStats = th... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L145-L159 | 337662919b0e215a03d18f9ede33d64628587134 | github |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | ColorFilters are optional objects in the drawing pipeline.
@syscap SystemCapability.Graphics.Drawing
@since 11 | export class ColorFilter {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | AST#export_declaration#Left export AST#class_declaration#Left class ColorFilter AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_... | export class ColorFilter {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L532-L533 | 8bbd4f79f1dbf429d12818b477aba065902253bb | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets | arkts | sha1_ft | Perform the appropriate triplet combination function for the current
iteration
返回对应F函数的值 | sha1_ft(t: number, b: number, c: number, d: number) {
if (t < 20) {
return (b & c) | ((~b) & d);
}
if (t < 40) {
return b ^ c ^ d;
}
if (t < 60) {
return (b & c) | (b & d) | (c & d);
}
return b ^ c ^ d; // t<80
} | AST#method_declaration#Left sha1_ft AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_a... | sha1_ft(t: number, b: number, c: number, d: number) {
if (t < 20) {
return (b & c) | ((~b) & d);
}
if (t < 40) {
return b ^ c ^ d;
}
if (t < 60) {
return (b & c) | (b & d) | (c & d);
}
return b ^ c ^ d;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA1.ets#L122-L137 | 0b76c0ab38b0445136c903d8bf6a0c56e341c8ee | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/model/Folder.ets | arkts | 文件夹数据类型。 | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/Folder.ets#L7-L7 | 85f1d1a68e4b3ebb80ea8f08ed4a74e2373732b0 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | ensureMigrated | 确保 Demo 表完成迁移
@returns {void} 无返回 | private ensureMigrated(): void {
if (!DemoLocalDataSourceImpl.migrated) {
this.orm.migrate(DemoEntity);
DemoLocalDataSourceImpl.migrated = true;
}
} | AST#method_declaration#Left private ensureMigrated AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#m... | private ensureMigrated(): void {
if (!DemoLocalDataSourceImpl.migrated) {
this.orm.migrate(DemoEntity);
DemoLocalDataSourceImpl.migrated = true;
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L28-L33 | 762034a9457bbfc46d0f13d5b882c149d4b6fa31 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | closeSocket | 关闭Socket | async closeSocket(): Promise<void> {
if (!this.udpSocket) {
return;
}
await this.udpSocket.close();
this.udpSocket.off('message');
this.udpSocket = undefined;
} | AST#method_declaration#Left async closeSocket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | async closeSocket(): Promise<void> {
if (!this.udpSocket) {
return;
}
await this.udpSocket.close();
this.udpSocket.off('message');
this.udpSocket = undefined;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L54-L61 | 22dc258b5967dcbf8e88f196214e3e3679eba3a5 | gitee |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/tabcontent/HomeContent.ets | arkts | todoItem | 封装该页面的代办列表 | @Builder todoItem(todoItem: TodoItem) {
Row() {
Row() {
Text(todoItem.title)
.fontSize(18)
// 设置最大长度
.maxLines(1)
// 设置截断方式
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('80%')
Blank();
Checkbox({ name: 'checkbox' })
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right todoItem AST#parameter_list#Left ( AST#parameter#Left todoItem : AST#type_annotation#Left AST#primary_type#Left TodoItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#... | @Builder todoItem(todoItem: TodoItem) {
Row() {
Row() {
Text(todoItem.title)
.fontSize(18)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('80%')
Blank();
Checkbox({ name: 'checkbox' })
.select(f... | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/tabcontent/HomeContent.ets#L151-L173 | 3e00c6e254751b5e89c71fd03d5be8dda568de55 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets | arkts | processCustomSpans | 处理自定义span列表数据,生成属性字符串数组
@param {MyCustomSpan[]} spans - 包含不同类型文本片段的数组(如普通文本、链接等)
@returns {MutableStyledString[]} - 生成的属性字符串数组 | processCustomSpans(spans: MyCustomSpan[]): MutableStyledString[] {
let charCount = 0; // 遍历拼接customMessage.spans,记录已拼接的字符串长度
const styledStrings: MutableStyledString[] = []; // 已生成的属性字符串数组
spans.forEach((span, index) => {
// 如果当前累积字符数已经达到最大允许长度,则停止处理后续文本片段
if (charCount >= this.maxStringLength)... | AST#method_declaration#Left processCustomSpans AST#parameter_list#Left ( AST#parameter#Left spans : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MyCustomSpan [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | processCustomSpans(spans: MyCustomSpan[]): MutableStyledString[] {
let charCount = 0;
const styledStrings: MutableStyledString[] = [];
spans.forEach((span, index) => {
if (charCount >= this.maxStringLength) {
return;
}
if (charCount + span.content.length >= ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L83-L102 | abf475a5510fb28d05e132e56e2561f233e39138 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/MosaicComponent.ets | arkts | 马赛克控制器 | export interface MosaicController {
refreshScale: (scale: number) => void;
refreshBrushSize: (size: number) => void;
undo: (data: MosaicData) => void;
refreshPixelMap: (pixelMap: PixelMap) => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MosaicController AST#object_type#Left { AST#type_member#Left refreshScale : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | export interface MosaicController {
refreshScale: (scale: number) => void;
refreshBrushSize: (size: number) => void;
undo: (data: MosaicData) => void;
refreshPixelMap: (pixelMap: PixelMap) => void;
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/MosaicComponent.ets#L27-L32 | 00bd84534dee366c7f122d37eb183c8f3f0294c1 | gitee | |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/utils/Recorder.ets | arkts | stopRecord | 停止录制 | async stopRecord() {
if (this.avRecorder != undefined) {
// 1. 停止录制
// 仅在started或者paused状态下调用stop为合理状态切换
if (this.avRecorder.state === 'started'
|| this.avRecorder.state === 'paused') {
await this.avRecorder.stop();
}
// 2.重置
await this.avRecorder.reset();
// ... | AST#method_declaration#Left async stopRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#... | async stopRecord() {
if (this.avRecorder != undefined) {
if (this.avRecorder.state === 'started'
|| this.avRecorder.state === 'paused') {
await this.avRecorder.stop();
}
await this.avRecorder.reset();
await this.avRecorder.release();
fs.... | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/utils/Recorder.ets#L65-L82 | 294a51d66c1ecad8b56662c0807ef0e831d4448a | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets | arkts | aboutToAppear | ************************************build********************************************* | aboutToAppear(): void {
this.getGraphData()
} | 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#expression... | aboutToAppear(): void {
this.getGraphData()
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets#L185-L188 | 176c897fac9c62b59c7ceed021b170b501bc2bb9 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/image/SmallAvatar.ets | arkts | 构建小尺寸头像
@returns {void} 无返回值 | build(): void {
Avatar({
src: this.src,
avatarSize: 36,
onTap: this.onTap
});
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Avatar ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left A... | build(): void {
Avatar({
src: this.src,
avatarSize: 36,
onTap: this.onTap
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/SmallAvatar.ets#L24-L30 | d343137498ce9a7244c54670105a9fcf3261ded9 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringUtils.ets | arkts | containsEmpty | 是否包含空格或换行字符
@param str 输入字符串
@returns 是否包含 | static containsEmpty(str: string): boolean {
const chars = Array.from(str);
for (const c of chars) {
if (emptyStr.includes(c)) {
return true;
}
}
return false;
} | AST#method_declaration#Left static containsEmpty 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_t... | static containsEmpty(str: string): boolean {
const chars = Array.from(str);
for (const c of chars) {
if (emptyStr.includes(c)) {
return true;
}
}
return false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L43-L51 | 9a74e168f752c607c560846e2f78a7942d9babd7 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | decrypt | 解密,异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|GCM|PKCS7、SM4_128|CBC|PKCS7、SM4_128|ECB|PKCS7、等)。
@returns | static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
} | AST#method_declaration#Left static async decrypt AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey... | static async decrypt(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.decrypt(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L241-L244 | 4fb5f84e2c9fbdfe764ff43bf185ab5a6d84bd6b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets | arkts | jumpToPrivacyWebView | Redirect to the HUAWEI ID User Authentication Agreement page. | jumpToPrivacyWebView(privacyText: loginComponentManager.PrivacyText) {
if (!this.enableStatus) {
return;
}
if (privacyText.tag === 'privacy_policy') {
// 直接跳转到隐私协议页面
this.vm.navStack.pushPathByName('PrivacyAgreement', undefined);
return;
}
const hasNet: boolean = connection.h... | AST#method_declaration#Left jumpToPrivacyWebView AST#parameter_list#Left ( AST#parameter#Left privacyText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left loginComponentManager . PrivacyText AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param... | jumpToPrivacyWebView(privacyText: loginComponentManager.PrivacyText) {
if (!this.enableStatus) {
return;
}
if (privacyText.tag === 'privacy_policy') {
this.vm.navStack.pushPathByName('PrivacyAgreement', undefined);
return;
}
const hasNet: boolean = connection.hasDefaultNetSy... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/QuickLoginPage.ets#L139-L162 | 08f15d9eb9086c1d050598ac3307718ea27529d0 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | receive_tab | Receives a tab from LocalStorage, usually transferred from another window.
This acts very like method newTab(...).
@param storage The LocalStorage.
@returns The new main tab index (idx of the new, received tab). | receive_tab(storage: LocalStorage) {
let move_tab_tab_info_packed = AppStorage.get('move_tab_tab_info_packed') as tab_info_packed;
let move_tab_tab_label = AppStorage.get('move_tab_tab_label') as tab_label;
let move_tab_TabNodeController = AppStorage.get('move_tab_TabNodeController') as TabNodeController;
... | AST#method_declaration#Left receive_tab AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio... | receive_tab(storage: LocalStorage) {
let move_tab_tab_info_packed = AppStorage.get('move_tab_tab_info_packed') as tab_info_packed;
let move_tab_tab_label = AppStorage.get('move_tab_tab_label') as tab_label;
let move_tab_TabNodeController = AppStorage.get('move_tab_TabNodeController') as TabNodeController;
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L391-L412 | b5f2f5830e8b38fd0473e95e4e81d37052230bd7 | gitee |
guyu0327/HarmonyGomoku.git | e615d8f24e08db68c23f0345cde1ff621de4cb07 | entry/src/main/ets/pages/Second.ets | arkts | checkLink | 判断是否五子连珠 | checkLink() {
if (!this.chess_coord || this.chess_coord.length === 0) {
return;
}
const lastCoord = this.chess_coord[this.chess_coord.length - 1];
const directions: [number, number][] = [
[1, 0], // 垂直方向
[0, 1], // 水平方向
[1, 1], // 右对角线
[-1, 1]// 左对角线
];
for (const... | AST#method_declaration#Left checkLink AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#... | checkLink() {
if (!this.chess_coord || this.chess_coord.length === 0) {
return;
}
const lastCoord = this.chess_coord[this.chess_coord.length - 1];
const directions: [number, number][] = [
[1, 0],
[0, 1],
[1, 1],
[-1, 1]
];
for (const direction of directions) {
... | https://github.com/guyu0327/HarmonyGomoku.git/blob/e615d8f24e08db68c23f0345cde1ff621de4cb07/entry/src/main/ets/pages/Second.ets#L141-L195 | a028660fcb078cec40b111649ebcc6e38199a207 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets | arkts | ActionIconButton | 操作入口按钮(图标 + 文案)
@param {ResourceStr} iconResId - 图标资源
@param {ResourceStr} text - 文案资源
@param {() => void} onTap - 点击回调
@returns {void} 无返回值 | @Builder
private ActionIconButton(iconResId: ResourceStr, text: ResourceStr, onTap: () => void): void {
ColumnCenter({
widthValue: 40,
paddingValue: {
top: $r("app.float.space_vertical_small_x"),
bottom: $r("app.float.space_vertical_small_x")
},
onTap: (): void => onTap()
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ActionIconButton AST#parameter_list#Left ( AST#parameter#Left iconResId : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#t... | @Builder
private ActionIconButton(iconResId: ResourceStr, text: ResourceStr, onTap: () => void): void {
ColumnCenter({
widthValue: 40,
paddingValue: {
top: $r("app.float.space_vertical_small_x"),
bottom: $r("app.float.space_vertical_small_x")
},
onTap: (): void => onTap()
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailBottomBar.ets#L127-L149 | 759dfd0dc19acd5c630aaae3c12f68d5617272a0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/ECDSA.ets | arkts | sign | 对数据进行签名,异步
@param dataBlob 待签名数据
@param priKey 私钥
@param algName 指定签名算法(ECC256|SHA256、ECC256|SHA512、ECC384|SHA256、等)。
@returns | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName = 'ECC256|SHA256'): Promise<cryptoFramework.DataBlob> {
return await CryptoUtil.sign(dataBlob, priKey, algName);
} | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKe... | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName = 'ECC256|SHA256'): Promise<cryptoFramework.DataBlob> {
return await CryptoUtil.sign(dataBlob, priKey, algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/ECDSA.ets#L35-L38 | 4b6e21d8f77e9fdb6b7ba39eabf7a5010fe35825 | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageUtils.ets | arkts | allValid | ========== 判断操作 ==========
判断所有消息是否都有效
@param messages 消息数组
@returns true 如果所有消息都有效
使用示例:
```typescript
const people = [person1, person2, person3]
if (MessageUtils.allValid(people)) {
console.log('All messages are valid')
}
``` | static allValid<T extends Message>(messages: T[]): boolean {
return messages.every(m => m.isValid())
} | AST#method_declaration#Left static allValid 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 : AS... | static allValid<T extends Message>(messages: T[]): boolean {
return messages.every(m => m.isValid())
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L236-L238 | 097046b255a35f070e30f184501ae9be4fe796e4 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample7/LightArt.ets | arkts | LightArtDataComponentType | Fill in the data to LightArtDataComponent. | @Sendable
export class LightArtDataComponentType implements ISerializableType<LightArtDataComponent> {
public fromJson(jsonObj: object): LightArtDataComponent {
let ans = new LightArtDataComponent();
ans.mergeFrom(jsonObj);
return ans;
}
public static instance: LightArtDataComponentType = new LightA... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class LightArtDataComponentType AST#implements_clause#Left implements AST#generic_type#Left ISerializableType AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left LightArtDataComponent AST#primary_type#Rig... | @Sendable
export class LightArtDataComponentType implements ISerializableType<LightArtDataComponent> {
public fromJson(jsonObj: object): LightArtDataComponent {
let ans = new LightArtDataComponent();
ans.mergeFrom(jsonObj);
return ans;
}
public static instance: LightArtDataComponentType = new LightA... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/LightArt.ets#L72-L80 | 6a64355d64ebbc473c04328fb0f299ff9d61f850 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/pages/Index.ets | arkts | updateFileData | 刷新当前页面数据 | updateFileData() {
this.fileData = [];
let subdirectory = FileSystem.getSubdirectory(this.directoryPath);
// 构建文件结构
subdirectory.forEach(item => {
this.fileData.push(new FileStructure(item.name, item.type, item.time, item.childrenNum, item.fileSize));
})
} | AST#method_declaration#Left updateFileData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileData AST#member_ex... | updateFileData() {
this.fileData = [];
let subdirectory = FileSystem.getSubdirectory(this.directoryPath);
subdirectory.forEach(item => {
this.fileData.push(new FileStructure(item.name, item.type, item.time, item.childrenNum, item.fileSize));
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/entry/src/main/ets/pages/Index.ets#L70-L77 | 8b02386ff839216f9fe75a5b16eec07154cf91c7 | gitee |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/database/Rdb.ets | arkts | getRdbStore | 获取操作数据库RdbStore对象的方法,接收一个回调函数 | getRdbStore(callback: Function = () => {
}) {
// 如果 回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!');
return;
}
// 如果属性rdbStore 不为空,说明操作对象已经初始化,打印日志,执行回调函数,退出方... | AST#method_declaration#Left getRdbStore AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Le... | getRdbStore(callback: Function = () => {
}) {
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!');
return;
}
if (this.rdbStore !== null) {
Logger.info(CommonConstants.RDB_TAG, 'The... | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/Rdb.ets#L30-L71 | 0c45d31e65ca509f144c75016f3e8db271a739ea | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement4.ets | arkts | executeTaskPool | [EndExclude execcolorinfo] | function executeTaskPool(bufferArray: ArrayBuffer): void {
taskpool.execute(execColorInfo, bufferArray, taskpool.Priority.HIGH).catch((error: BusinessError) => {
hilog.error(DOMAIN, TAG, FORMAT, `taskpool excute error: ${error}`);
});
} | AST#function_declaration#Left function executeTaskPool AST#parameter_list#Left ( AST#parameter#Left bufferArray : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left vo... | function executeTaskPool(bufferArray: ArrayBuffer): void {
taskpool.execute(execColorInfo, bufferArray, taskpool.Priority.HIGH).catch((error: BusinessError) => {
hilog.error(DOMAIN, TAG, FORMAT, `taskpool excute error: ${error}`);
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement4.ets#L29-L33 | 654f7fa565216a687cf664e8e57282e347ee2114 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | on | 添加监听事件 | static on(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel'
| 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification'
| 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList',
callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback... | AST#method_declaration#Left static on AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right AST#ERROR#Left : 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel' | 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification' | 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventR... | static on(type: 'stateChange' | 'stop' | 'release' | 'showPanel' | 'hidePanel'
| 'setArticle' | 'clickArticle' | 'clickAuthor' | 'clickNotification'
| 'requestMore' | 'eventPanel' | 'eventNotification' | 'eventReadList',
callback: Callback<void> | Callback<string> | Callback<TextReader.ReadState> | Callback... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L335-L371 | 806e7ae3d567a7d7033273236d55f34fec550904 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handletabs/src/main/ets/pages/HandleTabs.ets | arkts | tabContentBuilder | Tabs控制器
TabContent内容视图 | @Builder
tabContentBuilder() {
Column() {
Search().width('90%')
Grid() {
// 性能知识点:此处列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach
ForEach(this.addressList, () => {
GridItem() {
Column({ space: STYLE_CONFIGURATION.CONTENT_GUTTER_S }) {
Text()
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabContentBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_u... | @Builder
tabContentBuilder() {
Column() {
Search().width('90%')
Grid() {
ForEach(this.addressList, () => {
GridItem() {
Column({ space: STYLE_CONFIGURATION.CONTENT_GUTTER_S }) {
Text()
.width(STYLE_CONFIGURATION.IMAGE_SIZE)
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/HandleTabs.ets#L44-L75 | da547b2f30c30ee4c3ff78ce5e16a11da2c5e8dd | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/feedback/src/main/ets/viewmodel/FeedbackListViewModel.ets | arkts | @file 反馈列表页面 ViewModel
@author Joker.X | @ObservedV2
export default class FeedbackListViewModel extends BaseViewModel {
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class FeedbackListViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Rig... | @ObservedV2
export default class FeedbackListViewModel extends BaseViewModel {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/viewmodel/FeedbackListViewModel.ets#L7-L9 | 23aa3aa581a5207f1a3dea0d1043ac58141e5e45 | github | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | getCardZIndex | 获取卡片层级 | private getCardZIndex(dataIndex: number): number {
// 确保当前卡片在最上层,后续卡片按顺序递减
// 使用一个较大的基数来确保正确的层叠顺序
const baseZIndex: number = 1000;
const zIndex: number = baseZIndex - (dataIndex - this.currentIndex);
return zIndex;
} | AST#method_declaration#Left private getCardZIndex AST#parameter_list#Left ( AST#parameter#Left dataIndex : 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 number AST#pri... | private getCardZIndex(dataIndex: number): number {
const baseZIndex: number = 1000;
const zIndex: number = baseZIndex - (dataIndex - this.currentIndex);
return zIndex;
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L371-L377 | aaa63750b16cb9b983c5396ad6a6888b1fd41dee | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_two.ets | arkts | test | 传递的基础类型name:'jeck', age:'12'。 | test(): Student {
let st: Student = { name: 'jeck', age: '12' };
return st;
} | AST#method_declaration#Left test AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Student AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left st : AST#type_annot... | test(): Student {
let st: Student = { name: 'jeck', age: '12' };
return st;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_two.ets#L30-L33 | 0ba55d428948996032e3766993889ba03759ec76 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | addGreetingHistory | 添加祝福记录
@param greetingHistory 祝福历史实体 | async addGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> {
this.checkInitialization();
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
} | AST#method_declaration#Left async addGreetingHistory AST#parameter_list#Left ( AST#parameter#Left greetingHistory : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_... | async addGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> {
this.checkInitialization();
return await this.greetingHistoryDAO.insertGreetingHistory(greetingHistory);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L213-L216 | 1742a98cfff5cd8860769c70deaedb58def977ff | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets | arkts | MyScroller | 功能描述:
父容器Scroll组件统一派发子组件的偏移量
实现原理:
1、MyScroll对子组件进行偏移量派发: MyScroll使用Scroll.onScrollFrameBegin()中返回的offset滑动量判断页面上划/下划,
进而通过this.scrollWeb(offset)派发给web偏移量,通过this.scrollList(offset)派发给List偏移量,从而实现web的滚动和list组件滚动能无缝衔接,像同一个滚动组件滚动效果。
@param {() => void} webBuilder - web组件(新闻内容)(必需)
@param {() => void} listBuilder - List组... | @Component
export struct MyScroller {
private scroller: Scroller = new Scroller(); // 创建Scroller对象
scrollWeb?: (offset:number)=> void; // 滚动偏移派发给Web
scrollList?: (offset:number)=> void; // 滚动偏移派发给List
getListOffset?: ()=> number; // 检测List是否到上边界
getWebScrollEnd?: ()=> void; // 检测Web组件是否滚动到边界
@Builder custom... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyScroller AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#... | @Component
export struct MyScroller {
private scroller: Scroller = new Scroller();
scrollWeb?: (offset:number)=> void;
scrollList?: (offset:number)=> void;
getListOffset?: ()=> number;
getWebScrollEnd?: ()=> void;
@Builder customBuilder1() {};
@Builder customBuilder2() {};
@Builder customBuilder3... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/Scroller.ets#L36-L93 | 992226eaf1c1c2578701a0c5b7328d5e1bb0e2eb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets | arkts | Crop 1:1.
@param pixelMap.
@param width.
@param height. | export async function square(pixelMap: PixelMap, width: number, height: number): Promise<void> {
if (width < height) {
await pixelMap.crop({
size: {
width: width,
height: width
},
x: 0,
y: Math.round((height - width) / 2)
});
} else {
await pixelMap.crop({
s... | AST#export_declaration#Left export AST#function_declaration#Left async function square AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#Lef... | export async function square(pixelMap: PixelMap, width: number, height: number): Promise<void> {
if (width < height) {
await pixelMap.crop({
size: {
width: width,
height: width
},
x: 0,
y: Math.round((height - width) / 2)
});
} else {
await pixelMap.crop({
s... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets#L25-L45 | 31d712169473062db902b77f29e8f7760ba8041f | gitee | |
zeroone001/harmonyAPP.git | 49c8fa1b56de89cb7513b25f3b1b753ba857968a | features/quickstart/src/main/ets/view/EnablementView.ets | arkts | aboutToAppear(): void { console.log('测试一下') this.getEnablementListData(); } getEnablementListData () { getContext(this).resourceManager.getRawFileContent('EnablementData.json').then(value => { this.enablementList = JSON.parse(bufferToString(value)) as ArticleClass[]; }) } | build() {
Column() {
Text('赋能套件')
.fontColor('#182431')
.fontSize(16)
.fontWeight(500)
.fontFamily('HarmonyHeiTi-medium')
.textAlign(TextAlign.Start)
.padding({ left: 16 })
.margin({ bottom: 8.5 })
Grid() {
ForEach(this.enablementList, (ite... | 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 Text ( AST#expression#Left '赋能套件' AST#expression#Right ... | build() {
Column() {
Text('赋能套件')
.fontColor('#182431')
.fontSize(16)
.fontWeight(500)
.fontFamily('HarmonyHeiTi-medium')
.textAlign(TextAlign.Start)
.padding({ left: 16 })
.margin({ bottom: 8.5 })
Grid() {
ForEach(this.enablementList, (ite... | https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/features/quickstart/src/main/ets/view/EnablementView.ets#L43-L71 | f9fe2625bb3c5eb877a720bbfeba986c45c911bf | github | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets | arkts | TODO Dialog帮助工具类(全局自定义弹框,不依赖UI组件)
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01 | export class DialogHelper {
private static mainUIContext: UIContext | undefined; //MainWindow的UIContext
/**
* 设置默认统一样式
* @param configs
*/
static setDefaultConfig(configs: (config: DialogConfig) => void): void {
configs(ActionParameter.config);
}
/**
* 获取UIAbilityContext
* @returns
... | AST#export_declaration#Left export AST#class_declaration#Left class DialogHelper AST#class_body#Left { AST#property_declaration#Left private static mainUIContext : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right... | export class DialogHelper {
private static mainUIContext: UIContext | undefined;
static setDefaultConfig(configs: (config: DialogConfig) => void): void {
configs(ActionParameter.config);
}
static getUIAbilityContext(): common.UIAbilityContext {
if (ActionParameter.config?.uiAbilityContext) {... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets#L60-L430 | 3878787ec1732f0bc363767cd2da329ec9f25436 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets | arkts | deleteData | Delete the selected data.
@param selectArr: An array indicating whether historical data is selected. | deleteData(selectArr: Array<boolean>) {
if (!selectArr) {
Logger.error(TAG, 'Failed to delete data because selectArr is ' + selectArr);
}
let dataLen = this.targetData.length - CommonConstants.ONE_TASK;
for (let i = dataLen; i >= 0; i--) {
if (selectArr[i]) {
this.targetData.splice(i... | AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left selectArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | deleteData(selectArr: Array<boolean>) {
if (!selectArr) {
Logger.error(TAG, 'Failed to delete data because selectArr is ' + selectArr);
}
let dataLen = this.targetData.length - CommonConstants.ONE_TASK;
for (let i = dataLen; i >= 0; i--) {
if (selectArr[i]) {
this.targetData.splice(i... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L45-L55 | f0933c5f3cc76b423832f8bd1a0cab2d7c81bd51 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/objects/HistoryDataSource.ets | arkts | notifyDataAdd | 通知LazyForEach组件需要在index对应索引处添加子组件 | notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
// 写法2:listener.onDatasetChange([{type: DataOperationType.ADD, index: index}]);
});
} | AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
});
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/HistoryDataSource.ets#L44-L49 | 8ca2720f1fb8fe6e581923a75e9b824bcb1025ba | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/model/AppSettings.ets | arkts | 应用设置 | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ThemeMode AST#enum_body#Left { AST#enum_member#Left LIGHT = AST#expression#Left 'light' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DARK = AST#expression#Left 'dark' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto'
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/model/AppSettings.ets#L4-L8 | 10218a63990cb13bf0aaf91fdf7c448059581ee1 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | The single default search engine.
@returns 'https://bing.com/search?q=%s' | export function default_search_engine() {
return 'https://bing.com/search?q=%s';
} | AST#export_declaration#Left export AST#function_declaration#Left function default_search_engine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'https://bing.com/search?q=%s' AST#expression#Right ; AST#return_stateme... | export function default_search_engine() {
return 'https://bing.com/search?q=%s';
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L115-L117 | bc2a21627487ae729c6495f07869ea11b2ff5941 | gitee | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/AlarmClockUtils.ets | arkts | days | 生成最近闹钟提醒时间的提示文本。
@param nextAlarmTime 下一个闹钟的时间信息
@returns 提示文本 | export function generateNearestAlarmTimeToast(nextAlarmTime: {
days: number,
hours: number,
minutes: number
} | AST#export_declaration#Left export AST#ERROR#Left function generateNearestAlarmTimeToast ( nextAlarmTime : AST#ERROR#Right { days AST#ERROR#Left : number AST#ERROR#Right , hours AST#ERROR#Left : number AST#ERROR#Right , minutes AST#ERROR#Left : number AST#ERROR#Right } AST#export_declaration#Right | export function generateNearestAlarmTimeToast(nextAlarmTime: {
days: number,
hours: number,
minutes: number
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/AlarmClockUtils.ets#L9-L13 | d33dde541fb8e4ed61d0233919ca741cb87930e4 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/XorCipher.ets | arkts | decrypt | 解密文本(XOR加密是对称的,所以解密方法就是再次加密)
@param text 要解密的文本
@param key 密钥
@returns 解密后的文本 | static decrypt(text: string, key: string): string {
return XorCipher.encrypt(text, key);
} | AST#method_declaration#Left static decrypt 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#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static decrypt(text: string, key: string): string {
return XorCipher.encrypt(text, key);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/XorCipher.ets#L32-L34 | 9f4e8c7238f599ae55ed7253d0a4a753058fb66b | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | getCurrentRewardValue | 获取当前奖励值(用于调试和显示) | public getCurrentRewardValue(type: EncourageType): number {
return EncourageTypeHelper.getRewardCount(type);
} | AST#method_declaration#Left public getCurrentRewardValue AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left EncourageType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left numbe... | public getCurrentRewardValue(type: EncourageType): number {
return EncourageTypeHelper.getRewardCount(type);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L203-L205 | 88313b08c04759ccaa5014a25f18b1533aa014db | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | checkDiskSpace | 检查磁盘空间是否足够(带Toast提示) | static checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean {
if (!FileUtility.isDiskSpaceEnough(needMegas)) {
Toast.showMessage($r('app.string.sys_msg_disk_space_not_enough'))
return false;
}
return true;
} | AST#method_declaration#Left static checkDiskSpace AST#parameter_list#Left ( AST#parameter#Left needMegas : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression... | static checkDiskSpace(needMegas: number = AppSettings.App.minDisk): boolean {
if (!FileUtility.isDiskSpaceEnough(needMegas)) {
Toast.showMessage($r('app.string.sys_msg_disk_space_not_enough'))
return false;
}
return true;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L198-L204 | de04533ff3c7fd775db2e92d860915f5f32c44c0 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets | arkts | saveUserInfo | 保存用户信息 | async saveUserInfo() {
if (!this.validateInput()) {
return;
}
this.isSaving = true;
try {
const userId = this.userInfo.id;
if (!userId) {
throw new Error('用户ID不能为空');
}
// 更新用户信息
const updatedUser = await ApiService.updateUser(userId, this.userInfo... | AST#method_declaration#Left async saveUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#exp... | async saveUserInfo() {
if (!this.validateInput()) {
return;
}
this.isSaving = true;
try {
const userId = this.userInfo.id;
if (!userId) {
throw new Error('用户ID不能为空');
}
const updatedUser = await ApiService.updateUser(userId, this.userInfo);
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L153-L185 | 6249c4e4321401233fae6af8ad6997af3b20bac2 | github |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageRegistry.ets | arkts | fromBinary | 从二进制创建消息
⚠️ 注意:需要预先调用 register() 注册类型
@param typeName 消息类型名称
@param data 二进制数据
@returns 创建的消息对象,如果类型未注册则返回 null
使用示例:
```typescript
MessageRegistry.register(Person)
const binary = new Uint8Array([...])
const person = MessageRegistry.fromBinary('test.Person', binary)
``` | static fromBinary(typeName: string, data: Uint8Array): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered.`)
return null
}
return ctor.fromBinary(data)
} | AST#method_declaration#Left static fromBinary AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#prima... | static fromBinary(typeName: string, data: Uint8Array): Message | null {
const ctor = MessageRegistry.get(typeName)
if (ctor === undefined) {
console.warn(`Message type "${typeName}" not registered.`)
return null
}
return ctor.fromBinary(data)
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L183-L190 | 1c6417855a32a1ee05d3e3191e756d928f7dbc67 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawCenterText | set this to true to draw the text that is displayed in the center of the
pie chart
@param enabled | public setDrawCenterText(enabled: boolean): void {
this.mDrawCenterText = enabled;
} | AST#method_declaration#Left public setDrawCenterText AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pri... | public setDrawCenterText(enabled: boolean): void {
this.mDrawCenterText = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L503-L505 | f4fba146a27003d1a31a799a8fb33df1d733b8a3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | postEvent | 通过emitter将结果传递给页面
@param eventName 事件名称
@param status 网络状态(可传递不同的监听结果数据类型)
@param netType 网络类型(WI-FI、蜂窝数据等)
@param priority emitter事件权重 | private postEvent(eventName: NetworkEventName, status: NetworkData, netType?: connection.NetBearType,
priority?: emitter.EventPriority) {
this.emitterEvent.priority = priority;
emitter.emit(this.emitterEvent, {
data: new NetEventData(eventName, status, netType)
})
} | AST#method_declaration#Left private postEvent AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left NetworkEventName AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left Network... | private postEvent(eventName: NetworkEventName, status: NetworkData, netType?: connection.NetBearType,
priority?: emitter.EventPriority) {
this.emitterEvent.priority = priority;
emitter.emit(this.emitterEvent, {
data: new NetEventData(eventName, status, netType)
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L86-L92 | 29e54586ee8391a5cd8de6cc5aa176b4cb633008 | gitee |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/model/MusicItem.ets | arkts | 音乐数据项模型 | export class MusicItem {
id: number;
title: string;
artist: string;
cover: string;
duration: number; // 音乐时长(秒)
url?: string; // 音乐文件地址
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) {
this.id = id;
this.title = title;
this.artist = artis... | AST#export_declaration#Left export AST#class_declaration#Left class MusicItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type_an... | export class MusicItem {
id: number;
title: string;
artist: string;
cover: string;
duration: number;
url?: string;
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) {
this.id = id;
this.title = title;
this.artist = artist;
this.cover =... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/MusicItem.ets#L4-L30 | d028fa6e4d77d6746b9486280ad8ba34941835f2 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection.ets | arkts | onInit | 正确声明类属性 | onInit() {
this.timer = setInterval(() => {
this.updateData(); // 通过this调用类方法
}, 1000);
} | AST#method_declaration#Left onInit AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer AST#member_expression#Right = AST#exp... | onInit() {
this.timer = setInterval(() => {
this.updateData();
}, 1000);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection.ets#L46-L50 | 02bcdb0344d404eeaa108054445f00ef72b4b862 | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/pages/RegisterPage.ets | arkts | verify | 性别和姓名弹窗
@description: 校验必填字段
@date: 2024-01-14 21:47
@author wuwenqiang | verify(value: string, title: string) {
if (value.length > 18 || value.length < 6) {
promptAction.showToast({
message: `请输入6-18的${title}`,
duration: 2000,
bottom: px2vp(display.getDefaultDisplaySync().height) / 2
});
return false;
} else if (!value.trim()) {
prompt... | AST#method_declaration#Left verify AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST... | verify(value: string, title: string) {
if (value.length > 18 || value.length < 6) {
promptAction.showToast({
message: `请输入6-18的${title}`,
duration: 2000,
bottom: px2vp(display.getDefaultDisplaySync().height) / 2
});
return false;
} else if (!value.trim()) {
prompt... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/RegisterPage.ets#L68-L85 | cc6a47ce9ca79f0ed921dce125a6a68bb3b8d070 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/RankingDemo/entry/src/main/ets/common/constants/Constants.ets | arkts | The tag is the page name,which is used to print. | export const TAG: string = 'RankPage'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'RankPage' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#... | export const TAG: string = 'RankPage'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/common/constants/Constants.ets#L53-L53 | bcf11447bd296f4b114314d400e4c7084003835c | gitee | |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | mineModule/src/main/ets/components/ProfileComp.ets | arkts | ProfileComp | @desc:信息编辑页
@author:hxy
@time:2024/3/19 | @Component
export struct ProfileComp {
@StorageProp(USER_KEY)
userJson: string = '{}'
@State
user: UserModel = JSON.parse(this.userJson)
dialog: CustomDialogController = new CustomDialogController({
builder: LoadingDialog({ message: '更新中...' }),
customStyle: true,
alignment: DialogAlignment.Center... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ProfileComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left USER_KEY AST#expression#Right ) AST#decorator#Right userJson : AST#type_annotation#Left AST#pr... | @Component
export struct ProfileComp {
@StorageProp(USER_KEY)
userJson: string = '{}'
@State
user: UserModel = JSON.parse(this.userJson)
dialog: CustomDialogController = new CustomDialogController({
builder: LoadingDialog({ message: '更新中...' }),
customStyle: true,
alignment: DialogAlignment.Center... | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/mineModule/src/main/ets/components/ProfileComp.ets#L19-L145 | 33993434888035f9d72628c40d8c912a29291d1a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getNetworkSelectionMode | 获取当前选网模式。使用Promise异步回调。
@param slotId 卡槽ID,如果不指定slotId,默认移动数据的SIM卡。
@returns | static async getNetworkSelectionMode(slotId?: number): Promise<radio.NetworkSelectionMode> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //获取默认移动数据的SIM卡。
return radio.getNetworkSelectionMode(slotId);
} | AST#method_declaration#Left static async getNetworkSelectionMode AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ... | static async getNetworkSelectionMode(slotId?: number): Promise<radio.NetworkSelectionMode> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId();
return radio.getNetworkSelectionMode(slotId);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L365-L368 | 471b6f83be5bee8f487652c4234636503fc38320 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/JumpSearch.ets | arkts | findFirst | 查找第一个等于目标值的元素
@param arr 已排序的数组
@param target 目标值
@returns 第一个等于目标值的元素索引,如果不存在则返回-1 | public static findFirst(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
const n = arr.length;
let step = Math.floor(Math.sqrt(n));
let prev = 0;
let result = -1;
// 找到目标值可能存在的区间
while (arr[Math.min(step, n) - 1] < target) {
prev = step;... | AST#method_declaration#Left public static findFirst AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation... | public static findFirst(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
const n = arr.length;
let step = Math.floor(Math.sqrt(n));
let prev = 0;
let result = -1;
while (arr[Math.min(step, n) - 1] < target) {
prev = step;
step += ... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/JumpSearch.ets#L89-L121 | 9520338c23a8346b1ec09aa0a0cde24402983688 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | library/common/src/main/ets/bean/Person.ets | arkts | @author: HZWei
@date: 2024/12/22
@desc: | export class Student {
s_name: string = "李沁哲"
s_age: number = 25
constructor | AST#export_declaration#Left export AST#ERROR#Left class Student { s_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "李沁哲" AST#expression#Right s_age : number = 25 AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarat... | export class Student {
s_name: string = "李沁哲"
s_age: number = 25
constructor | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/library/common/src/main/ets/bean/Person.ets#L7-L11 | 5e719d05415e371ccff1bc54dbbc049cd1743cfc | gitee | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider19.ets | arkts | buildSlider19 | Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | @Builder function buildSlider19(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider19 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | @Builder function buildSlider19(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider19.ets#L16-L67 | 5ea9ec18c2279ea344304b0c4392ac788dcb718a | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/Index.ets | arkts | AuthRepository | @file data 模块统一导出
@author Joker.X | export { AuthRepository } from "./src/main/ets/repository/AuthRepository"; | AST#export_declaration#Left export { AuthRepository } from "./src/main/ets/repository/AuthRepository" ; AST#export_declaration#Right | export { AuthRepository } from "./src/main/ets/repository/AuthRepository"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/Index.ets#L6-L6 | a0abeacd6ea87200d473566898f2e89544cf4b23 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/RowAttribute.ets | arkts | 获取横向末尾 + 垂直顶部的 Row 对齐修饰器
@returns {AttributeModifier<RowAttribute>} Row 对齐修饰器
@example
Row() { Text("Hi"); }.attributeModifier(rowEndTop()); | export function rowEndTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(VerticalAlign.Top);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function rowEndTop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#prim... | export function rowEndTop(): AttributeModifier<RowAttribute> {
return {
applyNormalAttribute: (instance: RowAttribute): void => {
instance.justifyContent(FlexAlign.End);
instance.alignItems(VerticalAlign.Top);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L132-L139 | 23dd098613030105d6436bdbdaa557f81c052fbc | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/LinearSearch.ets | arkts | search | 标准线性查找
@param arr 数组
@param target 目标值
@returns 目标值在数组中的索引,如果不存在则返回-1 | public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
for (let i = 0; i < arr.length; i++) {
if (arr[i] === target) {
return i;
}
}
return -1;
} | AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#Le... | public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
for (let i = 0; i < arr.length; i++) {
if (arr[i] === target) {
return i;
}
}
return -1;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/LinearSearch.ets#L11-L23 | 55bb35e95dedc8e5a282e0b0d0842b96ccb6ccc3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | removeSlot | 删除此应用程序指定类型的通知渠道
@param type 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。
@returns | static async removeSlot(type: notificationManager.SlotType) {
return notificationManager.removeSlot(type);
} | AST#method_declaration#Left static async removeSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | static async removeSlot(type: notificationManager.SlotType) {
return notificationManager.removeSlot(type);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L388-L390 | c55f34ad3c82ce8e3b9ac7ecc444d3e56ddc30fd | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets | arkts | createAndShowFloatWindow | 创建悬浮窗 | private async createAndShowFloatWindow(context: common.UIAbilityContext) {
if (context.isTerminating()) {
return;
}
console.info(TAG,` createAndShowWindow`);
try {
let w = display.getDefaultDisplaySync().width;
// 创建应用子窗口
this.floatWindow = await window.createWindow({
na... | AST#method_declaration#Left private async createAndShowFloatWindow AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | private async createAndShowFloatWindow(context: common.UIAbilityContext) {
if (context.isTerminating()) {
return;
}
console.info(TAG,` createAndShowWindow`);
try {
let w = display.getDefaultDisplaySync().width;
this.floatWindow = await window.createWindow({
name: 'DemoF... | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets#L59-L81 | 13c281b9f1c90e329d3df5269f299b58a8eaaff9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isNativeError | 检查是否为Error类型。
@param value
@returns | static isNativeError(value: Object): boolean {
return new util.types().isNativeError(value);
} | AST#method_declaration#Left static isNativeError AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isNativeError(value: Object): boolean {
return new util.types().isNativeError(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L299-L301 | d96af798b965cabff8b038dcc6f41d7d6e234d15 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/chained_call/chained_call_001_T.ets | arkts | Introduction 链式调用 | export function chained_call_001_T(taint_src : string) {
new A().setData("_").clearData().setData(taint_src).f();
} | AST#export_declaration#Left export AST#function_declaration#Left function chained_call_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_statement#... | export function chained_call_001_T(taint_src : string) {
new A().setData("_").clearData().setData(taint_src).f();
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/chained_call/chained_call_001_T.ets#L6-L9 | 765cab2c33332f4482ab2a1d1f387d06324c9a7e | github | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/SubscriptionManager.ets | arkts | getSubscriptions | 获取所有订阅 | getSubscriptions(): SubscriptionInfo[] {
return Array.from(this.subscriptions.values())
} | AST#method_declaration#Left getSubscriptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SubscriptionInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_state... | getSubscriptions(): SubscriptionInfo[] {
return Array.from(this.subscriptions.values())
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L83-L85 | 2ec14d1459e187ad9062218b459f5257f8d9941c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | TODO 格式化工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class FormatUtil {
/**
* 判断传入的电话号码格式是否正确。
* @param phone
* country string 表示电话号码所属国家或地区代码。
* options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。
* @returns
*/
static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean {
const phone... | AST#export_declaration#Left export AST#class_declaration#Left class FormatUtil AST#class_body#Left { /**
* 判断传入的电话号码格式是否正确。
* @param phone
* country string 表示电话号码所属国家或地区代码。
* options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。
* @returns
*/ AST#method_declaration#Left static isPhone AST#para... | export class FormatUtil {
static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean {
const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option);
return phoneNumberFormat.isValidNumber(phone);
}
static getPhoneFormat(... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L28-L201 | 273097394597022737ee53514988f172185e685d | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets | arkts | @file
@kit ArkUI
Defines the popup text options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Defines the popup text options
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface PopupTextOptions {
/**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.Ark... | AST#export_declaration#Left export AST#interface_declaration#Left interface PopupTextOptions AST#object_type#Left { /**
* Set the text display content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Set the text display conten... | export interface PopupTextOptions {
text: ResourceStr;
fontSize?: number | string | Resource;
fontColor?: ResourceColor;
fontWeight?: number | FontWeight | string;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Popup.d.ets#L32-L97 | 91e48c44ba8c926decd2d5171b84202a2b48384a | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets | arkts | flashTheRecordingIcon | Red icon of the recording state to flash each 500ms | private flashTheRecordingIcon() {
this.timeoutID = setTimeout(() => {
this.isIconHidden = !this.isIconHidden
this.flashTheRecordingIcon()
}, 500)
} | AST#method_declaration#Left private flashTheRecordingIcon AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeoutID AST#member... | private flashTheRecordingIcon() {
this.timeoutID = setTimeout(() => {
this.isIconHidden = !this.isIconHidden
this.flashTheRecordingIcon()
}, 500)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets#L87-L92 | b67e65e71e75d3d5afd5e101529fd2f3efe378f3 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | initCamera | Initializes the camera function
@param surfaceId - Surface ID
@param cameraDeviceIndex - Camera equipment index
@returns No return value | async initCamera(cameraDeviceIndex: number, uiContext: UIContext): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// Get the Camera Manager instance
this.cameraManager = this.getCameraManagerFn(uiContext);
if (th... | AST#method_declaration#Left async initCamera AST#parameter_list#Left ( AST#parameter#Left cameraDeviceIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIConte... | async initCamera(cameraDeviceIndex: number, uiContext: UIContext): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
this.cameraManager = this.getCameraManagerFn(uiContext);
if (this.cameraManager === undefined) {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L123-L180 | 731ee62cade44cec3718776d40cddeeb699d81ec | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPictureUI/entry/src/main/ets/view/ActionList.ets | arkts | ActionList | 操作栏 | @Component
export struct ActionList {
build() {
Column(){
Text('操作栏')
.fontSize('24fp')
}
.height('52vp')
.borderColor(Color.Black)
.borderWidth('2vp')
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ActionList AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left ... | @Component
export struct ActionList {
build() {
Column(){
Text('操作栏')
.fontSize('24fp')
}
.height('52vp')
.borderColor(Color.Black)
.borderWidth('2vp')
}
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/view/ActionList.ets#L4-L16 | 8245db66e31d082bf4ebe71578f595e5efa05d1c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | calcAngles | calculates the needed angles for the chart slices | private calcAngles(): void {
if (!this.mData) {
return;
}
let entryCount: number = this.mData.getEntryCount();
if (this.mDrawAngles.length != entryCount) {
this.mDrawAngles = new Array<number>(entryCount) //new float[entryCount];
} else {
for (let i: number = 0; i < entryCount; i... | AST#method_declaration#Left private calcAngles AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Le... | private calcAngles(): void {
if (!this.mData) {
return;
}
let entryCount: number = this.mData.getEntryCount();
if (this.mDrawAngles.length != entryCount) {
this.mDrawAngles = new Array<number>(entryCount)
} else {
for (let i: number = 0; i < entryCount; i++) {
this.mDraw... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L231-L309 | 4727db4389399afa5451bbb731c3e2bcff723005 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/a11y-speak/99.10.9/package/index.ets | arkts | toHex | 应用约束10:显式指定函数参数和返回类型 | function toHex(data: string): string {
// 应用约束75:替换Buffer为TextEncoder
const encoder = new TextEncoder();
const encoded = encoder.encode(data);
let hex = '';
for (const byte of encoded) {
hex += byte.toString(16).padStart(2, '0');
}
return hex;
} | AST#function_declaration#Left function toHex 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | function toHex(data: string): string {
const encoder = new TextEncoder();
const encoded = encoder.encode(data);
let hex = '';
for (const byte of encoded) {
hex += byte.toString(16).padStart(2, '0');
}
return hex;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/a11y-speak/99.10.9/package/index.ets#L12-L21 | fee0289629c4fa24b92eeb8893d5a5de055b0da9 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/constants/PlayerConstants.ets | arkts | Constants for player area. | export class PlayerConstants {
/**
* The font size of the singer is smaller.
*/
static readonly FONT_REDUCE: number = 4;
/**
* The layout weight of player control.
*/
static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1;
/**
* The display priority is 1.
*/
static readonly DISPLAY_PRI... | AST#export_declaration#Left export AST#class_declaration#Left class PlayerConstants AST#class_body#Left { /**
* The font size of the singer is smaller.
*/ AST#property_declaration#Left static readonly FONT_REDUCE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Ri... | export class PlayerConstants {
static readonly FONT_REDUCE: number = 4;
static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1;
static readonly DISPLAY_PRIORITY_ONE: number = 1;
static readonly DISPLAY_PRIORITY_TWO: number = 2;
static readonly DISPLAY_PRIORITY_THREE: number = 3;
sta... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/constants/PlayerConstants.ets#L19-L99 | 5bb4e16040941f1280f00e811e24723bf3b30407 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets | arkts | insertRssSourceGroup | 新增分组 | async insertRssSourceGroup(rssGroupName:string){
await rssSourceGroupDao.insert({
rssGroupName: rssGroupName,
isTop: false,
isDelete: true
})
} | AST#method_declaration#Left async insertRssSourceGroup AST#parameter_list#Left ( AST#parameter#Left rssGroupName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme... | async insertRssSourceGroup(rssGroupName:string){
await rssSourceGroupDao.insert({
rssGroupName: rssGroupName,
isTop: false,
isDelete: true
})
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets#L54-L60 | ddf9ede4e6b875a15737032f271e5c7a1b2c0604 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets | arkts | deleteData | 3、调用delete()方法删除指定键值的数据(删除数据) | async deleteData(key: string): Promise<void> {
if (kvStore !== undefined) {
try {
await kvStore.delete(key) // 等待删除操作完成
console.log('Delete operation completed for key:', key);
} catch (error) {
console.error('Failed to delete data:', error);
}
} else {
console.in... | AST#method_declaration#Left async deleteData 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 AST#generic_type#Left Pro... | async deleteData(key: string): Promise<void> {
if (kvStore !== undefined) {
try {
await kvStore.delete(key)
console.log('Delete operation completed for key:', key);
} catch (error) {
console.error('Failed to delete data:', error);
}
} else {
console.info('kvStore... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets#L62-L73 | 7396c6ef07abf419fe5fbf34b700206b48a88295 | gitee |
MissTeven/ArkTS-demo.git | fd9f7695fa29889ad4a9ecf3330fda9991aca24c | entry/src/main/ets/model/MediaQueryModel.ets | arkts | unRegister | Deregister Listener. | public unRegister(): void {
let portraitFunc = this.onPortrait.bind(this);
this.listener.off('change', portraitFunc);
} | AST#method_declaration#Left public unRegister AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left portraitF... | public unRegister(): void {
let portraitFunc = this.onPortrait.bind(this);
this.listener.off('change', portraitFunc);
} | https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/model/MediaQueryModel.ets#L29-L32 | e9cb6dd1ae1937d8af1d6b1e73bdbd3199d67ebd | github |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/utils/PermissionUtil.ets | arkts | 校验当前是否已经授权 | export async function checkPermissionGrant(permission: Permissions, callback: Function = () => {
}): Promise<abilityAccessCtrl.GrantStatus> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DE... | AST#export_declaration#Left export AST#function_declaration#Left async function checkPermissionGrant AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : A... | export async function checkPermissionGrant(permission: Permissions, callback: Function = () => {
}): Promise<abilityAccessCtrl.GrantStatus> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DE... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/PermissionUtil.ets#L6-L36 | 6914bc4b3b7f7c5eb27a34fbed56f53a76a308a2 | github | |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/utils/Recorder.ets | arkts | resumeRecord | 恢复录制 | async resumeRecord() {
// 仅在paused状态下调用resume为合理状态切换
if (this.avRecorder != undefined && this.avRecorder.state === 'paused') {
await this.avRecorder.resume();
}
} | AST#method_declaration#Left async resumeRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 仅在paused状态下调用resume为合理状态切换 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expr... | async resumeRecord() {
if (this.avRecorder != undefined && this.avRecorder.state === 'paused') {
await this.avRecorder.resume();
}
} | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/utils/Recorder.ets#L57-L62 | 3322ccd7302ed6f4f7a61062d83cfe085be2390f | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Pick an image file from device gallery, pulling up a DocumentViewPicker.
@param select_number The maximum select number.
@returns A string, of the chosen file's content. | export async function image_gallery_pick_to_ArrayBuffer() {
let selected_uri: string[] = [];
try {
let buf: ArrayBuffer | undefined = undefined;
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoS... | AST#export_declaration#Left export AST#function_declaration#Left async function image_gallery_pick_to_ArrayBuffer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left selected_uri : AST#type_annotation#Left AST#... | export async function image_gallery_pick_to_ArrayBuffer() {
let selected_uri: string[] = [];
try {
let buf: ArrayBuffer | undefined = undefined;
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoS... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L243-L283 | d8bcce67b7f9699917a53792604849c3f8cfa059 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | generateBirthdayWish | 生成祝福语 | async generateBirthdayWish(
contactName: string,
relationship: string,
age: number,
personalization: boolean = false
): Promise<string> {
try {
let systemPrompt = `你是一个专业的祝福语生成助手。请为${contactName}生成一条生日祝福语。`;
if (personalization) {
systemPrompt += `关系:${relationship},年龄:$... | AST#method_declaration#Left async generateBirthdayWish AST#parameter_list#Left ( AST#parameter#Left contactName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left relationship : AST#type_annotation#Left AST#primary_type#Left ... | async generateBirthdayWish(
contactName: string,
relationship: string,
age: number,
personalization: boolean = false
): Promise<string> {
try {
let systemPrompt = `你是一个专业的祝福语生成助手。请为${contactName}生成一条生日祝福语。`;
if (personalization) {
systemPrompt += `关系:${relationship},年龄:$... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L424-L461 | 075f2cf67a80d622dade14e61532dc326bb05a29 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/CustomNavigationUtils.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface AnimateCallback {
finish: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
start: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
onFinish: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
interactive: ((operation: NavigationOperat... | AST#export_declaration#Left export AST#interface_declaration#Left interface AnimateCallback AST#object_type#Left { AST#type_member#Left finish : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#... | export interface AnimateCallback {
finish: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
start: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
onFinish: ((isPush: boolean, isExit: boolean) => void | undefined) | undefined;
interactive: ((operation: NavigationOperat... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/CustomNavigationUtils.ets#L15-L21 | 38212a0856a8b35d24bce9f9b9ca5f63113a7ab3 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.