nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets | arkts | initCurrentImageInfo | 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue
TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 | initCurrentImageInfo(): void {
this.matrix = matrix4.identity().copy();
const imageSource: image.ImageSource = image.createImageSource(this.imageUri);
imageSource.getImageInfo(0).then((data: image.ImageInfo) => {
this.imageWHRatio = data.size.width / data.size.height;
this.imageDefaultSize = thi... | AST#method_declaration#Left initCurrentImageInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expr... | initCurrentImageInfo(): void {
this.matrix = matrix4.identity().copy();
const imageSource: image.ImageSource = image.createImageSource(this.imageUri);
imageSource.getImageInfo(0).then((data: image.ImageInfo) => {
this.imageWHRatio = data.size.width / data.size.height;
this.imageDefaultSize = thi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets#L84-L109 | ff72705fe84ef6954e2ec01f9d36219d51e3ab62 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/ui/rcpLoading.ets | arkts | 图片文字布局枚举 | export enum RcpImgLayout {
/**
* 图片在文字上方
*/
TOP,
/**
* 图片在文字下方
*/
BOTTOM,
/**
* 图片在文字左侧
*/
LEFT,
/**
* 图片在文字右侧
*/
RIGHT
} | AST#export_declaration#Left export AST#enum_declaration#Left enum RcpImgLayout AST#enum_body#Left { /**
* 图片在文字上方
*/ AST#enum_member#Left TOP AST#enum_member#Right , /**
* 图片在文字下方
*/ AST#enum_member#Left BOTTOM AST#enum_member#Right , /**
* 图片在文字左侧
*/ AST#enum_member#Left LEFT AST#enum_member#Right , ... | export enum RcpImgLayout {
TOP,
BOTTOM,
LEFT,
RIGHT
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/ui/rcpLoading.ets#L230-L247 | cdc1275c3fe9686408b5266aae8c8bd837b82014 | gitee | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets | arkts | query | 查询表格中某一列或者几列的数据的数据 | query(rdbPredicates: dataRdb.RdbPredicates, columns?: Array<string>): Promise<dataRdb.ResultSet> {
return this.rdbStore.query(rdbPredicates, columns);
} | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left rdbPredicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataRdb . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns ? : AST... | query(rdbPredicates: dataRdb.RdbPredicates, columns?: Array<string>): Promise<dataRdb.ResultSet> {
return this.rdbStore.query(rdbPredicates, columns);
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L156-L158 | 75392795f7637d6811ec5d98dd5547d0e7b8a200 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | openFile | 调用三方软件打开文件 | static async openFile(uri: string, write: boolean = true): Promise<void> {
const fileExtention = FileUtil.getFileExtention(uri);
const mimeType = PreviewUtil.getMimeType(fileExtention);
const want: Want = {
flags: write ? (wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUT... | AST#method_declaration#Left static async openFile 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#Left write : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static async openFile(uri: string, write: boolean = true): Promise<void> {
const fileExtention = FileUtil.getFileExtention(uri);
const mimeType = PreviewUtil.getMimeType(fileExtention);
const want: Want = {
flags: write ? (wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUT... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L257-L268 | b99fa42f9904747d2f93c8ebd1ae3185dc4e8dd2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets | arkts | 卡片信息的接口类型。 | export interface CardInfo {
// 图片路径
src: ResourceStr,
// 卡片中图片展示宽度
width: number,
// 卡片中图片展示高度
height: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CardInfo AST#object_type#Left { // 图片路径 AST#type_member#Left src : 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 width : AST... | export interface CardInfo {
src: ResourceStr,
width: number,
height: number
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets#L65-L72 | beaab4411db3293da59469ae25711cd61b86f3b8 | gitee | |
yinxing2008/note_hongmeng_ArkUI.git | 5c7459ca682903d9184539facc63136bbe6230b9 | entry/src/main/ets/data/UserDataStore.ets | arkts | clear | 清空缓存数据 | public clear() {
User.sInstance = new User();
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
storage.clearSync();
} else {
// Logger.log("get sto... | AST#method_declaration#Left public clear 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 User AST#expression#Right . sInstance AST#member_expression#Right... | public clear() {
User.sInstance = new User();
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
storage.clearSync();
} else {
}
}
});
} | https://github.com/yinxing2008/note_hongmeng_ArkUI.git/blob/5c7459ca682903d9184539facc63136bbe6230b9/entry/src/main/ets/data/UserDataStore.ets#L70-L82 | 34c83dcbec0eca531273df909aaf35154cf807db | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/DataRenderer.ets | arkts | Superclass of all render classes for the different data types (line, bar, ...). | export default abstract class DataRenderer extends Renderer {
/**
* the animator object used to perform animations on the chart data
*/
protected mAnimator: ChartAnimator | null = null;
/**
* main paint object used for rendering
*/
protected mRenderPaint: Paint = new Paint();
// protected mPathPai... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class DataRenderer extends AST#type_annotation#Left AST#primary_type#Left Renderer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* the animator object used to perform animations on the chart data
*/ AST#pro... | export default abstract class DataRenderer extends Renderer {
protected mAnimator: ChartAnimator | null = null;
protected mRenderPaint: Paint = new Paint();
protected mHighlightPaint: Paint = new Paint();
protected mDrawPaint: Paint = new Paint();
public mValuePaint: Paint = new Paint();
co... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/DataRenderer.ets#L32-L200 | 7217cb4f6762e04dd0aa84ea8d23a91a39a27f6d | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets | arkts | startAdvertising | 2 首次启动广播 | public async startAdvertising() {
// 2.1 设置广播发送的参数
console.info('startAdvertising 2.1')
let setting: ble.AdvertiseSetting = {
interval: 160,
txPower: 0,
connectable: true
};
// 2.2 构造广播数据
console.info('startAdvertising 2.2')
let manufactureValueBuffer = new Uint8Array(4);
... | AST#method_declaration#Left public async startAdvertising AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 2.1 设置广播发送的参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cons... | public async startAdvertising() {
console.info('startAdvertising 2.1')
let setting: ble.AdvertiseSetting = {
interval: 160,
txPower: 0,
connectable: true
};
console.info('startAdvertising 2.2')
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets#L66-L125 | 9bb61b3aa7aedd99c72c63d454d253c696682464 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarDataSet.ets | arkts | getEntryCountStacks | returns the overall entry count, including counting each stack-value
individually
@return | public getEntryCountStacks(): number {
return this.mEntryCountStacks;
} | AST#method_declaration#Left public getEntryCountStacks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#memb... | public getEntryCountStacks(): number {
return this.mEntryCountStacks;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarDataSet.ets#L209-L211 | ad99715fe9ea23c812e82017c8c4b79338d4b6ce | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isInt16Array | 检查是否为Int16Array数组类型。
@param value
@returns | static isInt16Array(value: Object): boolean {
return new util.types().isInt16Array(value);
} | AST#method_declaration#Left static isInt16Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static isInt16Array(value: Object): boolean {
return new util.types().isInt16Array(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L210-L212 | c5fc943a31f780f89f26f93fdc0b8f0155dc596d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/widgets/BirthdayWidget.ets | arkts | onVisibilityChange | 卡片可见性变化 | onVisibilityChange(newStatus: { [key: string]: number }): void {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onVisibilityChange');
for (const formId in newStatus) {
const isVisible = newStatus[formId] === formInfo.VisibilityType.FORM_VISIBLE;
th... | AST#method_declaration#Left onVisibilityChange AST#parameter_list#Left ( AST#parameter#Left newStatus : AST#ERROR#Left { AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left key AST#primary_type#Right AST#type_annotation#Right : AST#ERROR#Rig... | onVisibilityChange(newStatus: { [key: string]: number }): void {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onVisibilityChange');
for (const formId in newStatus) {
const isVisible = newStatus[formId] === formInfo.VisibilityType.FORM_VISIBLE;
th... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/BirthdayWidget.ets#L74-L85 | 07093c14cb5e06f2807afb40cfa56e1a40da7b2c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets | arkts | getData | 获取指定数据项 | getData(index: number): NewsCommentModel {
return this.comments[index];
} | AST#method_declaration#Left getData 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 NewsCommentModel AST#primary_typ... | getData(index: number): NewsCommentModel {
return this.comments[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L125-L127 | 79d28e2e262bad3b2e93069b2bddd07c3d771ee0 | gitee |
openharmony/bundlemanager_bundle_framework | 89882654172b6bfba2a4a1ebfacdd6c9296f6f21 | interfaces/kits/ani/bundle_manager/ets/bundleManager/Metadata.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 Metadata {
name: string;
value: string;
resource: string;
readonly valueId?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Metadata 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 value : AST#type_annotation#Left AST... | export interface Metadata {
name: string;
value: string;
resource: string;
readonly valueId?: number;
} | https://github.com/openharmony/bundlemanager_bundle_framework/blob/89882654172b6bfba2a4a1ebfacdd6c9296f6f21/interfaces/kits/ani/bundle_manager/ets/bundleManager/Metadata.ets#L16-L21 | 29a01be66b38cbb5a511641d49861d3f93536fad | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 60% 百分比 | export const P60: string = "60%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P60 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "60%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P60: string = "60%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L69-L69 | c3da33c37b224890ffd91b8187ea41f663189990 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | clearData | 清除数据函数 | public clearData(): void {
this.originDataArray = [];
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | AST#method_declaration#Left public clearData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m... | public clearData(): void {
this.originDataArray = [];
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L45-L50 | a58f967dec363aa83c06da1cf1d79c25c2c36cfa | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Wifi/WifiScan.ets | arkts | scan | 扫描wifi | async scan() {
// 获取有关Wi-Fi连接的信息,存入linkedInfo
await this.getLinkedInfo()
// 不停地扫描wifi
let result: Array<WifiType> = await this.wifiModel.getScanInfos()
if (this.isSwitchOn) {
AppStorage.SetOrCreate('wifiList', result)
setTimeout(async () => {
await this.scan()
}, 3000)
... | AST#method_declaration#Left async scan AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取有关Wi-Fi连接的信息,存入linkedInfo AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await... | async scan() {
await this.getLinkedInfo()
let result: Array<WifiType> = await this.wifiModel.getScanInfos()
if (this.isSwitchOn) {
AppStorage.SetOrCreate('wifiList', result)
setTimeout(async () => {
await this.scan()
}, 3000)
}
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Wifi/WifiScan.ets#L68-L79 | 2ce119ec8753f1df044156e3e1f40f559d993465 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | /// ArkUI ///// see common_ts_ets_api.d.ts /////
Defines the AppStorage interface.
@since 7 | export class AppStorage {
/**
* Returns an alias to the AppStorage property with given name.
* @param propName - a property name
* @returns an AbstractProperty by the given name, or `undefined` if it does not exist
*/
static ref<T>(propName: string): AbstractProperty<T> | undefined {
... | AST#export_declaration#Left export AST#class_declaration#Left class AppStorage AST#class_body#Left { /**
* Returns an alias to the AppStorage property with given name.
* @param propName - a property name
* @returns an AbstractProperty by the given name, or `undefined` if it does not exist
*/ AST#met... | export class AppStorage {
static ref<T>(propName: string): AbstractProperty<T> | undefined {
return StorageMap.shared.entry<T>(propName)
}
static setAndRef<T>(propName: string, defaultValue: T): AbstractProperty<T> {
return StorageMap.shared.entryOrCreate(propName, defaultValue)
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L27-L256 | ec904ae4b908151638c59a47569ae83a8c5310b5 | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | onEpisodeSearchSubmit | 执行搜索(用户点击搜索或回车) | onEpisodeSearchSubmit() {
if (this.episodeSearchKeyword && this.episodeSearchKeyword.trim() !== '') {
this.searchEpisodes();
}
} | AST#method_declaration#Left onEpisodeSearchSubmit 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#call_expression#Left AST#expression#Left AST#member_expres... | onEpisodeSearchSubmit() {
if (this.episodeSearchKeyword && this.episodeSearchKeyword.trim() !== '') {
this.searchEpisodes();
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L285-L289 | dff3c3561ed02b5806412d18f7653bf5466d85f0 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleBackupManager.ets | arkts | 备份状态枚举 | export enum BackupStatus {
IDLE = 'idle',
BACKING_UP = 'backing_up',
RESTORING = 'restoring',
COMPLETED = 'completed',
FAILED = 'failed'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum BackupStatus AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left BACKING_UP = AST#expression#Left 'backing_up' AST#expression#Right AST#enum_member#Right , AST#enum... | export enum BackupStatus {
IDLE = 'idle',
BACKING_UP = 'backing_up',
RESTORING = 'restoring',
COMPLETED = 'completed',
FAILED = 'failed'
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L7-L13 | 1819fdec92e2ed6a26a49f50c3f85c6c1bc9e82c | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/guide/GuideService.ets | arkts | markGuideShown | 标记引导已显示 | async markGuideShown(key: string): Promise<void> {
try {
const guideKey = `${this.GUIDE_PREFIX}${key}`;
await StorageManager.setBoolean(guideKey, true);
await StorageManager.setNumber(`${guideKey}_count`, await this.getGuideShowCount(key) + 1);
await StorageManager.setNumber(`${guideKey}_tim... | AST#method_declaration#Left async markGuideShown AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | async markGuideShown(key: string): Promise<void> {
try {
const guideKey = `${this.GUIDE_PREFIX}${key}`;
await StorageManager.setBoolean(guideKey, true);
await StorageManager.setNumber(`${guideKey}_count`, await this.getGuideShowCount(key) + 1);
await StorageManager.setNumber(`${guideKey}_tim... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L35-L45 | b90bde33370a01d0f20bde64d62e6b526ee73b0b | github |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets | arkts | getHeader | Getter and setter for header | getHeader(): TreeMap<string, string> | undefined {
return this.header;
} | AST#method_declaration#Left getHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left TreeMap AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ,... | getHeader(): TreeMap<string, string> | undefined {
return this.header;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L74-L76 | dac8bfc45aac11531d568f60ee0383a9b8994e1f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/graphic/DisplaySync/entry/src/main/ets/DispalySync/CustomDrawDisplaySync.ets | arkts | doSomeRenderFirst | [Start display_sync_create_text_component] | @Builder
doSomeRenderFirst() {
Text('30')
.fontSize(this.drawFirstSize)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right doSomeRenderFirst 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 Text ( AST#expression#Left '30' AST#expression#Right ) A... | @Builder
doSomeRenderFirst() {
Text('30')
.fontSize(this.drawFirstSize)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/graphic/DisplaySync/entry/src/main/ets/DispalySync/CustomDrawDisplaySync.ets#L36-L40 | d7659d9b0288e7efcf04c523052d43b3763ab5c8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | addData | 在指定索引位置增加一个元素
@param index 数组索引
@param data 元素对象 | public addData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 0, data);
this.notifyDataReload();
} | AST#method_declaration#Left public addData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#... | public addData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 0, data);
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L44-L47 | e2f5c225bdda598c02a2333b9cb5c320a65a0cff | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | endsWith | 检查字符串是否以给定的字符串结尾
@param str 要检索的字符串
@param target 要检索字符
@param position 检索的位置
@returns 如果字符串以字符串结尾,那么返回 true,否则返回 false | static endsWith(str: string = '', target: string, position: number = str.length): boolean {
return str.endsWith(target, position);
} | AST#method_declaration#Left static endsWith 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#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#Left A... | static endsWith(str: string = '', target: string, position: number = str.length): boolean {
return str.endsWith(target, position);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L127-L129 | bbf7c26073d58ea4a350493a86cbbb88b813ecb5 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinG.ets | arkts | SpinG | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinG {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local scale2: number = 0.5;
@Local scale3: number = 0;
build() {
Row() {
Canvas()
.chunkStyle()
.scale({ x: this.scale1, y: this.scale1 })
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinG AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinG {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 1;
@Local scale2: number = 0.5;
@Local scale3: number = 0;
build() {
Row() {
Canvas()
.chunkStyle()
.scale({ x: this.scale1, y: this.scale1 })
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinG.ets#L26-L138 | 90050d8363067ec8efd1fb0fe8d1f2490fb5cb32 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | isSameYear | 是否是同一年 | static isSameYear(selectDate: Date, date: Date) {
return selectDate.getFullYear() === date.getFullYear();
} | AST#method_declaration#Left static isSameYear AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_typ... | static isSameYear(selectDate: Date, date: Date) {
return selectDate.getFullYear() === date.getFullYear();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L116-L118 | b812ec7310a730e6aaa8885902e96cbb4ef138ac | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/marquee/src/main/ets/model/DataSource.ets | arkts | pushData | 存储数据到懒加载数据源中 | pushData(data: TripDataType): void {
this.tripData.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.tripData.length - 1);
} | AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TripDataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | pushData(data: TripDataType): void {
this.tripData.push(data);
this.notifyDataAdd(this.tripData.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataSource.ets#L94-L98 | c635be086b1c096e743f06fe6140d45b1f7edf08 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getJoinedTitleItemsByRemovingDuplications | ================== 文本处理高级方法 ================== / 合并相同pos的翻译,并且去除重复part, 返回重新组合好的pos + title数组 | static getJoinedTitleItemsByRemovingDuplications(srcTexts: string[], maxParts: number): TitleItem[] {
const titleItems: TitleItem[] = [];
for (const srcText of srcTexts) {
const srcTextsSub: string[] = srcText.split("\n");
for (const srcTextSub of srcTextsSub) {
if (srcTextSub.length === 0)... | AST#method_declaration#Left static getJoinedTitleItemsByRemovingDuplications AST#parameter_list#Left ( AST#parameter#Left srcTexts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef... | static getJoinedTitleItemsByRemovingDuplications(srcTexts: string[], maxParts: number): TitleItem[] {
const titleItems: TitleItem[] = [];
for (const srcText of srcTexts) {
const srcTextsSub: string[] = srcText.split("\n");
for (const srcTextSub of srcTextsSub) {
if (srcTextSub.length === 0)... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L322-L360 | dcd8818458e12569c59faada47b00ed837571366 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | @file 商品相关数据源实现类
@author Joker.X | export class GoodsNetworkDataSourceImpl implements GoodsNetworkDataSource {
/**
* 查询商品分类列表
* @returns 商品分类列表响应
*/
async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
const resp: AxiosResponse<NetworkResponse<Category[]>> =
await NetworkClient.http.post("goods/type/list");
return ... | AST#export_declaration#Left export AST#class_declaration#Left class GoodsNetworkDataSourceImpl AST#implements_clause#Left implements GoodsNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 查询商品分类列表
* @returns 商品分类列表响应
*/ AST#method_declaration#Left async getGoodsTypeList AST#parameter_li... | export class GoodsNetworkDataSourceImpl implements GoodsNetworkDataSource {
async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
const resp: AxiosResponse<NetworkResponse<Category[]>> =
await NetworkClient.http.post("goods/type/list");
return resp.data;
}
async getGoodsSpecList(pa... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L22-L97 | d37122beb631e03687edc7e343d5ebad6a46b390 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets | arkts | 初始化需要UIContext 需在Ability获取 | export const createNWeb = (url: string, uiContext: UIContext) => {
// 创建NodeController
let baseNode = new MyNodeController();
let controller = new webview.WebviewController();
// 初始化自定义Web组件
baseNode.initWeb(url, uiContext, controller);
controllerMap.set(url, controller)
nodeMap.set(url, baseNode);
}
// 自... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left createNWeb = AST#expression#Left AST#arrow_function#Left 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#param... | export const createNWeb = (url: string, uiContext: UIContext) => {
let baseNode = new MyNodeController();
let controller = new webview.WebviewController();
baseNode.initWeb(url, uiContext, controller);
controllerMap.set(url, controller)
nodeMap.set(url, baseNode);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry2/src/main/ets/pages/common.ets#L99-L108 | 62e0f28f82cc3b8935afe4374388f79f36fe49b3 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/cs/CsNavigator.ets | arkts | @file 客服模块导航封装
@author Joker.X | export class CsNavigator {
/**
* 跳转到客服聊天
* @returns {void} 无返回值
*/
static toChat(): void {
navigateTo(CsRoutes.Chat);
}
} | AST#export_declaration#Left export AST#class_declaration#Left class CsNavigator AST#class_body#Left { /**
* 跳转到客服聊天
* @returns {void} 无返回值
*/ AST#method_declaration#Left static toChat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | export class CsNavigator {
static toChat(): void {
navigateTo(CsRoutes.Chat);
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/cs/CsNavigator.ets#L8-L16 | 5e1d485f09b79926c488fbdb4250ff3a1e4c9625 | github | |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/form/src/main/ets/default/view/FormManagerComponent.ets | arkts | clearAllFormById | Delete all form by id. | private clearAllFormById(): void {
for (let i = 0; i < this.mFormIdMap.size; i++) {
this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i));
}
} | AST#method_declaration#Left private clearAllFormById 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#for_statement#Left for ( AST#variable_declaration#Left let AS... | private clearAllFormById(): void {
for (let i = 0; i < this.mFormIdMap.size; i++) {
this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i));
}
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormManagerComponent.ets#L130-L134 | fbe2bab547f3ca8dd48efc4364bac26d87683183 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/primitives/primitives_string_001_T.ets | arkts | Introduction 基础数据类型-string | export function primitives_string_001_T(taint_src : string) : void {
taint.Sink(taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function primitives_string_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno... | export function primitives_string_001_T(taint_src : string) : void {
taint.Sink(taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/primitives/primitives_string_001_T.ets#L7-L9 | e8d7269b346c008d49b0e0087f42051dc91a43b5 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | workingMainTab | Gets the current main tab.
@returns A tab_info_packed object, of the current main tab. | workingMainTab() {
return this.Tabs[this.main_tab_idx];
} | AST#method_declaration#Left workingMainTab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ... | workingMainTab() {
return this.Tabs[this.main_tab_idx];
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L488-L490 | 703e4414667829e24a33594799096b7927d58b49 | gitee |
Duke_Bit/ElfRefresh | 56faf5431c1643ec5ae227dc854a31b391778b2c | library/src/main/ets/uitls/LengthUtil.ets | arkts | parseToVP | 核心转换方法(新增calc支持)
@param input 输入字符串,支持格式:'calc( 50% - 20vp )' | '100vp' | '50%'
@param parentSize 父容器尺寸(单位vp)
@returns 转换后的vp数值 | static parseToVP(input: string | number, parentSize: number): number {
if(typeof input === 'number'){
return input;
}
// 统一处理输入空白
const cleanInput = input.replace(/\s+/g, '');
// 解析calc表达式
if (cleanInput.startsWith('calc(')) {
return LengthUtil._parseCalc(cleanInput, parentSize);
... | AST#method_declaration#Left static parseToVP AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS... | static parseToVP(input: string | number, parentSize: number): number {
if(typeof input === 'number'){
return input;
}
const cleanInput = input.replace(/\s+/g, '');
if (cleanInput.startsWith('calc(')) {
return LengthUtil._parseCalc(cleanInput, parentSize);
}
if (clean... | https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/library/src/main/ets/uitls/LengthUtil.ets#L8-L46 | f60796cf88e826134bd48bf4d4cebddacc65e323 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/keyAgree/X25519Sync.ets | arkts | x25519 | X25519动态协商密钥,要求密钥长度为256位的非对称密钥
@param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
@param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 256位共享密钥字符串 | static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static x25519 AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , ... | static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/X25519Sync.ets#L36-L39 | 15d050187aaf6a0a9597e4f62a00a6584f734112 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildContactListItem | 构建联系人列表项 | @Builder
buildContactListItem(contact: SimpleContact) {
Row({ space: 12 }) {
// 头像
Column() {
Text(contact.name.charAt(0))
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#FFFFFF')
}
.width(44)
.height(44)
.borderRadius(22)
.ba... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactListItem AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left SimpleContact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builde... | @Builder
buildContactListItem(contact: SimpleContact) {
Row({ space: 12 }) {
Column() {
Text(contact.name.charAt(0))
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#FFFFFF')
}
.width(44)
.height(44)
.borderRadius(22)
.backgro... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1536-L1634 | 0f0e61f23013a2d928b5bf4245bd84bb9440e3b7 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets | arkts | 获取设备信息
@param deviceId 设备ID | export async function getDeviceInfo(deviceId: number): Promise<InputDeviceInfo | null> {
try {
let deviceData: InputDeviceInfo;
let inputDeviceData: inputDevice.InputDeviceData = await inputDevice.getDeviceInfo(deviceId)
logger.info(`${TAG} get device info ${JSON.stringify(inputDeviceData)}`)
deviceD... | AST#export_declaration#Left export AST#function_declaration#Left async function getDeviceInfo AST#parameter_list#Left ( AST#parameter#Left deviceId : 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_annotatio... | export async function getDeviceInfo(deviceId: number): Promise<InputDeviceInfo | null> {
try {
let deviceData: InputDeviceInfo;
let inputDeviceData: inputDevice.InputDeviceData = await inputDevice.getDeviceInfo(deviceId)
logger.info(`${TAG} get device info ${JSON.stringify(inputDeviceData)}`)
deviceD... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputDeviceUtil.ets#L58-L84 | 7cd2324ae0270eda3c7ccffaf1d62d27853ab500 | gitee | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/UserModel.ets | arkts | setCurrentUser | 设置当前登录用户 | private static async setCurrentUser(username: string): Promise<void> {
if (!UserManager.preferencesInstance) {
return;
}
try {
await UserManager.preferencesInstance.put(UserManager.KEY_CURRENT_USER, username);
await UserManager.preferencesInstance.flush();
} catch (error) {
cons... | AST#method_declaration#Left private static async setCurrentUser AST#parameter_list#Left ( AST#parameter#Left username : 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 A... | private static async setCurrentUser(username: string): Promise<void> {
if (!UserManager.preferencesInstance) {
return;
}
try {
await UserManager.preferencesInstance.put(UserManager.KEY_CURRENT_USER, username);
await UserManager.preferencesInstance.flush();
} catch (error) {
cons... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L152-L163 | 3ac36a706364753dccebf9e00f95fd2ef53f74fd | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPStack.ets | arkts | peek | 查看栈顶元素但不移除 | peek(): T | undefined {
return this._items[this._items.length - 1];
} | AST#method_declaration#Left peek AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#state... | peek(): T | undefined {
return this._items[this._items.length - 1];
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L19-L21 | d9a872015fd7840f0b939fbc76cff669d58c5a6a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/DataFactory.ets | arkts | 获取FriendMoment的模拟数据列表 | export async function getFriendMomentObjFromJSON(): Promise<Array<FriendMoment>> {
Logger.info(TAG, 'getFriendMomentObjFromJSON');
let jsonObj: JsonObject = new JsonObject(MOCK_DATA_FILE_DIR);
return await jsonObj.getFriendMomentObj();
} | AST#export_declaration#Left export AST#function_declaration#Left async function getFriendMomentObjFromJSON AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#gene... | export async function getFriendMomentObjFromJSON(): Promise<Array<FriendMoment>> {
Logger.info(TAG, 'getFriendMomentObjFromJSON');
let jsonObj: JsonObject = new JsonObject(MOCK_DATA_FILE_DIR);
return await jsonObj.getFriendMomentObj();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/DataFactory.ets#L77-L81 | 0834e09d295f8c74ea51f97de7fd106a6e4a4001 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Logger.ets | arkts | @Author csx
@DateTime 2023/12/29 20:10
@TODO Logger 日志工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core | export class Logger {
//优化日志 https://gitee.com/harmonyos_samples/logger
//获取内存信息 https://gitee.com/harmonyos_samples/debug
private static maxSize = 1024;
private static domain: number;
private static prefix: string;
private static format: string = '%{public}s%{public}s';
/**
* 初始化Logger,只需传入应用名和域
... | AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { //优化日志 https://gitee.com/harmonyos_samples/logger //获取内存信息 https://gitee.com/harmonyos_samples/debug AST#property_declaration#Left private static maxSize = AST#expression#Left 1024 AST#expression#Right ; AST#property_dec... | export class Logger {
private static maxSize = 1024;
private static domain: number;
private static prefix: string;
private static format: string = '%{public}s%{public}s';
static init(prefix: string = 'efTool', ctx: common.Context, domain: number = 0xFF00) {
Logger.prefix = prefix;
Logger.do... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L27-L150 | 124e6b2d6feac8f0a7464be77d52ba5ff810a180 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/ResetPasswordPage.ets | arkts | ResetPasswordPage | @file 重置密码页面视图
@author Joker.X | @ComponentV2
export struct ResetPasswordPage {
/**
* 重置密码页面 ViewModel
*/
@Local
private vm: ResetPasswordViewModel = new ResetPasswordViewModel();
/**
* 手机号输入
*/
@Local
private phone: string = "";
/**
* 验证码输入
*/
@Local
private verificationCode: string = "";
/**
* 新密码输入
*/
@... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ResetPasswordPage 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 Re... | @ComponentV2
export struct ResetPasswordPage {
@Local
private vm: ResetPasswordViewModel = new ResetPasswordViewModel();
@Local
private phone: string = "";
@Local
private verificationCode: string = "";
@Local
private newPassword: string = "";
@Local
private confirmPassword: string = "... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/ResetPasswordPage.ets#L14-L137 | d895d4485726ce355dd96a66c59e5f052a4f6c51 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/utils/Logger.ets | arkts | 简单的日志工具类 | export class Logger {
private static readonly TAG: string = 'Algorithm';
/**
* 输出信息日志
* @param message 日志信息
*/
public static info(message: string): void {
console.info(`[${Logger.TAG}] ${message}`);
}
/**
* 输出警告日志
* @param message 日志信息
*/
public static warn(message: string): void {
... | AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private static readonly TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Algorithm' AST#expression#Right ; AST... | export class Logger {
private static readonly TAG: string = 'Algorithm';
public static info(message: string): void {
console.info(`[${Logger.TAG}] ${message}`);
}
public static warn(message: string): void {
console.warn(`[${Logger.TAG}] ${message}`);
}
public static error(message: string... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L4-L38 | a5b33e3492e0df5fe5a96e41b24f3919dff5212f | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/RandomUtil.ets | arkts | randomNumber | 获得指定范围内的随机数
@param min 最小数(包含)
@param max 最大数(不包含)
@return 随机数 | static randomNumber(min: number, max: number): number {
return Math.floor(Math.random() * (max - min) + min);
} | AST#method_declaration#Left static randomNumber AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | static randomNumber(min: number, max: number): number {
return Math.floor(Math.random() * (max - min) + min);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/RandomUtil.ets#L56-L58 | 971b56d598edcd2221eee65382bcef10984059f3 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets | arkts | 用户登录参数 | export interface LoginParams {
username: string;
password: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LoginParams AST#object_type#Left { AST#type_member#Left username : 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 password : AST#type_annotatio... | export interface LoginParams {
username: string;
password: string;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L269-L272 | 3736cd73be0d4b16c2e4cb2caa5b9ef7b6003815 | github | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/common/CommonConstants.ets | arkts | Common constants for common component. | export class CommonConstants {
// Font family
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
// Font weight
static readonly DIALOG_TITLE_FONT_WEIGHT: ... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // Font family AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left stati... | export class CommonConstants {
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
static readonly DIALOG_TITLE_FONT_WEIGHT: number = 700;
static reado... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/common/CommonConstants.ets#L4-L58 | 4dd6682f6882fc249c113f9c6c947b11fea7c793 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/WorldClockViewModel.ets | arkts | removeCity | 从城市列表中移除指定索引的城市。
@param indexToRemove 要移除的城市索引 | public removeCity(indexToRemove: number) {
this.cities.splice(indexToRemove, 1)
this.setCitiesToDatabase()
} | AST#method_declaration#Left public removeCity AST#parameter_list#Left ( AST#parameter#Left indexToRemove : 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 ... | public removeCity(indexToRemove: number) {
this.cities.splice(indexToRemove, 1)
this.setCitiesToDatabase()
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/WorldClockViewModel.ets#L137-L140 | 42d7d27ad01757a08d6ccdaa480e7867827393c7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/SceneModuleInfo.ets | arkts | 首页瀑布流列表信息 | export class SceneModuleInfo {
// 首页列表图片
imageSrc: ResourceStr;
// 首页列表名称
name: string;
// 路由信息,自动生成路由时,在自定义装饰器中AppRouter中配置的参数,使用新版本自动路由时需要添加此参数,用于动态路由的跳转。使用规则:模块名/需要加载的自定义组件名,如addressexchange/AddressExchangeView
appUri: string;
// 路由传参数据
param: string;
// 难度星级
ratingNumber: number;
// 分类
categ... | AST#export_declaration#Left export AST#class_declaration#Left class SceneModuleInfo AST#class_body#Left { // 首页列表图片 AST#property_declaration#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 首页列表名称 AST#property... | export class SceneModuleInfo {
imageSrc: ResourceStr;
name: string;
appUri: string;
param: string;
ratingNumber: number;
category: string;
serialNumber: number;
swiperImage: ResourceStr;
helperUrl: string;
constructor(imageSrc: ResourceStr, name: string, appUri: string, c... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/SceneModuleInfo.ets#L19-L51 | 4b01404c4aa693ee7fddbeb4e2059576206bf52d | gitee | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/request/Request.type.ets | arkts | host地址 | export const BASE_HOST = '118.31.50.145:9003' | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BASE_HOST = AST#expression#Left '118.31.50.145:9003' AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export const BASE_HOST = '118.31.50.145:9003' | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/request/Request.type.ets#L9-L9 | 974c217e171557a1c45b17c5b7f2eda44b5a16ba | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets | arkts | BuilderNodePoolDemo | 全局自定义组件复用池页面,可以实现跨页面、跨父组件复用子组件,减少组件创建耗时,提高应用性能 | @Component
export struct BuilderNodePoolDemo {
@State arrayTitle: Title[] = [];
arrayStr: string[] = [Constants.HOME, Constants.FILM, Constants.TELEPLAY, Constants.ANIMATION, Constants.SPORT];
@State array: TitleDataSource = new TitleDataSource();
swiperController: SwiperController = new SwiperController();
@... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BuilderNodePoolDemo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right arrayTitle : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Title [ ] AST#... | @Component
export struct BuilderNodePoolDemo {
@State arrayTitle: Title[] = [];
arrayStr: string[] = [Constants.HOME, Constants.FILM, Constants.TELEPLAY, Constants.ANIMATION, Constants.SPORT];
@State array: TitleDataSource = new TitleDataSource();
swiperController: SwiperController = new SwiperController();
@... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets#L88-L168 | 9466ee6aa8525668c0515ecb00dbe48d1d61ff85 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/UtilsPage.ets | arkts | startPage | 跳转到详情页
@param describe | startPage(describe: DescribeBean) {
let url = `pages/${describe.name}Page`;
if (describe.type == 1) {
url = `pages/utils/${describe.name}Page`;
} else if (describe.type == 2) {
url = `pages/crypto/${describe.name}Page`;
}
router.pushUrl({ url: url, params: describe })
} | AST#method_declaration#Left startPage AST#parameter_list#Left ( AST#parameter#Left describe : AST#type_annotation#Left AST#primary_type#Left DescribeBean 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... | startPage(describe: DescribeBean) {
let url = `pages/${describe.name}Page`;
if (describe.type == 1) {
url = `pages/utils/${describe.name}Page`;
} else if (describe.type == 2) {
url = `pages/crypto/${describe.name}Page`;
}
router.pushUrl({ url: url, params: describe })
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/UtilsPage.ets#L42-L50 | ddb5bbedb089f35ae39172fc4fb6c6417672f718 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData.ets | arkts | getLegalHolidays | 获取法定节假日 | public static getLegalHolidays(): FestivalInfo[] {
return FestivalData.getAllFestivals().filter(festival => festival.isLegal);
} | AST#method_declaration#Left public static getLegalHolidays AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FestivalInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re... | public static getLegalHolidays(): FestivalInfo[] {
return FestivalData.getAllFestivals().filter(festival => festival.isLegal);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData.ets#L259-L261 | fb97880c4efbeb7a5c698c230e8ca7aa03daa050 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | signSegment | 对数据进行分段签名,异步
@param data 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
@param len 自定义的数据拆分长度。
@returns | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + ... | AST#method_declaration#Left static async signSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualifi... | static async signSegment(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): Promise<cryptoFramework.DataBlob> {
let signer = cryptoFramework.createSign(algName);
await signer.init(priKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L353-L364 | 273d1eeaa4f769d6e3458dda3fc9f474ba92c924 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | update_web_settings | Syncs the Web Settings (js, image, force dark) to the according LocalStorage.
@param index The index of tab. | update_web_settings() {
// JS
let main_switch_js = AppStorage.get('disable_js') as boolean;
let sub_switch_js = AppStorage.get('disable_js_all_sites') as boolean;
let disable_js_these_sites = AppStorage.get('disable_js_these_sites') as string[];
// Image
let main_switch_image = AppStorage.get('d... | AST#method_declaration#Left update_web_settings AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // JS AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left main_switch_js = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left... | update_web_settings() {
let main_switch_js = AppStorage.get('disable_js') as boolean;
let sub_switch_js = AppStorage.get('disable_js_all_sites') as boolean;
let disable_js_these_sites = AppStorage.get('disable_js_these_sites') as string[];
let main_switch_image = AppStorage.get('disable_image'... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L928-L966 | c16b626addf3de942663371286fd784da632663b | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AssetUtil.ets | arkts | get | 查询关键资产
@param key
@returns | static async get(key: string): Promise<string> {
try {
if (!AssetUtil.canIUse()) {
LogUtil.error(`AssetStore-当前设备不支持该模块`);
return "";
}
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key));
query.set(asset.Tag.RETURN_TYPE, asse... | AST#method_declaration#Left static 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pro... | static async get(key: string): Promise<string> {
try {
if (!AssetUtil.canIUse()) {
LogUtil.error(`AssetStore-当前设备不支持该模块`);
return "";
}
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, StrUtil.strToUint8Array(key));
query.set(asset.Tag.RETURN_TYPE, asse... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AssetUtil.ets#L96-L120 | 089ac40a229e0cb3eb2f063455df5cfbe125e91e | gitee |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/TaoYao.ets | arkts | isDistributedEnabled | 判断是否支持分布式通知
@returns true支持,false不支持 | static isDistributedEnabled(): Promise<boolean> {
return NotificationPermissionChecker.isDistributedEnabled()
} | AST#method_declaration#Left static isDistributedEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > ... | static isDistributedEnabled(): Promise<boolean> {
return NotificationPermissionChecker.isDistributedEnabled()
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L95-L97 | cb11c243e115448e67ab8e50b1166f94477d8fcf | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | setLottieAnimation | 设置lottie动画
@param lottieFunction lottie动画函数
@returns | setLottieAnimation(lottieFunction: (arg: CanvasRenderingContext2D) => void): EfRcp {
lottieFunction(efRcpConfig.loading.lottieRenderingCtx);
return this;
} | AST#method_declaration#Left setLottieAnimation AST#parameter_list#Left ( AST#parameter#Left lottieFunction : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left arg : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotati... | setLottieAnimation(lottieFunction: (arg: CanvasRenderingContext2D) => void): EfRcp {
lottieFunction(efRcpConfig.loading.lottieRenderingCtx);
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L438-L441 | 1cc28f1aa8c1db81938d398cd2a5c2dc144cc231 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/CustomComponent.ets | arkts | CustomTabBar | 非选中状态的外边距初始值 | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
build() {
Row() {
ForEach(tabsInfo, (item: TabBarData) => {
this.tabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
.clip(false)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#ty... | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
build() {
Row() {
ForEach(tabsInfo, (item: TabBarData) => {
this.tabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
.clip(false)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/CustomComponent.ets#L22-L73 | 3514e66aa47a15521234418ea8de7bbc9ff292c9 | gitee |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/pages/musicView/DetailsPage.ets | arkts | playComponent | 顶部状态栏高度 自定义播放组件。仅用于UX展示 | @Builder
playComponent() {
Column() {
Row() {
Text($r('app.string.mini_player_animation_playback_duration'))
.fontSize($r('app.float.mini_player_animation_font_size'))
.opacity($r('app.float.mini_player_animation_time_opacity'))
.fontColor(Color.White)
Slider({
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right playComponent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el... | @Builder
playComponent() {
Column() {
Row() {
Text($r('app.string.mini_player_animation_playback_duration'))
.fontSize($r('app.float.mini_player_animation_font_size'))
.opacity($r('app.float.mini_player_animation_time_opacity'))
.fontColor(Color.White)
Slider({
... | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/pages/musicView/DetailsPage.ets#L39-L116 | 0b04766200cb11ad5ae5cbd8f53d777f9773f359 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/RegisterPage.ets | arkts | 构建注册页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.RegisterContent();
}
} | 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left... | build(): void {
AppNavDestination({
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") },
viewModel: this.vm
}) {
this.RegisterContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/RegisterPage.ets#L49-L57 | 82f827760ee2f85eefc832b6488a0a06d8b8545e | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/Part_Unit.ets | arkts | get | 获取下一个要学习的单词索引 | get indexOfNextLearnWord(): number {
const aliveWords = this.aliveWords;
for (let i = 0; i < aliveWords.length; i++) {
if (aliveWords[i].learnTimes === 0) {
return i;
}
}
return 0;
} | AST#method_declaration#Left get AST#ERROR#Left in dexOfNextLearnWord AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left c... | get indexOfNextLearnWord(): number {
const aliveWords = this.aliveWords;
for (let i = 0; i < aliveWords.length; i++) {
if (aliveWords[i].learnTimes === 0) {
return i;
}
}
return 0;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Part_Unit.ets#L34-L42 | 3e8a8466eb9ef30ca5efd77ccb487f1dbc5a3e7b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceVerticalSmall | 创建一个小垂直间距(8vp)
@returns {void} 无返回值 | @Builder
export function SpaceVerticalSmall(): void {
Blank().height($r("app.float.space_vertical_small"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalSmall AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts... | @Builder
export function SpaceVerticalSmall(): void {
Blank().height($r("app.float.space_vertical_small"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L46-L49 | e9b981e59b3b98a9542d122fe1f32cec8f2c62d9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData2025.ets | arkts | isFestival | 判断指定日期是否为节日 | public static isFestival(year: number, month: number, day: number): boolean {
const solarFestivals = FestivalData2025.getFestivals(year, month, day, false);
const lunarFestivals = FestivalData2025.getFestivals(year, month, day, true);
return solarFestivals.length > 0 || lunarFestivals.length > 0;
} | AST#method_declaration#Left public static isFestival AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | public static isFestival(year: number, month: number, day: number): boolean {
const solarFestivals = FestivalData2025.getFestivals(year, month, day, false);
const lunarFestivals = FestivalData2025.getFestivals(year, month, day, true);
return solarFestivals.length > 0 || lunarFestivals.length > 0;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L272-L276 | 46b0bd40aca67637c97ebc1cbaec533ec795f764 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.mediaquery.d.ets | arkts | matchMedia | Queries a media item and returns a MediaQueryList object.
@param { string } condition
@returns { MediaQueryList }
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
Queries a media item and returns a MediaQueryList object.
@param { string } condition
@returns { MediaQueryList }
@syscap SystemCapability.ArkUI.ArkUI.... | static matchMedia(condition: string): MediaQueryList; | AST#method_declaration#Left static matchMedia AST#parameter_list#Left ( AST#parameter#Left condition : 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 MediaQueryList AST... | static matchMedia(condition: string): MediaQueryList; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.mediaquery.d.ets#L194-L194 | 7683893e0fdce963046e2d5f725ee4175e1659c0 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/notify/NotificationHelper.ets | arkts | isServiceReady | 检查notification服务是否启动 | async isServiceReady(): Promise<void> {
const retryTimes: number = 10;
let count: number = 0;
let isReady: boolean = false;
while (count < retryTimes) {
try {
await notification.isDistributedEnabled().then(() => {
this.logInfo('notification service is ready');
isReady =... | AST#method_declaration#Left async isServiceReady AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async isServiceReady(): Promise<void> {
const retryTimes: number = 10;
let count: number = 0;
let isReady: boolean = false;
while (count < retryTimes) {
try {
await notification.isDistributedEnabled().then(() => {
this.logInfo('notification service is ready');
isReady =... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L211-L233 | 8fd042d66e9cec65230bc3944551f14de867b3f0 | gitee |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/TimerPage.ets | arkts | formatStopwatchTime | 格式化方法 | formatStopwatchTime(): string {
const totalSeconds = Math.floor(this.stopwatchTime / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const milliseconds = Math.floor((this.stopwatchTime % 1000) / 10);
return `${this.pad(minutes)}:${this.pad(seconds)}.${this.pa... | AST#method_declaration#Left formatStopwatchTime 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#variable_declaration#Left const AST#variable_declarator#Left tot... | formatStopwatchTime(): string {
const totalSeconds = Math.floor(this.stopwatchTime / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const milliseconds = Math.floor((this.stopwatchTime % 1000) / 10);
return `${this.pad(minutes)}:${this.pad(seconds)}.${this.pa... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TimerPage.ets#L669-L675 | 4f3fc726dc34a326b8c81f2763ae936f9146f0c6 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets | arkts | getData | Get the latest data. | getData(): Array<TaskItemViewModel> {
return this.targetData;
} | AST#method_declaration#Left getData 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 TaskItemViewModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | getData(): Array<TaskItemViewModel> {
return this.targetData;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L36-L38 | cc200d1c4b4a7a4fd9ca2159352fdcbcb9fb99bf | gitee |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter7/entry/src/main/ets/model/ToolsModel.ets | arkts | 测试数据 | export class MackData {
static getTools(){
return [
new ToolsModel(
1,
'AppGallery',
'appGallery_connect.png',
'https://developer.huawei.com/consumer/cn/agconnect/',
'AppGallery Connect 致力于为开发者提供创意、开发、分发、运营、分析的全生命周期服务,可以提升开发、运营效率,帮助开发者实现用户及收入的规模增长。'
),
new... | AST#export_declaration#Left export AST#class_declaration#Left class MackData AST#class_body#Left { AST#method_declaration#Left static getTools AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ... | export class MackData {
static getTools(){
return [
new ToolsModel(
1,
'AppGallery',
'appGallery_connect.png',
'https://developer.huawei.com/consumer/cn/agconnect/',
'AppGallery Connect 致力于为开发者提供创意、开发、分发、运营、分析的全生命周期服务,可以提升开发、运营效率,帮助开发者实现用户及收入的规模增长。'
),
new... | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter7/entry/src/main/ets/model/ToolsModel.ets#L19-L94 | c61a34e13a5766122f0c3e9f0b28082b66559154 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets | arkts | decodingPictureNdk | Native多图图片解码
@param decodingType 解码类型(1:Gain map)
@returns | async decodingPictureNdk(auxType: image.AuxiliaryPictureType, uri: string): Promise<void> {
logger.info(TAG, `decodingPicture start`);
logger.debug(TAG, `decodingPicture Type = ${auxType}`);
this.pixelMap = await NDKPictureDecoding(uri, auxType);
if (!this.pixelMap) {
logger.info(TAG, `decodingPic... | AST#method_declaration#Left async decodingPictureNdk AST#parameter_list#Left ( AST#parameter#Left auxType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . AuxiliaryPictureType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le... | async decodingPictureNdk(auxType: image.AuxiliaryPictureType, uri: string): Promise<void> {
logger.info(TAG, `decodingPicture start`);
logger.debug(TAG, `decodingPicture Type = ${auxType}`);
this.pixelMap = await NDKPictureDecoding(uri, auxType);
if (!this.pixelMap) {
logger.info(TAG, `decodingPic... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L180-L197 | 83e4c78b9b4d45ad946475375a583923e4cb1fc5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets | arkts | buildUsageTab | 构建使用情况标签页 | @Builder
buildUsageTab(usage: UsageStats) {
Scroll() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
// 使用时长统计
this.buildStatsCard('使用时长', [
{ label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') },
{ label: '本周使用', value: th... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUsageTab AST#parameter_list#Left ( AST#parameter#Left usage : AST#type_annotation#Left AST#primary_type#Left UsageStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b... | @Builder
buildUsageTab(usage: UsageStats) {
Scroll() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
this.buildStatsCard('使用时长', [
{ label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') },
{ label: '本周使用', value: this.format... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets#L507-L572 | 08d6661eb8314c026f3ec1812b39887f4957bac5 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets | arkts | 底部Tab栏数据结构 | export interface TabItem{
imgSrcNomral: ResourceStr;
imgSrcPress: ResourceStr;
tabText: ResourceStr;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TabItem AST#object_type#Left { AST#type_member#Left imgSrcNomral : 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 imgSrcPress : AST#type_a... | export interface TabItem{
imgSrcNomral: ResourceStr;
imgSrcPress: ResourceStr;
tabText: ResourceStr;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/GroupAvatarModel.ets#L49-L53 | 890a1803483ccd759edbc4c185d71be7152f8f2f | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample1/correct/b.ets | arkts | [Start foo_class] b.ets | export class Foo {
id: number = 0;
} | AST#export_declaration#Left export AST#class_declaration#Left class Foo AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right } AST#clas... | export class Foo {
id: number = 0;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample1/correct/b.ets#L3-L5 | 3f67aa9d436cbca026bebbfdf52818a719fc9888 | gitee | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/AgvMovementService.ets | arkts | agvStop | 停止AGV
@returns 控制结果 | static async agvStop(): Promise<Object> {
try {
console.info('[AgvMovementService] ⏹️ 停止AGV');
const response = await HttpUtil.post('/agv/movement/stop');
console.info('[AgvMovementService] ✅ AGV停止指令发送成功');
return response;
} catch (error) {
console.error('[AgvMovementService] ❌ 停止... | AST#method_declaration#Left static async agvStop 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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type... | static async agvStop(): Promise<Object> {
try {
console.info('[AgvMovementService] ⏹️ 停止AGV');
const response = await HttpUtil.post('/agv/movement/stop');
console.info('[AgvMovementService] ✅ AGV停止指令发送成功');
return response;
} catch (error) {
console.error('[AgvMovementService] ❌ 停止... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L76-L86 | 22c46264ba85315d9873ac3dd51eae73276e7617 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/GreetingsPage.ets | arkts | buildSearchAndFilter | 构建搜索和筛选栏 | @Builder
buildSearchAndFilter() {
Column({ space: 12 }) {
// 搜索框
Row({ space: 12 }) {
TextInput({ placeholder: '搜索祝福语内容或标签' })
.fontSize(16)
.backgroundColor('#ffffff')
.borderRadius(8)
.padding({ left: 16, right: 16 })
.layoutWeight(1)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchAndFilter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#componen... | @Builder
buildSearchAndFilter() {
Column({ space: 12 }) {
Row({ space: 12 }) {
TextInput({ placeholder: '搜索祝福语内容或标签' })
.fontSize(16)
.backgroundColor('#ffffff')
.borderRadius(8)
.padding({ left: 16, right: 16 })
.layoutWeight(1)
.on... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L206-L256 | 83fda59d73b641dc723f254405d9f0f379d09c41 | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | PieSlice | Draw pie slice | @Builder
PieSlice(item: CategoryStats, index: number) {
Path()
.width(180)
.height(180)
.commands(this.getPieSlicePath(item.percentage, this.getPieStartAngle(index)))
.fill(item.color)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right PieSlice AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CategoryStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Lef... | @Builder
PieSlice(item: CategoryStats, index: number) {
Path()
.width(180)
.height(180)
.commands(this.getPieSlicePath(item.percentage, this.getPieStartAngle(index)))
.fill(item.color)
} | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L230-L237 | 07cbd237884eede6d22992946d45d6dd291bf422 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/DataSet.ets | arkts | The DataSet class represents one group or type of entries (Entry) in the
Chart that belong together. It is designed to logically separate different
groups of values inside the Chart (e.g. the values for a specific line in the
LineChart, or the values of a specific group of bars in the BarChart). | export abstract class DataSet<T extends EntryOhos> extends BaseDataSet<T> {
/**
* the entries that this DataSet represents / holds together
*/
protected mEntries: JArrayList<T> | null = new JArrayList<T>();
/**
* maximum y-value in the value array
*/
protected mYMax: number = -Number.MAX_VALUE;
/*... | AST#export_declaration#Left export AST#class_declaration#Left abstract class DataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right extends AST#typ... | export abstract class DataSet<T extends EntryOhos> extends BaseDataSet<T> {
protected mEntries: JArrayList<T> | null = new JArrayList<T>();
protected mYMax: number = -Number.MAX_VALUE;
protected mYMin: number = Number.MAX_VALUE;
protected mXMax: number = -Number.MAX_VALUE;
protected mXMin: numb... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L29-L439 | 787594db4349d1bdef12c0c8cb2773e93db0f56e | gitee | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_modifier/entry/src/main/ets/MainAbility/pages/gauge.ets | arkts | applyNormalAttribute | descriptionBuilder:CustomBuilder; | applyNormalAttribute(instance: GaugeAttribute): void {
super.applyNormalAttribute?.(instance);
} | AST#method_declaration#Left applyNormalAttribute AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left GaugeAttribute 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... | applyNormalAttribute(instance: GaugeAttribute): void {
super.applyNormalAttribute?.(instance);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_modifier/entry/src/main/ets/MainAbility/pages/gauge.ets#L21-L23 | 0b14f129fd36af750b46c5362eb5497d5aac5c77 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/MD5.ets | arkts | digest | 对称密钥SymKey
MD5摘要,同步
@param data 待摘要的数据
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@returns | static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.digest(data, 'MD5', resultCoding);
} | AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_... | static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.digest(data, 'MD5', resultCoding);
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/MD5.ets#L37-L39 | d6dc4a4e08644f91c6b7ebc0c1eabeb2e34d2600 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/immersive/Index.ets | arkts | NavImmersive | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { NavImmersive } from './src/main/ets/view/NavImmersive'; | AST#export_declaration#Left export { NavImmersive } from './src/main/ets/view/NavImmersive' ; AST#export_declaration#Right | export { NavImmersive } from './src/main/ets/view/NavImmersive'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/Index.ets#L15-L15 | f97ab8ce27665f6a3afb5a1772a2e3a5ee0ffe6b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets | arkts | insertUser | Save the encrypted user information to the database.
@param encryptPassword Ciphertext.
@param authTag GCM authTag. | insertUser(encryptPassword: string, authTag: string) {
let user = new User(null, this.username, encryptPassword, authTag);
this.userTableApi.insertUserData(user);
PromptUtil.promptMessage($r('app.string.message_register_success'), CommonConstants.PROMPT_TIME);
// After the registration is successful, th... | AST#method_declaration#Left insertUser AST#parameter_list#Left ( AST#parameter#Left encryptPassword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left authTag : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | insertUser(encryptPassword: string, authTag: string) {
let user = new User(null, this.username, encryptPassword, authTag);
this.userTableApi.insertUserData(user);
PromptUtil.promptMessage($r('app.string.message_register_success'), CommonConstants.PROMPT_TIME);
router.back();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets#L211-L217 | 5588dc32b2737179af44f044b9bcc04e0428c73c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey 给定秘钥规格密钥
@param iv iv偏移量字符串
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@returns | static async decodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//转换密钥
let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName);
// 初始化加解密操作环境:开始解密
let mode = crypto.CryptoMode.DECRYPT_MODE;
//创建解密器
... | AST#method_declaration#Left static async decodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static async decodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName);
let mode = crypto.CryptoMode.DECRYPT_MODE;
let cipher = crypto.createCiph... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L174-L188 | b616347f332a73fa175185d0a06bad6d7e6e2244 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets | arkts | lazyForEachListPage | 视频列表视图 | @Builder
lazyForEachListPage() {
Column() {
List() {
LazyForEach(this.newsList, (news: NewsItem, index: number) => {
ListItem() {
XComponentVideo({
centerIndex: this.centerIndex,
news: news,
index: index
})
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right lazyForEachListPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts... | @Builder
lazyForEachListPage() {
Column() {
List() {
LazyForEach(this.newsList, (news: NewsItem, index: number) => {
ListItem() {
XComponentVideo({
centerIndex: this.centerIndex,
news: news,
index: index
})
}
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoListAutoPlay/casesfeature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets#L120-L152 | 210afeca5b9432f623b451c76e127295e686c452 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | setCubicIntensity | Sets the intensity for cubic lines (if enabled). Max = 1f = very cubic,
Min = 0.05f = low cubic effect, Default: 0.2f
@param intensity | public setCubicIntensity(intensity: number): void {
if (intensity > 1)
intensity = 1;
if (intensity < 0.05)
intensity = 0.05;
;
this.mCubicIntensity = intensity;
} | AST#method_declaration#Left public setCubicIntensity AST#parameter_list#Left ( AST#parameter#Left intensity : 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#pr... | public setCubicIntensity(intensity: number): void {
if (intensity > 1)
intensity = 1;
if (intensity < 0.05)
intensity = 0.05;
;
this.mCubicIntensity = intensity;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L136-L143 | a7807285554b3e2781fdb41296fd305e65a05bbf | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/MultipleDialog/entry/src/main/ets/entryability/EntryAbility.ets | arkts | Lift cycle management of Ability. | export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability.
windowStage.loadContent('pages/HomePage', (err, data) => {
if (err.code) {
Logger.error(CommonConstants.TAG_ABILITY, 'Failed to ... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left wi... | export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: Window.WindowStage) {
windowStage.loadContent('pages/HomePage', (err, data) => {
if (err.code) {
Logger.error(CommonConstants.TAG_ABILITY, 'Failed to load the content. Cause:' + JSON.stringify(err));
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/entryability/EntryAbility.ets#L24-L35 | 8d501dec0a4ee80f29b3fde95c90eb80ba755679 | gitee | |
Duke_Bit/logan | 37ce340f90e508cbf3914162df2254aca76a525a | core/src/main/ets/Logan.ets | arkts | @param loganProtocolStatus 日志状态回调 | export function setOnLoganProtocolStatus(loganProtocolStatus: OnLoganProtocolStatus): void {
LoganControlCenter.instance().setOnLoganProtocolStatus(loganProtocolStatus)
} | AST#export_declaration#Left export AST#function_declaration#Left function setOnLoganProtocolStatus AST#parameter_list#Left ( AST#parameter#Left loganProtocolStatus : AST#type_annotation#Left AST#primary_type#Left OnLoganProtocolStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | export function setOnLoganProtocolStatus(loganProtocolStatus: OnLoganProtocolStatus): void {
LoganControlCenter.instance().setOnLoganProtocolStatus(loganProtocolStatus)
} | https://github.com/Duke_Bit/logan/blob/37ce340f90e508cbf3914162df2254aca76a525a/core/src/main/ets/Logan.ets#L44-L46 | a9f8d908bcea4a05f8d9b12030f86368140b4c22 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/validation/ValidationUtil.ets | arkts | isValidPhone | 验证手机号是否有效
@param {string} phone - 手机号
@returns {boolean} 是否有效 | static isValidPhone(phone: string): boolean {
return phone.length === 11 && ValidationUtil.PHONE_REGEX.test(phone);
} | AST#method_declaration#Left static isValidPhone AST#parameter_list#Left ( AST#parameter#Left phone : 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 isValidPhone(phone: string): boolean {
return phone.length === 11 && ValidationUtil.PHONE_REGEX.test(phone);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L21-L23 | bd437457012f9732cfeaaa06b89f20589a81e49d | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DialogUtils.ets | arkts | initConfirmButton | 一个按钮,初始化参数
@param options | private static initConfirmButton(options: ConfirmDialogOptions) {
options.confirm = options.confirm ?? DialogUtils.defaultConfig.secondaryButton;
if (Tools.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.onA... | AST#method_declaration#Left private static initConfirmButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#exp... | private static initConfirmButton(options: ConfirmDialogOptions) {
options.confirm = options.confirm ?? DialogUtils.defaultConfig.secondaryButton;
if (Tools.isResourceStr(options.confirm)) {
options.confirm = {
value: options.confirm as ResourceStr,
action: () => {
if (options.onA... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L232-L255 | 39a9aa77b0e998d4436d412fc969599301fbd358 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/model/MeMenuItem.ets | arkts | @file 我的页面菜单项模型
@author Joker.X | export interface MeMenuItem {
/**
* 菜单标题
*/
title: ResourceStr;
/**
* 菜单图标
*/
icon: Resource;
/**
* 图标颜色
*/
iconColor: ResourceColor;
/**
* 点击回调
*/
onClick: () => void;
/**
* 是否显示分割线
*/
showDivider: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MeMenuItem AST#object_type#Left { /**
* 菜单标题
*/ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 菜单图标
*/ AST#type_... | export interface MeMenuItem {
title: ResourceStr;
icon: Resource;
iconColor: ResourceColor;
onClick: () => void;
showDivider: boolean;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/model/MeMenuItem.ets#L5-L30 | a9496e0335e1f23398cf942951652a1ae8884d5a | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets | arkts | updateAssetAccountFromTransaction | 根据交易记录更新资产账户 | public async updateAssetAccountFromTransaction(
tx: UserTransaction | TransactionTableBasis,
) {
const assetId = tx.assetId;
if (!assetId) {
return;
}
const isExpense = tx.type === 'expense';
const sql = `
UPDATE assets
SET amount = amount ${isExpense ? '-' : '+'} ${tx.amount}
... | AST#method_declaration#Left public async updateAssetAccountFromTransaction AST#parameter_list#Left ( AST#parameter#Left tx : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UserTransaction AST#primary_type#Right | AST#primary_type#Left TransactionTableBasis AST#primary_type#Right AST#union_type#Right... | public async updateAssetAccountFromTransaction(
tx: UserTransaction | TransactionTableBasis,
) {
const assetId = tx.assetId;
if (!assetId) {
return;
}
const isExpense = tx.type === 'expense';
const sql = `
UPDATE assets
SET amount = amount ${isExpense ? '-' : '+'} ${tx.amount}
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L359-L373 | 91011df09c0cc3d190a866327cd5adf84b4f58a5 | github |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/constants/LoginConstants.ets | arkts | 登录模块常量配置
Common constants for login feature.
Source: 基于 WindowManager 项目的常量迁移并适配溪村园区项目 | export default class LoginConstants {
/**
* 验证码页面 URL
* Verify page url.
*/
static readonly VERIFY_PAGE_URL: string = 'pages/VerifyPage';
/**
* 登录页面 URL
* Login page url.
*/
static readonly LOGIN_PAGE_URL: string = 'pages/LoginPage';
/**
* 子窗口名称
* Sub window name for login verificati... | AST#export_declaration#Left export default AST#class_declaration#Left class LoginConstants AST#class_body#Left { /**
* 验证码页面 URL
* Verify page url.
*/ AST#property_declaration#Left static readonly VERIFY_PAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation... | export default class LoginConstants {
static readonly VERIFY_PAGE_URL: string = 'pages/VerifyPage';
static readonly LOGIN_PAGE_URL: string = 'pages/LoginPage';
static readonly SUB_WINDOW_NAME: string = 'VerifyLoginWindow';
static readonly SUB_WINDOW_WIDTH_RATIO: number = 0.93;
static readon... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/LoginConstants.ets#L21-L63 | 95d173bb82e9698e38bd5ba2c6e8e2e635e65b9b | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getReviewSectionedWords | 获取复习用的分段单词数据 | getReviewSectionedWords(): SectionDatas<string, WordUser> {
const sectionWords = new SectionDatas<string,WordUser>();
const reviewWords = this.allWords.filter(word =>
word.lastResultType === SearchConstants.TEST_RESULT_WRONG && !word.deleted
);
// 按错误日期排序(降序)
const sortedWords = reviewWords.sor... | AST#method_declaration#Left getReviewSectionedWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left SectionDatas AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , ... | getReviewSectionedWords(): SectionDatas<string, WordUser> {
const sectionWords = new SectionDatas<string,WordUser>();
const reviewWords = this.allWords.filter(word =>
word.lastResultType === SearchConstants.TEST_RESULT_WRONG && !word.deleted
);
const sortedWords = reviewWords.sort((a, b) => {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L516-L538 | b079469e5df6108ec966fca4997973c2cfd9986c | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/NavRouterView.ets | arkts | NavRouterView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NavRouterView {
@State isActive: boolean = false
@State dex: number = 0
@Link _position: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 })
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct NavRouterView {
@State isActive: boolean = false
@State dex: number = 0
@Link _position: Position;
private componentKey: string;
build() {
NavRouter() {
Row() {
Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 })
... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/NavRouterView.ets#L16-L53 | 7c24a24f37786be6e04c9048f3035f3445dc1035 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | appendMemBox | / 在内存中添加box | appendMemBox(box: Box): void {
this.boxes.push(box);
} | AST#method_declaration#Left appendMemBox AST#parameter_list#Left ( AST#parameter#Left box : AST#type_annotation#Left AST#primary_type#Left Box 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#... | appendMemBox(box: Box): void {
this.boxes.push(box);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L189-L191 | 4e0c13d719b0ec8f1d73de81d171800c7d8c474d | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets | arkts | 系统Utils | export class SystemSceneUtils {
static isApplyLocPermAgain: boolean = false;
static context: Context = getContext() as common.UIAbilityContext;
/**
* 检查用户是否授权
* @param permission
* @returns
*/
static async checkPermissionGrant(permission: Permissions): Promise<boolean> {
let atManager: abilityA... | AST#export_declaration#Left export AST#class_declaration#Left class SystemSceneUtils AST#class_body#Left { AST#property_declaration#Left static isApplyLocPermAgain : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left fal... | export class SystemSceneUtils {
static isApplyLocPermAgain: boolean = false;
static context: Context = getContext() as common.UIAbilityContext;
static async checkPermissionGrant(permission: Permissions): Promise<boolean> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L85-L178 | 70bae6617840ffd580b227e6febdda14c208da24 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Windows and their data
Gets the last LocalStorage.
@returns A LocalStorage. | export function last_storage() {
return (AppStorage.get('windowStorages') as LocalStorage[])[(AppStorage.get('windowStorages') as LocalStorage[]).length-1];
} | AST#export_declaration#Left export AST#function_declaration#Left function last_storage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#parenthesized_expression#Le... | export function last_storage() {
return (AppStorage.get('windowStorages') as LocalStorage[])[(AppStorage.get('windowStorages') as LocalStorage[]).length-1];
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L421-L423 | 4bfd00fbae64fbd6394050f7792e9c44bfba1d11 | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.FormMenu.d.ets | arkts | Defines the add form options.
@interface AddFormOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export interface AddFormOptions {
/**
* Indicates the form data.
*
* @type { ?formBindingData.FormBindingData }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
formBindingData?: formBindingData.FormBindingData;
/**
* The callback is used to... | AST#export_declaration#Left export AST#interface_declaration#Left interface AddFormOptions AST#object_type#Left { /**
* Indicates the form data.
*
* @type { ?formBindingData.FormBindingData }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#L... | export interface AddFormOptions {
formBindingData?: formBindingData.FormBindingData;
callback?: AsyncCallback<string>;
style?: FormMenuItemStyle;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.FormMenu.d.ets#L49-L77 | 0bb831580181b1093026e5b93abf37d55c7a32b1 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | initiatingUserAuthentication3 | [EndExclude authentication_example3] [End authentication_example2]
start-authentication.md
示例3:
发起用户认证,采用认证可信等级≥ATL3的人脸 + 锁屏密码 + 指纹认证 + 任意应用认证类型相关 + 复用任意应用最大有效时长认证,获取认证结果: | initiatingUserAuthentication3() {
// 设置认证参数
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const ... | AST#method_declaration#Left initiatingUserAuthentication3 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置认证参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left reuseUnlockResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left... | initiatingUserAuthentication3() {
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const len: numb... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L251-L280 | e368fa18f51a72bc540fedc3c329a9541331ac0d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets | arkts | onCreate | [StartExclude save_uiContext_to_localstorage_in_entry_ability] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
} | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets#L28-L30 | f0243c4ab937104969b942a9196f71c6dcca5f11 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/arkts/@arkts.collections.d.ets | arkts | setBitsByRange | Sets a range of bits in a bit vector to a particular element.
@param { number } element - Element to be set (0 means 0, else means 1).
@param { number } fromIndex - The starting position of the index, containing the value at that index position.
@param { number } toIndex - The end of the index, excluding the value at ... | setBitsByRange(element: number, fromIndex: number, toIndex: number): void; | AST#method_declaration#Left setBitsByRange AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | setBitsByRange(element: number, fromIndex: number, toIndex: number): void; | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.collections.d.ets#L5513-L5513 | dee2010bda3a9d284fd3baacf1823000d37bced6 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.