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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | createBullet | 创建子弹 | createBullet() {
var that = this
let bullet = new GameElement();
bullet.positionX = that.bulletPosX
bullet.positionY = that.bulletPosY
bullet.timestamp = new Date().getTime()
bullet.imgSrc = '/common/images/bullet.png'
bullet.imgWidth = that.bulletWith
bullet.imgHeight = that.bulletHeigh... | AST#method_declaration#Left createBullet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left that = AST#expression#Left this AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AS... | createBullet() {
var that = this
let bullet = new GameElement();
bullet.positionX = that.bulletPosX
bullet.positionY = that.bulletPosY
bullet.timestamp = new Date().getTime()
bullet.imgSrc = '/common/images/bullet.png'
bullet.imgWidth = that.bulletWith
bullet.imgHeight = that.bulletHeigh... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L360-L370 | fbd29d7aeda2ab715ca5e621d7ec191300de0fbf | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns | static decodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, dataCoding);
} | AST#method_declaration#Left static 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L86-L89 | 21988b97002f1ea5121b44c0004a049290cbff42 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | getConvertKeyPairSync | 获取转换的非对称密钥KeyPair,同步
@param pubKey 公钥字符串
@param priKey 私钥字符串
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2)
@returns | static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pubKey, priKey, key... | AST#method_declaration#Left static getConvertKeyPairSync 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#primary_type#Left AST#qualified_type#Left crypto... | static getConvertKeyPairSync(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: string = 'SM2_256'): cryptoFramework.KeyPair {
return CryptoUtil.getConvertKeyPairSync(algName, pubKey, priKey, key... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L122-L126 | 21c60f60b472394ff41dc6c8ab4e47ecdb5e954c | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/components/msg_content_view/MsgContentView_image.ets | arkts | ImageMsgContentView | Copyright (C) 2024 即时通讯网(52im.net) & Jack Jiang.
The MobileIMSDK-鸿蒙Next客户端 Project. All rights reserved.
联系邮件:jack.jiang@52im.net
联系微信:hellojackjiang
联系QQ: 413980957
技术社区:http://www.52im.net
普通聊天消息内容组件(图片消息)。
@author Jack Jiang(http://www.52im.net/thread-2792-1-1.html) | @Component
export struct ImageMsgContentView {
build() {
// TODO: 待实现。。。
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageMsgContentView AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { // TODO: 待实现。。。 } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declara... | @Component
export struct ImageMsgContentView {
build() {
}
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/components/msg_content_view/MsgContentView_image.ets#L16-L21 | af02f6afcda5ee3580415768258f839e93968388 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBarV2.d.ets | arkts | ToolBarV2SymbolGlyph | Defines toolBarV2 symbolGlyph.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @ObservedV2
export class ToolBarV2SymbolGlyph {
/**
* Modifier of toolbarV2's normal symbol.
*
* @type { SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
@Trace
normal: SymbolGlyphModifier;
/**
* Modifier of toolbarV2's... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class ToolBarV2SymbolGlyph AST#class_body#Left { /**
* Modifier of toolbarV2's normal symbol.
*
* @type { SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice... | @ObservedV2
export class ToolBarV2SymbolGlyph {
@Trace
normal: SymbolGlyphModifier;
@Trace
activated?: SymbolGlyphModifier;
constructor(options: ToolBarV2SymbolGlyphOptions);
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L70-L104 | 25dc6e93973ceaa873d817ee435aaf0d260140f8 | gitee |
HarmonyOS-Next/interview-handbook-project.git | 1e053477091e58ba00c65045ae2c51f669855c41 | commons/calendar/BuildProfile.ets | arkts | Use these variables when you tailor your ArkTS code. They must be of the const type. | export const HAR_VERSION = '2.0.2'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '2.0.2' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const HAR_VERSION = '2.0.2'; | https://github.com/HarmonyOS-Next/interview-handbook-project.git/blob/1e053477091e58ba00c65045ae2c51f669855c41/commons/calendar/BuildProfile.ets#L4-L4 | e294ab7f1838d20d9967b5b1666eaf2a566358ec | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Scroll.ets | arkts | 构建带中等内边距的水平滚动布局
@returns {void} 无返回值 | build(): void {
HorizontalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_medium"),
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left HorizontalScroll ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_ex... | build(): void {
HorizontalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_medium"),
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L497-L508 | 4a824a56a049d087c6b76b1a94685a4cfe85911b | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets | arkts | startAnimation | 性能:显式动画(https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-explicit-animation-V5) | startAnimation(isLeft: boolean, duration: number): void {
animateTo({
duration: duration,
}, () => {
const tempIndex: number = isLeft ? this.currentIndex + 1 : this.currentIndex - 1 + this.swiperListView.length;
this.currentIndex = tempIndex % this.swiperListView.length;
})
} | AST#method_declaration#Left startAnimation AST#parameter_list#Left ( AST#parameter#Left isLeft : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | startAnimation(isLeft: boolean, duration: number): void {
animateTo({
duration: duration,
}, () => {
const tempIndex: number = isLeft ? this.currentIndex + 1 : this.currentIndex - 1 + this.swiperListView.length;
this.currentIndex = tempIndex % this.swiperListView.length;
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets#L119-L126 | de9ff3a019eeea439c39c87bbf9ce4f506f009cc | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/TypeConversion.ets | arkts | byteToString | Uint8Array 转 string
@param arr Uint8Array
@returns string | static byteToString(arr: Uint8Array): string {
let str: string = ''
let _arr: Uint8Array = arr
for (let i = 0; i < _arr.length; i++) {
// 将数值转为二进制字符串
let binaryStr: string = _arr[i].toString(2)
let matchArray = binaryStr.match(new RegExp('/^1+?(?=0)/'))
if (matchArray && binaryStr.l... | AST#method_declaration#Left static byteToString AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static byteToString(arr: Uint8Array): string {
let str: string = ''
let _arr: Uint8Array = arr
for (let i = 0; i < _arr.length; i++) {
let binaryStr: string = _arr[i].toString(2)
let matchArray = binaryStr.match(new RegExp('/^1+?(?=0)/'))
if (matchArray && binaryStr.length == 8) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/TypeConversion.ets#L25-L47 | 1671ccf5663238efe04a87c67978958d5a7be9f9 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | autoScale | Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view. | protected autoScale(): void {
if (!this.mData) {
return;
}
const fromX: number = this.getLowestVisibleX();
const toX: number = this.getHighestVisibleX();
this.mData.calcMinMaxY(fromX, toX);
if (this.mXAxis) {
this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax());
}
... | AST#method_declaration#Left protected autoScale AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#L... | protected autoScale(): void {
if (!this.mData) {
return;
}
const fromX: number = this.getLowestVisibleX();
const toX: number = this.getHighestVisibleX();
this.mData.calcMinMaxY(fromX, toX);
if (this.mXAxis) {
this.mXAxis.calculate(this.mData.getXMin(), this.mData.getXMax());
}
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L504-L527 | 0ef45d77fb1b6f04d865a45000bb15dfa8b39825 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | checkPermissionPermanentlyDenied | 检查权限是否被永久拒绝
@param {Array<Permissions>} permissions 目标权限
@returns {Promise<boolean>} 是否已拒绝 | private async checkPermissionPermanentlyDenied(permissions: Array<Permissions>): Promise<boolean> {
// 通过检查是否可以再次请求权限来判断是否被永久拒绝
try {
for (const permission of permissions) {
// 如果已经授权,跳过
if (await this.checkPermissionGrant(permission)) {
continue;
}
// 尝试请求权限,是否还... | AST#method_declaration#Left private async checkPermissionPermanentlyDenied AST#parameter_list#Left ( AST#parameter#Left permissions : 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 Permissions AST#primary_type#Right AST... | private async checkPermissionPermanentlyDenied(permissions: Array<Permissions>): Promise<boolean> {
try {
for (const permission of permissions) {
if (await this.checkPermissionGrant(permission)) {
continue;
}
const result = await this.atManager.request... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L74-L95 | a839c2efbd0e762f645e17dd41e951d3a40a66e3 | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/data/Repository.ets | arkts | getLibraryLatestMedia | 获取媒体库最近媒体
@param id
@returns | public getLibraryLatestMedia(id?: string): Promise<Array<FinItem>> {
return this.requireApi().getLatestItems(id)
} | AST#method_declaration#Left public getLibraryLatestMedia AST#parameter_list#Left ( AST#parameter#Left id ? : 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_... | public getLibraryLatestMedia(id?: string): Promise<Array<FinItem>> {
return this.requireApi().getLatestItems(id)
} | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L59-L61 | 4c7116627313f60c574547f454e34ff2596c28ca | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/detail/DetailCardsView.ets | arkts | buildDictView | /创建DictView | @Builder buildDictView(){
DictView({title: this.showingDictText, isShowing: this.isShowDictView!!})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDictView 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 DictView ( AST#component_parameters#Left { AST#component_par... | @Builder buildDictView(){
DictView({title: this.showingDictText, isShowing: this.isShowDictView!!})
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L326-L329 | 9ad32d65f0ff228ae86e45c5d4f4cb0e38a16713 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | setImageRect | Set image rect.
@param image | setImageRect(image: RectF) {
this.imageRect.set(image.left, image.top, image.right, image.bottom);
} | AST#method_declaration#Left setImageRect AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression... | setImageRect(image: RectF) {
this.imageRect.set(image.left, image.top, image.right, image.bottom);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L114-L116 | 715bcd3c1c398f72960358ff5887997c5f3cb985 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/subwindow/SubWindowUtils.ets | arkts | edgeDetermination | 贴边判断
@param window 目标窗口
@param windowPosition 位置信息 | public edgeDetermination(windowPosition: Position,
windowClass: window.Window = SubWindowUtils.windowClass): Direction {
if (!windowClass) {
LogUtils.error(TAG, "windowClass 为空,请先调用 initSubWindow 初始化!")
return Direction.LEFT
}
let halfWidth = display.getDefaultDisplaySync().width * 0.5
... | AST#method_declaration#Left public edgeDetermination AST#parameter_list#Left ( AST#parameter#Left windowPosition : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Lef... | public edgeDetermination(windowPosition: Position,
windowClass: window.Window = SubWindowUtils.windowClass): Direction {
if (!windowClass) {
LogUtils.error(TAG, "windowClass 为空,请先调用 initSubWindow 初始化!")
return Direction.LEFT
}
let halfWidth = display.getDefaultDisplaySync().width * 0.5
... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/subwindow/SubWindowUtils.ets#L104-L121 | bdfb113cdc829ab2de95eee1f63487d947a66720 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | readC3 | 读取C3部分
@param sm2_sequence sm2序列工具
@param data 待读取的数据
@returns C3部分 | private readC3(sm2_sequence: SM2Sequence, data: string): string {
if (data.startsWith("0420")) {
sm2_sequence.C3 = data.slice(4, 68);
data = data.slice(68, data.length);
} else {
Logger.debug('读取SM2字符串中的C3出错');
}
return data;
} | AST#method_declaration#Left private readC3 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | private readC3(sm2_sequence: SM2Sequence, data: string): string {
if (data.startsWith("0420")) {
sm2_sequence.C3 = data.slice(4, 68);
data = data.slice(68, data.length);
} else {
Logger.debug('读取SM2字符串中的C3出错');
}
return data;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L253-L261 | dca30155d714272a192eb46bf5a93d6d9c1be0c6 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/DESSync.ets | arkts | decodeCBC | 解密-CBC模式
@param str 加密的字符串
@param aesKey 3DES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static decodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, dataCoding);
} | AST#method_declaration#Left static 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 desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DESSync.ets#L87-L90 | 7bf9e6579db4df7beafa8c1ed780c5a5be81b23d | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_content | Returns The contents of this folder.
@returns A bookmark[] array. | get_content() {
return this.contents as collections.Array<bookmark>;
} | AST#method_declaration#Left get_content AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contents A... | get_content() {
return this.contents as collections.Array<bookmark>;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L838-L840 | 1b274fe89b3558ca84c33b348bf4b96e20d6fbf1 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/SearchComponent/searchcomponent/src/main/ets/components/model/SceneModuleInfo.ets | arkts | 首页瀑布流列表信息 | export class SceneModuleInfo {
// 首页列表名称
public name: string;
// 路由信息,自动生成路由时,在自定义装饰器中AppRouter中配置的参数,使用新版本自动路由时需要添加此参数,用于动态路由的跳转。
// 使用规则:模块名/需要加载的自定义组件名,如addressexchange/AddressExchangeView
public appUri: string;
// 路由传参数据
public param: string;
// 难度星级
public ratingNumber: number;
// 分类
public c... | AST#export_declaration#Left export AST#class_declaration#Left class SceneModuleInfo AST#class_body#Left { // 首页列表名称 AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 路由信息,自动生成路由时,在自定义装饰器中... | export class SceneModuleInfo {
public name: string;
public appUri: string;
public param: string;
public ratingNumber: number;
public category: string;
public serialNumber: number;
public swiperImage: ResourceStr;
public helperUrl: string;
constructor(name: string, appUri: s... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/SearchComponent/searchcomponent/src/main/ets/components/model/SceneModuleInfo.ets#L19-L49 | 75aed80930e40f1012921d586c0a54bd0df75eb0 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets | arkts | IDataSource处理数据监听的基本实现 | export abstract class BasicDataSource<T> implements IDataSource<T> {
private listeners: DataChangeListener[] = [];
// 获取数组长度
public abstract totalCount(): number;
public abstract getData(index: number): T;
// 为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void {
... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements AST#generic_type#Left IDataSource AST#type_arguments#Left < AST#type_annotation#Lef... | export abstract class BasicDataSource<T> implements IDataSource<T> {
private listeners: DataChangeListener[] = [];
public abstract totalCount(): number;
public abstract getData(index: number): T;
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0)... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/collapsemenu/BasicDataSource.ets#L21-L63 | 7728eb18f96b70bb076ef4367a115e8a7c87ab3f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/UrlUtils.ets | arkts | getUrl | 获取上传下载地址 | async getUrl(context: common.UIAbilityContext): Promise<string> {
let preference = await preferences.getPreferences(context, STORE_NAME);
let url = await preference.get(URL_KEY, '') as string;
logger.info(TAG, `getUrl,url= ${url}`);
return url;
} | AST#method_declaration#Left async getUrl AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#... | async getUrl(context: common.UIAbilityContext): Promise<string> {
let preference = await preferences.getPreferences(context, STORE_NAME);
let url = await preference.get(URL_KEY, '') as string;
logger.info(TAG, `getUrl,url= ${url}`);
return url;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/UrlUtils.ets#L31-L36 | 8811196124ae65683508e737d92e975f84bb712f | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | enableAxisLineDashedLine | Enables the axis line to be drawn in dashed mode, e.g. like this
"- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF.
Keep in mind that hardware acceleration boosts performance.
@param lineLength the length of the line pieces
@param spaceLength the length of space in between the pieces
@param phase ... | public enableAxisLineDashedLine(lineLength: number, spaceLength: number, phase: number): void {
this.mAxisLineDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase);
} | AST#method_declaration#Left public enableAxisLineDashedLine AST#parameter_list#Left ( AST#parameter#Left lineLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left spaceLength : AST#type_annotation#Left AST#primary_type#Le... | public enableAxisLineDashedLine(lineLength: number, spaceLength: number, phase: number): void {
this.mAxisLineDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L636-L638 | e5baf9e3a08ef5db5897cd84d14b0dcb92a3cb45 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | digest | 摘要
@param str 带摘要的字符串
@param symAlgName 秘钥规格
@param resultCoding 返回结果编码方式(hex/base64)
@returns 摘要后的字符串 | static digest(str: string, symAlgName: string, resultCoding: buffer.BufferEncoding): string {
//摘要对象
let md = crypto.createMd(symAlgName);
//字符串转换的字节流对象
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
for (let i = 0; i < messag... | AST#method_declaration#Left static digest 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 symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static digest(str: string, symAlgName: string, resultCoding: buffer.BufferEncoding): string {
let md = crypto.createMd(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
for (let i = 0; i < messageData.length; i += updateLength) {
le... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L475-L488 | e792b31fd777e3977568d43170e39d526670b367 | gitee |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | commonModule/src/main/ets/utils/HttpUtils.ets | arkts | @desc:请求工具类
@author:hxy
@date:2024/2/17 | export class HttpUtils {
//GET请求
static get<T>(url: string, params?: object) {
return request<T>(url, http.RequestMethod.GET, params)
}
//POST请求
static post<T>(url: string, params?: object) {
return request<T>(url, http.RequestMethod.POST, params)
}
//PUT请求
static put<T>(url: string, params?: ob... | AST#export_declaration#Left export AST#class_declaration#Left class HttpUtils AST#class_body#Left { //GET请求 AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotat... | export class HttpUtils {
static get<T>(url: string, params?: object) {
return request<T>(url, http.RequestMethod.GET, params)
}
static post<T>(url: string, params?: object) {
return request<T>(url, http.RequestMethod.POST, params)
}
static put<T>(url: string, params?: object) {
return req... | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/utils/HttpUtils.ets#L66-L83 | ea1c02f995c7e7f2691c5f6c18babbd590d3e903 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | encryptSync | 加密,同步
@param data 加密或者解密的数据。data不能为null。
@param key 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
@returns | static encryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
le... | AST#method_declaration#Left static encryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AS... | static encryptSync(data: cryptoFramework.DataBlob, key: cryptoFramework.Key,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, params);
le... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L53-L59 | 7716fdec14715210b7a77ae6c39182207a46a9be | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/customcomponents/SeekBar.ets | arkts | SeekBar | Copyright (C) 2022 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... | @ComponentV2
export default struct SeekBar {
@Param model: SeekBarModel = new SeekBarModel()
build() {
Row() {
Slider({
value: this.model.value,
min: this.model.min,
max: this.model.max,
style: SliderStyle.OutSet
})
.width('90%')
.blockColor(0x009688)... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export default struct SeekBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right model : AST#type_annotation#Left AST#primary_type#Left SeekBarModel AST#primary_type#Right AST#t... | @ComponentV2
export default struct SeekBar {
@Param model: SeekBarModel = new SeekBarModel()
build() {
Row() {
Slider({
value: this.model.value,
min: this.model.min,
max: this.model.max,
style: SliderStyle.OutSet
})
.width('90%')
.blockColor(0x009688)... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/customcomponents/SeekBar.ets#L16-L41 | 353e243af18927f7b2be77ed26d31e683761d899 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService.ets | arkts | updateContact | 更新联系人 | async updateContact(id: string, params: UpdateContactParams): Promise<Contact | null> {
const contactIndex = this.contacts.findIndex(contact => contact.id === id);
if (contactIndex === -1) {
return null;
}
const existingContact = this.contacts[contactIndex];
const updatedContact: Contact = {
... | AST#method_declaration#Left async updateContact AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateContactParams AS... | async updateContact(id: string, params: UpdateContactParams): Promise<Contact | null> {
const contactIndex = this.contacts.findIndex(contact => contact.id === id);
if (contactIndex === -1) {
return null;
}
const existingContact = this.contacts[contactIndex];
const updatedContact: Contact = {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L268-L309 | 8d8789f0b525f534452a8c1417e36038a415a3f1 | github |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/long-task-master/entry/src/main/ets/pages/Index.ets | arkts | createAVPlayerLive | 以下demo为通过url设置网络地址来实现播放直播码流 ********************************** AVPlayer播放音频url ********************************** | async createAVPlayerLive() {
// 创建avPlayer实例对象
this.avPlayer = await media.createAVPlayer();
// 创建状态机变化回调函数
this.setAVPlayerCallback(this.avPlayer);
this.avPlayer.url = 'http://ngcdn001.cnr.cn/live/zgzs/index.m3u8';
} | AST#method_declaration#Left async createAVPlayerLive AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 创建avPlayer实例对象 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlaye... | async createAVPlayerLive() {
this.avPlayer = await media.createAVPlayer();
this.setAVPlayerCallback(this.avPlayer);
this.avPlayer.url = 'http://ngcdn001.cnr.cn/live/zgzs/index.m3u8';
} | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/long-task-master/entry/src/main/ets/pages/Index.ets#L64-L71 | e9ab2d6aceaec07707f239acf31c572972d0528c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets | arkts | MyRenderNode类,初始化画笔和绘制路径 | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path(); // 新建路径对象,用于绘制手指移动轨迹
// RenderNode进行绘制时会调用draw方法
draw(context: DrawContext): void {
const canvas = context.canvas;
// 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制
const pen = new drawing.Pen();
// 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑
... | AST#export_declaration#Left export AST#class_declaration#Left class MyRenderNode extends AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left path : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type... | export class MyRenderNode extends RenderNode {
path: drawing.Path = new drawing.Path();
draw(context: DrawContext): void {
const canvas = context.canvas;
const pen = new drawing.Pen();
pen.setAntiAlias(true);
const pen_color: common2D.Color = { alpha: 0xFF, red: 0x00, green: 0x00... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L22-L44 | b16fc2f357b8f8ee13a8b36342c5974eb9fcae3f | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets | arkts | RecentPhotoOptions Object
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class RecentPhotoOptions {
/**
* Support set period time
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
period?: number;
/**
* The Type of the file in the recent photo window.
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class RecentPhotoOptions AST#class_body#Left { /**
* Support set period time
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since... | export declare class RecentPhotoOptions {
period?: number;
MIMEType?: photoAccessHelper.PhotoViewMIMETypes;
photoSource?: PhotoSource;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets#L105-L133 | fb5381ba27af30de06ccc405439895f784b0b30d | github | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/pages/TaskReviewView.ets | arkts | loadData | 加载数据 | async loadData() {
try {
this.loading = true;
console.log('[TaskReviewView] 开始加载数据,任务ID:', this.taskId);
await Promise.all([
this.loadTaskDetail(),
this.loadFlaws()
]);
} catch (error) {
console.error('[TaskReviewView] 加载数据失败:', error);
promptAction.sho... | AST#method_declaration#Left async loadData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Le... | async loadData() {
try {
this.loading = true;
console.log('[TaskReviewView] 开始加载数据,任务ID:', this.taskId);
await Promise.all([
this.loadTaskDetail(),
this.loadFlaws()
]);
} catch (error) {
console.error('[TaskReviewView] 加载数据失败:', error);
promptAction.sho... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L119-L137 | da38526b15f4da47ff477cf3e6526a15b57ad5a4 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showTextInputDialog | 显示单行文本输入弹框
@param options
@returns | static showTextInputDialog(options: TextInputOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initDialogDefault(options);
ActionParameter.initAlertTitle(options);
ActionParameter.initButtons(options, true);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wr... | AST#method_declaration#Left static showTextInputDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TextInputOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left s... | static showTextInputDialog(options: TextInputOptions): string {
ActionParameter.initBaseDefault(options);
ActionParameter.initDialogDefault(options);
ActionParameter.initAlertTitle(options);
ActionParameter.initButtons(options, true);
const dialogId = ActionBaseCore.getInstance().openCustomDialog(wr... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L193-L200 | 8d22c008a127dde2a41cc5b4b574019c691fab9c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | getPreferences | 获取Preferences实例 | public static async getPreferences(faultDataSource: FaultDataSource): Promise<void> {
logger.info('getPreferences start.');
try {
let val: dataPreferences.Preferences = await (dataPreferences.getPreferences(AppStorage.get('context'),
'myStore') as Promise<dataPreferences.Preferences>);
dataP... | AST#method_declaration#Left public static async getPreferences AST#parameter_list#Left ( AST#parameter#Left faultDataSource : AST#type_annotation#Left AST#primary_type#Left FaultDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | public static async getPreferences(faultDataSource: FaultDataSource): Promise<void> {
logger.info('getPreferences start.');
try {
let val: dataPreferences.Preferences = await (dataPreferences.getPreferences(AppStorage.get('context'),
'myStore') as Promise<dataPreferences.Preferences>);
dataP... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets#L26-L39 | df9839a27b6a73b60d205460a38ad6bc6ccb9972 | gitee |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/utils/FileUtil.ets | arkts | *
功能:删除目录
参数 1:要删除的目录的路径 | export function rmdir(path: string) {
fs.rmdir(path).then(() => {
Logger.info('[FileUtils.rmdir]', `rmdir succeed, rmdir: ${path}.`);
}).catch((err: BusinessError) => {
Logger.error('[FileUtils.rmdir]', `rmdir failed with error message: ${err.message}, error code: ${err.code}`);
});
} | AST#export_declaration#Left export AST#function_declaration#Left function rmdir AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#stateme... | export function rmdir(path: string) {
fs.rmdir(path).then(() => {
Logger.info('[FileUtils.rmdir]', `rmdir succeed, rmdir: ${path}.`);
}).catch((err: BusinessError) => {
Logger.error('[FileUtils.rmdir]', `rmdir failed with error message: ${err.message}, error code: ${err.code}`);
});
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/FileUtil.ets#L138-L144 | 2d144578eedd3ee89e0fce036a84cdf965f95665 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets | arkts | formatPathCommands | 拼接绘制闭合曲线的commands
@param firstAbscissa
@param secondAbscissa
@param ordinate
@param radius
@returns | formatPathCommands(firstAbscissa: number, secondAbscissa: number, ordinate: number, radius: number): string {
return `M${firstAbscissa} ${ordinate} A${radius} ${radius} 0 ${ordinate > Constants.RADIUS_IN_PX ? 0 : 1} 0 ${secondAbscissa} ${ordinate}`
+ `Q${(firstAbscissa + 3 * secondAbscissa) / 4} ${ordinate + ... | AST#method_declaration#Left formatPathCommands AST#parameter_list#Left ( AST#parameter#Left firstAbscissa : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secondAbscissa : AST#type_annotation#Left AST#primary_type#Left numb... | formatPathCommands(firstAbscissa: number, secondAbscissa: number, ordinate: number, radius: number): string {
return `M${firstAbscissa} ${ordinate} A${radius} ${radius} 0 ${ordinate > Constants.RADIUS_IN_PX ? 0 : 1} 0 ${secondAbscissa} ${ordinate}`
+ `Q${(firstAbscissa + 3 * secondAbscissa) / 4} ${ordinate + ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L112-L115 | 1c6e98e26ea888797a903dfaa66496655d4901c0 | gitee |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/crypto/otpUtils.ets | arkts | rfc4226Sec5_4Impl | interface MOTPSchema extends OTPSchema,TimedOTPSchema,PinedOTPSchema { type: 'motp', algorithm: 'MD5', period: 10, digits: 6, } interface YAOTPSchema extends OTPSchema,TimedOTPSchema,PinedOTPSchema { type: 'yandex', algorithm: 'SHA256', period: 30, digits: 8, } http://tools.ietf.org/html/rfc4226#section-5.4 | function rfc4226Sec5_4Impl(hash: Uint8Array): number {
const offset = hash[hash.length - 1] & 0xf;
const otp = ((hash[offset] & 0x7f) << 24)
| ((hash[offset + 1] & 0xff) << 16)
| ((hash[offset + 2] & 0xff) << 8)
| (hash[offset + 3] & 0xff);
return otp;
} | AST#function_declaration#Left function rfc4226Sec5_4Impl AST#parameter_list#Left ( AST#parameter#Left hash : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number A... | function rfc4226Sec5_4Impl(hash: Uint8Array): number {
const offset = hash[hash.length - 1] & 0xf;
const otp = ((hash[offset] & 0x7f) << 24)
| ((hash[offset + 1] & 0xff) << 16)
| ((hash[offset + 2] & 0xff) << 8)
| (hash[offset + 3] & 0xff);
return otp;
} | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/crypto/otpUtils.ets#L65-L72 | 6ffb05813ba986284598dd06869ff59444e697a6 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getAmountDay | 获取前几天日期或后几天日期
@param date
@param amount 进行加减操作的具体数值。 | static getAmountDay(date: number | string | Date, amount: number): Date {
let relativeDate = DateUtils.getFormatDate(date);
relativeDate.setDate(relativeDate.getDate() + amount);
return relativeDate;
} | AST#method_declaration#Left static getAmountDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri... | static getAmountDay(date: number | string | Date, amount: number): Date {
let relativeDate = DateUtils.getFormatDate(date);
relativeDate.setDate(relativeDate.getDate() + amount);
return relativeDate;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L259-L263 | d099d2d1344a01eba4d142f3519d7cd79c5477a1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | onFoldStatusChange | 开启折叠设备折叠状态变化的监听。
@param callback 回调函数。表示折叠设备折叠状态。 | static onFoldStatusChange(callback: Callback<display.FoldStatus>) {
display.on('foldStatusChange', callback)
} | AST#method_declaration#Left static onFoldStatusChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_... | static onFoldStatusChange(callback: Callback<display.FoldStatus>) {
display.on('foldStatusChange', callback)
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L172-L174 | fdaecdd3e97069983ecc13e13e207f0188df97b6 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/ui/rcpLoading.ets | arkts | rcpLoadingOptions | 窗口loading方式入参实体 | @Observed
export class rcpLoadingOptions {
/**
* 加载内容
*/
@Track content: string = '';
/**
* 内容字体大小
*/
@Track fontSize?: string | number;
/**
* loading位置
*/
@Track position?: Alignment;
/**
* 图片布局方式
*/
@Track imgLayout?: RcpImgLayout;
/**
* 弹框形状
*/
@Track layoutShape?: R... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class rcpLoadingOptions AST#class_body#Left { /**
* 加载内容
*/ AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | @Observed
export class rcpLoadingOptions {
@Track content: string = '';
@Track fontSize?: string | number;
@Track position?: Alignment;
@Track imgLayout?: RcpImgLayout;
@Track layoutShape?: RcpLoadingShape;
@Track winBgColor?: string;
constructor() {
this.content = '小的正在努力加载中...';
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/ui/rcpLoading.ets#L180-L210 | 1e821088efc2cdb313ec58686d8be6c80ec89346 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Converts an ArrayBuffer to image.PixelMap object.
@param buf the ArrayBuffer
@returns an image.PixelMap | export function arrayBuffer_2_pixelMap(buf: ArrayBuffer) {
// ArrayBuffer => PixelMap
const imageSource = image.createImageSource(buf);
console.log('imageSource: ' + JSON.stringify(imageSource));
return imageSource.createPixelMap({}).then((pm) => {
let pixelMap = pm;
return pixelMap;
}).finally(() => ... | AST#export_declaration#Left export AST#function_declaration#Left function arrayBuffer_2_pixelMap AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function arrayBuffer_2_pixelMap(buf: ArrayBuffer) {
const imageSource = image.createImageSource(buf);
console.log('imageSource: ' + JSON.stringify(imageSource));
return imageSource.createPixelMap({}).then((pm) => {
let pixelMap = pm;
return pixelMap;
}).finally(() => {
imageSource.release(... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L760-L771 | 5ea0ef00e325a6aac586a2bea9f2974db3ff45db | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/NewAlbumPage.ets | arkts | onActive | The callback when current page is in the foreground | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
this.groupDataSource.dataRemove();
} | AST#method_declaration#Left onActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expressi... | onActive(): void {
if (!this.isActive) {
Log.info(TAG, 'onActive');
this.isActive = true;
}
this.groupDataSource.dataRemove();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/pages/NewAlbumPage.ets#L128-L134 | bba4f90e75f187ba7e54415f530afd3753184728 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setColorByColor | Sets the one and ONLY color that should be used for this DataSet.
Internally, this recreates the colors array and adds the specified color.
@param color | public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
} | AST#method_declaration#Left public setColorByColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_... | public setColorByColor(color: Number): void {
this.resetColors();
this.mColors.add(color);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L203-L206 | 5a82f495718494bcac47aff269ff12f2a76676cb | gitee |
gouhaoshuang/arkts-booking-software.git | e0254dae0c4cfd3d43c4e3970528d97136fcc69b | demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | isEmptyArr | Check array is empty
@param {Array}array
@return {boolean} true(empty) | isEmptyArr(array: Array<AccountData>): boolean {
return this.isEmpty(array) || array.length === 0;
} | AST#method_declaration#Left isEmptyArr AST#parameter_list#Left ( AST#parameter#Left array : 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 AccountData AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | isEmptyArr(array: Array<AccountData>): boolean {
return this.isEmpty(array) || array.length === 0;
} | https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L123-L125 | b2f49e4ad5e07cfd081678ddd8230739d3d26471 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets | arkts | readFileToJson | 读取文件内容转化Map | readFileToJson(path: string): DMPMap | null {
try {
if (!fs.accessSync(path)) {
return null;
}
let stat = fs.statSync(path);
let text = fs.readTextSync(path, { offset: 0, length: stat.size });
return DMPMap.createFromString(text)
} catch (e) {
return null;
}
} | AST#method_declaration#Left readFileToJson AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DMPMap... | readFileToJson(path: string): DMPMap | null {
try {
if (!fs.accessSync(path)) {
return null;
}
let stat = fs.statSync(path);
let text = fs.readTextSync(path, { offset: 0, length: stat.size });
return DMPMap.createFromString(text)
} catch (e) {
return null;
}
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L265-L276 | c8b7f3c84058dfc419821fd4fb59c618987386f5 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showSpinnerLoading | 显示 Spinner 加载提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showSpinnerLoading(message: string | ResourceStr): void {
IBestToast.show({
type: "loading",
loadingType: "spinner",
message: message
});
} | AST#method_declaration#Left static showSpinnerLoading AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#para... | static showSpinnerLoading(message: string | ResourceStr): void {
IBestToast.show({
type: "loading",
loadingType: "spinner",
message: message
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L66-L72 | 4e23daafa596d32c9b16db748a65b1c5d3808a0e | github |
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/ChooseCity.ets | arkts | checkCurrentLocationStatus | 检查当前位置是否已设置 | private checkCurrentLocationStatus() {
if (this.currentLocation && this.allCities.length > 0) {
const currentCity = this.allCities.find(city => city.city_name === this.currentLocation);
this.isCurrentLocationSet = currentCity?.is_current || false;
}
} | AST#method_declaration#Left private checkCurrentLocationStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expres... | private checkCurrentLocationStatus() {
if (this.currentLocation && this.allCities.length > 0) {
const currentCity = this.allCities.find(city => city.city_name === this.currentLocation);
this.isCurrentLocationSet = currentCity?.is_current || false;
}
} | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L115-L120 | 3e9d50b75e7af27d8024b3644148413823ff79b0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets | arkts | checkPermission | 检测是否已授权
@param {Permissions} permissionName 检测授权的权限名
@returns {boolean} 检测结果 | async checkPermission(permissionName: Permissions): Promise<boolean> {
// 检测用户是否已经授权
const grantStatus: abilityAccessCtrl.GrantStatus = await this.reqCurGrantStatus(permissionName);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
// 用户之前已授权,可以直接访问目标操作
return true;
}
... | AST#method_declaration#Left async checkPermission AST#parameter_list#Left ( AST#parameter#Left permissionName : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async checkPermission(permissionName: Permissions): Promise<boolean> {
const grantStatus: abilityAccessCtrl.GrantStatus = await this.reqCurGrantStatus(permissionName);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return true;
}
return false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets#L49-L59 | ee612b4933c26055c2ce75045384fa1454748fd7 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | pause | 暂停倒计时 | pause(): void {
if (this.active && !this.paused) {
this.paused = true;
this.active = false;
if (this.timerId >= 0) {
clearInterval(this.timerId);
this.timerId = -1;
}
}
} | AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expres... | pause(): void {
if (this.active && !this.paused) {
this.paused = true;
this.active = false;
if (this.timerId >= 0) {
clearInterval(this.timerId);
this.timerId = -1;
}
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L72-L81 | 367365c75552a1c2752ff9c8bb3e2eaa17c6f315 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets | arkts | FlexShowList | Show List in Flex | @Component
export struct FlexShowList {
@Consume list: number[];
@Consume currentFlexDirection: FlexDirection;
@Consume currentFlexJustifyContent: FlexAlign;
@Consume currentFlexAlignItems: ItemAlign;
@Consume currentFlexWrap: FlexWrap;
@Consume currentFlexAlignContent: FlexAlign;
build() {
Column() ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlexShowList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type... | @Component
export struct FlexShowList {
@Consume list: number[];
@Consume currentFlexDirection: FlexDirection;
@Consume currentFlexJustifyContent: FlexAlign;
@Consume currentFlexAlignItems: ItemAlign;
@Consume currentFlexWrap: FlexWrap;
@Consume currentFlexAlignContent: FlexAlign;
build() {
Column() ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexShowList.ets#L25-L67 | d0a6c2e7704bd4145455d211ffd01692e1786c72 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | stopBLEScan | 停止扫描设备 | stopBLEScan() {
Log.showInfo(TAG, `stopBLEScan`);
clearTimeout(this.mTimeoutID);
this.offBLEDeviceFind();
this.stopBLEScanInner();
} | AST#method_declaration#Left stopBLEScan AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo AST#member_expre... | stopBLEScan() {
Log.showInfo(TAG, `stopBLEScan`);
clearTimeout(this.mTimeoutID);
this.offBLEDeviceFind();
this.stopBLEScanInner();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L105-L110 | 7aac872f4f50f59d44c5e548a290de55f30acab3 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/B.ets | arkts | c | 从'C'内获取c对象,标记为延迟加载 | export { c }; | AST#export_declaration#Left export { c } ; AST#export_declaration#Right | export { c }; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/B.ets#L19-L19 | ad627442f5256d0287d4b1ee8968ad8180d86783 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/NotificationTypes.ets | arkts | 通知统计 | export interface NotificationStats {
total: number;
unread: number;
byType: Record<NotificationType, number>;
byPriority: Record<NotificationPriority, number>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationStats AST#object_type#Left { AST#type_member#Left total : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left unread : AST#type_annotati... | export interface NotificationStats {
total: number;
unread: number;
byType: Record<NotificationType, number>;
byPriority: Record<NotificationPriority, number>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L84-L89 | bce417eb2034c6bec20274a30600cb2d7d5b3ce1 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/PageLoading/pageloading/src/main/ets/view/PageLoading.ets | arkts | PageLoadingComponent | 毫秒数 | @Component
export struct PageLoadingComponent {
@State isLoading: Boolean = true;
@State nowProgress: number = 0;
aboutToAppear(): void {
// 模拟网络请求操作,请求网络3秒后得到数据,通知组件,变更列表数据
setTimeout(() => {
this.isLoading = false;
}, MILLISECONDS);
//模拟进度,开发者可在实际业务中与服务端协调当前进度,自行实现
setInterval(()=>{
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageLoadingComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST... | @Component
export struct PageLoadingComponent {
@State isLoading: Boolean = true;
@State nowProgress: number = 0;
aboutToAppear(): void {
setTimeout(() => {
this.isLoading = false;
}, MILLISECONDS);
setInterval(()=>{
this.nowProgress += 10
},MILLISECONDS / 10)
}
build()... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PageLoading/pageloading/src/main/ets/view/PageLoading.ets#L34-L64 | 4fb80c28362dbc19b36d9827abfc007152c094a2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | putArray | 存储数组值(转换为JSON字符串)
@param key 键
@param value 数组值 | async putArray<T>(key: string, value: T[]): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to put arr... | AST#method_declaration#Left async putArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#Rig... | async putArray<T>(key: string, value: T[]): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to put arr... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L166-L175 | ab5702273e0dd04f40a4ae374a0a02599d475435 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleBackupManager.ets | arkts | getBackupStatus | 获取备份状态 | getBackupStatus(): BackupStatus {
return this.currentStatus;
} | AST#method_declaration#Left getBackupStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BackupStatus AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex... | getBackupStatus(): BackupStatus {
return this.currentStatus;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L145-L147 | 548ea5a417110d723408710daec446d3b4c20baa | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/result.ets | arkts | itemui | *************************** 搜索内容 *********************************// | @Builder
itemui(item:searchContent){
Column({space:1}){
Image(item.img).width(180)
.height(250)
.borderRadius(12)
Column(){
Text(item.name).fontSize(15)
.fontWeight(5)
.width('80%')
Text('k1初学者.'+item.time+'分钟'+item.num+'千卡').fontSi... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemui AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left searchContent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder
itemui(item:searchContent){
Column({space:1}){
Image(item.img).width(180)
.height(250)
.borderRadius(12)
Column(){
Text(item.name).fontSize(15)
.fontWeight(5)
.width('80%')
Text('k1初学者.'+item.time+'分钟'+item.num+'千卡').fontSi... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/result.ets#L36-L54 | e89fde7a97f29e4fc30c16621ce110ddca2adb3e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | keepDecimals | 保留几位小数(默认保留两位小数)
@param value
@param digit 位数,默认保留两位小数;digit小于0返回value原值。-1、0、1、2、3、4、5、6、7、8、9...这样的Int类型数据
@returns | static keepDecimals(value: number, digit: number = 2): number {
if (digit > 0) {
digit = Math.trunc(digit); //取整
const digits = Math.pow(10, digit);
return Math.round(value * digits) / digits;
} else if (digit === 0) {
return Math.round(value);
}
return value;
} | AST#method_declaration#Left static keepDecimals AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left digit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | static keepDecimals(value: number, digit: number = 2): number {
if (digit > 0) {
digit = Math.trunc(digit);
const digits = Math.pow(10, digit);
return Math.round(value * digits) / digits;
} else if (digit === 0) {
return Math.round(value);
}
return value;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L160-L169 | 5e7e6a23bf586bef0c80a9dc93515cda71785602 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isUint8Array | Check whether the entered value is the uint8array array type.
@param { Object } value - A Uint8Array value
@returns { boolean } Returns true if the value is a built-in Uint8Array instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isUint8Array(value: Object): boolean; | AST#method_declaration#Left isUint8Array 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_type#Ri... | isUint8Array(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1356-L1356 | 247583cca4fbf334b5103b33c31f06de4e58421f | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/usemoney.ets | arkts | outcomeView | 收入 tab 内容 | @Builder
outcomeView() {
Column({ space: 10 }) {
ForEach([
{ type: '支', place:'创意卫浴五件套 欧式高档漱口杯',way:'商城兑换', date: '2025-07-01',amount: '-25.0币' },
{ type: '现', place:'人民广场自助回收机',way:'手机提现', date: '2025-07-01',amount: '-100.0币' },
{ type: '支', place:'创意卫浴五件套 欧式高档漱口杯',way:'商城兑换', date:... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right outcomeView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_paramet... | @Builder
outcomeView() {
Column({ space: 10 }) {
ForEach([
{ type: '支', place:'创意卫浴五件套 欧式高档漱口杯',way:'商城兑换', date: '2025-07-01',amount: '-25.0币' },
{ type: '现', place:'人民广场自助回收机',way:'手机提现', date: '2025-07-01',amount: '-100.0币' },
{ type: '支', place:'创意卫浴五件套 欧式高档漱口杯',way:'商城兑换', date:... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/usemoney.ets#L253-L321 | 849561794616cb7324ea120fdc7abb7bb4ea86bf | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Piece.ets | arkts | compareTo | MARK: - 比较(Comparable)
比较两个Piece对象的大小
@param other - 另一个Piece对象 | compareTo(other: Piece): number {
return this.pieceNo - other.pieceNo;
} | AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Piece AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | compareTo(other: Piece): number {
return this.pieceNo - other.pieceNo;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L85-L87 | 3c501636dc2388b2ecd67c42a9ed2a27b51de429 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleNewIntent | 处理新的启动意图
@param want Want信息 | private handleNewIntent(want: Want): void {
// 解析启动参数
if (want.parameters) {
const action = want.parameters['action'] as string;
const data = want.parameters['data'] as string;
console.log(`[EntryAbility] Handle new intent - action: ${action || 'none'}, data: ${data || 'none'}`);
... | AST#method_declaration#Left private handleNewIntent 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_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void... | private handleNewIntent(want: Want): void {
if (want.parameters) {
const action = want.parameters['action'] as string;
const data = want.parameters['data'] as string;
console.log(`[EntryAbility] Handle new intent - action: ${action || 'none'}, data: ${data || 'none'}`);
hilog.inf... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L231-L249 | bca86cecf8267cfc9e37aa36b9a47a33a829f7e8 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/actions-toolbox/1.0.0/package/index.ets | arkts | 应用约束70:不支持对函数声明属性,改用模块导出替代属性挂载 应用约束60:不支持require和import赋值表达式,改用ES模块导出 应用约束61:不支持export =语法,改为常规export | export default HelloWorldNPM; | AST#export_declaration#Left export default AST#expression#Left HelloWorldNPM AST#expression#Right ; AST#export_declaration#Right | export default HelloWorldNPM; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/actions-toolbox/1.0.0/package/index.ets#L12-L12 | f0ad2c7ed199fa0cb272bab3bb07217feabc9aa8 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/FoldableAdaptation/entry/src/main/ets/constants/BreakpointConstants.ets | arkts | Constants for breakpoint. | export class BreakpointConstants {
/**
* Breakpoints that represent small device types.
*/
public static readonly BREAKPOINT_SM: string = 'sm';
/**
* Breakpoints that represent middle device types.
*/
public static readonly BREAKPOINT_MD: string = 'md';
/**
* Breakpoints that represent large de... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* Breakpoints that represent small device types.
*/ AST#property_declaration#Left public static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS... | export class BreakpointConstants {
public static readonly BREAKPOINT_SM: string = 'sm';
public static readonly BREAKPOINT_MD: string = 'md';
public static readonly BREAKPOINT_LG: string = 'lg';
public static readonly GRID_ROW_COLUMNS: number[] = [4, 8, 12];
public static readonly GRID_COLUMN_SP... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/FoldableAdaptation/entry/src/main/ets/constants/BreakpointConstants.ets#L19-L44 | 5d52830cf57e8fbcdf3f2249a82199016a74801e | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/pages/WatchVodPage.ets | arkts | imReceiveChatMessage | 接收聊天消息
@param im im
@param message chat消息 data中聊天消息格式 说明详见本文件底部注释 | imReceiveChatMessage(type: string, message: VHIMMessageModel) {
if (type === VHRoomEventType.IM_TEXT) {
EmitterMessage.handleChatImText(type, message);
}
// 点赞消息
if (type === VHRoomEventType.CUSTOM_PRAISE) {
EmitterMessage.handleCustomMessage(type, message);
}
} | AST#method_declaration#Left imReceiveChatMessage AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left VHIMMessageModel A... | imReceiveChatMessage(type: string, message: VHIMMessageModel) {
if (type === VHRoomEventType.IM_TEXT) {
EmitterMessage.handleChatImText(type, message);
}
if (type === VHRoomEventType.CUSTOM_PRAISE) {
EmitterMessage.handleCustomMessage(type, message);
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/WatchVodPage.ets#L210-L218 | 2e24ecb4393f8d2e55a7a3d0277ced021fd31f23 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactEditPage.ets | arkts | fillFormWithContact | 用联系人数据填充表单 | private fillFormWithContact(contact: Contact) {
this.name = contact.name;
this.relation = contact.relation;
this.gender = contact.gender;
this.phone = contact.phone || '';
this.email = contact.email || '';
this.avatar = contact.avatar || '';
this.notes = contact.notes || '';
this.intimac... | AST#method_declaration#Left private fillFormWithContact AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expressi... | private fillFormWithContact(contact: Contact) {
this.name = contact.name;
this.relation = contact.relation;
this.gender = contact.gender;
this.phone = contact.phone || '';
this.email = contact.email || '';
this.avatar = contact.avatar || '';
this.notes = contact.notes || '';
this.intimac... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L133-L172 | 7d05ee226c066bd8eae62b288a02a1944775ceb1 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppDelay/entry/src/main/ets/pages/TabsNegativeExample.ets | arkts | customContent | [StartExclude tabs_negative_example] | @Builder
customContent(color: Color) {
Column()
.width('100%')
.height('100%')
.backgroundColor(color)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customContent AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder
customContent(color: Color) {
Column()
.width('100%')
.height('100%')
.backgroundColor(color)
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/TabsNegativeExample.ets#L32-L38 | 68ea3174bc16e896d53ea8c47e10bc1a9dfc5a58 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/navigation/NavigationHost.ets | arkts | NavigationHost | @file 挂载全局导航栈
@author Joker.X | @ComponentV2
export struct NavigationHost {
/**
* 导航栈
*/
@Provider(NAV_PATH_STACK_KEY)
navPathStack: NavPathStack = new NavPathStack();
aboutToAppear(): void {
setNavPathStack(this.navPathStack);
}
/**
* 导航目标构建器
* @param name 路由名称
* @returns 路由构建器
*/
@Builder
PagesMap(name: strin... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct NavigationHost AST#component_body#Left { /**
* 导航栈
*/ AST#property_declaration#Left AST#decorator#Left @ Provider ( AST#expression#Left NAV_PATH_STACK_KEY AST#expression#Right ) AST#decorator#Right navPathStac... | @ComponentV2
export struct NavigationHost {
@Provider(NAV_PATH_STACK_KEY)
navPathStack: NavPathStack = new NavPathStack();
aboutToAppear(): void {
setNavPathStack(this.navPathStack);
}
@Builder
PagesMap(name: string) {
if (RouteBuild.getBuilder(name) !== undefined) {
(RouteBuild.getBui... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/navigation/NavigationHost.ets#L8-L44 | b04dc3d032610ba56655d646c0cf46bdfa7abe17 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/viewmodel/ChartPoint.ets | arkts | Chart point entity class. | export default class ChartPoint {
/**
* Step value.
*/
value: number = 0;
/**
* Style of chart points.
*/
pointStyle: PointStyle = {
shape: '',
fillColor: '',
strokeColor: '',
size: 0
};
/**
* Description of icon points.
*/
description: string = '';
/**
* Chart text ... | AST#export_declaration#Left export default AST#class_declaration#Left class ChartPoint AST#class_body#Left { /**
* Step value.
*/ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Righ... | export default class ChartPoint {
value: number = 0;
pointStyle: PointStyle = {
shape: '',
fillColor: '',
strokeColor: '',
size: 0
};
description: string = '';
textLocation: string = '';
textColor: string = '';
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/viewmodel/ChartPoint.ets#L21-L47 | bc3399969451d96b78129c0204b7273078301f07 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | onBTStateChange | 订阅蓝牙设备开关状态事件 | private onBTStateChange() {
Log.showInfo(TAG, `onBTStateChange`);
try {
access.on('stateChange', (data: access.BluetoothState) => {
Log.showInfo(TAG, `onBTStateChange: data = ${data}`);
if (data === access.BluetoothState.STATE_ON) {
this.startBLEScan();
} else if (data ==... | AST#method_declaration#Left private onBTStateChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . ... | private onBTStateChange() {
Log.showInfo(TAG, `onBTStateChange`);
try {
access.on('stateChange', (data: access.BluetoothState) => {
Log.showInfo(TAG, `onBTStateChange: data = ${data}`);
if (data === access.BluetoothState.STATE_ON) {
this.startBLEScan();
} else if (data ==... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L166-L181 | d1b224f986b1b8ef0c4da43c774ed5b08eecc29a | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/pages/PageThree.ets | arkts | [EndExclude PageThree_start] | build() {
NavDestination() {
// [StartExclude PageThree_start]
this.navDestinationTitle()
// [EndExclude PageThree_start]
Column() {
if (this.isShowStridePixel) {
Image(this.stridePixel)
.width(this.getUIContext().px2vp(this.imageWidth))
.height(this... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { // [StartExclude PageThree_start] AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A... | build() {
NavDestination() {
this.navDestinationTitle()
Column() {
if (this.isShowStridePixel) {
Image(this.stridePixel)
.width(this.getUIContext().px2vp(this.imageWidth))
.height(this.getUIContext().px2vp(this.imageHeight))
.margin({ t... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/pages/PageThree.ets#L101-L135 | e210890188396086a6f4b1b1f163fed02b2e679b | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/sync/CloudSyncService.ets | arkts | startSync | 开始同步 | async startSync(options: SyncOptions = {}): Promise<SyncResult> {
if (!this.isAuthenticated || !this.currentUser) {
throw new Error('用户未登录');
}
if (this.isSyncing) {
throw new Error('同步正在进行中');
}
try {
this.isSyncing = true;
const syncId = this.generateSyncId();
const... | AST#method_declaration#Left async startSync AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left SyncOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Rig... | async startSync(options: SyncOptions = {}): Promise<SyncResult> {
if (!this.isAuthenticated || !this.currentUser) {
throw new Error('用户未登录');
}
if (this.isSyncing) {
throw new Error('同步正在进行中');
}
try {
this.isSyncing = true;
const syncId = this.generateSyncId();
const... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudSyncService.ets#L148-L215 | a325af8797be9ecb648126328db4571fd4634b31 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | buildCsvInput | 构建CSV输入区域 | @Builder
buildCsvInput() {
Column({ space: 12 }) {
Text('粘贴CSV内容')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
TextArea({
placeholder: '请粘贴CSV内容,或从文件中复制粘贴...',
text: this.csvContent
})
.fontSize(14)
.height('20... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCsvInput AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_param... | @Builder
buildCsvInput() {
Column({ space: 12 }) {
Text('粘贴CSV内容')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
TextArea({
placeholder: '请粘贴CSV内容,或从文件中复制粘贴...',
text: this.csvContent
})
.fontSize(14)
.height('20... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L230-L282 | f5ce46c675a1ca4c2a6676b89e5f42e2b7d6f77a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets | arkts | 在uiAbility销毁之前,应当注销对应uiContext | export const removeUIContext: (abilityID: string) => void; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left removeUIContext : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left abilityID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#... | export const removeUIContext: (abilityID: string) => void; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/cpp/types/libetswrapper/index.d.ets#L31-L31 | a5b92b535dccbd98196477391ec91fff95024f90 | gitee | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/SubscriptionManager.ets | arkts | saveSubscriptions | 保存订阅列表到本地存储 | private async saveSubscriptions(): Promise<void> {
try {
if (!this.preferences) {
console.warn('⚠️ Preferences 未初始化')
return
}
const data = Array.from(this.subscriptions.values())
const jsonStr = JSON.stringify(data)
await this.preferences.put('subscriptions', jsonStr)
... | AST#method_declaration#Left private async saveSubscriptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >... | private async saveSubscriptions(): Promise<void> {
try {
if (!this.preferences) {
console.warn('⚠️ Preferences 未初始化')
return
}
const data = Array.from(this.subscriptions.values())
const jsonStr = JSON.stringify(data)
await this.preferences.put('subscriptions', jsonStr)
... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L198-L212 | de2b17b10ffa299b4948e2f26ed5ac2d8ebed0f1 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIBasicComponents/entry/src/main/ets/pages/Index.ets | arkts | httpRequest | 网络图片请求方法 | private httpRequest() {
let httpRequest = http.createHttp();
httpRequest.request(
"https://waylau.com/images/showmethemoney-sm.jpg", // 网络图片地址
(error, data) => {
if (error) {
console.log("error code: " + error.code + ", msg: " + error.message)
} else {
let code =... | AST#method_declaration#Left private httpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#... | private httpRequest() {
let httpRequest = http.createHttp();
httpRequest.request(
"https://waylau.com/images/showmethemoney-sm.jpg",
(error, data) => {
if (error) {
console.log("error code: " + error.code + ", msg: " + error.message)
} else {
let code = data.res... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIBasicComponents/entry/src/main/ets/pages/Index.ets#L783-L814 | 439c67ec3ec5b7b82edda511d1eb24a29f5c8018 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/MockDataService.ets | arkts | 直播间模型 | export interface LiveRoom {
id: string;
title: string;
cover: string;
anchor: string;
anchorAvatar: string;
viewerCount: number;
status: 'live' | 'offline';
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LiveRoom AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#p... | export interface LiveRoom {
id: string;
title: string;
cover: string;
anchor: string;
anchorAvatar: string;
viewerCount: number;
status: 'live' | 'offline';
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L72-L80 | 166de35f1a9b41b9aa6a9bea94aa2eda6e403e2f | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Has | Called when owning or not.
@since 7
@deprecated since 10 | static Has(propName: string): boolean {
return AppStorage.has(propName)
} | AST#method_declaration#Left static Has AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R... | static Has(propName: string): boolean {
return AppStorage.has(propName)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L117-L119 | 435059b8256ef44fa32bdf831b20430aa926524d | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | getCustomYAxisLabels | Get Y-axis custom labels
@param numbers labels | public getCustomYAxisLabels(): number[] {
return this.customYAxisLabels;
} | AST#method_declaration#Left public getCustomYAxisLabels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stat... | public getCustomYAxisLabels(): number[] {
return this.customYAxisLabels;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L143-L145 | 3d2ccfbdd21242a758ac1bf1223ec79b94ab865f | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/extension_actions.ets | arkts | Load and Uninstall
Calculates the id for locally installed extension.
@param path The path.
@returns The ID. | export function extension_id_for_path(path: string) {
let mdAlgName = 'SHA256';
let message = path;
let md = cryptoFramework.createMd(mdAlgName);
md.updateSync({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) });
let mdResult = md.digestSync();
console.info('[id_for_path][Sync] Md result:' + mdR... | AST#export_declaration#Left export AST#function_declaration#Left function extension_id_for_path AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le... | export function extension_id_for_path(path: string) {
let mdAlgName = 'SHA256';
let message = path;
let md = cryptoFramework.createMd(mdAlgName);
md.updateSync({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) });
let mdResult = md.digestSync();
console.info('[id_for_path][Sync] Md result:' + mdR... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L60-L80 | 9a512e3b2144e1b49593af38071d40d5de1ed34a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets | arkts | publicUpdateFunc | 调用updateSession进行协商操作 | async function publicUpdateFunc(handle: number, huksOptions: huks.HuksOptions) {
console.info(`enter promise doUpdate`);
let throwObject: ThrowObject = { isThrow: false };
try {
await updateSession(handle, huksOptions, throwObject)
.then((data) => {
console.info(`promise: doUpdate success, data ... | AST#function_declaration#Left async function publicUpdateFunc AST#parameter_list#Left ( AST#parameter#Left handle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left huksOptions : AST#type_annotation#Left AST#primary_type#Left... | async function publicUpdateFunc(handle: number, huksOptions: huks.HuksOptions) {
console.info(`enter promise doUpdate`);
let throwObject: ThrowObject = { isThrow: false };
try {
await updateSession(handle, huksOptions, throwObject)
.then((data) => {
console.info(`promise: doUpdate success, data ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyUsage/KeyExchange/entry/src/main/ets/pages/X25519.ets#L220-L240 | b5c0b1b0c268fbf03c0a41379fc3ed4cc4479a54 | gitee |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets | arkts | updateOpenFolderData | 监听桌面元素变化时,更新打开的大文件的数据。
eg:应用角标更新时,大文件内的应用角标同步更新。 | updateOpenFolderData() {
const openFolderData = AppStorage.get('openFolderData') as FolderData;
if (CheckEmptyUtils.isEmptyArr(this.mAppListInfo)) {
Log.showError(TAG, 'mAppListInfo is empty');
return;
}
if (openFolderData?.folderId && this.mAppListInfo?.length) {
let temp = this.mAppL... | AST#method_declaration#Left updateOpenFolderData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left openFolderData = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AS... | updateOpenFolderData() {
const openFolderData = AppStorage.get('openFolderData') as FolderData;
if (CheckEmptyUtils.isEmptyArr(this.mAppListInfo)) {
Log.showError(TAG, 'mAppListInfo is empty');
return;
}
if (openFolderData?.folderId && this.mAppListInfo?.length) {
let temp = this.mAppL... | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets#L84-L94 | 00df6261f44ce00b62eb2942491ab640451c1bbb | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | PageContent | 页面内容
@returns {void} 无返回值 | @Builder
private PageContent() {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderConfirmContent()
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left BaseNetWorkView ( AST#component_parameters#Left { AST#component_parameter#Left uiState : AST#expre... | @Builder
private PageContent() {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderConfirmContent()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L58-L65 | 0e7ffa00b2e0c464997a8da5e762cf242109e796 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/pages/Settings.ets | arkts | clearCache | 清理缓存 | clearCache(filepath: string) {
fs.listFile(filepath).then((filenames) => {
for (let i = 0; i < filenames.length; i++) {
let dirPath = filepath + '/' + filenames[i];
console.log('dirPath', dirPath);
// 判断是否为文件夹
let isDirectory: boolean = false;
try {
isDirector... | AST#method_declaration#Left clearCache AST#parameter_list#Left ( AST#parameter#Left filepath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressi... | clearCache(filepath: string) {
fs.listFile(filepath).then((filenames) => {
for (let i = 0; i < filenames.length; i++) {
let dirPath = filepath + '/' + filenames[i];
console.log('dirPath', dirPath);
let isDirectory: boolean = false;
try {
isDirectory = fs.stat... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/Settings.ets#L548-L572 | eab3cf599761957153003d36c3137889bfc9f465 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/TextPickerDialogView.ets | arkts | recursionPickerRange | 递归获取默认值 | recursionPickerRange(pickerRange: TextCascadePickerRangeContent[]) {
if (pickerRange && pickerRange.length > 0) {
let range = pickerRange[0];
(this.value as string[]).push(SysUtil.getResourceStr(range.text ?? "") ?? "");
this.recursionPickerRange(range.children ?? []);
}
} | AST#method_declaration#Left recursionPickerRange AST#parameter_list#Left ( AST#parameter#Left pickerRange : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TextCascadePickerRangeContent [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | recursionPickerRange(pickerRange: TextCascadePickerRangeContent[]) {
if (pickerRange && pickerRange.length > 0) {
let range = pickerRange[0];
(this.value as string[]).push(SysUtil.getResourceStr(range.text ?? "") ?? "");
this.recursionPickerRange(range.children ?? []);
}
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/TextPickerDialogView.ets#L66-L72 | 1bbb679e7130e18aa90d02fb09d9189a1513dbce | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | isDrawHighlightCircleEnabled | Returns true if highlight circle should be drawn, false if not @Override | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | AST#method_declaration#Left public isDrawHighlightCircleEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Lef... | public isDrawHighlightCircleEnabled(): boolean {
return this.mDrawHighlightCircleEnabled;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L44-L46 | 93a1484402290e78a9064f9d0dd8b5f96883a019 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_audio/src/main/ets/type/index.ets | arkts | 定义一个名为 EFPlayOptions 的接口,表示播放选项。 | export interface EFPlayOptions {
/**
* 可选属性,表示是否立即播放,默认为 undefined
*/
immediately?: boolean
/**
* 可选属性,表示是否循环播放,默认为 undefined
*/
loop?: boolean
/**
* 可选属性,指定的相对音量大小,取值范围为[0.00-1.00],1表示最大音量
*/
volume?: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface EFPlayOptions AST#object_type#Left { /**
* 可选属性,表示是否立即播放,默认为 undefined
*/ AST#type_member#Left immediately ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /... | export interface EFPlayOptions {
immediately?: boolean
loop?: boolean
volume?: number
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_audio/src/main/ets/type/index.ets#L34-L47 | 05c19d039fd78fad0f2478d3f84b13b1208debc5 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/RefundOrderRequest.ets | arkts | @file 退款请求实体类
@author Joker.X | export class RefundOrderRequest {
/**
* 订单ID
*/
orderId: number = 0;
/**
* 退款原因
*/
reason: string = "";
/**
* @param {RefundOrderRequest} init - 初始化数据
*/
constructor(init?: Partial<RefundOrderRequest>) {
if (!init) {
return;
}
this.orderId = init.orderId ?? this.orderId;... | AST#export_declaration#Left export AST#class_declaration#Left class RefundOrderRequest AST#class_body#Left { /**
* 订单ID
*/ AST#property_declaration#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; A... | export class RefundOrderRequest {
orderId: number = 0;
reason: string = "";
constructor(init?: Partial<RefundOrderRequest>) {
if (!init) {
return;
}
this.orderId = init.orderId ?? this.orderId;
this.reason = init.reason ?? this.reason;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/RefundOrderRequest.ets#L5-L25 | 43dea482a6ba4f550060571d85713db9fad86dce | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | moveData | 移动数据到指定index | public moveData(from: number, to: number): void {
if (from < 0 || from >= this.originDataArray.length || to < 0 || to >= this.originDataArray.length) {
throw new Error("Index out of bounds");
}
const data = this.originDataArray[from];
this.originDataArray.splice(from, 1);
... | AST#method_declaration#Left public moveData AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | public moveData(from: number, to: number): void {
if (from < 0 || from >= this.originDataArray.length || to < 0 || to >= this.originDataArray.length) {
throw new Error("Index out of bounds");
}
const data = this.originDataArray[from];
this.originDataArray.splice(from, 1);
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L62-L70 | 2c802bd7a450eb7b03b701ca1b2f8f75bbbae04f | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/PlayerService.ets | arkts | updateSessionMetadata | 更新 AVSession 媒体信息 | private async updateSessionMetadata(): Promise<void> {
if (!this.session || !this.currentEpisode) {
return;
}
try {
const metadata: avSession.AVMetadata = {
assetId: this.currentEpisode.id,
title: this.currentEpisode.title,
artist: 'Podcast',
duration: this.curre... | AST#method_declaration#Left private async updateSessionMetadata 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#Rig... | private async updateSessionMetadata(): Promise<void> {
if (!this.session || !this.currentEpisode) {
return;
}
try {
const metadata: avSession.AVMetadata = {
assetId: this.currentEpisode.id,
title: this.currentEpisode.title,
artist: 'Podcast',
duration: this.curre... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PlayerService.ets#L119-L135 | 7d40b6aec6797f77c55b453cf00471f9c3be88fa | github |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/pages/home/index.ets | arkts | _navTab | 1.顶部导航栏 | @Builder
_navTab() {
Row() {
Image($r("app.media.yunmoai_log"))
.height(20)
Row() {
Text("PRO")
.fontSize(14)
.fontWeight(FontWeight.Bold)
.fontColor(0xFFFFFF)
.padding({
left: 10,
right: 10,
top: 5,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right _navTab 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Lef... | @Builder
_navTab() {
Row() {
Image($r("app.media.yunmoai_log"))
.height(20)
Row() {
Text("PRO")
.fontSize(14)
.fontWeight(FontWeight.Bold)
.fontColor(0xFFFFFF)
.padding({
left: 10,
right: 10,
top: 5,
... | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/pages/home/index.ets#L21-L56 | faad3c3c2b8691960f7a59f6a5fb6f8836046b9e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/VideoPlayController.ets | arkts | 视频播放控制器。用于控制视频的播放暂停及播放进度。 | export class VideoPlayController {
// 播放接口
play = () => {
};
// 暂停接口
pause = () => {
};
// 播放进度接口
seek = (currentTime: number) => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class VideoPlayController AST#class_body#Left { // 播放接口 AST#property_declaration#Left play = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_litera... | export class VideoPlayController {
play = () => {
};
pause = () => {
};
seek = (currentTime: number) => {
};
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/VideoPlayController.ets#L19-L29 | 0950bcc87c03bb83df4459ea26d98a65c7d2f268 | gitee | |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets | arkts | countTakeVideoFn | 倒计时拍照和录像 | countTakeVideoFn(): void {
if (this.countdownNum) {
// 清除定时器
if (this.countTimerOut) {
clearTimeout(this.countTimerOut);
}
if (this.countTimerInt) {
clearInterval(this.countTimerInt);
}
// 开启定时器
this.countTimerOut = setTimeout(() => {
// 判断是录像还是拍照模式
... | AST#method_declaration#Left countTakeVideoFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_... | countTakeVideoFn(): void {
if (this.countdownNum) {
if (this.countTimerOut) {
clearTimeout(this.countTimerOut);
}
if (this.countTimerInt) {
clearInterval(this.countTimerInt);
}
this.countTimerOut = setTimeout(() => {
this.isVideoPhotoFn();... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets#L118-L142 | 43cde678e1b7efc6d2cc8d8923324d261bc069ee | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | clearAllSearchHistory | 清空所有搜索历史记录
@returns {Promise<void>} Promise<void> | async clearAllSearchHistory(): Promise<void> {
this.orm.query(SearchHistoryEntity).delete();
} | AST#method_declaration#Left async clearAllSearchHistory 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... | async clearAllSearchHistory(): Promise<void> {
this.orm.query(SearchHistoryEntity).delete();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L61-L63 | 41a74fb66da12895f2a610ad23e2c76db3b08b95 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/FileBackupExtension/entry/src/main/ets/common/BackupExtension.ets | arkts | onRestoreEx | onRestoreEx | async onRestoreEx(bundleVersion: BundleVersion, restoreInfo: string): Promise<string> {
console.log(`onRestoreEx ok ${JSON.stringify(bundleVersion)}`);
let errorInfo: ErrorInfo = {
type: 'ErrorInfo',
errorCode: 0,
errorInfo: 'app diy error info'
}
return JSON.stringify(errorInfo);
} | AST#method_declaration#Left async onRestoreEx AST#parameter_list#Left ( AST#parameter#Left bundleVersion : AST#type_annotation#Left AST#primary_type#Left BundleVersion AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left restoreInfo : AST#type_annotation#Left AST#primary_type#Left s... | async onRestoreEx(bundleVersion: BundleVersion, restoreInfo: string): Promise<string> {
console.log(`onRestoreEx ok ${JSON.stringify(bundleVersion)}`);
let errorInfo: ErrorInfo = {
type: 'ErrorInfo',
errorCode: 0,
errorInfo: 'app diy error info'
}
return JSON.stringify(errorInfo);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileBackupExtension/entry/src/main/ets/common/BackupExtension.ets#L51-L59 | 3225f20884c6b94836810c6ad09f470e6b0acfc3 | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/LoginPage.ets | arkts | watchLoginingStatus | Watch登录状态的改变。 | watchLoginingStatus(): void {
if(this.isLogining) {
// * 设置好服务端反馈的登陆结果观察者(当客户端收到服务端反馈过来的登陆消息时将被通知)【2】
IMClientManager.getInstance().getEmitter().on(UIEvent.UIEVENT_onIMAfterLoginComplete, this.onLoginSucessObserver);
// 开启登录超时计时器
this.startLoginTimer();
} else {
//## try to bug FI... | AST#method_declaration#Left watchLoginingStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#memb... | watchLoginingStatus(): void {
if(this.isLogining) {
IMClientManager.getInstance().getEmitter().on(UIEvent.UIEVENT_onIMAfterLoginComplete, this.onLoginSucessObserver);
this.startLoginTimer();
} else {
IMClientManager.getInstance().getEmitter().off(UIEvent.UIEVENT_on... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L114-L129 | 0e368a9995ef5c428f28d63bb2041917567cc9f6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/ai/AIAssistantService.ets | arkts | recognizeIntent | 意图识别 | private async recognizeIntent(message: string, context: ConversationContext): Promise<IntentResult> {
try {
let bestIntent = 'general_chat';
let bestConfidence = 0;
const entities: Record<string, any> = {};
// 规则匹配
for (const [intent, patterns] of this.intentPatterns.entries()) {
... | AST#method_declaration#Left private async recognizeIntent AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Conver... | private async recognizeIntent(message: string, context: ConversationContext): Promise<IntentResult> {
try {
let bestIntent = 'general_chat';
let bestConfidence = 0;
const entities: Record<string, any> = {};
for (const [intent, patterns] of this.intentPatterns.entries()) {
for... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/ai/AIAssistantService.ets#L583-L638 | 1c2aed371a2ca1ceed84a4c85d0549245266b0e2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | cleanup | 清理资源 | async cleanup(): Promise<void> {
try {
// 清理所有动态快捷方式
const dynamicShortcuts = Array.from(this.shortcuts.values()).filter(s => !s.isStatic);
for (const shortcut of dynamicShortcuts) {
await shortcutManager.removeShortcut(shortcut.id);
}
this.shortcuts.clear();
... | AST#method_declaration#Left async cleanup 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_argument... | async cleanup(): Promise<void> {
try {
const dynamicShortcuts = Array.from(this.shortcuts.values()).filter(s => !s.isStatic);
for (const shortcut of dynamicShortcuts) {
await shortcutManager.removeShortcut(shortcut.id);
}
this.shortcuts.clear();
hilog.info... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L506-L521 | 362b480de93dae74b4f0969aee8567fff69ff0ce | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | deleteFileAt | 删除文件 | static deleteFileAt(path: string | null): boolean {
if (!path) return false;
try {
if (fs.accessSync(path)) {
fs.unlinkSync(path);
return true;
}
return false;
} catch (e) {
return false;
}
} | AST#method_declaration#Left static deleteFileAt AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AS... | static deleteFileAt(path: string | null): boolean {
if (!path) return false;
try {
if (fs.accessSync(path)) {
fs.unlinkSync(path);
return true;
}
return false;
} catch (e) {
return false;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L29-L40 | 49717302b49eceb9a05a96838503aa58592f5f95 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets | arkts | dbLearns | 获取此 DBPlan 的 DBLearns | async dbLearns(): Promise<DBLearn[]> {
if (this.plan.planId) {
return await PlanDbAccess.shared.getLearns(this.plan.planId) ?? [];
}
return [];
} | AST#method_declaration#Left async dbLearns AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DBLearn [ ] AST#array_type#Right AST#primary_type#Ri... | async dbLearns(): Promise<DBLearn[]> {
if (this.plan.planId) {
return await PlanDbAccess.shared.getLearns(this.plan.planId) ?? [];
}
return [];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L53-L58 | 037a6ca0b0620f51bc7914f2ea5670f449e22e9c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/HttpUtils.ets | arkts | 3. 定义API响应接口 - 使用明确类型替代any | export interface ReceivedData<T> {
code?: number;
msg?: string;
data?: T[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ReceivedData AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left code ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | export interface ReceivedData<T> {
code?: number;
msg?: string;
data?: T[];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/HttpUtils.ets#L21-L25 | 8d3d09a92ce226f2a0523962e6471411cd9c405e | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.