nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
getSliderCaptcha
========== Step 2: 获取滑块验证码图片 ==========
async getSliderCaptcha(onProgress?: (p: LoginProgress) => void): Promise<SliderPuzzle> { if (onProgress) { onProgress({ step: 'captcha', message: '获取验证码...', percent: 15 }); } const url: string = this.CAPTCHA_URL + '?_=' + Date.now().toString(); // 直接用 getNoRedirect 获取 JSON 响应 const resp: H...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getSliderCaptcha AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left onProgress AST#identifier#Ri...
async getSliderCaptcha(onProgress?: (p: LoginProgress) => void): Promise<SliderPuzzle> { if (onProgress) { onProgress({ step: 'captcha', message: '获取验证码...', percent: 15 }); } const url: string = this.CAPTCHA_URL + '?_=' + Date.now().toString(); // 直接用 getNoRedirect 获取 JSON 响应 const resp: H...
https://github.com/PollenWang6/HiXD
dfe20f0fc235cf4c97ac63a5aec408d2d759d128
github
openharmony/arkui_ace_engine
examples/ImageCapiExample/entry/src/main/ets/pages/Index.ets
arkts
changeNativeFlag
监听 showNative 变化,创建或销毁 Native 组件
changeNativeFlag(): void { if (this.showNative) { // 传递 NodeContent 对象用于 Native 创建组件的挂载显示 nativeNode.createNativeRoot(this.rootSlot) } else { // 销毁 NativeModule 组件 nativeNode.destroyNativeRoot() } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left changeNativeFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio...
changeNativeFlag(): void { if (this.showNative) { // 传递 NodeContent 对象用于 Native 创建组件的挂载显示 nativeNode.createNativeRoot(this.rootSlot) } else { // 销毁 NativeModule 组件 nativeNode.destroyNativeRoot() } }
https://gitcode.com/openharmony/arkui_ace_engine
d3085a9dd4be6d6514c19ea33e78b4600d87a9a6
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
removeItemFromCategory
从分类中移除内容
async removeItemFromCategory(itemId: string, contentType: ContentType): Promise<void> { const key = `${contentType}_${itemId}`; this.itemCategoryMap.delete(key); await this.saveItemCategoryMap(); await this.updateCategoryCounts(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeItemFromCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemId AST#identifier#Right AST#type_annotation#Left AST...
async removeItemFromCategory(itemId: string, contentType: ContentType): Promise<void> { const key = `${contentType}_${itemId}`; this.itemCategoryMap.delete(key); await this.saveItemCategoryMap(); await this.updateCategoryCounts(); }
https://github.com/DaLongZhuaZi/manxia
76c10d0aaa4e2b8425b14c3acec2ba7a810ae56f
github
openharmony/applications_contacts
common/src/main/ets/util/StringUtil.ets
arkts
paddingLeft
根据指定字符padCh,补全字符串str 到指定长度len @param str @param padCh @param len @returns
static paddingLeft(str: string, padCh: string, len: number): string { while (str.length < len) { str = padCh + str; } return str; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left paddingLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static paddingLeft(str: string, padCh: string, len: number): string { while (str.length < len) { str = padCh + str; } return str; }
https://gitee.com/openharmony/applications_contacts.git
0e4e2cdf8f3125dea7d9958f128efcad85610f73
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets
arkts
setUseNativeEngine
设置是否使用Native引擎
setUseNativeEngine(use: boolean): void { this.useNativeEngine = use; if (use && !this.nativeEngineReady) { this.initNativeEngine(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUseNativeEngine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left use AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Lef...
setUseNativeEngine(use: boolean): void { this.useNativeEngine = use; if (use && !this.nativeEngineReady) { this.initNativeEngine(); } }
https://github.com/DaLongZhuaZi/manxia
233f7b167853d65151264ded4833534c09dc2226
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/AdminAuthService.ets
arkts
login
管理员登录 @param request 登录请求参数 @returns 登录响应
static async login(request: AdminLoginRequest): Promise<BaseResponse<AdminLoginResponse>> { return await HttpUtil.post<AdminLoginResponse>(`${AdminAuthService.BASE_URL}/login`, request, { skipAuth: true, isAdmin: true // 标识为管理员请求 }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left login AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Ri...
static async login(request: AdminLoginRequest): Promise<BaseResponse<AdminLoginResponse>> { return await HttpUtil.post<AdminLoginResponse>(`${AdminAuthService.BASE_URL}/login`, request, { skipAuth: true, isAdmin: true // 标识为管理员请求 }); }
https://github.com/LJ666-ui/harmony-health-care
219628b49d7526d326eab58dc8b6a7d06f6bfba0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
copyWithin
Makes a shallow copy of the Array part to another location in the same Array and returns it without modifying its length. @param target index at which to copy the sequence @param start index at which to start copying elements from @param end index at which to end copying elements from @returns this array after transfor...
public copyWithin(target: number, start: number, end: number): Array<T> { return this.copyWithin(target as int, start as int, end as int); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public copyWithin(target: number, start: number, end: number): Array<T> { return this.copyWithin(target as int, start as int, end as int); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e19b9e03ffb19ee5f4024e0c6369904719ae1b86
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGManager.ets
arkts
setAttribute
为对象设置属性或子节点(覆盖原有键值对) @param parentObj 要设置属性或结点的对象 @param key 主键 @param value 属性/节点
public setAttribute(parentObj: Object, key: string, value: string): void { let parentObjValue: Record<string,string|object>|object=parentObj if (typeof parentObjValue === SVGAttrConstants.TYPEOF_OBJECT && key && value) { let attributesObj: Record<string,string|object>|string = '' ; if (hasKeyInOb...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide...
public setAttribute(parentObj: Object, key: string, value: string): void { let parentObjValue: Record<string,string|object>|object=parentObj if (typeof parentObjValue === SVGAttrConstants.TYPEOF_OBJECT && key && value) { let attributesObj: Record<string,string|object>|string = '' ; if (hasKeyInOb...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
5010769d65dc6586f16da34270033080089dc6a4
gitee
richshaw2015/nds
ohos/entry/src/test/NativeSync.test.ets
arkts
getConfigCount
获取存储的配置数量
getConfigCount(): number { return this.configStore.size; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfigCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme...
getConfigCount(): number { return this.configStore.size; }
https://github.com/richshaw2015/nds
fd0f190fd0f5f75b9e7bee0459f7d981d346a724
github
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
getExtensionByMime
根据 MIME 格式获取推荐文件扩展名
static getExtensionByMime(format: string): string { if (format === 'image/png') { return 'png'; } if (format === 'image/webp') { return 'webp'; } return 'jpg'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getExtensionByMime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static getExtensionByMime(format: string): string { if (format === 'image/png') { return 'png'; } if (format === 'image/webp') { return 'webp'; } return 'jpg'; }
https://github.com/kumaleap/ArkLuban
fa5b798a376257b21bc5e4b553e10019391206c2
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
isGyroActive
获取陀螺仪活跃状态
isGyroActive(): boolean { return this.gyroEnabled; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isGyroActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem...
isGyroActive(): boolean { return this.gyroEnabled; }
https://github.com/AlkaidLab/moonlight-harmony
bf1a942f46bd7d8e496d0a94d412e0638bf2a5fb
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
relayAccountsToJson
==================== RustDesk Relay CRUD (本地) ====================
private relayAccountsToJson(relay: RustDeskRelayConfig): string { const crypto = DataCrypto.getInstance(); const items: RustDeskAccountJSON[] = []; for (let i = 0; i < relay.accounts.length; i++) { const item: RustDeskAccountJSON = relay.accounts[i].toJSON(); if (item.password !== '') { item.p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left relayAccountsToJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left relay AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private relayAccountsToJson(relay: RustDeskRelayConfig): string { const crypto = DataCrypto.getInstance(); const items: RustDeskAccountJSON[] = []; for (let i = 0; i < relay.accounts.length; i++) { const item: RustDeskAccountJSON = relay.accounts[i].toJSON(); if (item.password !== '') { item.p...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
c156d20b7cbee14def32752f067921c73f168a64
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/IllustDetailViewModel.ets
arkts
handleTransitionReady
处理动画初始化逻辑
handleTransitionReady(ctx: NavDestinationContext, params: DetailPageParams) { const fromId = params.fromId as string; const pageId = ctx.navDestinationId; if (!pageId || !fromId) { // 如果没有 fromId,说明不是通过卡片点击进入的,直接设置最终状态 this.longTakeAnimationProperties.setFinalStatus(); return; } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleTransitionReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NavDestinationContex...
handleTransitionReady(ctx: NavDestinationContext, params: DetailPageParams) { const fromId = params.fromId as string; const pageId = ctx.navDestinationId; if (!pageId || !fromId) { // 如果没有 fromId,说明不是通过卡片点击进入的,直接设置最终状态 this.longTakeAnimationProperties.setFinalStatus(); return; } ...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/IllustDetailViewModel.ets#L176-L195
031fe83fec9d1990613b86b9f905d4d677b95793
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/TextReaderComponent.ets
arkts
build
使用 Stack 布局:所有层叠加,底部信息栏使用 position 定位
build() { // 背景层 - 图片模式下需要底色保证文字可读性 Stack() { // 底层:半透明底色,确保文字可读 if (this.settings.background.type === BackgroundType.IMAGE && this.settings.background.imagePath) { // 底层:半透明底色,确保文字可读 Column() .width('100%') .height('100%') .backgroundColor('#F5F0E...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { // 背景层 - 图片模式下需要底色保证文字可读性 Stack() { // 底层:半透明底色,确保文字可读 if (this.settings.background.type === BackgroundType.IMAGE && this.settings.background.imagePath) { // 底层:半透明底色,确保文字可读 Column() .width('100%') .height('100%') .backgroundColor('#F5F0E...
https://github.com/DaLongZhuaZi/manxia
a5d1cd48d4af57497aa49b97e77fa2c2e0bec532
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/DSiWareManager.ets
arkts
hasPublicSavFile
判断标题是否有 public.sav - 对齐 Android DSiWareTitle.hasPublicSavFile()
function hasPublicSavFile(title: DSiWareTitleNative): boolean { return (title.publicSavSize ?? 0) !== 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasPublicSavFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left title AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function hasPublicSavFile(title: DSiWareTitleNative): boolean { return (title.publicSavSize ?? 0) !== 0; }
https://github.com/richshaw2015/nds
edc08ecf64f6d83c84616e7c71865dc62fef0e52
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getValueForDate
获取指定日期的数据值
getValueForDate(date: string): number { const record = this.records.find(r => r.date === date); if (!record) return 0; switch (this.selectedMetric) { case 'weight': return record.weight || 0; case 'heartRate': return record.heartRate || 0; case 'bloodPressure': r...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValueForDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
getValueForDate(date: string): number { const record = this.records.find(r => r.date === date); if (!record) return 0; switch (this.selectedMetric) { case 'weight': return record.weight || 0; case 'heartRate': return record.heartRate || 0; case 'bloodPressure': r...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
3814f9ecf0c3c32fada83860bbc9842a62fbf1cb
github
OHPG/FinVideo
entry/src/main/ets/player/AppMediaResolver.ets
arkts
pickVersion
─── 版本选择 ──────────────────────────────────────────────────────────────
private async pickVersion(sources: FinItemSource[]): Promise<FinItemSource> { return new Promise<FinItemSource>((resolve) => { try { const names = sources.map((s: FinItemSource): string => s.name ?? s.id ?? s.url) const sheet = new VersionPickerSheet( this.uiContext, name...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left pickVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left :...
private async pickVersion(sources: FinItemSource[]): Promise<FinItemSource> { return new Promise<FinItemSource>((resolve) => { try { const names = sources.map((s: FinItemSource): string => s.name ?? s.id ?? s.url) const sheet = new VersionPickerSheet( this.uiContext, name...
https://github.com/OHPG/FinVideo
d35378060588cc471598bdd9d39617499ba1eb90
github
the-wwyang/kids-learning-app
src/main/ets/storage/AchievementManager.ets
arkts
saveUserAchievements
保存用户成就
private async saveUserAchievements(achievements: Achievement[]): Promise<boolean> { const currentUser = appStorage.getCurrentUser(); if (this.dataPreferences === null || currentUser === null) { return false; } try { const username = currentUser.username; const key = `${AchievementMa...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveUserAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievements AST#identifier#Righ...
private async saveUserAchievements(achievements: Achievement[]): Promise<boolean> { const currentUser = appStorage.getCurrentUser(); if (this.dataPreferences === null || currentUser === null) { return false; } try { const username = currentUser.username; const key = `${AchievementMa...
https://github.com/the-wwyang/kids-learning-app
4be8fb653cd24d9258d4810499fada1dfe037951
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeClick
执行点击操作
private async executeClick(action: ClickAction, context: ActionContext): Promise<boolean> { const selector = this.replaceVariables(action.selector, context.variables); logger.info(TAG, `点击元素: ${selector}`); const exists = await this.checkElement(selector); if (!exists) { throw new MangaSourceEr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left executeClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left :...
private async executeClick(action: ClickAction, context: ActionContext): Promise<boolean> { const selector = this.replaceVariables(action.selector, context.variables); logger.info(TAG, `点击元素: ${selector}`); const exists = await this.checkElement(selector); if (!exists) { throw new MangaSourceEr...
https://github.com/DaLongZhuaZi/manxia
3ee8abc02e74c277fed4e3a73db6a67c9927afab
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/order/OrderNavigator.ets
arkts
toComment
跳转到订单评价 @param {number} orderId - 订单 ID @param {number} goodsId - 商品 ID @returns {void} 无返回值
static toComment(orderId: number, goodsId: number): void { const params: OrderCommentParam = { orderId, goodsId }; navigateTo(OrderRoutes.Comment, params); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
static toComment(orderId: number, goodsId: number): void { const params: OrderCommentParam = { orderId, goodsId }; navigateTo(OrderRoutes.Comment, params); }
https://github.com/Joker-x-dev/CoolMallArkTS
236fba239c072ba6ac12ab2264b398254f53a8bd
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createPowerKey
发送电源键
static createPowerKey(): ArrayBuffer[] { return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_POWER); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createPowerKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ArrayBu...
static createPowerKey(): ArrayBuffer[] { return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_POWER); }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
fde07e7622dd6ea000051a4dc45a7219128e3c8e
github
openharmony-sig/arkui_composite_component
source/TreeView/TreeView.ets
arkts
modifyNode
Modify the node name. Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node. @since 10
public modifyNode(): void { let clickNodeId = this.listNodeDataSource.getClickNodeId(); this.listNodeDataSource.setItemVisibilityOnEdit(clickNodeId, MenuOperation.MODIFY_NODE); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left modifyNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Rig...
public modifyNode(): void { let clickNodeId = this.listNodeDataSource.getClickNodeId(); this.listNodeDataSource.setItemVisibilityOnEdit(clickNodeId, MenuOperation.MODIFY_NODE); }
https://gitee.com/openharmony-sig/arkui_composite_component.git
e5e647f536b9162c716f6a9d0d49d351ca0a1354
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
float
Write float32 little-endian
float(v: number): Writer { const ab = new ArrayBuffer(4); const dv = new DataView(ab); dv.setFloat32(0, v, true); const u = new Uint8Array(ab); for (let i = 0; i < 4; i++) this.push(u[i]); return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left float AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right ...
float(v: number): Writer { const ab = new ArrayBuffer(4); const dv = new DataView(ab); dv.setFloat32(0, v, true); const u = new Uint8Array(ab); for (let i = 0; i < 4; i++) this.push(u[i]); return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
bd054fc0f95e8485d980c698593c05f24ef15cd2
gitcode
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/StateTag.ets
arkts
getBackgroundColor
根据类型获取背景颜色
getBackgroundColor() { switch (this.state) { case State.Open: return $r('app.color.state_open') break case State.Merged: return $r('app.color.state_merged') break case State.Closed: return $r('app.color.state_closed') break case IssueState.Op...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block...
getBackgroundColor() { switch (this.state) { case State.Open: return $r('app.color.state_open') break case State.Merged: return $r('app.color.state_merged') break case State.Closed: return $r('app.color.state_closed') break case IssueState.Op...
https://gitee.com/openharmony-sig/online_event.git
30bf9e6359e4893fa4aa2b0fbb67d9405b3e36a3
gitee
openharmony-sig/applications_filemanager
entry/src/main/ets/Components/ClassityList.ets
arkts
getDirSum
把媒体算出内容个数
getDirSum(listItemType: string){ var n=0 if(listItemType=='image') n = this.imageList1.length else if(listItemType=='video') n =this.videoList.length else if(listItemType=='audio') n =this.audioList.length else if(listItemType=='file') n =this.fileTypeList.length return n; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDirSum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listItemType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
getDirSum(listItemType: string){ var n=0 if(listItemType=='image') n = this.imageList1.length else if(listItemType=='video') n =this.videoList.length else if(listItemType=='audio') n =this.audioList.length else if(listItemType=='file') n =this.fileTypeList.length return n; }
https://gitee.com/openharmony-sig/applications_filemanager.git
c4deb9b3008c88f3f85a83bdbab940ee2ffb80a9
gitee
openharmony-sig/commons-cli
library/src/main/ets/components/cli/JMap.ets
arkts
values
获取MAP中所有VALUE的数组(ARRAY)
values():Array<T2> { let arr: Array<T2> = new Array(); for (let i: number = 0; i < this.elements.length; i++) { arr.push(this.elements[i].value); } return arr; };
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST...
values():Array<T2> { let arr: Array<T2> = new Array(); for (let i: number = 0; i < this.elements.length; i++) { arr.push(this.elements[i].value); } return arr; };
https://gitee.com/openharmony-sig/commons-cli.git
3d9016015b1dd0e322a2caa6403b79ce9a286143
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
formatRangeToParts
Returns an Array of objects representing the range of numbers in parts that can be used for custom locale-aware formatting. @param start Start range to format a number or BigInt @param end End range to format a number or BigInt @throws TypeError if start or end is NaN @returns An Array of objects containing the formatt...
public formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[] { let isStartBigInt: boolean = false; if (start instanceof BigInt) { isStartBigInt = true; } else if (isNaN(start as number)) { throw new TypeError...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left formatRangeToParts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expre...
public formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[] { let isStartBigInt: boolean = false; if (start instanceof BigInt) { isStartBigInt = true; } else if (isNaN(start as number)) { throw new TypeError...
https://gitcode.com/iop123123/arkts-static-skills
52ada00bade5ac869eb09744f54acf69bb362ffe
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
getVar
==================== 变量存取 ==================== 获取变量
getVar(key: string): string { return this.variables.get(key) || ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getVar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig...
getVar(key: string): string { return this.variables.get(key) || ''; }
https://github.com/DaLongZhuaZi/manxia
c62f5f69bd2f89d1b4220961cab2fdc8d91c5e77
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitRepeatedUint64
访问 repeated uint64 字段 JSON: array of string
visitRepeatedUint64(value: bigint[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.map(v => v.toString()) as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left bigin...
visitRepeatedUint64(value: bigint[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.map(v => v.toString()) as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
14b383a8bcdb5530b9622deda161fa1d668f4786
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
warmUpWebViewSession
HTTP 层预热:订水 OAuth 走一遍,xxcapp session 入 HTTP cookieStore,再同步到 WebView 调用时机:登录成功后(HTTP 层已有 TGC),不需要 WebView
async warmUpWebViewSession(): Promise<void> { console.info(TAG, "warmUpWebViewSession: start"); try { // Step 1: warm order OAuth (dingshui) const t1 = Date.now(); await this.http.get("https://order.xidian.edu.cn/mobile/thirdoauth/oauth2Xidian/1"); console.info(TAG, "warmUpWebViewSessi...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left warmUpWebViewSession AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async warmUpWebViewSession(): Promise<void> { console.info(TAG, "warmUpWebViewSession: start"); try { // Step 1: warm order OAuth (dingshui) const t1 = Date.now(); await this.http.get("https://order.xidian.edu.cn/mobile/thirdoauth/oauth2Xidian/1"); console.info(TAG, "warmUpWebViewSessi...
https://github.com/PollenWang6/HiXD
a2ed6c29c15bdac3863e3e959322492c36807eb7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an BigInt64Array from FixedArray<bigint> @param { FixedArray<bigint> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<bigint>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].getLong()) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<bigint>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].getLong()) } }
https://gitcode.com/iop123123/arkts-static-skills
584f04ca80d63ef4a5431e38b817d19a2c57daee
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/ShortcutManager.ets
arkts
deleteShortcut
删除快捷键
async deleteShortcut(id: string): Promise<boolean> { const index = this.shortcuts.findIndex(s => s.id === id); if (index === -1) return false; // 记录被删除的内置快捷键ID,防止重启后恢复 if (this.shortcuts[index].isBuiltin) { this.deletedBuiltinIds.push(id); } this.shortcuts.splice(index, 1); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteShortcut AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async deleteShortcut(id: string): Promise<boolean> { const index = this.shortcuts.findIndex(s => s.id === id); if (index === -1) return false; // 记录被删除的内置快捷键ID,防止重启后恢复 if (this.shortcuts[index].isBuiltin) { this.deletedBuiltinIds.push(id); } this.shortcuts.splice(index, 1); ...
https://github.com/AlkaidLab/moonlight-harmony
47bd664d3f7dd98dd63638d09de762a703993c6c
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentDetailViewModel.ets
arkts
changeTopNavigationState
改变顶部导航状态 @param event
private changeTopNavigationState(event: TopNavigationChangeEvent): void { this.state.topNavigationModel = { title: this.state.topNavigationModel.title, titleColor: this.state.topNavigationModel.titleColor, isFullScreen: this.state.topNavigationModel.isFullScreen, isBlur: event.isBlur, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left changeTopNavigationState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private changeTopNavigationState(event: TopNavigationChangeEvent): void { this.state.topNavigationModel = { title: this.state.topNavigationModel.title, titleColor: this.state.topNavigationModel.titleColor, isFullScreen: this.state.topNavigationModel.isFullScreen, isBlur: event.isBlur, ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
47dc70301855834e150ac9ef2b3de355ec991f34
gitcode
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
fillEmptyAIContentPlaceholder
当 AI 消息内容完全为空时,填充一条兜底提示,避免出现空气泡
private fillEmptyAIContentPlaceholder(aiMessage: ChatMessage, errorHint: string = ''): void { // 流式完成时顺便把本轮 Responses reasoning 原文持久化到消息上。 // 对非官方 Responses 路径来说 blob 始终为空,不影响其他模型。 this.harvestResponsesReasoningSignature(aiMessage) // 同样地,把本轮流式累积的 token 用量收割到消息上(消费即清空)。 // 工具循环已在每轮逐一收割,这里对非工具路径的单轮...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fillEmptyAIContentPlaceholder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
private fillEmptyAIContentPlaceholder(aiMessage: ChatMessage, errorHint: string = ''): void { // 流式完成时顺便把本轮 Responses reasoning 原文持久化到消息上。 // 对非官方 Responses 路径来说 blob 始终为空,不影响其他模型。 this.harvestResponsesReasoningSignature(aiMessage) // 同样地,把本轮流式累积的 token 用量收割到消息上(消费即清空)。 // 工具循环已在每轮逐一收割,这里对非工具路径的单轮...
https://github.com/LongLiveY96/chatcube
1dcf9da6c0dac56b9b992e30678f6223c2e27a3c
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/LrcView.ets
arkts
hasLrc
Whether any lyric lines are loaded (non-instrumental track).
hasLrc(): boolean { return this.mLrcEntryList && this.mLrcEntryList.length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasLrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_bl...
hasLrc(): boolean { return this.mLrcEntryList && this.mLrcEntryList.length > 0; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
2943333d5d5ac317a0e54dfdef9371353318fab1
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/LayoutConfigManager.ets
arkts
findSimilarLayoutVariant
查找相似变体 (对齐 Android UILayoutProvider.findSimilarLayoutVariant — 简化版) 优先: 同方向+同尺寸 → 同方向任意尺寸 → null
private findSimilarLayoutVariant(config: LayoutConfiguration, variant: UILayoutVariant): PositionedLayoutComponent[] | null { const keys = Object.keys(config.layoutVariants); let sameOrientationMatch: UILayout | null = null; for (const k of keys) { const v = keyToVariant(k); if (!v) continue;...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findSimilarLayoutVariant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private findSimilarLayoutVariant(config: LayoutConfiguration, variant: UILayoutVariant): PositionedLayoutComponent[] | null { const keys = Object.keys(config.layoutVariants); let sameOrientationMatch: UILayout | null = null; for (const k of keys) { const v = keyToVariant(k); if (!v) continue;...
https://github.com/richshaw2015/nds
dd4aebff8057fd7933f346cc9fd28b09dd2613ac
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
setUTCMonth
Sets the month for a specified date according to universal time. @param month new month
public setUTCMonth(month: number): void { this.setUTCMonth(month as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left month AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public setUTCMonth(month: number): void { this.setUTCMonth(month as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f161d8cd2d570c41fdc1e678272ae1472e35ad19
gitee
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
applyFeatureSelection
Re-mark the distributed-table set to match the current per-feature toggles, then run a sync. Called when the user flips a feature toggle while cloud sync is already on (master enabled + permission granted), so it skips the permission prompt. Never throws.
static async applyFeatureSelection(context: common.UIAbilityContext): Promise<void> { const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { return } await LocalDataCloudSync.flushStuckRowsOnce(context) await LocalDataCloudSync.cloudSyncNow(context) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left applyFeatureSelection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:...
static async applyFeatureSelection(context: common.UIAbilityContext): Promise<void> { const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { return } await LocalDataCloudSync.flushStuckRowsOnce(context) await LocalDataCloudSync.cloudSyncNow(context) }
https://github.com/honjow/Next2V
f7158a9ce1956c78f08a8411cca2baf0e12225c6
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/EventControl.ets
arkts
setAllEventEnable
启用所有事件
public setAllEventEnable() { this.eventMap.forEach((val, key, m) => { m.set(key, true); }) return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAllEventEnable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Le...
public setAllEventEnable() { this.eventMap.forEach((val, key, m) => { m.set(key, true); }) return this; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d2fe8660df2b084e8f8b14fbbd18deaf78e9a83b
gitee
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowSpaceBetweenBottom() { Text("A"); Text("B"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: VerticalAlign.Bottom, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.margi...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: VerticalAlign.Bottom, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.margi...
https://github.com/Joker-x-dev/CoolMallArkTS
cf4ef4644cb9cf1e5e06c4e4f8a5fc68cefaf071
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint8Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<number> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted @t...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8Array.length") } for (let i = 0; i < arr.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8Array.length") } for (let i = 0; i < arr.length; i++) { ...
https://gitcode.com/iop123123/arkts-static-skills
957eb417989e4ba2a0eca75044c6c1d536258dfc
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/pages/StandardPageTemplate.ets
arkts
aboutToAppear
==================== 生命周期函数 ==================== 页面即将显示 用于初始化数据和配置
aboutToAppear(): void { console.info('[StandardPageTemplate] aboutToAppear'); this.theme = AccessibilityConfig.getInstance(); this.loadData(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { console.info('[StandardPageTemplate] aboutToAppear'); this.theme = AccessibilityConfig.getInstance(); this.loadData(); }
https://github.com/LJ666-ui/harmony-health-care
51ab6157522180cc267613e0a825a3face162708
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
getWeekDataFromDb
异步获取周数据
async function getWeekDataFromDb(context: Context): Promise<Record<string, string>> { const resultData: Record<string, string> = { 'sunday': '0', 'monday': '0', 'tuesday': '0', 'wednesday': '0', 'thursday': '0', 'friday': '0', 'saturday': '0', 'total': '0', 'dateRange': '' }; try { const rdbStore...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getWeekDataFromDb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AS...
async function getWeekDataFromDb(context: Context): Promise<Record<string, string>> { const resultData: Record<string, string> = { 'sunday': '0', 'monday': '0', 'tuesday': '0', 'wednesday': '0', 'thursday': '0', 'friday': '0', 'saturday': '0', 'total': '0', 'dateRange': '' }; try { const rdbStore...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
177cb956e05d5d3a88b5749ef3b0f4a0a16b176a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Authentication/LoginManager.ets
arkts
extractCookiesFromWebView
从WebView提取Cookie
async extractCookiesFromWebView( controller: webview.WebviewController, sourceId: number, domain: string, cookieNames?: string[] ): Promise<Record<string, string>> { const cookies: Record<string, string> = {}; try { // 使用JavaScript获取Cookie const jsCode = 'document.cookie'; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left extractCookiesFromWebView AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left controller AST#identifier#Right AST#type_annotation#L...
async extractCookiesFromWebView( controller: webview.WebviewController, sourceId: number, domain: string, cookieNames?: string[] ): Promise<Record<string, string>> { const cookies: Record<string, string> = {}; try { // 使用JavaScript获取Cookie const jsCode = 'document.cookie'; ...
https://github.com/DaLongZhuaZi/manxia
6ffa9835b423b170e780cb786fb95ff145a69467
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
currentTabSearchInputKey
Gets the current tab search key in the input field.
get currentTabSearchInputKey() { return this.currentTab?.inputSearchKey; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left currentTabSearchInputKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left...
get currentTabSearchInputKey() { return this.currentTab?.inputSearchKey; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
f03a5ec68fafa9993b16bdf595626933147053ad
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/features/mydemo/src/main/ets/Chart/dialog/McBarChart2.ets
arkts
aboutToAppear
在生命周期函数aboutToAppear()中延时2秒后刷新数据报表
aboutToAppear() { setTimeout(() => { this.defOption.setVal({ series: [ { name: '最高气温', data: [110, 110, 150, 130, 102, 130, 210] } ] }) }, 2000) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { setTimeout(() => { this.defOption.setVal({ series: [ { name: '最高气温', data: [110, 110, 150, 130, 102, 130, 210] } ] }) }, 2000) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
aa12762936ba54f1d861a9857942e0b82ac7903c
gitcode
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsProcessor.ets
arkts
scheduleNextAlarmLocked
检索数据表,生成alarm,在提醒时间发送广播 @param rdbStore RdbStore
async function scheduleNextAlarmLocked(rdbStore: data_rdb.RdbStore) { Log.info(TAG, 'scheduleNextAlarmLocked start.'); let rowsDeleted: number = 0; let isAlarmLessThenCurrent: boolean = false; const date: Date = new Date(); let currentMillis = date.getTime(); const start = currentMillis - SCHEDULE_ALARM_SLA...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left scheduleNextAlarmLocked AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#R...
async function scheduleNextAlarmLocked(rdbStore: data_rdb.RdbStore) { Log.info(TAG, 'scheduleNextAlarmLocked start.'); let rowsDeleted: number = 0; let isAlarmLessThenCurrent: boolean = false; const date: Date = new Date(); let currentMillis = date.getTime(); const start = currentMillis - SCHEDULE_ALARM_SLA...
https://gitee.com/openharmony/applications_calendar_data.git
41be2df41facb04eef8b0b9a6db1065b2771b09d
gitee
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
pop
@deprecated @see {ZRouter.getInstance().pop} @param animated
public static pop(animated: boolean = true) { ZRouter.getRouterMgr().pop(animated) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le...
public static pop(animated: boolean = true) { ZRouter.getRouterMgr().pop(animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L447-L449
61e15dc070577299dc1ff75c77bdaaeec490e8f2
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
getRecordingDir
获取录音存储目录
private getRecordingDir(): string { if (!this.context) { return '' } return this.context.filesDir + '/recordings' }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRecordingDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string ...
private getRecordingDir(): string { if (!this.context) { return '' } return this.context.filesDir + '/recordings' }
https://gitcode.com/openharmony/codelabs
e41830dbaa5e248be70a9349517f131e7613bed9
gitcode
HarmonyOS_Samples/guide-snippets
Ability/InsightIntentConfigDevelopment/entry/src/main/ets/insightintents/PlayMusicExecutor.ets
arkts
onExecuteInUIAbilityBackgroundMode
由于意图配置中'executeMode'配置了'background'后台模式执行,故需要实现该接口
async onExecuteInUIAbilityBackgroundMode(intentName: string, params: Record<string, Object>): Promise<insightIntent.ExecuteResult> { // 后台控制逻辑 const result: insightIntent.ExecuteResult = { code: 0 }; return Promise.resolve(result); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onExecuteInUIAbilityBackgroundMode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left intentName AST#identifier#Right AST#type_ann...
async onExecuteInUIAbilityBackgroundMode(intentName: string, params: Record<string, Object>): Promise<insightIntent.ExecuteResult> { // 后台控制逻辑 const result: insightIntent.ExecuteResult = { code: 0 }; return Promise.resolve(result); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
19186f28790e6f4fba63e909e060e56bf629f244
gitcode
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
filter
设置压缩条件过滤器 @param predicate 过滤条件 @returns 构建器实例
filter(predicate: CompressionPredicate): LubanBuilder { this.config.filter = predicate; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicate AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CompressionPredicate AST#identifier#Right AS...
filter(predicate: CompressionPredicate): LubanBuilder { this.config.filter = predicate; return this; }
https://github.com/kumaleap/ArkLuban
5e161b7f14d17066b0b5d4f81f7fbebed0720cae
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/FontNameParser.ets
arkts
getNameByPriority
按优先级获取名称
function getNameByPriority(names: Map<string, string>, nameID: number, languagePriority: number[]): string | undefined { // 先尝试Windows平台 for (let i = 0; i < languagePriority.length; i++) { const langID = languagePriority[i]; const key = `${nameID}_${PLATFORM_ID_WINDOWS}_${langID}`; if (names.has(key)) {...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getNameByPriority AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left names AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function getNameByPriority(names: Map<string, string>, nameID: number, languagePriority: number[]): string | undefined { // 先尝试Windows平台 for (let i = 0; i < languagePriority.length; i++) { const langID = languagePriority[i]; const key = `${nameID}_${PLATFORM_ID_WINDOWS}_${langID}`; if (names.has(key)) {...
https://github.com/DaLongZhuaZi/manxia
7b9f54bd11a6dd51420c126b2a90460df7dad968
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/HomeViewModel.ets
arkts
findChildCategoryIds
查找指定分类的子分类 ID @param {number} parentId - 父分类 ID @param {Category[]} allCategories - 全部分类列表 @returns {number[]} 子分类 ID 列表
private findChildCategoryIds(parentId: number, allCategories: Category[]): number[] { return allCategories .filter((item: Category): boolean => item.parentId === parentId) .map((item: Category): number => item.id); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findChildCategoryIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
private findChildCategoryIds(parentId: number, allCategories: Category[]): number[] { return allCategories .filter((item: Category): boolean => item.parentId === parentId) .map((item: Category): number => item.id); }
https://github.com/Joker-x-dev/CoolMallArkTS
ef6b27ca460a2d3bdee9b9cf1e625893b7b136ff
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebDAVService.ets
arkts
headRemote
查询远端文件信息
async headRemote(config: WebDAVConfig, remoteFileName: string): Promise<RemoteInfo> { const url = this.joinPath(config.serverUrl, config.remoteDir, remoteFileName) const headers = this.buildHeaders(config) const httpService = HttpService.getInstance() const response = await httpService.head(url, heade...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left headRemote AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async headRemote(config: WebDAVConfig, remoteFileName: string): Promise<RemoteInfo> { const url = this.joinPath(config.serverUrl, config.remoteDir, remoteFileName) const headers = this.buildHeaders(config) const httpService = HttpService.getInstance() const response = await httpService.head(url, heade...
https://github.com/LongLiveY96/chatcube
8a40e3af432d96ae08bdd8c0759336f1ce1e68fd
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/OrderRepository.ets
arkts
cancelOrder
取消订单 @param params 取消订单参数 @returns 是否取消成功
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.cancelOrder(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.cancelOrder(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
cbf483d08429e0571a4579f40363404df3f5f44b
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/utils/UserAuthManager.ets
arkts
isBiometricAvailable
查询设备生物识别能力 (排除 PIN)
isBiometricAvailable(): boolean { try { userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1); return true; } catch { /* */ } try { userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1); return true; } catch { /* */ } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isBiometricAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AS...
isBiometricAvailable(): boolean { try { userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1); return true; } catch { /* */ } try { userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1); return true; } catch { /* */ } return false; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
65f31bbc03297be8feaedcdb0fcbada3b65ef835
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/auth/AuthService.ets
arkts
applySession
将认证状态写入 AppStorage 注意:必须先写 currentUserId/currentUserRole,最后写 isLoggedIn 因为 isLoggedIn 变化会触发 Index 的 @Watch → 创建 DashboardPageContent 如果 currentUserId 尚未写入,Dashboard.loadStats() 会因 userId 为空而短路返回 0
static applySession(user: User): void { AppStorage.set<string>(AppStorageKeys.CURRENT_USER_ID, user.id) AppStorage.set<string>(AppStorageKeys.CURRENT_USER_ROLE, user.role === UserRole.Admin ? UserRole.Admin : UserRole.User) AppStorage.set<boolean>(AppStorageKeys.IS_LOGGED_IN, true) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applySession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Use...
static applySession(user: User): void { AppStorage.set<string>(AppStorageKeys.CURRENT_USER_ID, user.id) AppStorage.set<string>(AppStorageKeys.CURRENT_USER_ROLE, user.role === UserRole.Admin ? UserRole.Admin : UserRole.User) AppStorage.set<boolean>(AppStorageKeys.IS_LOGGED_IN, true) }
https://github.com/encorexin/WordPressCMS
155e11d940a17d273cc701a671d8d132d432f6fa
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
getFavoriteBooks
获取收藏的书籍
async getFavoriteBooks(): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT * FROM novel_book WHERE isFavorite = 1 ORDER BY lastReadTime DESC' ); return this.parseBookResults(rs); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFavoriteBooks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getFavoriteBooks(): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT * FROM novel_book WHERE isFavorite = 1 ORDER BY lastReadTime DESC' ); return this.parseBookResults(rs); }
https://github.com/DaLongZhuaZi/manxia
4090459c5212ba3dedf0ef13e5076dfb593b1c5a
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
getKVMInfo
============================================================ KVM / 加速模式信息 ============================================================ 获取 KVM 信息
async getKVMInfo(): Promise<KVMInfo> { try { const response = await this.sendCommand({ command: 'get_kvm_info', isReleaseBuild: this.isReleaseBuild }) if (response.success && response.data) { return response.data as KVMInfo } // 默认返回 return...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getKVMInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async getKVMInfo(): Promise<KVMInfo> { try { const response = await this.sendCommand({ command: 'get_kvm_info', isReleaseBuild: this.isReleaseBuild }) if (response.success && response.data) { return response.data as KVMInfo } // 默认返回 return...
https://github.com/AetheriumSimulator/qemu-hmos
358f98f267f50ab0f5029b469bf47ee9d8f361c4
github
LZZLHY/hlib
entry/src/main/ets/utils/I18n.ets
arkts
applyArgs
把 %s/%d/%f 占位符按顺序替换;多余占位符保持原样,多余 args 忽略。
private static applyArgs(template: string, args: Array<string | number>): string { if (args.length === 0) { return template; } let i: number = 0; return template.replace(/%[sdf]/g, (match: string): string => { if (i >= args.length) { return match; } const v: string | nu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left applyArgs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left :...
private static applyArgs(template: string, args: Array<string | number>): string { if (args.length === 0) { return template; } let i: number = 0; return template.replace(/%[sdf]/g, (match: string): string => { if (i >= args.length) { return match; } const v: string | nu...
https://github.com/LZZLHY/hlib
7918393708fc33a514e3970001914fe70ac1e95b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets
arkts
getInstanceMethods
Get instance methods (including default methods from implemented interfaces) declared in the class. @returns { FixedArray<reflect.InstanceMethod> } a fixed array of instance methods. @syscap SystemCapability.Utils.Lang
public getInstanceMethods(): FixedArray<reflect.InstanceMethod> { return this.getInstanceMethodsInternal(true) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInstanceMethods AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp...
public getInstanceMethods(): FixedArray<reflect.InstanceMethod> { return this.getInstanceMethodsInternal(true) }
https://gitcode.com/iop123123/arkts-static-skills
5ddec15800488232c19f01de44bb5cb83e5205c3
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
post
执行 POST 请求(JSON body)
static async post(url: string, body: string, config?: HttpClientConfig): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipValidation = config?.skipS...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left post AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right A...
static async post(url: string, body: string, config?: HttpClientConfig): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipValidation = config?.skipS...
https://github.com/AlkaidLab/moonlight-harmony
71caf6062b36727e669014dee522a7fde3b9894d
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
delete
删除偏好设置 @param key 键
async delete(key: string): Promise<void> { await this.ensureInitialized(); try { await this.preference!.delete(key); await this.preference!.flush(); Logger.debug(this.LOG_TAG, `Preference deleted: ${key}`); } catch (err) { const error = err instanceof Error ? err : new Error(Strin...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async delete(key: string): Promise<void> { await this.ensureInitialized(); try { await this.preference!.delete(key); await this.preference!.flush(); Logger.debug(this.LOG_TAG, `Preference deleted: ${key}`); } catch (err) { const error = err instanceof Error ? err : new Error(Strin...
https://github.com/Kira-Yagami-Light/Kira-Projects
7ec5771c830f08676efe13ce039a966b40c827e0
github
HarmonyOS_Samples/BestPracticeSnippets
ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets
arkts
aboutToReuse
[EndExclude opt_funcParam]
aboutToReuse(params: Record<string, Object>): void { this.sum = params.sum as number; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ...
aboutToReuse(params: Record<string, Object>): void { this.sum = params.sum as number; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
6c66bacc0af6248619304f5a2ccb8b7b8ac558f7
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/OrderManager.ets
arkts
init
Initialize order manager with context
static async init(context: Context): Promise<void> { try { orderPreferences = await preferences.getPreferences(context, OrderManager.PREFERENCE_NAME); console.info('OrderManager: Preferences initialized'); } catch (err) { console.error('OrderManager: Failed to init preferences', err); } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
static async init(context: Context): Promise<void> { try { orderPreferences = await preferences.getPreferences(context, OrderManager.PREFERENCE_NAME); console.info('OrderManager: Preferences initialized'); } catch (err) { console.error('OrderManager: Failed to init preferences', err); } ...
https://github.com/Harrisonls2004/WaterFlow
4e6747546aebc6a96c8a20613ad916a4caf2e99c
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/image/types.ets
arkts
reset
重置偏移量值
reset(): void { this.offsetX = 0 this.offsetY = 0 this.positionX = 0 this.positionY = 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.offsetX = 0 this.offsetY = 0 this.positionX = 0 this.positionY = 0 }
https://github.com/itrainhub/wu-ui
caf179e1ddc9604094e406bcd0f04058477877b8
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
fixed32
Write fixed32 little-endian
fixed32(v: number): Writer { const ab = new ArrayBuffer(4); const dv = new DataView(ab); dv.setUint32(0, v >>> 0, true); const u = new Uint8Array(ab); for (let i = 0; i < 4; i++) this.push(u[i]); return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fixed32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Righ...
fixed32(v: number): Writer { const ab = new ArrayBuffer(4); const dv = new DataView(ab); dv.setUint32(0, v >>> 0, true); const u = new Uint8Array(ab); for (let i = 0; i < 4; i++) this.push(u[i]); return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
139ecde9d600449978bd31fac4cb99ff70d54271
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets
arkts
prepareAnimation
准备动画快照 @param oldPositions 旧位置列表 @param newPositions 新位置列表 @param pixelMaps 条目的PixelMap快照(key为条目ID) @param animationType 动画类型
public prepareAnimation( oldPositions: ItemPosition[], newPositions: ItemPosition[], pixelMaps: Map<string, PixelMap>, animationType: AnimationType ): void { this.animatingSnapshots = []; // 创建ID到位置的映射 const oldPosMap = new Map<string, ItemPosition>(); const newPosMap = new Map<...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left prepareAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left oldPositions AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri...
public prepareAnimation( oldPositions: ItemPosition[], newPositions: ItemPosition[], pixelMaps: Map<string, PixelMap>, animationType: AnimationType ): void { this.animatingSnapshots = []; // 创建ID到位置的映射 const oldPosMap = new Map<string, ItemPosition>(); const newPosMap = new Map<...
https://github.com/DaLongZhuaZi/manxia
cda044f32de96f9f346a24f09c2272a243334703
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/context/ContextUtil.ets
arkts
getAppCtx
获取应用级别的上下文的能力 @returns {common.ApplicationContext}
static getAppCtx(): common.ApplicationContext { return ContextUtil.context.getApplicationContext(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAppCtx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left AST#i...
static getAppCtx(): common.ApplicationContext { return ContextUtil.context.getApplicationContext(); }
https://github.com/Joker-x-dev/CoolMallArkTS
758439a80c1a1db13aa8301d6fdff3a8b02245db
github
apap6628114/nga_oh
entry/src/main/ets/parser/bbcode/parser.ets
arkts
parseTableContent
解析表格行:遇 [/table] 返回,遇 [tr] 解析一行单元格。
function parseTableContent(state: ParseState, closePattern: RegExp): BBNode[] { const rows: BBNode[] = [] while (state.pos < state.len) { closePattern.lastIndex = state.pos const cm = closePattern.exec(state.content) if (cm && cm.index === state.pos) { state.pos = closePattern.lastIndex retu...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseTableContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left state AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function parseTableContent(state: ParseState, closePattern: RegExp): BBNode[] { const rows: BBNode[] = [] while (state.pos < state.len) { closePattern.lastIndex = state.pos const cm = closePattern.exec(state.content) if (cm && cm.index === state.pos) { state.pos = closePattern.lastIndex retu...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/parser.ets#L136-L160
cbef7f5cdac1badde7a7743647629b7d450b1f5d
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets
arkts
getConnectionInfo
获取网络信息
getConnectionInfo() { // 获取检查默认数据网络是否被激活(检测是否有网络) const isHasDefaultNet = connection.hasDefaultNetSync() if (isHasDefaultNet === true) { // this.netBearType = '有网络' // 有网络的情况下,再检测是什么网络 this.getNetBearType() // 有网络的情况下,获取网络连接信息 this.getNetProperties() } else { this.n...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getConnectionInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#...
getConnectionInfo() { // 获取检查默认数据网络是否被激活(检测是否有网络) const isHasDefaultNet = connection.hasDefaultNetSync() if (isHasDefaultNet === true) { // this.netBearType = '有网络' // 有网络的情况下,再检测是什么网络 this.getNetBearType() // 有网络的情况下,获取网络连接信息 this.getNetProperties() } else { this.n...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
6fb39f76f73efb253f6b530edf7b0ca7124a7cd9
gitcode
arkui-x/samples
CodeLab/Cases/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
openSnapshotEditDialog
打开图片裁剪弹窗 @param uri
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openSnapshotEditDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#...
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog...
https://gitcode.com/arkui-x/samples
36df2a85570d000bcacfda68dd1f2dd07136522d
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
initDeviceIdPreferences
初始化设备ID的 preferences(由 EntryAbility 调用)
public static async initDeviceIdPreferences(context: common.UIAbilityContext): Promise<void> { try { SyncSettingsService.deviceIdPreferences = await preferences.getPreferences(context, DEVICE_ID_PREFERENCES); hilog.info(DOMAIN, TAG, 'DeviceId preferences initialized'); } catch (error) { hilo...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left initDeviceIdPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier...
public static async initDeviceIdPreferences(context: common.UIAbilityContext): Promise<void> { try { SyncSettingsService.deviceIdPreferences = await preferences.getPreferences(context, DEVICE_ID_PREFERENCES); hilog.info(DOMAIN, TAG, 'DeviceId preferences initialized'); } catch (error) { hilo...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L122-L129
4e2faea8245e185a8aec83dcc14defb00436034b
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/XAxis.ets
arkts
setPosition
sets the position of the x-labels @param pos
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left XAxis...
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
06d7585c3c3418d550ec4ccb3956059022bc581d
gitee
Open-Tech-Project/OpenBoard
entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets
arkts
unblockWord
Unblock a word (optional utility)
unblockWord(lang: string, word: string): void { const m = this.ensure(lang); const w = word.toLowerCase(); m.blockedWords.delete(w); console.info(`OpenBoard: Unblocked word "${w}"`); // Auto-save after unblocking this.save().catch((err: BusinessError) => { console.error('OpenBoard: Fai...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unblockWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lang AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST...
unblockWord(lang: string, word: string): void { const m = this.ensure(lang); const w = word.toLowerCase(); m.blockedWords.delete(w); console.info(`OpenBoard: Unblocked word "${w}"`); // Auto-save after unblocking this.save().catch((err: BusinessError) => { console.error('OpenBoard: Fai...
https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L446-L457
050fe3cdbd9abdb353f61e2d1c7b4f982efd64a9
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/http/HttpClient.ets
arkts
createBasicAuth
创建 Basic Auth 头
static createBasicAuth(username: string, password: string): string { try { const raw = `${username}:${password}` const helper = new util.Base64Helper() const encoder = new util.TextEncoder() const encoded = encoder.encodeInto(raw) const base64Str = helper.encodeToStringSync(encoded) ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBasicAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
static createBasicAuth(username: string, password: string): string { try { const raw = `${username}:${password}` const helper = new util.Base64Helper() const encoder = new util.TextEncoder() const encoded = encoder.encodeInto(raw) const base64Str = helper.encodeToStringSync(encoded) ...
https://github.com/encorexin/WordPressCMS
d20eb3bb9f77eb2586a00c02043360fcec35171d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
matchInternal
Internal method, executes match starting from lastIndex. @param { String } str The string to match. @returns { RegExpMatchArray | null } If match succeeds, returns a match result array, otherwise returns null. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private matchInternal(str: String): RegExpMatchArray | null { return this.matchInternal(str, this.lastIndex) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private matchInternal(str: String): RegExpMatchArray | null { return this.matchInternal(str, this.lastIndex) }
https://gitcode.com/iop123123/arkts-static-skills
22e60a71f1951045d1ff7dda10ce16e4884b31c4
gitcode
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getSwipeThreshold
获取滑动阈值
static getSwipeThreshold(): number { // 基于屏幕宽度的15%作为滑动阈值 return Math.max(50, DeviceUtils.getWidthPercent(15)) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSwipeThreshold AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number A...
static getSwipeThreshold(): number { // 基于屏幕宽度的15%作为滑动阈值 return Math.max(50, DeviceUtils.getWidthPercent(15)) }
https://github.com/SMAT-Lab/PhantomRendering
1d2a03e9669d192306402539fb70c611dbe3d794
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
exportToJSON
导出所有书源为JSON
exportToJSON(): string { const sources: LegadoBookSource[] = []; this.sources.forEach(source => { sources.push(source); }); return JSON.stringify(sources, null, 2); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exportToJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
exportToJSON(): string { const sources: LegadoBookSource[] = []; this.sources.forEach(source => { sources.push(source); }); return JSON.stringify(sources, null, 2); }
https://github.com/DaLongZhuaZi/manxia
1e6ded5477aeb87f715ce144ddf95cbb1f48a665
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
syncAllToNative
批量同步所有缓存设置到 C++ 层 Requirements: 1.2 @returns 操作结果
public async syncAllToNative(): Promise<SettingsResult<void>> { try { const configs: Record<string, SettingsConfigValue> = {}; const entries = Array.from(this.settingsCache.entries()); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left syncAllToNative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public async syncAllToNative(): Promise<SettingsResult<void>> { try { const configs: Record<string, SettingsConfigValue> = {}; const entries = Array.from(this.settingsCache.entries()); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const value = entries[i][...
https://github.com/richshaw2015/nds
1a131508cd4de9de3a8017537011600d3a1bbc2a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/QueryHelper.ets
arkts
queryBillsByCategoryAndTags
组合查询:按分类和标签筛选账单 @param userId 用户ID @param categoryIds 分类ID数组(可选) @param tagIds 标签ID数组(可选) @param startDate 开始日期 @param endDate 结束日期 @returns 账单列表
static async queryBillsByCategoryAndTags( userId: number, categoryIds: number[] | null, tagIds: number[] | null, startDate: string, endDate: string ): Promise<Bill[]> { const store = DatabaseManager.getDatabase(); let sql = ` SELECT DISTINCT b.* FROM bills b INNER...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left queryBillsByCategoryAndTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right ...
static async queryBillsByCategoryAndTags( userId: number, categoryIds: number[] | null, tagIds: number[] | null, startDate: string, endDate: string ): Promise<Bill[]> { const store = DatabaseManager.getDatabase(); let sql = ` SELECT DISTINCT b.* FROM bills b INNER...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
44940f60469f9a32fd10632461dc4a86007701eb
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V30.ets
arkts
splitAndPutParam
Splits parameter values into pieces in accordance with vCard 3.0 specification and puts pieces into mInterpreter. param-value = ptext / quoted-string quoted-string = DQUOTE QSAFE-CHAR DQUOTE QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-ASCII ; Any character except CTLs, DQUOTE QSAFE-CHAR must not contain DQUOTE, includ...
private splitAndPutParam(property:VCardProperty , paramName:string , paramValue:string ) : void{ // "comma,separated:inside.dquote",pref // --> // - comma,separated:inside.dquote // - pref // // Note: Though there's a code, we don't need to take much care of ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitAndPutParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left property AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private splitAndPutParam(property:VCardProperty , paramName:string , paramValue:string ) : void{ // "comma,separated:inside.dquote",pref // --> // - comma,separated:inside.dquote // - pref // // Note: Though there's a code, we don't need to take much care of ...
https://gitee.com/openharmony-tpc/VCard.git
ff4ec857680fc071d59681d3f7f602d128ceda8c
gitee
erosTeam/NextE
shared/src/main/ets/state/GalleryReadProgressState.ets
arkts
replaceAll
Bulk-replace the in-memory map (restore-from-disk at startup).
replaceAll(entries: ReadProgressEntry[]): void { this.indexMap.clear() this.timeMap.clear() this.columnModeMap.clear() entries.forEach((e: ReadProgressEntry) => { if (e.g.length > 0 && e.i >= 0) { this.indexMap.set(e.g, e.i) this.timeMap.set(e.g, e.t) if (e.c === ReadColu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ReadProgress...
replaceAll(entries: ReadProgressEntry[]): void { this.indexMap.clear() this.timeMap.clear() this.columnModeMap.clear() entries.forEach((e: ReadProgressEntry) => { if (e.g.length > 0 && e.i >= 0) { this.indexMap.set(e.g, e.i) this.timeMap.set(e.g, e.t) if (e.c === ReadColu...
https://github.com/erosTeam/NextE
611336ed7c8539550ffda73d8c80208c2f2fe329
github
2763981847/Clock-Alarm
entry/src/main/ets/viewmodel/AlarmClockViewModel.ets
arkts
queryAlarmsTasker
刷新闹钟任务。 @param callback (alarms: Array<AlarmItem>) => void 回调函数,用于处理查询结果
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { let that = this; // 查询数据库中的闹钟项 that.queryDatabaseAlarms(callback); // 获取全局上下文中的 PreferencesHandler 实例 let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; // 添加数据库变化监听器,用于在数据发生变化时刷新闹钟...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left queryAlarmsTasker AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( A...
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { let that = this; // 查询数据库中的闹钟项 that.queryDatabaseAlarms(callback); // 获取全局上下文中的 PreferencesHandler 实例 let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; // 添加数据库变化监听器,用于在数据发生变化时刷新闹钟...
https://github.com/2763981847/Clock-Alarm
f288017dba5e8e0b52d4ce3cfa518449ae8e0a3c
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/pages/LibretroGamePage.ets
arkts
setButton
设置按键状态 (新架构)
setButton(buttonId: number, pressed: boolean) { sendRuntimeButton(this.portAssignments, this.selectedPortIndex, buttonId, pressed); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttonId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#L...
setButton(buttonId: number, pressed: boolean) { sendRuntimeButton(this.portAssignments, this.selectedPortIndex, buttonId, pressed); }
https://github.com/daugf2527/harmonyos-libretro-emulator
dae46d635c7ecf0cd63af68d52e863ac9599da1e
github
chendi126/harmonyOS-TCP
entry/src/main/ets/common/GlassStyles.ets
arkts
getDeepShadowColor
获取深度阴影色
static getDeepShadowColor(): string { return GlassColors.DEEP_SHADOW; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDeepShadowColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string ...
static getDeepShadowColor(): string { return GlassColors.DEEP_SHADOW; }
https://github.com/chendi126/harmonyOS-TCP
37e1f4abbcc5e0fec0ef464204b88fc8e52436cb
github
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
entry/src/main/ets/utils/ExpressionEvaluator.ets
arkts
checkParentheses
检查括号是否匹配 @param expression 表达式 @returns 是否匹配
private static checkParentheses(expression: string): boolean { let count = 0; for (let i = 0; i < expression.length; i++) { if (expression[i] === '(') { count++; } else if (expression[i] === ')') { count--; if (count < 0) { return false; // 右括号多于左括号 } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkParentheses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expression AST#identifier#Right AST#ERROR#Left AST...
private static checkParentheses(expression: string): boolean { let count = 0; for (let i = 0; i < expression.length; i++) { if (expression[i] === '(') { count++; } else if (expression[i] === ')') { count--; if (count < 0) { return false; // 右括号多于左括号 } ...
https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
39b5026d935451e3266eb8ca0b019de30a0762c0
github
cpdd5201314/harmonyOS-music-app
common/mediaCommon/src/main/ets/utils/request.ets
arkts
request
核心请求方法 - 用于普通 JSON 请求
async function request<T>( url: string, method: http.RequestMethod = http.RequestMethod.GET, data?: object ): Promise<T> { const httpRequest = http.createHttp(); let urlStr = BASE_URL + url; // 关键修改:从storage获取Token const currentToken = await getTokenFromStorage(); console.log('当前请求Token:', currentToken...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left request AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_param...
async function request<T>( url: string, method: http.RequestMethod = http.RequestMethod.GET, data?: object ): Promise<T> { const httpRequest = http.createHttp(); let urlStr = BASE_URL + url; // 关键修改:从storage获取Token const currentToken = await getTokenFromStorage(); console.log('当前请求Token:', currentToken...
https://github.com/cpdd5201314/harmonyOS-music-app
95ed398fe97d26f0e447b4ed4bb288396986e934
github
LongLiveY96/chatcube
entry/src/main/ets/services/PreferencesService.ets
arkts
getCurrentProviderId
获取当前选中的服务商ID
async getCurrentProviderId(): Promise<string> { return await this.getString(PreferenceKeys.CURRENT_PROVIDER_ID, '') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCurrentProviderId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
async getCurrentProviderId(): Promise<string> { return await this.getString(PreferenceKeys.CURRENT_PROVIDER_ID, '') }
https://github.com/LongLiveY96/chatcube
8eff08ead9039278613db1f7505fd15ecdbd27f8
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
clearUndefined
判断位置坐标值
clearUndefined(num: number | undefined) { if (num == undefined) { return 0; } return num; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearUndefined AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left ...
clearUndefined(num: number | undefined) { if (num == undefined) { return 0; } return num; }
https://github.com/openharmony/applications_app_samples
e79314034d95fa3ca8302c60722ecc734d29994a
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
check_like
喜欢检测 //
private async check_like(path: string) { try { // 读取 const tmp = `${fs.statSync(fs.openSync(path).fd).ino}` // 扫描判断 const index = this.like_list.findIndex(item => item === tmp) if (index === -1) { emitter.emit({ eventId: 717 }, { data: { like: false } }) this.sessi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left check_like AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST...
private async check_like(path: string) { try { // 读取 const tmp = `${fs.statSync(fs.openSync(path).fd).ino}` // 扫描判断 const index = this.like_list.findIndex(item => item === tmp) if (index === -1) { emitter.emit({ eventId: 717 }, { data: { like: false } }) this.sessi...
https://github.com/Nekofox-POT/LinMusic
9db7731fda1686f766be97db56d8e64cbc9a7405
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
requestAddressBarFocus
Focus address bar. @param uiContext The uiContext.
requestAddressBarFocus(uiContext: UIContext) { this.requestHideAddressBarOverlay(); try { uiContext.getFocusController().requestFocus(addressBarId); this.reportAddressBarFocus(); return true; } catch (e) { meow(`Failed to request focus: ${e.message}`, `meowUiHost][${this.windowId}]...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestAddressBarFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST...
requestAddressBarFocus(uiContext: UIContext) { this.requestHideAddressBarOverlay(); try { uiContext.getFocusController().requestFocus(addressBarId); this.reportAddressBarFocus(); return true; } catch (e) { meow(`Failed to request focus: ${e.message}`, `meowUiHost][${this.windowId}]...
https://github.com/awaLiny2333/LinysBrowser_NEXT
9cb7020f06ac7e0a84ddb9a89668cc96b7552336
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/CategoryDao.ets
arkts
deleteCategory
删除分类 删除前需判断是否被交易记录引用 @param categoryId 分类ID @returns 是否删除成功
public async deleteCategory(categoryId: number): Promise<boolean> { try { // 检查是否有交易记录引用此分类 const hasTransactions: boolean = await this.hasTransactionsUsingCategory(categoryId); if (hasTransactions) { console.warn(`分类 ${categoryId} 已被交易记录使用,无法删除`); return false; } co...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async deleteCategory(categoryId: number): Promise<boolean> { try { // 检查是否有交易记录引用此分类 const hasTransactions: boolean = await this.hasTransactionsUsingCategory(categoryId); if (hasTransactions) { console.warn(`分类 ${categoryId} 已被交易记录使用,无法删除`); return false; } co...
https://github.com/fuhhhhhhhh/openharmony
8c719a6a3ef6fa56cdbee7f8374223eba8b42aa5
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/SshPreflightService.ets
arkts
cleanup
清理所有过期 token
cleanup(): void { const now = Date.now(); const toDelete: string[] = []; this.tokens.forEach((data, id) => { if (now - (data.createdAt || 0) > this.TTL_MS) { toDelete.push(id); } }); for (const id of toDelete) { this.tokens.delete(id); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
cleanup(): void { const now = Date.now(); const toDelete: string[] = []; this.tokens.forEach((data, id) => { if (now - (data.createdAt || 0) > this.TTL_MS) { toDelete.push(id); } }); for (const id of toDelete) { this.tokens.delete(id); } }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
8132180918bc7ada47a47201fa0d75ea779d66b2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ChangelogManager.ets
arkts
markCurrentVersionAsShown
标记当前版本为已显示(不实际显示更新日志)
private async markCurrentVersionAsShown(): Promise<void> { if (this.prefs) { await this.prefs.put(KEY_LAST_SHOWN_VERSION, this.currentVersion); await this.prefs.put(KEY_LAST_SHOWN_VERSION_CODE, this.currentVersionCode); await this.prefs.flush(); this.lastShownVersion = this.currentVersion;...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left markCurrentVersionAsShown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi...
private async markCurrentVersionAsShown(): Promise<void> { if (this.prefs) { await this.prefs.put(KEY_LAST_SHOWN_VERSION, this.currentVersion); await this.prefs.put(KEY_LAST_SHOWN_VERSION_CODE, this.currentVersionCode); await this.prefs.flush(); this.lastShownVersion = this.currentVersion;...
https://github.com/DaLongZhuaZi/manxia
43b20595a88e4a3131d9bbce4eb7f18545ea4733
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
buildString
构建命令字符串(调试用)
public buildString(): string { return this.build().join(' '); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left buildString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str...
public buildString(): string { return this.build().join(' '); }
https://github.com/jjjjjjava/ffmpeg_tools
5f43c09855851d9c6e4124f69e3b1a371ebe91c7
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
logErrorLines
输出 error 日志(支持多行与分段) @param {string[]} lines - 日志行 @returns {void} 无返回值
function logErrorLines(lines: string[]): void { logLines("error", lines); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left logErrorLines AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left lines AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function logErrorLines(lines: string[]): void { logLines("error", lines); }
https://github.com/Joker-x-dev/CoolMallArkTS
d3ab5d0bb3e384fca382df5d65020678a6922fab
github
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getSimilarTrailers
@summary Gets similar items. @param {LibraryApiGetSimilarTrailersRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public async getSimilarTrailers(requestParameters: LibraryApiGetSimilarTrailersRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Trailers/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getSimilarTrailers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ...
public async getSimilarTrailers(requestParameters: LibraryApiGetSimilarTrailersRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Trailers/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
f04965714390f813996cf652058a735e23968352
github
XJTUWYD/ArkDiff
entry/src/main/ets/services/BinaryFileHandler.ets
arkts
binaryOnlyEntry
仅一侧存在的二进制文件
static binaryOnlyEntry( path: string, side: 'a' | 'b', metadata: FileMetadata ): BinaryDiffEntry { return { path, side, sizeA: side === 'a' ? metadata.size : 0, sizeB: side === 'b' ? metadata.size : 0, modifiedTimeA: side === 'a' ? metadata.modifiedTime : 0, modif...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left binaryOnlyEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static binaryOnlyEntry( path: string, side: 'a' | 'b', metadata: FileMetadata ): BinaryDiffEntry { return { path, side, sizeA: side === 'a' ? metadata.size : 0, sizeB: side === 'b' ? metadata.size : 0, modifiedTimeA: side === 'a' ? metadata.modifiedTime : 0, modif...
https://github.com/XJTUWYD/ArkDiff
3ccafe2887b8bfc16a6e6a834407ba0c52905c45
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets
arkts
handleDebugModeCall
/设置debug模式,已废弃
async handleDebugModeCall(call: MethodCall, result: MethodResult): Promise<void> { DatabaseHelper.debugMode(call, result); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleDebugModeCall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#type_annotation#Left...
async handleDebugModeCall(call: MethodCall, result: MethodResult): Promise<void> { DatabaseHelper.debugMode(call, result); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
debd9b5f2abd01c25a8535f603e4676687dca0ac
gitee