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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/index.ets | arkts | JsonEncodingVisitor | JSON 编码 Visitor
将消息编码为 Protobuf JSON mapping | export { JsonEncodingVisitor } from './JsonEncodingVisitor' | AST#export_declaration#Left export { JsonEncodingVisitor } from './JsonEncodingVisitor' AST#export_declaration#Right | export { JsonEncodingVisitor } from './JsonEncodingVisitor' | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L58-L58 | 4f216c64780694a9d8df9def53d84963cb5f108d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets | arkts | getFileListData | 获取解压后的文件列表 | getFileListData(outFileDir: string) {
// TODO:知识点:使用fs.listFile接口获取解压得到的沙箱目录下的所有文件名。
fs.listFile(outFileDir).then((fileNames: Array<string>) => {
this.fileListData.clearData(); // 清空上一次获取的列表
for (let i = 0; i < fileNames.length; i++) {
this.fileListData.pushData(new FileItem(fileNames[i], `$... | AST#method_declaration#Left getFileListData AST#parameter_list#Left ( AST#parameter#Left outFileDir : 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 { // TODO:知识点:使用fs.listFile接口获取解压得到的沙... | getFileListData(outFileDir: string) {
fs.listFile(outFileDir).then((fileNames: Array<string>) => {
this.fileListData.clearData();
for (let i = 0; i < fileNames.length; i++) {
this.fileListData.pushData(new FileItem(fileNames[i], `${outFileDir}/${fileNames[i]}`));
}
}).catch((err:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets#L113-L123 | a84b1076ca5a58f8501e4af74fc130e1c4cfd0ee | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/dialogs/web/woofPrompt.ets | arkts | focus_input | Focus on the search input. | focus_input() {
focusControl.requestFocus(this.my_id);
} | AST#method_declaration#Left focus_input AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left focusControl AST#expression#Right . requestFocus AST... | focus_input() {
focusControl.requestFocus(this.my_id);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/dialogs/web/woofPrompt.ets#L124-L126 | 32360ad0451a48ed187d7c8520ddf533105c2cdc | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/market/src/main/ets/navigation/MarketGraph.ets | arkts | register | 注册营销模块导航路由 | register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
} | AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left... | register(): void {
RouteBuild.register(MarketRoutes.Coupon, wrapBuilder(CouponNav));
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/market/src/main/ets/navigation/MarketGraph.ets#L13-L15 | 0c5a6d5b4b146cfcf487756f4c6327b206322470 | github |
zhLei02/Gobang_ArkTS.git | f4d1a430847ed779fc9000b8716983dacb89b19b | entry/src/main/ets/view/ConfirmDialog.ets | arkts | stop:()=>void aboutToAppear(){ this.stop() } | build() {
Column() {
if(this.over == 1){
Text('游戏结束!!黑棋胜利!!').fontSize(20).margin({ top: 10, bottom: 10 })
Text('您需要清空棋盘吗?').fontSize(20).margin({ top: 10, bottom: 10 })
} else if(this.over ==2){
Text('游戏结束!!白棋胜利!!').fontSize(20).margin({ top: 10, bottom: 10 })
Text('您需要清... | 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expre... | build() {
Column() {
if(this.over == 1){
Text('游戏结束!!黑棋胜利!!').fontSize(20).margin({ top: 10, bottom: 10 })
Text('您需要清空棋盘吗?').fontSize(20).margin({ top: 10, bottom: 10 })
} else if(this.over ==2){
Text('游戏结束!!白棋胜利!!').fontSize(20).margin({ top: 10, bottom: 10 })
Text('您需要清... | https://github.com/zhLei02/Gobang_ArkTS.git/blob/f4d1a430847ed779fc9000b8716983dacb89b19b/entry/src/main/ets/view/ConfirmDialog.ets#L13-L37 | 6aa4ceaa257de36684f4ca2dd4b47bf85fc1a3af | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets | arkts | downloadData | MARK: - 下载方法 | private async downloadData(text: string, finished: (data: Uint8Array | null, error: string | null) => void) {
// 生成文件名,将文本转为拼音并转换为.mp3格式
const fileName = `${StringPyHelper.convertUnicodeForPinyin(text)}.mp3`;
// 缓存文件夹路径
const context = getContext() as common.UIAbilityContext;
const dow... | AST#method_declaration#Left private async downloadData 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 finished : AST#type_annotation#Left AST#function_type#Left AST#parame... | private async downloadData(text: string, finished: (data: Uint8Array | null, error: string | null) => void) {
const fileName = `${StringPyHelper.convertUnicodeForPinyin(text)}.mp3`;
const context = getContext() as common.UIAbilityContext;
const downloadCacheFolder = `${context.cache... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/Downloader/CosDownloader.ets#L41-L116 | d41cf72d60182c1da6241b1b11efc552122b6014 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/Manacher.ets | arkts | findAllPalindromes | 查找所有回文子串
@param str 输入字符串
@returns 所有回文子串数组 | static findAllPalindromes(str: string): string[] {
if (!str || str.length === 0) {
return [];
}
const result: string[] = [];
const processed = Manacher.preprocess(str);
const n = processed.length;
const p: number[] = new Array(n).fill(0);
let center = 0;
let rightBound = 0;
f... | AST#method_declaration#Left static findAllPalindromes 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 AST#array_type#L... | static findAllPalindromes(str: string): string[] {
if (!str || str.length === 0) {
return [];
}
const result: string[] = [];
const processed = Manacher.preprocess(str);
const n = processed.length;
const p: number[] = new Array(n).fill(0);
let center = 0;
let rightBound = 0;
f... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Manacher.ets#L87-L129 | a2b20c70809272e65b5a06bfaf6394e5a239fe87 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | loadPresetThemes | 私有方法
加载预设主题 | private async loadPresetThemes(): Promise<void> {
this.colorThemes = [
// 默认主题
{
id: 'default_light',
name: '默认浅色',
description: '清新简约的浅色主题',
preview: '#2196F3',
colors: {
primary: '#2196F3',
primaryVariant: '#1976D2',
secondary: '#FF... | AST#method_declaration#Left private async loadPresetThemes 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 > ... | private async loadPresetThemes(): Promise<void> {
this.colorThemes = [
{
id: 'default_light',
name: '默认浅色',
description: '清新简约的浅色主题',
preview: '#2196F3',
colors: {
primary: '#2196F3',
primaryVariant: '#1976D2',
secondary: '#FF9800',
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L521-L677 | e090b5d08ff353397c93906327ee4f90558bec1b | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets | arkts | base64ToUint8Array | Base64 to uint8Array.
@param content Base64 data.
@returns Uint8Array data. | base64ToUint8Array(content: string): Uint8Array {
let uint8ArrayData: Uint8Array = (this.base64Helper as util.Base64Helper).decodeSync(content);
return uint8ArrayData;
} | AST#method_declaration#Left base64ToUint8Array AST#parameter_list#Left ( AST#parameter#Left content : 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 Uint8Array AST#prim... | base64ToUint8Array(content: string): Uint8Array {
let uint8ArrayData: Uint8Array = (this.base64Helper as util.Base64Helper).decodeSync(content);
return uint8ArrayData;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets#L31-L34 | a40a9f63ae7cdccfd06fc81a117024c8df661d55 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/SearchPage.ets | arkts | buildEmptyResults | 构建空结果 | @Builder
buildEmptyResults() {
Column({ space: 16 }) {
Image($r('app.media.ic_search_empty'))
.width(80)
.height(80)
.fillColor($r('app.color.text_secondary'))
.opacity(0.5)
Text('未找到相关结果')
.fontSize(16)
.fontColor($r('app.color.text_secondary'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_p... | @Builder
buildEmptyResults() {
Column({ space: 16 }) {
Image($r('app.media.ic_search_empty'))
.width(80)
.height(80)
.fillColor($r('app.color.text_secondary'))
.opacity(0.5)
Text('未找到相关结果')
.fontSize(16)
.fontColor($r('app.color.text_secondary'))
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/SearchPage.ets#L380-L412 | 2f9b6c9b74d6a27192f222e8dfb4fa8c236c7da4 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 分页响应 | export interface PageResponse<T> {
content: T[];
totalElements: number;
totalPages: number;
size: number;
number: number;
first: boolean;
last: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PageResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ... | export interface PageResponse<T> {
content: T[];
totalElements: number;
totalPages: number;
size: number;
number: number;
first: boolean;
last: boolean;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L194-L202 | da7eb39b4fe439ae160e2bfbec6c8bcc00d0c031 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/objects/HistoryDataSource.ets | arkts | unregisterDataChangeListener | 该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
// console.info('remove listener');
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/HistoryDataSource.ets#L28-L34 | fd6c106396f94395e603319c51f3ef5d39d71638 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/ContactTypes.ets | arkts | 联系人完整信息接口 | export interface Contact extends ContactInfo {
birthday: BirthdayInfo;
intimacyLevel: number; // 亲密度等级 1-5
isFavorite: boolean; // 是否收藏
lastContactDate?: string; // 最后联系日期
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Contact AST#extends_clause#Left extends ContactInfo AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left birthday : AST#type_annotation#Left AST#primary_type#Left BirthdayInfo AST#primary_type#Right AST#type_annotation#Right AST... | export interface Contact extends ContactInfo {
birthday: BirthdayInfo;
intimacyLevel: number;
isFavorite: boolean;
lastContactDate?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L127-L132 | 063538ed254294f801e66e792afb60e31db5b441 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets | arkts | login | 登录服务器 | async login() {
//首先判断套接字是否绑定到本地地址,如果没有绑定就绑定一下
if (!this.bindLocal) {
this.bindSocket()
}
//服务器地址
let serverAddress = { address: this.serverAddr, port: this.serverPort, family: 1 }
//连接smtp服务器
await tcpSocket.connect({ address: serverAddress })
.then(() => {
this.msgH... | AST#method_declaration#Left async login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { //首先判断套接字是否绑定到本地地址,如果没有绑定就绑定一下 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expressio... | async login() {
if (!this.bindLocal) {
this.bindSocket()
}
let serverAddress = { address: this.serverAddr, port: this.serverPort, family: 1 }
await tcpSocket.connect({ address: serverAddress })
.then(() => {
this.msgHistory += 'C:connect success ' + "\r\n";
}... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets#L273-L315 | e7c140a67dab20ec20c09f7b671d846b58b8d0b0 | gitee |
CQULeaf/HarmonyOS-App-Development.git | 91f6ab13be3dbf83f6c1c4d2958673f15faefe46 | Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets | arkts | init | 初始化ai语音转文字引擎 | static async init(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
await SpeechRecognizerManager.createEngine()
SpeechRecognizerManager.setListener(callback)
SpeechRecognizerManager.startListening()
} | AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#q... | static async init(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
await SpeechRecognizerManager.createEngine()
SpeechRecognizerManager.setListener(callback)
SpeechRecognizerManager.startListening()
} | https://github.com/CQULeaf/HarmonyOS-App-Development.git/blob/91f6ab13be3dbf83f6c1c4d2958673f15faefe46/Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets#L138-L143 | 712145fc23b9ed3592dc244328f0e79e4b108207 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets | arkts | showDebug | print debug level log
@param {string} tag - Page or class tag
@param {string} log - Log needs to be printed | static showDebug(tag: string, log: string){
console.debug(`${TAG} tag: ${tag} --> ${log}`);
} | AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static showDebug(tag: string, log: string){
console.debug(`${TAG} tag: ${tag} --> ${log}`);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets#L38-L40 | 9fae0c6f382b90093d25435b1d1f810b6e6594cd | gitee |
jiwangyihao/FlameChase.git | 446275e6972bd5f92a3c5b7eba354ca83d504594 | entry/src/main/ets/pages/ChroniclePage.ets | arkts | increaseDate | 增加一天日期的函数+ | private async increaseDate(): Promise<void> {
this.displayDate.setDate(this.displayDate.getDate() + 1);
this.currentDate = this.getFormattedDate(this.displayDate);
} | AST#method_declaration#Left private async increaseDate 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#... | private async increaseDate(): Promise<void> {
this.displayDate.setDate(this.displayDate.getDate() + 1);
this.currentDate = this.getFormattedDate(this.displayDate);
} | https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/pages/ChroniclePage.ets#L496-L499 | b7c518c44b06535ce7635d72284c9f59a0bef4b7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets | arkts | insertData | Insert dayInfo.
@param dayInfo
@param callback | insertData(dayInfo: DayInfo, callback: Function): void {
const valueBucket = generateBucket(dayInfo);
RdbUtils.insert('dayInfo', valueBucket).then(result => {
callback(result);
})
Logger.info('DayInfoTable', 'Insert dayInfo finished.');
} | AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left dayInfo : AST#type_annotation#Left AST#primary_type#Left DayInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_ty... | insertData(dayInfo: DayInfo, callback: Function): void {
const valueBucket = generateBucket(dayInfo);
RdbUtils.insert('dayInfo', valueBucket).then(result => {
callback(result);
})
Logger.info('DayInfoTable', 'Insert dayInfo finished.');
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets#L30-L36 | ec1b84f6d36c78fda78b5d842708eaba2d0bd60d | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets | arkts | startRecording | 执行录音 | private async startRecording() {
// 设置监听器
this.setListener()
let audioInfo: speechRecognizer.AudioInfo = {
audioType: 'pcm',
sampleRate: 16000,
soundChannel: 1,
sampleBit: 16
}
let extraParams: Record<string, Object> = {
'recognitionMode': 0,
'vadBegin': 2000,
... | AST#method_declaration#Left private async startRecording AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置监听器 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expr... | private async startRecording() {
this.setListener()
let audioInfo: speechRecognizer.AudioInfo = {
audioType: 'pcm',
sampleRate: 16000,
soundChannel: 1,
sampleBit: 16
}
let extraParams: Record<string, Object> = {
'recognitionMode': 0,
'vadBegin': 2000,
'va... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets#L177-L222 | b00bdbea45949e7ef2d2059f9d33cb028e975504 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/OrderPageRequest.ets | arkts | @file 订单分页查询请求模型
@author Joker.X | export class OrderPageRequest {
/**
* 页码
*/
page: number = 1;
/**
* 每页大小
*/
size: number = 10;
/**
* 订单状态列表
*/
status?: number[] | null;
/**
* @param {Partial<OrderPageRequest>} init - 初始化数据
*/
constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page ... | AST#export_declaration#Left export AST#class_declaration#Left class OrderPageRequest AST#class_body#Left { /**
* 页码
*/ AST#property_declaration#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#prop... | export class OrderPageRequest {
page: number = 1;
size: number = 10;
status?: number[] | null;
constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.status = init.status ?? this.status;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/OrderPageRequest.ets#L5-L28 | 2b2664c0d9c6a97fffca8a5e4b777667e2a677c6 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/ContactDAO.ets | arkts | 联系人数据访问对象
负责联系人表的所有CRUD操作 | export class ContactDAO {
private dbManager: DatabaseManager;
constructor() {
this.dbManager = DatabaseManager.getInstance();
}
/**
* 插入新联系人
* @param contact 联系人实体
* @returns 插入的记录ID
*/
async insertContact(contact: ContactEntity): Promise<number> {
const rdbStore = this.dbManager.getRdbS... | AST#export_declaration#Left export AST#class_declaration#Left class ContactDAO AST#class_body#Left { AST#property_declaration#Left private dbManager : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declarat... | export class ContactDAO {
private dbManager: DatabaseManager;
constructor() {
this.dbManager = DatabaseManager.getInstance();
}
async insertContact(contact: ContactEntity): Promise<number> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not init... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/ContactDAO.ets#L9-L119 | 8631dcc84e65f72022132c952c8696183abd3d89 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ValidationUtils.ets | arkts | isValidEmail | 验证邮箱 | static isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
} | AST#method_declaration#Left static isValidEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L9-L12 | 128f1f4f2304a0e653c22c5d467e3c42553ede7a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/WaterFlowDataSource.ets | arkts | notifyDatasetChange | 通知控制器数据批量修改 | notifyDatasetChange(operations: DataOperation[]): void {
this.listeners.forEach(listener => {
listener.onDatasetChange(operations);
})
} | AST#method_declaration#Left notifyDatasetChange AST#parameter_list#Left ( AST#parameter#Left operations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataOperation [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | notifyDatasetChange(operations: DataOperation[]): void {
this.listeners.forEach(listener => {
listener.onDatasetChange(operations);
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/WaterFlowDataSource.ets#L69-L73 | 456aae64590c0d632b41c0c19d725f05db6c83db | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Box.ets | arkts | MARK: - 构造函数
构造函数
@param distance - 距离天数
@param pieceNo - 片段编号 | constructor(distance: DistanceFromBase, pieceNo: number) {
this._distance = distance;
this._pieceNo = pieceNo;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left distance : AST#type_annotation#Left AST#primary_type#Left DistanceFromBase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pieceNo : AST#type_annotation#Left AST#primary_type#Left number A... | constructor(distance: DistanceFromBase, pieceNo: number) {
this._distance = distance;
this._pieceNo = pieceNo;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L49-L52 | c227a99244e75adf793b49171494fddd08aad123 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | notifyDataChange | 通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件函数
@param index | private notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | AST#method_declaration#Left private notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | private notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChange(index);
})
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L145-L149 | d1a45b345ef7ffa90af76ff1a197563e22e7fe50 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/Socket/entry/src/main/ets/model/DataType.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 AddrType {
address: string;
family: number;
port: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AddrType AST#object_type#Left { AST#type_member#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left family : AST#type_annotation#Left... | export interface AddrType {
address: string;
family: number;
port: number
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/Socket/entry/src/main/ets/model/DataType.ets#L16-L20 | c254ed1f23bb9cbf349f8942d8efd6fceb57630f | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getUdid | 获取设备Udid。说明:数据长度为65字节。可作为设备唯一识别码。 示例:9D6AABD147XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE5536412
需要权限:ohos.permission.sec.ACCESS_UDID (目前只限系统应用使用,不对三方应用开放) | static getUdid(): string {
return deviceInfo.udid;
} | AST#method_declaration#Left static getUdid AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressio... | static getUdid(): string {
return deviceInfo.udid;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L142-L144 | 9f26c8e59658a6ff95a92b83f3da3d69a76feb37 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | update_my_timestamp | Updates the internal timestamp of this bunch_of_tabs object.
So that UI refresh would be triggered. | update_my_timestamp() {
this.status_update_timestamp = Date.now();
} | AST#method_declaration#Left update_my_timestamp 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 . status_update_timestamp AST#me... | update_my_timestamp() {
this.status_update_timestamp = Date.now();
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L719-L721 | 6b2e4f6ed7753719bd5e07e7d28bd4357ca53afc | gitee |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘16%’ | export const THOUSANDTH_400: string = '40%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_400 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_400: string = '40%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L54-L54 | 969197bef816c986d3bb25fcd0144062b97b0bb1 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onAction | LongPress gesture recognition success callback.
@param { Callback<GestureEvent> } event
@returns { LongPressGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onAction(event: Callback<GestureEvent>): LongPressGesture; | AST#method_declaration#Left onAction AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | onAction(event: Callback<GestureEvent>): LongPressGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L429-L429 | da7f01934d8042f34d4a950ec7207e5c18c2e991 | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/LoginPage.ets | arkts | stopLoginTimer | 关闭登录超时计时器。 | stopLoginTimer() {
if(this.loginingTimerId != -1) {
clearTimeout(this.loginingTimerId);
this.loginingTimerId = -1;
}
} | AST#method_declaration#Left stopLoginTimer 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#Ri... | stopLoginTimer() {
if(this.loginingTimerId != -1) {
clearTimeout(this.loginingTimerId);
this.loginingTimerId = -1;
}
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L146-L151 | 0c18f724f880fe4bd88bb10aada80389e7f44955 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets | arkts | 图片适配类型 | export enum ImageFitType {
TYPE_WIDTH = 'width',
TYPE_HEIGHT = 'height',
TYPE_DEFAULT = 'default'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ImageFitType AST#enum_body#Left { AST#enum_member#Left TYPE_WIDTH = AST#expression#Left 'width' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TYPE_HEIGHT = AST#expression#Left 'height' AST#expression#Right AST#enum_member#Right , AST#... | export enum ImageFitType {
TYPE_WIDTH = 'width',
TYPE_HEIGHT = 'height',
TYPE_DEFAULT = 'default'
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets#L24-L28 | 456876b78bb820fa91268c618667ee3b5bfa1461 | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | addRootPageShowObserver | 添加根页面显示回调
@param callback | public static addRootPageShowObserver(callback: () => void) {
ZRouter.addGlobalLifecycleObserver({
onRootShow: () => {
callback()
}
} as ILifecycleObserver)
} | AST#method_declaration#Left public static addRootPageShowObserver AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation... | public static addRootPageShowObserver(callback: () => void) {
ZRouter.addGlobalLifecycleObserver({
onRootShow: () => {
callback()
}
} as ILifecycleObserver)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L318-L324 | bd70bce5125ebaf5db05667fcdc15bf09757c5e4 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/ExamReportBuilder.ets | arkts | ExamReportView | 常用设置底部弹窗视图 | @Component
export struct ExamReportView {
private highlightDataSource: AwardDataSource = new AwardDataSource();
@State settingDataSource: VHGiftAwardFiled[] = [];
@State models:VHExamReport[] = [];
@Require webinar_info:VHWebinarData;
private examRank:VHExamRank = new VHExamRank();
private timeId:number ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ExamReportView AST#component_body#Left { AST#property_declaration#Left private highlightDataSource : AST#type_annotation#Left AST#primary_type#Left AwardDataSource AST#primary_type#Right AST#type_annotation#Right = AS... | @Component
export struct ExamReportView {
private highlightDataSource: AwardDataSource = new AwardDataSource();
@State settingDataSource: VHGiftAwardFiled[] = [];
@State models:VHExamReport[] = [];
@Require webinar_info:VHWebinarData;
private examRank:VHExamRank = new VHExamRank();
private timeId:number ... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/ExamReportBuilder.ets#L66-L210 | c1255313e3c459d872e4e2eb3b3f74fc84b00ce9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | 期间比较接口 | export interface PeriodComparison {
previousPeriodValue: number;
currentPeriodValue: number;
changePercent: number;
isImprovement: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PeriodComparison AST#object_type#Left { AST#type_member#Left previousPeriodValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left currentPeriod... | export interface PeriodComparison {
previousPeriodValue: number;
currentPeriodValue: number;
changePercent: number;
isImprovement: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L80-L85 | 2344dce0f57a7be7487e0654ae58972163759a99 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkSameRootUsable | / 检查 是否可以使用同根词 | public checkSameRootUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedSameRoot) { return true } // 非会员 锁定同根词 功能是否启用
if (this.isActive) { return true } // 非会员才做检查
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_sameroot'))
}
return fal... | AST#method_declaration#Left public checkSameRootUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST... | public checkSameRootUsable(showMessage: boolean = true): boolean {
if (!this.nonMember.isLockedSameRoot) { return true }
if (this.isActive) { return true }
if (showMessage) {
Toast.showMessage($r('app.string.member_manager_msg_limit_use_sameroot'))
}
return false
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L350-L359 | 13e7c25b531dc24a6f3d660c80b8ac5ee5d16a86 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnStartCenter() { Text("Hi"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVal... | 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 ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVal... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L844-L859 | bea5f7b1c69f146c9cb2c5710cf37a032d34d8d8 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getAliveWordIds | 获取活跃单词的ID数组(未删除的单词) | getAliveWordIds(): number[] {
return this.allWords
.filter(word => !word.deleted)
.map(word => word.idx ?? 0);
} | AST#method_declaration#Left getAliveWordIds AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#return_statement#Left r... | getAliveWordIds(): number[] {
return this.allWords
.filter(word => !word.deleted)
.map(word => word.idx ?? 0);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L333-L337 | 14f04673084f05229d9aae6f5529354c071956f3 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/launch/src/main/ets/view/GuidePage.ets | arkts | GuidePage | @file 引导页视图
@author Joker.X | @ComponentV2
export struct GuidePage {
/**
* 引导页 ViewModel
*/
@Local
private vm: GuideViewModel = new GuideViewModel();
/**
* 构建引导页
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "引导页",
viewModel: this.vm
}) {
this.GuideContent();
}
}
/**
*... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GuidePage AST#component_body#Left { /**
* 引导页 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left GuideViewMode... | @ComponentV2
export struct GuidePage {
@Local
private vm: GuideViewModel = new GuideViewModel();
build() {
AppNavDestination({
title: "引导页",
viewModel: this.vm
}) {
this.GuideContent();
}
}
@Builder
private GuideContent() {
Text("引导页内容视图")
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/view/GuidePage.ets#L8-L37 | 1fcc2a91246e352deeafe5200a84d24e2ebc35b1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | hasAnniversaryOnDay | 判断指定日期是否有纪念日 | private hasAnniversaryOnDay(date: Date): boolean {
return this.getAnniversariesOnDate(date).length > 0;
} | AST#method_declaration#Left private hasAnniversaryOnDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri... | private hasAnniversaryOnDay(date: Date): boolean {
return this.getAnniversariesOnDate(date).length > 0;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2783-L2785 | f1feb37dfcd45647f0914e6822ef1bdd26a1418a | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | setCircleColor | Sets the one and ONLY color that should be used for this DataSet.
Internally, this recreates the colors array and adds the specified color.
@param color | public setCircleColor(color: number): void {
this.resetCircleColors();
if (this.mCircleColors) {
// this.mCircleColor = color;
this.mCircleColors.add(color);
}
} | AST#method_declaration#Left public setCircleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public setCircleColor(color: number): void {
this.resetCircleColors();
if (this.mCircleColors) {
this.mCircleColors.add(color);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L305-L311 | c8dbc8e7ccd9439e910e5e51224e186f6e0dd77c | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkDemoPage.ets | arkts | NetworkDemoContent | 构建网络示例内容
@returns {void} 无返回值 | @Builder
private NetworkDemoContent() {
ColumnCenter() {
Text(this.vm.data?.title ?? "")
Text(this.vm.data?.subTitle ?? "")
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NetworkDemoContent 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 ColumnCenter ( ) AST#container_content_body#Lef... | @Builder
private NetworkDemoContent() {
ColumnCenter() {
Text(this.vm.data?.title ?? "")
Text(this.vm.data?.subTitle ?? "")
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkDemoPage.ets#L38-L44 | 2b4a9bcd779d15683a6aa68a6a756dcca0ede6ab | github |
devaige/HarmonyOSOfficialDemo.git | 8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c | RankingDemo/entry/src/main/ets/view/ListItemComponent.ets | arkts | ListItemComponent | 列表项组件 装饰器是用于类、结构、方法和变量上表示特殊含义的字符串,一般以 @ 开头。 下述代码中 @Component、@State 以及 @Prop 等都是装饰器。 @Component 装饰器用来表示 ListItemComponent 这个结构体是一个自定义的组件,可以与其它组件进行组合 struct 关键字表示 ListItemComponent 是一个数据结构。 export 关键字表示 ListItemComponent 是一个可在其它地方导出使用的数据结构,在需要使用 ListItemComponent 的地方使用 import 关键字导入 该 ListItemComponent:import { ListItemC... | @Component
export struct ListItemComponent {
index?: number;
private name?: Resource;
@Prop vote: string;
@Prop isSwitchDataSource: boolean;
// The state is related to the font color of ListItemComponent.
// 用 @State 装饰器装饰的变量值发生改变时会触发该变量所对应的组件 UI 自动刷新。
@State isChange: boolean = false;
// build 函数以声明式的... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemComponent AST#component_body#Left { AST#property_declaration#Left index ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Rig... | @Component
export struct ListItemComponent {
index?: number;
private name?: Resource;
@Prop vote: string;
@Prop isSwitchDataSource: boolean;
@State isChange: boolean = false;
build() {
Row() {
Column() {
if (this.isRenderCircleText()) {
if (this.index !== undefined... | https://github.com/devaige/HarmonyOSOfficialDemo.git/blob/8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c/RankingDemo/entry/src/main/ets/view/ListItemComponent.ets#L24-L92 | 5774fdc51b1b33f01d4076d07b02d1c21db0f615 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkTS_high_performance_segment/entry/src/main/ets/segment/segment.ets | arkts | [Start Case3] lib.ets | export interface TestA {
sum: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TestA AST#object_type#Left { AST#type_member#Left sum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#exp... | export interface TestA {
sum: number
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment.ets#L20-L22 | 241b61641f6442f819796134457709314bf6d23a | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | getCameraManagerFn | Get Camera Manager Instance | getCameraManagerFn(): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager;
try {
cameraManager = camera.getCameraManager(GlobalContext.get().getCameraSettingContext());
Logger.info(TAG, `getCameraManager succ... | AST#method_declaration#Left getCameraManagerFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right... | getCameraManagerFn(): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager;
try {
cameraManager = camera.getCameraManager(GlobalContext.get().getCameraSettingContext());
Logger.info(TAG, `getCameraManager succ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L314-L328 | 8e0132b96af01a96b6f1582bc8a066ba4f26d270 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets | arkts | GPData实体类 | export class GPData {
public moduleType: String;
public timeStamp: number;
public values: Map<String, String>;
constructor(moduleType: String, timeStamp: number, values: Map<String, String>) {
this.moduleType = moduleType;
this.timeStamp = timeStamp;
this.values = values;
}
toString() {
va... | AST#export_declaration#Left export AST#class_declaration#Left class GPData AST#class_body#Left { AST#property_declaration#Left public moduleType : AST#type_annotation#Left AST#primary_type#Left String AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public ... | export class GPData {
public moduleType: String;
public timeStamp: number;
public values: Map<String, String>;
constructor(moduleType: String, timeStamp: number, values: Map<String, String>) {
this.moduleType = moduleType;
this.timeStamp = timeStamp;
this.values = values;
}
toString() {
va... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/entity/DatabaseEntity.ets#L19-L36 | 81832b7fb03701b50ed0dd8f7f69320b3df80281 | gitee | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | get | 从用户首选项中获取键对应的值。
@param key 键名
@return 与键关联的数据值,如果键不存在则返回默认值 | public async get(key: string) {
let data: string = '';
if (this.preferences != null) {
data = await this.preferences.get(key, this.defaultValue) as string;
}
return data;
} | AST#method_declaration#Left public async get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | public async get(key: string) {
let data: string = '';
if (this.preferences != null) {
data = await this.preferences.get(key, this.defaultValue) as string;
}
return data;
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L52-L58 | d8e84d806d3c527f82e9f111482060d9e5a6c84d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/OrderPageRequest.ets | arkts | @param {Partial<OrderPageRequest>} init - 初始化数据 | constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.status = init.status ?? this.status;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left OrderPageRequest AST#primary_type#Right AST#type_annotation#Right > AST... | constructor(init?: Partial<OrderPageRequest>) {
if (!init) return;
this.page = init.page ?? this.page;
this.size = init.size ?? this.size;
this.status = init.status ?? this.status;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/OrderPageRequest.ets#L22-L27 | 27307dc1b554dcb7702670caeeb24db1c9f8547c | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets | arkts | getDate | 从缓存的Preferences实例中获取键对应的值
@param { Context } Context - 应用上下文
@param { function } callback - 回调函数 | static getDate(context: Context, callback: (dateModel: DateModel) => void) {
let dateModel: DateModel = getRealTimeDate();
try {
// 获取Preferences实例
// TODO: 知识点: 通过用户首选项实现数据持久化
let promise = dataPreferences.getPreferences(context, 'date')
promise.then((object: dataPreferences.Preferences... | AST#method_declaration#Left static getDate AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list... | static getDate(context: Context, callback: (dateModel: DateModel) => void) {
let dateModel: DateModel = getRealTimeDate();
try {
let promise = dataPreferences.getPreferences(context, 'date')
promise.then((object: dataPreferences.Preferences) => {
try {
let ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets#L30-L64 | 95ae2b0ad24e6d6787d33ae8c0d13d6738ef440e | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineRadarRenderer.ets | arkts | Created by Philipp Jahoda on 25/01/16. | export default abstract class LineRadarRenderer extends LineScatterCandleRadarRenderer {
constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
}
/**
* Draws the provided path in filled mode with the provided drawable.
*
* @param c
* @param fill... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class LineRadarRenderer extends AST#type_annotation#Left AST#primary_type#Left LineScatterCandleRadarRenderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_l... | export default abstract class LineRadarRenderer extends LineScatterCandleRadarRenderer {
constructor(animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
}
protected drawFilledPath(filledPath: string, icon?: ImagePaint, fillColor?: number, fillAlpha?: number): Pai... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineRadarRenderer.ets#L25-L52 | 7fa5f70d643c2b81c189b5a10bf7f689e674a642 | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.inputMethodList.d.ets | arkts | InputMethodListDialog | Declare input method list dialog. The caller must be the current inputmethod.
@syscap SystemCapability.MiscServices.InputMethodFramework
@since 11 | @CustomDialog
export declare struct InputMethodListDialog {
/**
* Sets the controller.
*
* @type { CustomDialogController }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
controller: CustomDialogController;
/**
* Sets the pattern options. This ... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct InputMethodListDialog AST#component_body#Left { /**
* Sets the controller.
*
* @type { CustomDialogController }
* @syscap SystemCapability.MiscServices.Inp... | @CustomDialog
export declare struct InputMethodListDialog {
controller: CustomDialogController;
patternOptions?: PatternOptions;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.inputMethodList.d.ets#L83-L101 | 5fe583a76f2e58f395559e42ae80ed71dda768bf | github |
westinyang/f-oh | 0b3022f69a2b7f8331b92ed18851050c1639f2c9 | entry/src/main/ets/components/AppListItem.ets | arkts | installApp | 安装应用 或 更新应用 | installApp(hapPath: string) {
let hapFilePaths = [hapPath];
let installParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
try {
installer.getBundleInstaller().then(data => {
data.install(hapFilePaths, installParam, err => {
this.installLoading = false... | AST#method_declaration#Left installApp AST#parameter_list#Left ( AST#parameter#Left hapPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left ... | installApp(hapPath: string) {
let hapFilePaths = [hapPath];
let installParam = {
userId: 100,
isKeepData: false,
installFlag: 1,
};
try {
installer.getBundleInstaller().then(data => {
data.install(hapFilePaths, installParam, err => {
this.installLoading = false... | https://github.com/westinyang/f-oh/blob/0b3022f69a2b7f8331b92ed18851050c1639f2c9/entry/src/main/ets/components/AppListItem.ets#L211-L246 | 6979fd6ac84d292f8a30a498d1157a74a864949d | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bridges/Audio/AVPlayManager.ets | arkts | setAVPlayerCallback | 注册avplayer回调函数 | setAVPlayerCallback(avPlayer: media.AVPlayer) {
// seek操作结果回调函数
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
// error回调监听函数,当avPlayer在操作过程中出现错误时调用 reset接口触发重置流程
avPlayer.on('error', (err: BusinessError) => {
... | AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERR... | setAVPlayerCallback(avPlayer: media.AVPlayer) {
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
})
avPlayer.on('error', (err: BusinessError) => {
console.error(`Invoke avPlayer failed, code is ${err.code}, messa... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/Audio/AVPlayManager.ets#L29-L51 | fe801789a436a35732b21a857b3711ab7430e8bf | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setDataUri | 将URI数据写入系统剪贴板,使用Promise异步回调。
@param uri URI内容
@returns | static async setDataUri(uri: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_URI, uri);
} | AST#method_declaration#Left static async setDataUri AST#parameter_list#Left ( AST#parameter#Left uri : 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#L... | static async setDataUri(uri: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_URI, uri);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L184-L186 | 8e87ddec36f305eb3da88653038b34becbf42c5d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomShareDlg.ets | arkts | onPlatClick | 点击分享平台事件 | onPlatClick() {
promptAction.showToast({ message: $r('app.string.video_trimmer_toast_tips') });
} | AST#method_declaration#Left onPlatClick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#me... | onPlatClick() {
promptAction.showToast({ message: $r('app.string.video_trimmer_toast_tips') });
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomShareDlg.ets#L109-L111 | 9660a511d5562025caa816abaa34b5bf661f1140 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/TaskService.ets | arkts | listTask | 获取任务列表
@param params 分页和筛选参数
@returns 任务列表数据 | static async listTask(params: PageParam): Promise<TableDataInfo<AgvTask>> {
try {
console.info('[TaskService] 🔍 获取任务列表,参数:', JSON.stringify(params));
let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`;
if (params.taskCode) queryString += `&taskCode=${encodeURI... | AST#method_declaration#Left static async listTask AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageParam 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_ty... | static async listTask(params: PageParam): Promise<TableDataInfo<AgvTask>> {
try {
console.info('[TaskService] 🔍 获取任务列表,参数:', JSON.stringify(params));
let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`;
if (params.taskCode) queryString += `&taskCode=${encodeURI... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/TaskService.ets#L60-L101 | a6efebe043af1e966e719742ebd07ff650702885 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | logger | 视频暂停播放 | logger.info('state paused called'); | AST#method_declaration#Left logger AST#ERROR#Left . in fo AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'state paused called' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | logger.info('state paused called'); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L259-L259 | 9c1773a391a70fae7afc391e893da6b7844da823 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/SecurityComponent/entry/src/main/ets/securitycomponent/pages/Location.ets | arkts | getCurrentLocationInfo | 获取当前位置信息 | function getCurrentLocationInfo() {
const requestInfo: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.UNSET,
'timeInterval': 1,
'distanceInterval': 0,
'maxAccuracy': 0
};
try {
... | AST#function_declaration#Left function getCurrentLocationInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocati... | function getCurrentLocationInfo() {
const requestInfo: geoLocationManager.LocationRequest = {
'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,
'scenario': geoLocationManager.LocationRequestScenario.UNSET,
'timeInterval': 1,
'distanceInterval': 0,
'maxAccuracy': 0
};
try {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/SecurityComponent/entry/src/main/ets/securitycomponent/pages/Location.ets#L22-L43 | 6e64ebbda07aef25027e013fa956ea07f7ad125f | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | ColumnSpaceAround | 纵向环绕分布 + 水平居中 | @ComponentV2
export struct ColumnSpaceAround {
/**
* Column 构造参数
*/
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceAround AST#component_body#Left { /**
* Column 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_... | @ComponentV2
export struct ColumnSpaceAround {
@Param
options: ColumnOptions | ColumnOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Paddi... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L465-L540 | 5c959d672555e90fecbeb422e7bd3352fcecfdb4 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | getNetworkConnectionType | 获取当前网络连接类型
判断当前使用的网络是蜂窝或者Wi-Fi
BEARER_CELLULAR时(值为0),表示蜂窝网络
BEARER_WIFI时(值为1),表示Wi-Fi网络
BEARER_BLUETOOTH时(值为2),表示蓝牙网络
BEARER_ETHERNET时(值为3),表示以太网网络
BEARER_VPN时(值为4),表示VPN网络
@returns 当前可用网络类型的列表 | getNetworkConnectionType(): Array<connection.NetBearType> {
try {
// 获取默认激活的数据网络
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return [];
}
// 获取网络的类型、拥有的能力等信息
let netCapability = connection.getNetCapabilitiesSync(netHandle);
... | AST#method_declaration#Left getNetworkConnectionType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBearType AST#qualified_t... | getNetworkConnectionType(): Array<connection.NetBearType> {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return [];
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
return netCapability.bearerT... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L138-L153 | 9080ac2a30ee7a621803a465f1cb94bf49e2d677 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | isDrawTopYLabelEntryEnabled | returns true if drawing the top y-axis label entry is enabled
@return | public isDrawTopYLabelEntryEnabled(): boolean {
return this.mDrawTopYLabelEntry;
} | AST#method_declaration#Left public isDrawTopYLabelEntryEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | public isDrawTopYLabelEntryEnabled(): boolean {
return this.mDrawTopYLabelEntry;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L208-L210 | e35557a677f5313b09c50526ecf30d293d989689 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | 分析报告接口 | export interface AnalyticsReport {
id: string;
type: MetricType;
title: string;
description: string;
timeRange: TimeRange;
startDate: string;
endDate: string;
data: DataPoint[];
summary: ReportSummary;
insights: Insight[];
recommendations: Recommendation[];
createdAt: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AnalyticsReport AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left... | export interface AnalyticsReport {
id: string;
type: MetricType;
title: string;
description: string;
timeRange: TimeRange;
startDate: string;
endDate: string;
data: DataPoint[];
summary: ReportSummary;
insights: Insight[];
recommendations: Recommendation[];
createdAt: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L49-L62 | b935213a1adfd322751da8d3a59ea227763491bb | github | |
HarmonyCandies/loading_more_list.git | 49ab379fb8baff92fc42f7c3bc6fcea87a1f4970 | loading_more_list/src/main/ets/viewmodel/LoadingMoreBase.ets | arkts | notifyDataReload | IDataSource end | notifyDataReload(): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataReloaded();
})
} | AST#method_declaration#Left notifyDataReload 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#express... | notifyDataReload(): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataReloaded();
})
} | https://github.com/HarmonyCandies/loading_more_list.git/blob/49ab379fb8baff92fc42f7c3bc6fcea87a1f4970/loading_more_list/src/main/ets/viewmodel/LoadingMoreBase.ets#L63-L67 | 1cf49f06e9159d22bc33e13da5e1fed29b5076ec | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | create_web_drag_image_cache | Set cache dir of web-dragged image into Scratching Board. | function create_web_drag_image_cache(context: common.UIAbilityContext) {
try {
fileIo.mkdirSync(context.tempDir + '/web-drag-image-cache', true);
} catch (e) {
console.error('[Index] mkdirSync temp/web-drag-image-cache failed! ' + e);
}
} | AST#function_declaration#Left function create_web_drag_image_cache 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... | function create_web_drag_image_cache(context: common.UIAbilityContext) {
try {
fileIo.mkdirSync(context.tempDir + '/web-drag-image-cache', true);
} catch (e) {
console.error('[Index] mkdirSync temp/web-drag-image-cache failed! ' + e);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L176-L182 | 84c153ad9fc13a609696dc70a55794ad5d7bb546 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ChatbotEngine.ets | arkts | startConversationFlow | 启动对话流程 | async startConversationFlow(
flowId: string,
sessionId: string,
initialContext: Record<string, any> = {}
): Promise<ConversationFlow | null> {
try {
const flowTemplate = this.getFlowTemplate(flowId);
if (!flowTemplate) {
throw new Error(`Flow template not found: ${flowId}`);
... | AST#method_declaration#Left async startConversationFlow AST#parameter_list#Left ( AST#parameter#Left flowId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string ... | async startConversationFlow(
flowId: string,
sessionId: string,
initialContext: Record<string, any> = {}
): Promise<ConversationFlow | null> {
try {
const flowTemplate = this.getFlowTemplate(flowId);
if (!flowTemplate) {
throw new Error(`Flow template not found: ${flowId}`);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L191-L223 | 65d5463ca4bfed93a2c1201a354d633d1ed9c64f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ArrayUtil.ets | arkts | reverse | 将数组反转,会修改原始数组。
@param <T> 数组元素类型
@param array 数组
@return 变更后的原数组 | static reverse<T>(array: T[]): T[] {
return array.reverse();
} | AST#method_declaration#Left static reverse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right A... | static reverse<T>(array: T[]): T[] {
return array.reverse();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L83-L85 | 187b9fbfcab7e9af51b7ed8e019aabb4c304d1de | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/pages/user/feedback.ets | arkts | pickMedia | 模拟选择媒体文件 | pickMedia(): void {
if (this.mediaList.length >= 5) {
this.result = "最多只能上传5个文件";
setTimeout(() => {
this.result = "";
}, 3000);
return;
}
const types = ["截图", "照片", "录屏"];
const randomType = types[Math.floor(Math.random() ... | AST#method_declaration#Left pickMedia 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#binary_expression#Left AST#ex... | pickMedia(): void {
if (this.mediaList.length >= 5) {
this.result = "最多只能上传5个文件";
setTimeout(() => {
this.result = "";
}, 3000);
return;
}
const types = ["截图", "照片", "录屏"];
const randomType = types[Math.floor(Math.random() ... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/feedback.ets#L123-L137 | ab593ecb3aab6c30d9d02fc8a955d6703d32f57f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toConfirm | 跳转到确认订单
@returns {void} 无返回值 | static toConfirm(): void {
navigateTo(OrderRoutes.Confirm);
} | AST#method_declaration#Left static toConfirm AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_exp... | static toConfirm(): void {
navigateTo(OrderRoutes.Confirm);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L29-L31 | bbeb054e5faf7338189905ef5fb9e39fdcbd69ec | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/BruteForce.ets | arkts | contains | 检查文本是否包含模式串
@param text 文本字符串
@param pattern 模式串
@returns 是否包含模式串 | static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const n = text.length;
const m = pattern.length;
for (let i = 0; i <= n - m; i++) {
let j = 0;
while (j < m && text[i + j] === pattern[j]) {
j++;
... | AST#method_declaration#Left static contains 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 pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const n = text.length;
const m = pattern.length;
for (let i = 0; i <= n - m; i++) {
let j = 0;
while (j < m && text[i + j] === pattern[j]) {
j++;
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BruteForce.ets#L41-L61 | 5da283fce597dc615761d205447732d821c6e6f6 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets | arkts | Calls a worker thread to load built index from disk.
@param load_type either "normal" or "reindex". | export function history_index_load_from_disk_worker(load_type: string) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined;
let reindexing = AppStorage.get('reindexing_history') as bo... | AST#export_declaration#Left export AST#function_declaration#Left function history_index_load_from_disk_worker AST#parameter_list#Left ( AST#parameter#Left load_type : 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... | export function history_index_load_from_disk_worker(load_type: string) {
let history_index_saving = AppStorage.get('history_index_saving') as boolean | undefined;
let history_index_loading = AppStorage.get('history_index_loading') as boolean | undefined;
let reindexing = AppStorage.get('reindexing_history') as bo... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L13-L78 | e6ac25a5757ad8cf7764d1323da2367e2a38e9e8 | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | startSubscriptionUpdateTimer | 开始订阅更新定时器 - 每5秒刷新集数 | startSubscriptionUpdateTimer() {
if (this.subscriptionUpdateTimer === -1) {
this.subscriptionUpdateTimer = setInterval(() => {
this.loadSubscriptions();
console.info('[MainPage] Subscription list refreshed');
}, 5000);
}
} | AST#method_declaration#Left startSubscriptionUpdateTimer 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... | startSubscriptionUpdateTimer() {
if (this.subscriptionUpdateTimer === -1) {
this.subscriptionUpdateTimer = setInterval(() => {
this.loadSubscriptions();
console.info('[MainPage] Subscription list refreshed');
}, 5000);
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L157-L164 | 7b4ca68d4afdd3d45a6de51d367551a7ff5c6172 | github |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/SubscriptionManager.ets | arkts | addSubscription | 添加订阅 | addSubscription(name: string, url: string): string {
const id = Date.now().toString(36) + Math.random().toString(36).substring(2)
const subscription: SubscriptionInfo = {
id: id,
name: name,
url: url,
lastUpdate: 0,
enabled: true
}
this.subscriptions.set(id, subscripti... | AST#method_declaration#Left addSubscription AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | addSubscription(name: string, url: string): string {
const id = Date.now().toString(36) + Math.random().toString(36).substring(2)
const subscription: SubscriptionInfo = {
id: id,
name: name,
url: url,
lastUpdate: 0,
enabled: true
}
this.subscriptions.set(id, subscripti... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L51-L66 | e276d3275d938af23859c7b40fd8302afb2d1c70 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/launch/src/main/ets/view/SplashPage.ets | arkts | 构建启动页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "启动页",
viewModel: this.vm
}) {
this.SplashContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "启动页" AST#expression#Right AST#component_parameter#Right , AST#component_p... | build() {
AppNavDestination({
title: "启动页",
viewModel: this.vm
}) {
this.SplashContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/view/SplashPage.ets#L20-L27 | eed94653e78901cbc8681347246b815c794f0466 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/ContactTypes.ets | arkts | 联系人导入数据接口 | export interface ContactImportData {
name: string;
relation?: string;
birthday?: string;
isLunar?: boolean | string;
gender?: string;
phone?: string;
email?: string;
tags?: string | string[];
notes?: string;
intimacyLevel?: number | string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ContactImportData AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left relation ? : AST#type_annot... | export interface ContactImportData {
name: string;
relation?: string;
birthday?: string;
isLunar?: boolean | string;
gender?: string;
phone?: string;
email?: string;
tags?: string | string[];
notes?: string;
intimacyLevel?: number | string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L201-L212 | 58010e6ce8eb0d4d0149322f67957386cd6e57f3 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/Base64Encoding.ets | arkts | encode | 将字符串编码为Base64
@param text 要编码的文本
@returns Base64编码后的字符串 | static encode(text: string): string {
if (!text) {
return '';
}
let result = '';
let i = 0;
const len = text.length;
while (i < len) {
// 获取三个字节
const c1 = text.charCodeAt(i++) & 0xff;
const c2 = i < len ? text.charCodeAt(i++) & 0xff : 0;
const c3 = i < len ? text... | AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static encode(text: string): string {
if (!text) {
return '';
}
let result = '';
let i = 0;
const len = text.length;
while (i < len) {
const c1 = text.charCodeAt(i++) & 0xff;
const c2 = i < len ? text.charCodeAt(i++) & 0xff : 0;
const c3 = i < len ? text.charCode... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/Base64Encoding.ets#L14-L42 | f50542ed94fcad181cecc4c5ba8194a150452021 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/promise_callback/promise_callback_006_F.ets | arkts | Introduction 异步-Promise-finally | export function promise_callback_006_F(taint_src : string) {
let _t = taint_src;
let clean = "clean";
let p = f(clean);
let t = "";
p.then((result) => {t = result}).catch((error : string) => {}).finally(() => {
taint.Sink(t);
})
} | AST#export_declaration#Left export AST#function_declaration#Left function promise_callback_006_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function promise_callback_006_F(taint_src : string) {
let _t = taint_src;
let clean = "clean";
let p = f(clean);
let t = "";
p.then((result) => {t = result}).catch((error : string) => {}).finally(() => {
taint.Sink(t);
})
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/promise_callback/promise_callback_006_F.ets#L6-L14 | 6fe32f9f9720c02826c15f4c924d92d363509795 | github | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | 文本配置 | export interface ImageEditTextOption{
text:ResourceStr
fontColor?:string
fontSize?:number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ImageEditTextOption AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left fontColor ? : AST#type... | export interface ImageEditTextOption{
text:ResourceStr
fontColor?:string
fontSize?:number
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L160-L164 | 4f83a10db8a6321460ed13b5726dc1d765c7e7a1 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 网络类型。 | export enum NetworkType {
NETWORK_TYPE_UNKNOWN = 0,
NETWORK_TYPE_WIFI = 1,
NETWORK_TYPE_2G = 2,
NETWORK_TYPE_3G = 3,
NETWORK_TYPE_4G = 4,
NETWORK_TYPE_5G = 5
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NetworkType AST#enum_body#Left { AST#enum_member#Left NETWORK_TYPE_UNKNOWN = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NETWORK_TYPE_WIFI = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AS... | export enum NetworkType {
NETWORK_TYPE_UNKNOWN = 0,
NETWORK_TYPE_WIFI = 1,
NETWORK_TYPE_2G = 2,
NETWORK_TYPE_3G = 3,
NETWORK_TYPE_4G = 4,
NETWORK_TYPE_5G = 5
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L75-L82 | 0c65c3c353a36b389f5f19a8734f4fcd11c5fe39 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Transformer.ets | arkts | pathValueToPixel | transform a path with all the given matrices VERY IMPORTANT: keep order
to value-touch-offset
@param path | public pathValueToPixel(path: Path2D): Path2D {
path = this.pathTransform(path, this.mMatrixValueToPx);
path = this.pathTransform(path, this.mViewPortHandler.getMatrixTouch());
path = this.pathTransform(path, this.mMatrixOffset);
return path;
} | AST#method_declaration#Left public pathValueToPixel AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left Path2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Path2D AST#primar... | public pathValueToPixel(path: Path2D): Path2D {
path = this.pathTransform(path, this.mMatrixValueToPx);
path = this.pathTransform(path, this.mViewPortHandler.getMatrixTouch());
path = this.pathTransform(path, this.mMatrixOffset);
return path;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L252-L257 | 09cf742f1c50b1e53566162f4dc0be2718baa6d2 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/ColumnAttribute.ets | arkts | 获取纵向起始 + 水平起始的 Column 对齐修饰器
@returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器
@example
Column() { Text("Hi"); }.attributeModifier(columnStart()); | export function columnStart(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.Start);
instance.alignItems(HorizontalAlign.Start);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function columnStart 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 ColumnAttribute AST... | export function columnStart(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.Start);
instance.alignItems(HorizontalAlign.Start);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L27-L34 | 08462b18d98b303b6b8458831dfcccd4ebfc748b | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/HighlightText.ets | arkts | getHighlightParts | ---------- 私有方法:分割文本 ---------- | private getHighlightParts(): TextSegment[] {
if (!this.keyword) {
// 没有关键词,按行拆分
return this.content.split('\n').flatMap((line, index, arr) => {
const segments: TextSegment[] = [{ text: line, isHighlight: false }];
if (index < arr.length - 1) segments.push({ text: '\n', isHighlight: false... | AST#method_declaration#Left private getHighlightParts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TextSegment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_state... | private getHighlightParts(): TextSegment[] {
if (!this.keyword) {
return this.content.split('\n').flatMap((line, index, arr) => {
const segments: TextSegment[] = [{ text: line, isHighlight: false }];
if (index < arr.length - 1) segments.push({ text: '\n', isHighlight: false });
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/HighlightText.ets#L41-L93 | 4c3d73a55829af01883635c101d558694c0891e3 | github |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/pages/DiaryEdit.ets | arkts | selectMood | 切换心情记录时的逻辑 | selectMood(index: number) {
this.selectedIndex = index;
this.currentMood = this.todayMoods[index];
// ★ 关键:切换时,要把这条心情里已有的日记内容填进去
this.diaryContent = this.currentMood.diaryContent || '';
} | AST#method_declaration#Left selectMood 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | selectMood(index: number) {
this.selectedIndex = index;
this.currentMood = this.todayMoods[index];
this.diaryContent = this.currentMood.diaryContent || '';
} | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/DiaryEdit.ets#L37-L42 | 2632c2319caedc4b36e68ad27acfae58e644e7d6 | github |
wuyukobe24/HMApp_ArkTS.git | 6d09d9b07a4fdc4713e5a13b61b85bc1e7893956 | entry/src/main/ets/common/networking/QQNetworkRequest.ets | arkts | get | export function getRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:Error)=>void) {
let httpRequest = http.createHttp()
let reponseResult = httpRequest.request(url, {
method: http.RequestMethod.GET,
readTimeout:60000,
connectTimeout:60000,
header: header,
extraData: para... | AST#export_declaration#Left export AST#function_declaration#Left function getRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#pri... | export function getRequest(url:string, param:Object, success:(str:string)=>void, fail:(error:Error)=>void) {
let httpRequest = http.createHttp()
let reponseResult = httpRequest.request(url, {
method: http.RequestMethod.GET,
readTimeout:60000,
connectTimeout:60000,
header: header,
extraData: para... | https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/common/networking/QQNetworkRequest.ets#L53-L83 | 99a3b15b76d16356f5bd2ba6f157c0a5fdf37fc3 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | redeemReward | 使用积分兑换奖励 | async redeemReward(rewardId: string, cost: number): Promise<boolean> {
try {
if (!this.userGameData || this.userGameData.availablePoints < cost) {
return false;
}
this.userGameData.availablePoints -= cost;
await this.saveUserGameData();
hilog.info(LogConstants.DOMAIN_APP, Log... | AST#method_declaration#Left async redeemReward AST#parameter_list#Left ( AST#parameter#Left rewardId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cost : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | async redeemReward(rewardId: string, cost: number): Promise<boolean> {
try {
if (!this.userGameData || this.userGameData.availablePoints < cost) {
return false;
}
this.userGameData.availablePoints -= cost;
await this.saveUserGameData();
hilog.info(LogConstants.DOMAIN_APP, Log... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L494-L512 | 94fbe174f7e5f0ab5a6f9d1564764bd50b06b7f0 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets | arkts | 生成AES密钥
@returns AES密钥的16进制字符串 | export async function generateAesKey(): Promise<string> {
try {
// 创建对称密钥生成器
let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256');
// 通过密钥生成器随机生成对称密钥
let symKey = await symKeyGenerator.generateSymKey();
// 获取对称密钥的二进制数据,输出长度为256bit的字节流
let encod... | AST#export_declaration#Left export AST#function_declaration#Left async function generateAesKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | export async function generateAesKey(): Promise<string> {
try {
let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256');
let symKey = await symKeyGenerator.generateSymKey();
let encodedKey: cryptoFramework.DataBlob = symKey.getEncoded();
le... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets#L30-L45 | 7a25a66734265c8fbb19f7184525398db1a14f2e | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | @file 百分比常量
@author Joker.X
0% 百分比 | export const P0: string = "0%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P0 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "0%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right A... | export const P0: string = "0%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L9-L9 | 8db6c5d7ec71b1da935279d82eae6b630766da62 | github | |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Tab.ets | arkts | rightTabBuilder | 自定义 rightTabBuilder
@param index
@param name | @Builder rightTabBuilder(index: number, item: ColorItem) {
Column() {
Text(item.name)
.fontColor(this.rightCurrent === index ? item.color : this.fontColor)
.fontSize(16)
.fontWeight(this.rightCurrent === index ? FontWeight.Bold : FontWeight.Normal)
.lineHeight(22)
}.width('... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right rightTabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Lef... | @Builder rightTabBuilder(index: number, item: ColorItem) {
Column() {
Text(item.name)
.fontColor(this.rightCurrent === index ? item.color : this.fontColor)
.fontSize(16)
.fontWeight(this.rightCurrent === index ? FontWeight.Bold : FontWeight.Normal)
.lineHeight(22)
}.width('... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Tab.ets#L121-L129 | 89043ce19f09d802ef7d2da090a0e7abfa2d41d5 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | products/entry/src/main/ets/pages/SplashPage.ets | arkts | SplashPage | @author: HZWei
@date: 2024/10/12
@desc: 如果@Route不设置任何属性,则默认使用类名作为路由名称 | @Route({
param: {
"ids": {
default: -1
}
}
})
@Component
export struct SplashPage {
@State ids: number = -1
@State countdown: number = 3000
build() {
NavDestination() {
Column() {
Text("测试id参数=" + this.ids)
Text('欢迎使用ZRouter')
.fontColor(Color.Black)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left param AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "ids" AST#property_name#R... | @Route({
param: {
"ids": {
default: -1
}
}
})
@Component
export struct SplashPage {
@State ids: number = -1
@State countdown: number = 3000
build() {
NavDestination() {
Column() {
Text("测试id参数=" + this.ids)
Text('欢迎使用ZRouter')
.fontColor(Color.Black)
... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/SplashPage.ets#L9-L74 | 0756a3bc4c020c98a8eb7353009323befb867c81 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/WordCardOne.ets | arkts | buildWordTranslationRow | 构建日文翻译行 | @Builder
buildWordTranslationRow() {
Stack(){
if (this.isHideWordTranslation){
Text($r('app.string.wordcard_txt_show_translation'))
.width('100%')
.fontSize(18)
.minFontScale(0.1)
.fontColor($r('app.color.color_list_item_subtitle'))
.textAlign(TextAl... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWordTranslationRow 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 Stack ( ) AST#container_content_body#Left { AST#ui... | @Builder
buildWordTranslationRow() {
Stack(){
if (this.isHideWordTranslation){
Text($r('app.string.wordcard_txt_show_translation'))
.width('100%')
.fontSize(18)
.minFontScale(0.1)
.fontColor($r('app.color.color_list_item_subtitle'))
.textAlign(TextAl... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L220-L265 | afa908f20ff8fe5066417153fa7e5a74ac3bdd5c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 用户活跃度数据接口 | export interface UserActivity {
date: string;
logins: number;
actions: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserActivity AST#object_type#Left { AST#type_member#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left logins : AST#type_annotation#Lef... | export interface UserActivity {
date: string;
logins: number;
actions: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L82-L86 | 408c432e95ba867b23fed9ef9f2c49669e281be1 | github | |
love1060764057/RouterDemo.git | 95c66a436465c5ad52c2c9158c1dbdea64f93cd7 | entry/src/main/ets/pages/MyTabs.ets | arkts | MyTabsBuilder | 对外暴露MyTabsBuilder方法 | @Builder
export function MyTabsBuilder(){
// 调用组件
MyTabs()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MyTabsBuilder 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 MyTabs ( ) AST#ui_componen... | @Builder
export function MyTabsBuilder(){
MyTabs()
} | https://github.com/love1060764057/RouterDemo.git/blob/95c66a436465c5ad52c2c9158c1dbdea64f93cd7/entry/src/main/ets/pages/MyTabs.ets#L3-L7 | 4083b862f79b3d225f887f83a774d246b475948e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/CommonComponent.ets | arkts | CommonItem | Show List in Column | @Component
export struct CommonItem {
private item: number = 0;
build() {
Text(this.item.toString())
.fontSize(MARGIN_FONT_SIZE_SPACE.FIFTH_MARGIN)
.width(MARGIN_FONT_SIZE_SPACE.NINTH_MARGIN)
.height(MARGIN_FONT_SIZE_SPACE.NINTH_MARGIN)
.fontColor($r("app.color.show_list_fontColor"))
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItem AST#component_body#Left { AST#property_declaration#Left private item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expr... | @Component
export struct CommonItem {
private item: number = 0;
build() {
Text(this.item.toString())
.fontSize(MARGIN_FONT_SIZE_SPACE.FIFTH_MARGIN)
.width(MARGIN_FONT_SIZE_SPACE.NINTH_MARGIN)
.height(MARGIN_FONT_SIZE_SPACE.NINTH_MARGIN)
.fontColor($r("app.color.show_list_fontColor"))
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/CommonComponent.ets#L21-L37 | 291655ae988dc8277cf6b2ccbec210915bee97f9 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64
@returns | static encodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static encodeCBC 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeCBC(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L125-L128 | 501e870e8c989ebead4290e88c00f2fc2b7712e1 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Alarm/PermissionManager.ets | arkts | requestRecordPermission | ================= 具体权限封装方法 ================= 请求录音权限(封装方法) | static async requestRecordPermission(
context: common.UIAbilityContext,
rationale?: string | Resource
): Promise<boolean> {
return await PermissionManager.requestPermissions(
context,
[...PermissionManager.PERMISSION_GROUP.RECORD],
rationale
);
} | AST#method_declaration#Left static async requestRecordPermission 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#par... | static async requestRecordPermission(
context: common.UIAbilityContext,
rationale?: string | Resource
): Promise<boolean> {
return await PermissionManager.requestPermissions(
context,
[...PermissionManager.PERMISSION_GROUP.RECORD],
rationale
);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L242-L251 | 63c4c01be4b4ba405a5743f9c17987890715b12b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | buildPasteImportSection | 构建复制粘贴导入区域 | @Builder
buildPasteImportSection() {
Column({ space: 16 }) {
// 说明
this.buildPasteInstructions()
// 粘贴内容输入
this.buildPasteInput()
// 导入按钮
this.buildImportButton('粘贴')
}
.width('100%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPasteImportSection 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#compo... | @Builder
buildPasteImportSection() {
Column({ space: 16 }) {
this.buildPasteInstructions()
this.buildPasteInput()
this.buildImportButton('粘贴')
}
.width('100%')
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L161-L174 | ba540bf868d8963f80ce97197f3a66a31ac65c59 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | compareByWordEn | 安全比较器:按 wordEn 忽略大小写排序(不使用 localeCompare 的 options) | private compareByWordEn(a: WordUser, b: WordUser): number {
const A : string = (a.titleEn || '').toLowerCase();
const B : string = (b.titleEn || '').toLowerCase();
if (A < B) return -1;
if (A > B) return 1;
return 0;
} | AST#method_declaration#Left private compareByWordEn AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_t... | private compareByWordEn(a: WordUser, b: WordUser): number {
const A : string = (a.titleEn || '').toLowerCase();
const B : string = (b.titleEn || '').toLowerCase();
if (A < B) return -1;
if (A > B) return 1;
return 0;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L653-L660 | 022bc80f384d46138ae49a161268852e59199d64 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/NewsChannel.ets | arkts | setup | 应用约束1:添加方法参数类型 | setup(data: any): void {
super.setup(data);
/**
* The ratelimit per user for this channel (always 0)
*/
this.rateLimitPerUser = 0;
} | AST#method_declaration#Left setup AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_a... | setup(data: any): void {
super.setup(data);
this.rateLimitPerUser = 0;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/NewsChannel.ets#L23-L30 | d9a145d884f80b0ea6c5994c46325a98a27b44f3 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | setData | 设置数据
@param data 新数据集 | public setData(data: ESObject[]): void {
this.originDataArray = data;
this.notifyDataReload();
} | AST#method_declaration#Left public setData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ESObject [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | public setData(data: ESObject[]): void {
this.originDataArray = data;
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L70-L73 | ef432a0446bcbe9d8f353582c4fe18cc48ba15f1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/view/CustomCalendarPickerDialog.ets | arkts | itemHead | 显示日历布局的每个月上方的年月信息 | @Builder
itemHead(text: string) {
Text(text)
.backgroundColor($r('app.color.ohos_id_color_sub_background'))
.width('100%')
.height($r('app.integer.customcalendarpickerdialog_text_height'))
.textAlign(TextAlign.Center)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemHead AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
itemHead(text: string) {
Text(text)
.backgroundColor($r('app.color.ohos_id_color_sub_background'))
.width('100%')
.height($r('app.integer.customcalendarpickerdialog_text_height'))
.textAlign(TextAlign.Center)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/view/CustomCalendarPickerDialog.ets#L101-L108 | 8d824f3df6e73a07b0f0a76edf45eea4e0d822da | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/common/database/Form.ets | arkts | Database form entity class. | export default class Form {
/**
* Form ID.
*/
formId: string = '';
/**
* Form name.
*/
formName: string = '';
/**
* Card dimension.
*/
dimension: number = 0;
/**
* Get inserted form data.
*
* @return Return form data.
*/
toValuesBucket(): relationalStore.ValuesBucket {
... | AST#export_declaration#Left export default AST#class_declaration#Left class Form AST#class_body#Left { /**
* Form ID.
*/ AST#property_declaration#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST... | export default class Form {
formId: string = '';
formName: string = '';
dimension: number = 0;
toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/database/Form.ets#L20-L46 | b9417f927d8a220cf907cb5ba851f2d05f908ed4 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.