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
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
initialize
初始化设置管理器 @param context UIAbilityContext 上下文 @returns 初始化是否成功
public async initialize(context: common.UIAbilityContext): Promise<boolean> { if (this.initialized) { console.info(`${TAG} Already initialized`); return true; } this.context = context; try { // 获取 Preferences 实例 this.dataPreferences = await preferences.getPreferences(context,...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST...
public async initialize(context: common.UIAbilityContext): Promise<boolean> { if (this.initialized) { console.info(`${TAG} Already initialized`); return true; } this.context = context; try { // 获取 Preferences 实例 this.dataPreferences = await preferences.getPreferences(context,...
https://github.com/richshaw2015/nds
2c97218e778d749f409e60ef28ff0f852d8a236d
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileFolderUtil.ets
arkts
fileFolderExistCheck
检查文件夹是否存在
static fileFolderExistCheck() { const paths = [ PathUtils.videoPath, PathUtils.subtitlePath, PathUtils.photoPath ] paths.forEach(path => { try { if (!fileIo.accessSync(path)) { fileIo.mkdirSync(path) } } catch (error) { salmonLogger.addLog(T...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fileFolderExistCheck 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#{...
static fileFolderExistCheck() { const paths = [ PathUtils.videoPath, PathUtils.subtitlePath, PathUtils.photoPath ] paths.forEach(path => { try { if (!fileIo.accessSync(path)) { fileIo.mkdirSync(path) } } catch (error) { salmonLogger.addLog(T...
https://github.com/Yebingiscn/SweetVideo
6cddf691d885c0c4b94db0e5fa85fc8b5f383bab
github
DaLongZhuaZi/manxia
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
updateFormData
更新卡片数据
private async updateFormData(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, FORM_STORAGE); // FormDimension枚举: 2=2x2, 3=2x4, 4=4x4 const dimension = (await pref.get(`dimension_${formId}`, 2)) as number; const widgetPref = await pre...
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 updateFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left...
private async updateFormData(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, FORM_STORAGE); // FormDimension枚举: 2=2x2, 3=2x4, 4=4x4 const dimension = (await pref.get(`dimension_${formId}`, 2)) as number; const widgetPref = await pre...
https://github.com/DaLongZhuaZi/manxia
496a28c258876add42cdf14f84500c98cb23fa3b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
stopPolling
停止状态轮询定时器
stopPolling(): void { if (this.pollingTimerId !== -1) { console.info('ComputerManager: 停止状态轮询'); clearInterval(this.pollingTimerId); this.pollingTimerId = -1; } this.isPollingActive = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopPolling 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#...
stopPolling(): void { if (this.pollingTimerId !== -1) { console.info('ComputerManager: 停止状态轮询'); clearInterval(this.pollingTimerId); this.pollingTimerId = -1; } this.isPollingActive = false; }
https://github.com/AlkaidLab/moonlight-harmony
886738d62103591796ff23b8980f8cf224035774
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/settings/classes/meowManagedSettings.ets
arkts
constructor
For showcase, READ ONLY. Constructor of this managed settings. @param settingsFileSavePath The path to SAVE the settings file in each this.saveToDisk() call. It is totally not related to the one passed to this.initFrom() function.
constructor(settingsFileSavePath: string) { this.settingsFileSavePath = settingsFileSavePath; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left settingsFileSavePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR...
constructor(settingsFileSavePath: string) { this.settingsFileSavePath = settingsFileSavePath; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
91ae82747aa5565c1e71bae54a5174247a278d3b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets
arkts
from
Creates a new ArrayBuffer from a segment of an existing ArrayBuffer with number parameters. @param { ArrayBuffer } buffer Source buffer. @param { number } [byteOffset] Start offset. @param { number } [length] Byte length. @returns { ArrayBuffer } The new ArrayBuffer. @static @syscap SystemCapability.Utils.Lang @FaAndSt...
public static from(buffer: ArrayBuffer, byteOffset?: number, length?: number): ArrayBuffer { const resolvedByteOffset = byteOffset ?? 0; const resolvedLength = length ?? buffer.byteLength.toDouble(); return ArrayBuffer.from(buffer, resolvedByteOffset.toInt(), resolvedLength.toInt()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#R...
public static from(buffer: ArrayBuffer, byteOffset?: number, length?: number): ArrayBuffer { const resolvedByteOffset = byteOffset ?? 0; const resolvedLength = length ?? buffer.byteLength.toDouble(); return ArrayBuffer.from(buffer, resolvedByteOffset.toInt(), resolvedLength.toInt()); }
https://gitcode.com/iop123123/arkts-static-skills
390e96fee6d5e1cb0898a955597662cf95cb0fca
gitcode
honjow/Next2V
shared/src/main/ets/services/AutoDailyCheckinService.ets
arkts
surfaceSuccess
SUCCESS is the non-actionable case: the day is signed and the account page shows 已签到. The shell shows the foreground toast; here we only reach a user who has already LEFT the app, with a notification, so a success that landed after they backgrounded the app still surfaces.
private static surfaceSuccess(rewardCoins: number): void { if (connectAppForeground().foreground) { return } const title = AppStrings.text($r('app.string.daily_checkin_notify_title'), 'Daily check-in') const text = rewardCoins > 0 ? AppStrings.format( AppStrings.text($r...
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 surfaceSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rewardCoins AST#identifier#Right AST#ERROR#Left AST#...
private static surfaceSuccess(rewardCoins: number): void { if (connectAppForeground().foreground) { return } const title = AppStrings.text($r('app.string.daily_checkin_notify_title'), 'Daily check-in') const text = rewardCoins > 0 ? AppStrings.format( AppStrings.text($r...
https://github.com/honjow/Next2V
5a082aae0cd7e2794511cd07745bdcc9c2fdb7f9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setUTCDate
Changes the day of the month of a given Date instance, based on UTC time. @param { int } value new day. @returns { long } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setUTCDate(value: int): long { let day = this.getUTCDate(); this.ms -= day * msPerDay; this.ms += value * msPerDay; return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
public setUTCDate(value: int): long { let day = this.getUTCDate(); this.ms -= day * msPerDay; this.ms += value * msPerDay; return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
5838f74a36286c0f0112f8b6304605a635f4eea1
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
ensureInitialized
延迟初始化方法(内部使用) 在第一次使用时才进行初始化,确保GlobalContext已经准备好
private async ensureInitialized(): Promise<void> { if (this.isInitialized) { return; } // 如果还没有初始化,调用公开的初始化方法 await this.initialize(); }
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 ensureInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async ensureInitialized(): Promise<void> { if (this.isInitialized) { return; } // 如果还没有初始化,调用公开的初始化方法 await this.initialize(); }
https://github.com/DaLongZhuaZi/manxia
59c7b7f30a9eb2be11776b224f743f0733ec378c
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testSetOperations
--- Set operations (union, intersection via manual) ---
function testSetOperations(): string { let setA: Set<number> = new Set<number>(); setA.add(1); setA.add(2); setA.add(3); let setB: Set<number> = new Set<number>(); setB.add(2); setB.add(3); setB.add(4); // Intersection: items in both let count: number = 0; setA.forEach((val: number): void => { ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSetOperations 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#:#Right AST#predefine...
function testSetOperations(): string { let setA: Set<number> = new Set<number>(); setA.add(1); setA.add(2); setA.add(3); let setB: Set<number> = new Set<number>(); setB.add(2); setB.add(3); setB.add(4); // Intersection: items in both let count: number = 0; setA.forEach((val: number): void => { ...
https://github.com/miaochiahao/ark-ghidra
3a077a81e469c69cc6c2a609b5373a67278fe30c
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
syncIncremental
==================== Incremental Sync ====================
async syncIncremental(): Promise<WebDavSyncResult> { console.info('[WebDavSyncManager] ==== Starting incremental sync ===='); const syncStartMs = Date.now(); const missing = this.requireConfigured(); if (missing !== null) { console.error('[WebDavSyncManager] Sync failed: not configured'); ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left syncIncremental 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#:#Right...
async syncIncremental(): Promise<WebDavSyncResult> { console.info('[WebDavSyncManager] ==== Starting incremental sync ===='); const syncStartMs = Date.now(); const missing = this.requireConfigured(); if (missing !== null) { console.error('[WebDavSyncManager] Sync failed: not configured'); ...
https://github.com/CLMC2025/Vignette
aba1d583b5b7751c4218e76b3a9ef1e728989643
github
HarmonyOS_Samples/BestPracticeSnippets
AppDataSecurity/entry/src/main/ets/pages/Index.ets
arkts
GenerateAesKey
[End get_aes_decrypt_properties] [Start generate_aes_key]
async function GenerateAesKey(): Promise<void> { let genProperties = GetAesGenerateProperties(); let options: huks.HuksOptions = { properties: genProperties }; await huks.generateKeyItem(aesKeyAlias, options) .then((data) => { hilog.info(0x0000, 'AppDataSecurity', `promise: generate AES Key succe...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left GenerateAesKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async function GenerateAesKey(): Promise<void> { let genProperties = GetAesGenerateProperties(); let options: huks.HuksOptions = { properties: genProperties }; await huks.generateKeyItem(aesKeyAlias, options) .then((data) => { hilog.info(0x0000, 'AppDataSecurity', `promise: generate AES Key succe...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
5556efc73e8d19f4f6f6d8b64ef49a685568fc33
gitcode
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/network/NetworkPageData.ets
arkts
constructor
构造函数,对接口返回做空值兜底 @param {Partial<NetworkPageData<T>>} payload - 接口返回的分页数据
constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.list ?? null; this.pagination = payload?.pagination ? new NetworkPageMeta(payload.pagination) : null; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left payload AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
constructor(payload?: Partial<NetworkPageData<T>>) { this.list = payload?.list ?? null; this.pagination = payload?.pagination ? new NetworkPageMeta(payload.pagination) : null; }
https://github.com/Joker-x-dev/CoolMallArkTS
6fd45e79b5130f97b89cd8ab2f6c05c8b82a8b3d
github
apap6628114/nga_oh
entry/src/main/ets/store/BaseStore.ets
arkts
isCurrent
异步回调前调用:generation 不匹配说明已过时,放弃执行
protected isCurrent(gen: number): boolean { return gen === this.generation }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left isCurrent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gen AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
protected isCurrent(gen: number): boolean { return gen === this.generation }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/BaseStore.ets#L52-L54
2e9a951dfa2f1022307b6e2d9460042af34f79cf
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/main/MainNavigator.ets
arkts
toMain
跳转到主框架 @returns {void} 无返回值
static toMain(): void { navigateTo(MainRoutes.Main); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toMain 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_stat...
static toMain(): void { navigateTo(MainRoutes.Main); }
https://github.com/Joker-x-dev/CoolMallArkTS
f3f7adb715827e48ac9967c388d5c9563576fdf8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/SnapshotCapture.ets
arkts
init
初始化UIContext
public init(uiContext: UIContext): void { this.uiContext = uiContext; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST...
public init(uiContext: UIContext): void { this.uiContext = uiContext; }
https://github.com/DaLongZhuaZi/manxia
8357f9e7e71f16dbc9e5383ae3df1ee8c98840cf
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/AnnotationEngine.ets
arkts
createCustomAnnotation
创建自定义标注 @param type 标注类型 @param label 标注标签 @param boundingBox 边界框 @param description 描述 @returns 自定义标注
createCustomAnnotation( type: AnnotationType, label: string, boundingBox: BoundingBox, description?: string ): ImageAnnotation { return { id: this.generateAnnotationId(), type: type, label: label, boundingBox: boundingBox, description: description, style: this...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createCustomAnnotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AnnotationType AST#identifier#Rig...
createCustomAnnotation( type: AnnotationType, label: string, boundingBox: BoundingBox, description?: string ): ImageAnnotation { return { id: this.generateAnnotationId(), type: type, label: label, boundingBox: boundingBox, description: description, style: this...
https://github.com/LJ666-ui/harmony-health-care
0d78b6ff8ec7a48cfcec435fd2184c50c49de8e0
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/GestureUtils.ets
arkts
createDragGesture
创建拖拽手势处理器 @param onStart - 拖拽开始回调 @param onUpdate - 拖拽更新回调 @param onEnd - 拖拽结束回调 @returns 拖拽手势处理器
static createDragGesture( onStart: (x: number, y: number) => void, onUpdate: (state: GestureState) => void, onEnd: (state: GestureState) => void ): PanGestureInterface { let gestureState: GestureState | null = null; hilog.debug(0x0000, TAG, 'GestureUtils.createDragGesture: 创建拖拽手势'); return...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left createDragGesture AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#iden...
static createDragGesture( onStart: (x: number, y: number) => void, onUpdate: (state: GestureState) => void, onEnd: (state: GestureState) => void ): PanGestureInterface { let gestureState: GestureState | null = null; hilog.debug(0x0000, TAG, 'GestureUtils.createDragGesture: 创建拖拽手势'); return...
https://github.com/kumaleap/ArkSwipeDeck
4fb7b13619bb4b98fcc242c2ff0d2be0801258ee
github
dingzhilin1990/zhilinclaw
src/agents/AgentBase.ets
arkts
getSimulatedResponse
获取模拟响应(当 AI 模型不可用时)
protected getSimulatedResponse(prompt: string): string { return `[模拟响应] 针对"${prompt.substring(0, 50)}..."的处理结果。实际部署时将使用真实的 AI 模型。`; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getSimulatedResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prompt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
protected getSimulatedResponse(prompt: string): string { return `[模拟响应] 针对"${prompt.substring(0, 50)}..."的处理结果。实际部署时将使用真实的 AI 模型。`; }
https://github.com/dingzhilin1990/zhilinclaw
90f88ae73412727e63bc471912f8e87b9f5ecc2d
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
sendImageMessage
发送图片消息 @param conversationId 会话ID @param imageUrl 图片URL @param content 可选的图片描述
async sendImageMessage(conversationId: string, imageUrl: string, content?: string): Promise<ApiResponse<Message>> { return this.sendMessage({ conversationId, type: MessageType.IMAGE, content: content || '', imageUrl }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendImageMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left A...
async sendImageMessage(conversationId: string, imageUrl: string, content?: string): Promise<ApiResponse<Message>> { return this.sendMessage({ conversationId, type: MessageType.IMAGE, content: content || '', imageUrl }) }
https://github.com/David8Idira/AI-OA
a6d0d5bbdf021f4250dbba18c191b6259f33b2d8
github
LZZLHY/hlib
entry/src/main/ets/utils/Layout.ets
arkts
pagePadding
页面左右 padding(vp)。
static pagePadding(bp: Breakpoint): number { if (bp === 'sm') return 16; if (bp === 'md') return 24; if (bp === 'lg') return 32; return 40; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pagePadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Breakp...
static pagePadding(bp: Breakpoint): number { if (bp === 'sm') return 16; if (bp === 'md') return 24; if (bp === 'lg') return 32; return 40; }
https://github.com/LZZLHY/hlib
61873b025389088b96321a0b604470b33d3ded2e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets
arkts
getOwnPropertyNames
Returns the names of the own fields of an object @param o object that contains the own fields @returns array representation of names
public static getOwnPropertyNames(o: Object): string[] { if (o instanceof Char || o instanceof Boolean || o instanceof Byte || o instanceof Short || o instanceof Int || o instanceof Long || o instanceof Float || o instanceof...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getOwnPropertyNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left :...
public static getOwnPropertyNames(o: Object): string[] { if (o instanceof Char || o instanceof Boolean || o instanceof Byte || o instanceof Short || o instanceof Int || o instanceof Long || o instanceof Float || o instanceof...
https://gitcode.com/iop123123/arkts-static-skills
7cbd07d312c8c7f0b6b566d2830999241ebcc7c9
gitcode
2763981847/Clock-Alarm
entry/src/main/ets/common/util/Logger.ets
arkts
warn
记录警告级别的日志。 @param args 要记录的日志信息
warn(...args: string[]): void { hilog.warn(this.domain, this.prefix, this.format, args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
warn(...args: string[]): void { hilog.warn(this.domain, this.prefix, this.format, args); }
https://github.com/2763981847/Clock-Alarm
94ecfea0f2520b3d7c638c0dd0710fe3ecba2554
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets
arkts
parseTokenResponse
解析令牌响应 @param response 响应数据 @return OAuth2Token 令牌信息 @throws 如果解析失败则抛出异常
protected parseTokenResponse(response: Record<string, Object>): OAuth2Token { const accessToken = this.extractStringFromObject(response, 'access_token'); const tokenType = this.extractStringFromObject(response, 'token_type', 'Bearer'); const refreshToken = this.extractOptionalStringFromObject(response, 'r...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left parseTokenResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left ...
protected parseTokenResponse(response: Record<string, Object>): OAuth2Token { const accessToken = this.extractStringFromObject(response, 'access_token'); const tokenType = this.extractStringFromObject(response, 'token_type', 'Bearer'); const refreshToken = this.extractOptionalStringFromObject(response, 'r...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L263-L289
74f3236049114b163fcf98907dd3abbacb7e7583
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to length. @param { number } length - Number of elements @throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Int8Array.BYTES_PER_ELEMENT).toInt()) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLength = this...
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 length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Int8Array.BYTES_PER_ELEMENT).toInt()) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLength = this...
https://gitcode.com/iop123123/arkts-static-skills
22771ff3517ae9c2d555ff3287035771006b6285
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
setInt8
Sets bytes as they represent given type @param byteOffset zero index to write (big endian)
public setInt8(byteOffset: double, value: number): void { this.setInt8(byteOffset as int, value as byte) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AST#identif...
public setInt8(byteOffset: double, value: number): void { this.setInt8(byteOffset as int, value as byte) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9f1dc9937f9779f43756f6c93cb8f8d78e29b3ee
gitee
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/image/ImageUtil.ets
arkts
getPixelMapFromResource
用户获取resource目录下的media中的图片PixelMap @param {Resource} resource Resource资源信息 @param {image.DecodingOptions} options 图像解码参数 @returns {Promise<image.PixelMap>} 返回图像的PixelMap对象
static async getPixelMapFromResource(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { const resManager: resourceManager.ResourceManager = ContextUtil.getUIAbilityCtx().resourceManager; const uint8Array: Uint8Array = resManager.getMediaContentSync(resource.id); return await I...
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 getPixelMapFromResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AS...
static async getPixelMapFromResource(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { const resManager: resourceManager.ResourceManager = ContextUtil.getUIAbilityCtx().resourceManager; const uint8Array: Uint8Array = resManager.getMediaContentSync(resource.id); return await I...
https://github.com/Joker-x-dev/CoolMallArkTS
fe07edd248bfd3b846a8d6a1d8b87c75d3beb270
github
pangpang20/antennaPodHM
entry/src/main/ets/service/PlayerService.ets
arkts
getSleepTimerRemaining
获取睡眠定时器剩余秒数
getSleepTimerRemaining(): number { if (this.sleepTimerMinutes <= 0 || this.sleepTimerStartTime <= 0) { return 0; } const elapsed = Date.now() - this.sleepTimerStartTime; const totalMs = this.sleepTimerMinutes * 60 * 1000; const remaining = Math.max(0, totalMs - elapsed); return Math...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSleepTimerRemaining 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...
getSleepTimerRemaining(): number { if (this.sleepTimerMinutes <= 0 || this.sleepTimerStartTime <= 0) { return 0; } const elapsed = Date.now() - this.sleepTimerStartTime; const totalMs = this.sleepTimerMinutes * 60 * 1000; const remaining = Math.max(0, totalMs - elapsed); return Math...
https://github.com/pangpang20/antennaPodHM
202a4af9455f76f2fede732718f040cc925b79bf
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/navigation/TabContentDemo.ets
arkts
getTabBar_indicator
SubTabBarStyle - 允许定义选中样式和未选中样式的页签 of() - 页签文本 padding() - 内边距 labelStyle() - 页签文本的样式 overflow, maxLines, minFontSize, maxFontSize, heightAdaptivePolicy - 详见 component/text/TextDemo.ets 中的说明 font - 字体(size, style, weight, family) selectedColor - 选中时的颜色 unselectedColor - 未选中时的颜色 selectedMode() - 页签被选中时的附加效果(SelectedMode...
getTabBar_indicator(text: string) { return SubTabBarStyle.of(text) .padding({ top: 0, right: 40, bottom: 0, left: 40 }) .labelStyle({ overflow: TextOverflow.Ellipsis, maxLines: 1, minFontSize: 24, maxFontSize: 24, heightAdap...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTabBar_indicator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier...
getTabBar_indicator(text: string) { return SubTabBarStyle.of(text) .padding({ top: 0, right: 40, bottom: 0, left: 40 }) .labelStyle({ overflow: TextOverflow.Ellipsis, maxLines: 1, minFontSize: 24, maxFontSize: 24, heightAdap...
https://github.com/webabcd/HarmonyDemo
604746a26f4da952faaea64c2bbad22583c2076e
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
defineMacro
Define a macro for controlling #ifdef conditional compilation in importSyntax @param macroName Macro name
public defineMacro(macroName: string): boolean { if (this.nativeHandle == 0) { return false; } return lib.HighlightEngine_DefineMacro(this.nativeHandle, macroName); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left defineMacro AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left macroName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public defineMacro(macroName: string): boolean { if (this.nativeHandle == 0) { return false; } return lib.HighlightEngine_DefineMacro(this.nativeHandle, macroName); }
https://github.com/FinalScave/SweetLine
05ab28351250cd7d4eeb87794188863e0888f04c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_long.ets
arkts
main
--- desc: check greater operation for two long integers ---
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a > b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#:#Right AST#predefined_type#Left A...
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a > b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2c46a3c00f1b32ea5df1bbe37b5c77705a68e5e6
gitee
heeh02/superconnect
harmony/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
Notification "exit fullscreen" action re-foregrounds this (singleton) ability with scAction. Bump an AppStorage key the page watches → page returns to windowed.
onNewWant(want: Want, _launchParam: AbilityConstant.LaunchParam): void { const params = want.parameters as Record<string, Object> | undefined; if (params && params['scAction'] === 'exitFullscreen') { AppStorage.setOrCreate('scExitFullscreen', Date.now()); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R...
onNewWant(want: Want, _launchParam: AbilityConstant.LaunchParam): void { const params = want.parameters as Record<string, Object> | undefined; if (params && params['scAction'] === 'exitFullscreen') { AppStorage.setOrCreate('scExitFullscreen', Date.now()); } }
https://github.com/heeh02/superconnect
c3bef16831b828eac3f79f6efaad0bb6bf3cee8f
github
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/components/ball/RedBlueBall.ets
arkts
numberText
复制球号文本
@Extend(Text) function numberText() { .fontSize(28) .textAlign(TextAlign.Center) .width('100%') }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function numberText() { .fontSize(28) .textAlign(TextAlign.Center) .width('100%') }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
08173c5a68f8ef29b19e9e7fedd472b71688e680
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/AvifTranscoder.ets
arkts
transcodeToSameDirectory
将 AVIF 文件在原目录转码为 WebP
public async transcodeToSameDirectory(avifPath: string, options?: AvifTranscodeOptions): Promise<AvifTranscodeResult> { try { const dotIndex: number = avifPath.lastIndexOf('.'); const basePath: string = dotIndex >= 0 ? avifPath.substring(0, dotIndex) : avifPath; const opts: AvifTranscodeOptions ...
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 transcodeToSameDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left avifPath AST#identifier#Right AST#ERROR#Left A...
public async transcodeToSameDirectory(avifPath: string, options?: AvifTranscodeOptions): Promise<AvifTranscodeResult> { try { const dotIndex: number = avifPath.lastIndexOf('.'); const basePath: string = dotIndex >= 0 ? avifPath.substring(0, dotIndex) : avifPath; const opts: AvifTranscodeOptions ...
https://github.com/DaLongZhuaZi/manxia
6ebcbd4fec83e9f9e684fa66d6fd04fe5d6fd7f9
github
openharmony/codelabs
ETSUI/SchoolTimeTable/entry/src/main/ets/service/CourseDataService.ets
arkts
getAllCourses
--- 获取当前所有的课程 (UI 组件建议直接用 @StorageLink) ---
getAllCourses(): Course[] { return AppStorage.Get<Course[]>(COURSE_LIST_KEY) || []; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllCourses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
getAllCourses(): Course[] { return AppStorage.Get<Course[]>(COURSE_LIST_KEY) || []; }
https://gitcode.com/openharmony/codelabs
5693c68f8d92cdc4744b1ee733c24780c7c77410
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/core/contracts/NGFServiceRegistration.ets
arkts
constructor
创建服务注册信息 @param token 服务令牌/标识符 @param implementationName 实现类名称 @param service 服务实例
constructor(token: string, implementationName: string, service: object) { this.token = token; this.implementationName = implementationName; this.service = service; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
constructor(token: string, implementationName: string, service: object) { this.token = token; this.implementationName = implementationName; this.service = service; }
https://github.com/DaLongZhuaZi/NGF
a28085c80dcca7aaa97397e3293e8d8009f4dc76
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
gammaCorrection
Gamma校正 @param value RGB分量值(0-1) @returns 校正后的值
private static gammaCorrection(value: number): number { if (value <= 0.03928) { return value / 12.92; } else { return Math.pow((value + 0.055) / 1.055, 2.4); } }
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 gammaCorrection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Lef...
private static gammaCorrection(value: number): number { if (value <= 0.03928) { return value / 12.92; } else { return Math.pow((value + 0.055) / 1.055, 2.4); } }
https://github.com/LJ666-ui/harmony-health-care
5cc25146f34c69fe11d8e85b209e3f4d096d6488
github
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/common/PreferencesUtil.ets
arkts
putString
存储字符串数据 @param context 应用上下文 @param key 键 @param value 值
static async putString(context: common.UIAbilityContext, key: string, value: string): Promise<void> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); await dataPreferences.put(key, value); await dataPreferences.flush(); } catch (error) { console.error('Pref...
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 putString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
static async putString(context: common.UIAbilityContext, key: string, value: string): Promise<void> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); await dataPreferences.put(key, value); await dataPreferences.flush(); } catch (error) { console.error('Pref...
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
0f61b6ba74aa01b1df78770fc4f56183ce87699c
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test_original_index.ets
arkts
testTernary
=== Ternary operator ===
function testTernary(x: number): string { return x > 0 ? 'positive' : 'non-positive'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTernary AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function testTernary(x: number): string { return x > 0 ? 'positive' : 'non-positive'; }
https://github.com/miaochiahao/ark-ghidra
4ccd0b0757bb2b59b009004c0ca64328f8caf108
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/StreamMenuManager.ets
arkts
getTouchModeName
获取触摸模式的中文名称
getTouchModeName(): string { switch (this.viewModel.touchMode) { case 'trackpad': return '触摸板模式'; case 'direct': return '直接触摸模式'; case 'mouse': return '鼠标模式'; default: return this.viewModel.touchMode; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTouchModeName 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#state...
getTouchModeName(): string { switch (this.viewModel.touchMode) { case 'trackpad': return '触摸板模式'; case 'direct': return '直接触摸模式'; case 'mouse': return '鼠标模式'; default: return this.viewModel.touchMode; } }
https://github.com/AlkaidLab/moonlight-harmony
b4e83fa23130f4a534360c68fba429cfb6d36e22
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
constructor
Creates a new `BigInt` instance with value 0. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor() { this([], 0) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor 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 A...
constructor() { this([], 0) }
https://gitcode.com/iop123123/arkts-static-skills
9149b347b3271791a288416d13702eb21ffa7ad8
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ushort.ets
arkts
main
--- desc: check postfix decrement for unsigned short integer operand ---
function main(): void { let value: ushort = {{v.value}} let result: ushort = value-- assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#:#Right AST#predefined_type#Left A...
function main(): void { let value: ushort = {{v.value}} let result: ushort = value-- assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9c43a9cb7bd605f6105d9326c053c91633f83542
gitee
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
switchCamera
切换前后摄像头 CameraCapture.switchCamera() 只切换 config,需要完整的 release → re-initialize 流程: 1. 暂停帧发送 2. 释放旧摄像头资源 3. 切换摄像头方向 4. 用保存的 localPreviewSurfaceId 重新初始化 5. 启动摄像头采集 6. 恢复帧发送 + 请求关键帧
public async switchCamera(): Promise<boolean> { if (this.cameraCapture === null || this.localPreviewSurfaceId.length === 0) { LogUtil.error('[MediaStream] 无法切换摄像头:摄像头或预览Surface未就绪'); return false; } try { // 1. 暂停帧发送,避免切换过程中编码残留帧 this.videoSendEnabled = false; // 2. 释放旧摄像头 ...
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 switchCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public async switchCamera(): Promise<boolean> { if (this.cameraCapture === null || this.localPreviewSurfaceId.length === 0) { LogUtil.error('[MediaStream] 无法切换摄像头:摄像头或预览Surface未就绪'); return false; } try { // 1. 暂停帧发送,避免切换过程中编码残留帧 this.videoSendEnabled = false; // 2. 释放旧摄像头 ...
https://github.com/tdcare/tdwebrtc
7f0fc5450e10bc4bb12fa054b63a58fa27523ed2
github
arkui-x/samples
CodeLab/Cases/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
arkts
initCompressFile
将待压缩文件写入到应用沙箱目录 @param compressZipName 待压缩文件所处路径 @returns
initCompressFile(beCompressFileDir: string): void { //获取rawfile下的所有待压缩文件名 this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`,...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initCompressFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left beCompressFileDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#...
initCompressFile(beCompressFileDir: string): void { //获取rawfile下的所有待压缩文件名 this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`,...
https://gitcode.com/arkui-x/samples
72c4f66f04c5d43718c64ec637de78dacc197285
gitcode
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
showTodoToast
未完成的功能,显示TODO消息提示 @returns {void}
showTodoToast(): void { promptAction.showToast({ message: $r('app.string.foldable_screen_cases_toast_todo_show') }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showTodoToast 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...
showTodoToast(): void { promptAction.showToast({ message: $r('app.string.foldable_screen_cases_toast_todo_show') }) }
https://gitcode.com/arkui-x/samples
9f98412ce59092fa16edb173a4fc3ee8e51ebb90
gitcode
zmuxuny/ai-guardian-star
entry/src/main/ets/common/CloudService.ets
arkts
updateUser
更新云端用户资料,只传需要更新的字段
async updateUser(fields: CloudUpdateFields): Promise<CloudResult> { return postJson('/api/updateUser', fields); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fields AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async updateUser(fields: CloudUpdateFields): Promise<CloudResult> { return postJson('/api/updateUser', fields); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/CloudService.ets#L128-L130
2996efc938e870527ce54f0ab8cea0e551076c49
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
toReversed
Creates a reversed copy @returns a reversed copy
public toReversed(): Int8Array { return new Int8Array(this).reverse() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed 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 Int8Array A...
public toReversed(): Int8Array { return new Int8Array(this).reverse() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
dcf61fb6befead57a40b32d1fa2c90b17e4fce21
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
getCurrentInstruction
获取当前指令
private getCurrentInstruction(): string { if (!this.navigationState.currentPath) return ''; const index = this.navigationState.currentWaypointIndex; const instruction = this.navigationState.currentPath.instructions[index]; return instruction?.text || '继续前进'; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentInstruction 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 s...
private getCurrentInstruction(): string { if (!this.navigationState.currentPath) return ''; const index = this.navigationState.currentWaypointIndex; const instruction = this.navigationState.currentPath.instructions[index]; return instruction?.text || '继续前进'; }
https://github.com/LJ666-ui/harmony-health-care
1c3b5fde593907676cdff33bbd517c22c6c9c66d
github
Joker-x-dev/HarmonyKit
feature/main/src/main/ets/viewmodel/NavigationViewModel.ets
arkts
hasResultTitle
是否存在结果标题 @returns {boolean} 是否存在
hasResultTitle(): boolean { return this.resultTitle.length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasResultTitle 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#stat...
hasResultTitle(): boolean { return this.resultTitle.length > 0; }
https://github.com/Joker-x-dev/HarmonyKit
b1cb135047b2eadbfdf80e2d04cbc6ace4cb4b83
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
copyWithin
Makes a copy of internal elements to targetPos from begin to end of Uint16Array. See rules of parameters normalization on {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin} @param { int } target - insert index to place copied elements @returns { Uint16Array } @sysc...
public copyWithin(target: int): Uint16Array { this.copyWithinImpl(target, 0, this.lengthInt) return this }
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#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public copyWithin(target: int): Uint16Array { this.copyWithinImpl(target, 0, this.lengthInt) return this }
https://gitcode.com/iop123123/arkts-static-skills
3cd9d92d597b4c0dbc7e3527798799e61aecbf12
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
hasProperties
检查对象是否包含指定的属性 @param obj - 要检查的对象 @param properties - 属性名数组 @returns 是否包含所有属性
static hasProperties(obj: Object, properties: Array<string>): boolean { if (!TypeGuards.isObject(obj)) { return false; } const objValue = obj as Record<string, Object>; for (let i = 0; i < properties.length; i++) { const prop = properties[i]; if (!Object.keys(objValue).includes(...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Obj...
static hasProperties(obj: Object, properties: Array<string>): boolean { if (!TypeGuards.isObject(obj)) { return false; } const objValue = obj as Record<string, Object>; for (let i = 0; i < properties.length; i++) { const prop = properties[i]; if (!Object.keys(objValue).includes(...
https://github.com/DaLongZhuaZi/manxia
851ab6b2e20deb0f59d8f1e7e46297f14bd67f93
github
azhu0001/localsend-harmony
entry/src/main/ets/service/flush/FlushService.ets
arkts
end
文件写入结束
end() { //因为onStream是异步执行的调用onFinish时onStream可以还未执行结束 //这里用isFinished标记下 this.isFinished = true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left end 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 { AST#{#Right AST#comment#Left //因为onStream是异步执行的调用...
end() { //因为onStream是异步执行的调用onFinish时onStream可以还未执行结束 //这里用isFinished标记下 this.isFinished = true }
https://gitcode.com/azhu0001/localsend-harmony
c20bff652c79c7730b9e2b07b1496f690d29522c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreFavorites
恢复收藏标签
private async restoreFavorites(favorites: FavoriteBackup[]): Promise<void> { logger.info(TAG, `Restoring favorites: ${favorites.length} items`); const failures: string[] = []; for (const fav of favorites) { try { const lastReadTime = Number(fav.lastReadTime ?? fav.updateTime ?? 0); ...
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 restoreFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favorites AST#identifier#Right AST#:...
private async restoreFavorites(favorites: FavoriteBackup[]): Promise<void> { logger.info(TAG, `Restoring favorites: ${favorites.length} items`); const failures: string[] = []; for (const fav of favorites) { try { const lastReadTime = Number(fav.lastReadTime ?? fav.updateTime ?? 0); ...
https://github.com/DaLongZhuaZi/manxia
34eac0ec7802d013378716d1819c2e2e6755c209
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamLifecycleManager.ets
arkts
registerAppStateListener
==================== 应用前后台状态 ==================== 注册应用前后台状态监听
registerAppStateListener(): void { this.appStateListener = (state: AppState) => { if (state === AppState.BACKGROUND) { console.info('[StreamPage] 应用进入后台'); this.wasInBackground = true; } else if (state === AppState.FOREGROUND && this.wasInBackground) { console.info('[StreamPage...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerAppStateListener 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#sta...
registerAppStateListener(): void { this.appStateListener = (state: AppState) => { if (state === AppState.BACKGROUND) { console.info('[StreamPage] 应用进入后台'); this.wasInBackground = true; } else if (state === AppState.FOREGROUND && this.wasInBackground) { console.info('[StreamPage...
https://github.com/AlkaidLab/moonlight-harmony
7a0945b5c44ba11611a5b40a894df60c61f5ecf4
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadTypes.ets
arkts
fromVendorProduct
根据 VID/PID 推断控制器类型
static fromVendorProduct(vendorId: number, _productId: number): number { switch (vendorId) { case VendorId.MICROSOFT: return MoonlightControllerType.XBOX; case VendorId.SONY: return MoonlightControllerType.PS; case VendorId.NINTENDO: return MoonlightControllerType.NINTEND...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromVendorProduct AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left vendorId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num...
static fromVendorProduct(vendorId: number, _productId: number): number { switch (vendorId) { case VendorId.MICROSOFT: return MoonlightControllerType.XBOX; case VendorId.SONY: return MoonlightControllerType.PS; case VendorId.NINTENDO: return MoonlightControllerType.NINTEND...
https://github.com/AlkaidLab/moonlight-harmony
402bf86166fcb42e3276ddf8de81f1c50f42554a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint32Array using range [begin, this.lengthInt]. @param { int } begin - start index to be taken into slice. @returns { Uint32Array } - a new Uint32Array with elements of current Uint32Array[begin, this.lengthInt]. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public slice(begin: int): Uint32Array { return this.sliceFromTo(begin, this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public slice(begin: int): Uint32Array { return this.sliceFromTo(begin, this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
101dfb547efc7c1b220fe986e34d38abe14912f7
gitcode
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/pages/Calendar/statisticsComponent.ets
arkts
getAverage
辅助计算函数
getAverage(list: HealthChartData[]): number { const validData = list.filter(v => v.value > 0) if (validData.length === 0) { return 0 } const sum = validData.reduce((s, x) => s + x.value, 0) return Math.round(sum / validData.length) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAverage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left HealthChartData...
getAverage(list: HealthChartData[]): number { const validData = list.filter(v => v.value > 0) if (validData.length === 0) { return 0 } const sum = validData.reduce((s, x) => s + x.value, 0) return Math.round(sum / validData.length) }
https://gitcode.com/openharmony/codelabs
ea8103903d1cf4c6d79b5af0d256f5b33ccce3bb
gitcode
codelably/HCompass
packages/auth/src/main/ets/services/datasource/AuthNetworkDataSourceImpl.ets
arkts
loginByPassword
密码登录实现 @param {PasswordLoginRequest} params - 登录参数 @returns {Promise<NetworkResult<Auth>>} 登录结果
async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResult<Auth>> { const httpClient = getContainer().resolve<AxiosHttpClient>(CoreServiceKeys.HttpClient); const rawResponse: Unknown = await httpClient.post<Unknown>("user/login/password", params); return new NetworkResult<Auth>(rawResponse...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByPassword 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...
async loginByPassword(params: PasswordLoginRequest): Promise<NetworkResult<Auth>> { const httpClient = getContainer().resolve<AxiosHttpClient>(CoreServiceKeys.HttpClient); const rawResponse: Unknown = await httpClient.post<Unknown>("user/login/password", params); return new NetworkResult<Auth>(rawResponse...
https://github.com/codelably/HCompass
9f7dad1a7ae1748d3a96b2e2974f7f4b959d0023
github
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/model/UserTableApi.ets
arkts
queryUserByUsername
Querying user information by user name. @param username Querying user name. @returns Query result set.
async queryUserByUsername(username: string): Promise<User[]> { let resultList: Array<User>; let predicates = new dataRdb.RdbPredicates(TABLE_NAME); predicates.equalTo('username', username); let ret = await this.userTable.query(predicates); resultList = this.getListFromResultSet(ret); return re...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryUserByUsername AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#...
async queryUserByUsername(username: string): Promise<User[]> { let resultList: Array<User>; let predicates = new dataRdb.RdbPredicates(TABLE_NAME); predicates.equalTo('username', username); let ret = await this.userTable.query(predicates); resultList = this.getListFromResultSet(ret); return re...
https://gitee.com/openharmony/codelabs.git
411f5bef194d7a13a7957df41033c8669ffd34d1
gitee
XJTUWYD/ArkDiff
entry/src/main/ets/services/FileContentService.ets
arkts
detectGBK
===================== 编码检测与转换 ===================== 检测文本是否可能是 GBK/GB2312 编码 启发式:如果非ASCII字节中 GBK lead byte 占比 > 60%,则判定为 GBK
private static detectGBK(bytes: Uint8Array): boolean { let nonAscii = 0; let gbkLeads = 0; const limit = Math.min(bytes.length, 4096); // 只检测前 4KB for (let i = 0; i < limit; i++) { const b = bytes[i]; if (b > 0x7F) { nonAscii++; if (b >= 0x81 && b <= 0xFE) { gbkLe...
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 detectGBK AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AS...
private static detectGBK(bytes: Uint8Array): boolean { let nonAscii = 0; let gbkLeads = 0; const limit = Math.min(bytes.length, 4096); // 只检测前 4KB for (let i = 0; i < limit; i++) { const b = bytes[i]; if (b > 0x7F) { nonAscii++; if (b >= 0x81 && b <= 0xFE) { gbkLe...
https://github.com/XJTUWYD/ArkDiff
400f266919e9774e48f04fd624e9386237be490a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_int.ets
arkts
main
--- desc: check bitwise XOR of two integers ---
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a ^ b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#:#Right AST#predefined_type#Left A...
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a ^ b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
857a7426a7539f2781c0c3a9722c0a93aea49647
gitee
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
fetchFeedTopicListHtml
Fetch home/feed topic-list HTML, cookie-aware. Root product expectation: the home/feed must NOT be anonymous when the account is logged in. When a current account cookie exists the request is cookie-backed (getCookieHtml — uncached, carries the Cookie header), so the authenticated page includes the per-account `ignored...
private async fetchFeedTopicListHtml( endpoint: string, trigger: string = 'feed_capture', ): Promise<string> { const cookie = (CookieJarSettings.getCurrentCookie() || '').trim() if (cookie) { try { const html = await this.getCookieHtml(endpoint, cookie) const hasUsername = !!V2...
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 fetchFeedTopicListHtml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left endpoint AST#identifier#Right AST#ERROR#Left ...
private async fetchFeedTopicListHtml( endpoint: string, trigger: string = 'feed_capture', ): Promise<string> { const cookie = (CookieJarSettings.getCurrentCookie() || '').trim() if (cookie) { try { const html = await this.getCookieHtml(endpoint, cookie) const hasUsername = !!V2...
https://github.com/honjow/Next2V
da28d036cfee735c131b3eebdb4f62748e32a0ac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets
arkts
hasFatalErrorGroup
判断错误分组中是否包含致命错误
private hasFatalErrorGroup(errorGroups: string[]): boolean { for (let i = 0; i < errorGroups.length; i++) { if (!NovelSourceValidator.NON_FATAL_ERROR_GROUPS.includes(errorGroups[i])) { return true; } } return false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasFatalErrorGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorGroups AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ...
private hasFatalErrorGroup(errorGroups: string[]): boolean { for (let i = 0; i < errorGroups.length; i++) { if (!NovelSourceValidator.NON_FATAL_ERROR_GROUPS.includes(errorGroups[i])) { return true; } } return false; }
https://github.com/DaLongZhuaZi/manxia
8453f76f4a440a1df425c4ad1569609e99dd9834
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
isNoteChecked
Is Note Checked status @param checkedNoteArray - Checked status Note list @param noteItem - note @return boolean - Checked: true, unchecked: false
isNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData): boolean { for (let i = 0; i < checkedNoteArray.length; i++) { LogUtil.info(TAG, "index " + checkedNoteArray[i].uuid + " noteItem uuid: " + noteItem.uuid) } let index = checkedNoteArray.findIndex((note) => { return note.uuid == no...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNoteChecked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left checkedNoteArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right AST#[#Left [ AST...
isNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData): boolean { for (let i = 0; i < checkedNoteArray.length; i++) { LogUtil.info(TAG, "index " + checkedNoteArray[i].uuid + " noteItem uuid: " + noteItem.uuid) } let index = checkedNoteArray.findIndex((note) => { return note.uuid == no...
https://gitee.com/openharmony/applications_notes.git
37b06491b872ccf2d241d00220e22ab9f1f71e1a
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
startRecording
==================== 录音功能 ==================== 开始录音
async startRecording(callback?: RecordingCallback): Promise<boolean> { if (this.recordingState === RecordingState.RECORDING) { Logger.warn(TAG, 'Already recording') return false } try { // 先检查并请求麦克风权限 const hasPermission = await this.checkAndRequestMicrophonePermission() if ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startRecording AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left callback AST#identifier#Right ...
async startRecording(callback?: RecordingCallback): Promise<boolean> { if (this.recordingState === RecordingState.RECORDING) { Logger.warn(TAG, 'Already recording') return false } try { // 先检查并请求麦克风权限 const hasPermission = await this.checkAndRequestMicrophonePermission() if ...
https://gitcode.com/openharmony/codelabs
023ec3d6e7b150be3193f3c3c164f81b2813dab8
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
applyTriggerDeadzone
扳机死区处理 @param value 扳机值 (0.0 ~ 1.0) @returns 处理后的值
private applyTriggerDeadzone(value: number): number { return value <= GamepadManager.TRIGGER_DEADZONE ? 0 : value; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyTriggerDeadzone 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#identif...
private applyTriggerDeadzone(value: number): number { return value <= GamepadManager.TRIGGER_DEADZONE ? 0 : value; }
https://github.com/AlkaidLab/moonlight-harmony
2355d6a0a7ef7170fd5db01d0e865797d77c4eca
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
toLocaleDateString
Gets a string with a language-sensitive representation of the date portion of the specified date in the user agent's timezone. of the date portion of the specified date in the user agent's timezone. @returns { string } Gets a string with a language-sensitive representation of the date @throws { TypeError } - Input para...
public toLocaleDateString(): string { return this.toLocaleDateString(undefined) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleDateString 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 ...
public toLocaleDateString(): string { return this.toLocaleDateString(undefined) }
https://gitcode.com/iop123123/arkts-static-skills
210f13c9966a5666fb837d7905e68c7d6d7ac44f
gitcode
jiahaozheng406/huawei-travel-app-HarmonyOS
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getFirstGridData
Get data of the first grid. 首页搜索栏下的4个图标+文字 @return {Array<PageResource>} firstGridData.
getFirstGridData(): Array<ItemData> { let firstGridData: ItemData[] = [ // new ItemData($r('app.string.my_love'), $r('app.media.love')), // new ItemData($r('app.string.history_record'), $r('app.media.record')), // new ItemData($r('app.string.favorites'), $r('app.media.favorite')), // new ItemData(...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFirstGridData 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#:#...
getFirstGridData(): Array<ItemData> { let firstGridData: ItemData[] = [ // new ItemData($r('app.string.my_love'), $r('app.media.love')), // new ItemData($r('app.string.history_record'), $r('app.media.record')), // new ItemData($r('app.string.favorites'), $r('app.media.favorite')), // new ItemData(...
https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS
389007b329eaeaa7147383fd57824d9b2a202084
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/UserAuthManager.ets
arkts
checkUserAuthSupport
查询认证能力是否支持,有一项支持即可
checkUserAuthSupport() { // 遍历认证类型列表 const res = this.authTypes.map((item) => { try { // 检测是否可用 userAuth.getAvailableStatus(item, this.authTrustLevel) return true } catch { return false } }) // some 条件中有一项为 true,结果就返回 true // every 条件中所有项为 tru...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkUserAuthSupport 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_blo...
checkUserAuthSupport() { // 遍历认证类型列表 const res = this.authTypes.map((item) => { try { // 检测是否可用 userAuth.getAvailableStatus(item, this.authTrustLevel) return true } catch { return false } }) // some 条件中有一项为 true,结果就返回 true // every 条件中所有项为 tru...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
b568d1a0cdfeba1050d8952f6a049d227d23c6d5
gitcode
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
getDataMapper
获取数据映射器 @returns 数据映射器
getDataMapper(): DataMapper { return this.dataMapper }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDataMapper 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 DataMapper AST#identifier#Right AST#ERROR#Right ...
getDataMapper(): DataMapper { return this.dataMapper }
https://github.com/offlinecat-dev/OCNetORM
70815304c3bb2416b027d25138180bad01aa042f
github
PollenWang6/HiXD
entry/src/main/ets/services/UserInfoService.ets
arkts
fetchFromEhall
xgxt 个人信息拉取(CAS SSO → xgxt → getAppConfig → getStuBaseInfo)
async fetchFromEhall(xh: string): Promise<boolean> { console.info(TAG, 'fetchFromEhall: start, xh=' + xh); try { // ──── Step 0: 确保 CAS TGC 有效 ──── const casRestored: boolean = await CasLoginService.getInstance().tryAutoRestoreLogin(); console.info(TAG, 'fetchFromEhall: tryAutoRestoreLogin='...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchFromEhall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left xh AST#identifier#Right AST#type_annotation#Left AST#:#...
async fetchFromEhall(xh: string): Promise<boolean> { console.info(TAG, 'fetchFromEhall: start, xh=' + xh); try { // ──── Step 0: 确保 CAS TGC 有效 ──── const casRestored: boolean = await CasLoginService.getInstance().tryAutoRestoreLogin(); console.info(TAG, 'fetchFromEhall: tryAutoRestoreLogin='...
https://github.com/PollenWang6/HiXD
a96b7575f9ebbcc8e3b152a06e039eafa6feed72
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCountDownViewModel.ets
arkts
onControlStart
手动控制倒计时开始
onControlStart(): void { this.controlStatusText = "倒计时中"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onControlStart 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_blo...
onControlStart(): void { this.controlStatusText = "倒计时中"; }
https://github.com/codelably/tuniao-ui
4eebc60fd41966378264d388efd51da69d0f8eca
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/ParentBindingFlow.ui.test.ets
arkts
ensureParentPin
Idempotent PIN seeder. Mirrors ParentAdminFlow's helper. Re-committing the same PIN is a no-op from the operator's perspective — the ParentPinSetupPage commitOrReset() persists firstBuf into AppStorage and routes back to ConfigPage either way.
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { await openConfigPage(driver); await scrollToParentPinButton(driver); await clickByIdShared(driver, 'ConfigParentPinButton'); const keypadReady: boolean = await waitForParentPinSetupKeypad(driver, 12000); if (!keypad...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ensureParentPin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#t...
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { await openConfigPage(driver); await scrollToParentPinButton(driver); await clickByIdShared(driver, 'ConfigParentPinButton'); const keypadReady: boolean = await waitForParentPinSetupKeypad(driver, 12000); if (!keypad...
https://github.com/terryma2024/happyword
7884832110a868272b03051c64b1a8c57c046474
github
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/delegate/IWebDownloadFile.ets
arkts
prepareDirectory
准备存储目录
prepareDirectory(fullPath: string) { const dirPath = fullPath.substring(0, fullPath.lastIndexOf('/')) if (!this.checkPathExists(dirPath)) { fileIo.mkdirSync(dirPath) } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left prepareDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fullPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ...
prepareDirectory(fullPath: string) { const dirPath = fullPath.substring(0, fullPath.lastIndexOf('/')) if (!this.checkPathExists(dirPath)) { fileIo.mkdirSync(dirPath) } }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
2fa9c613fb21b655505f6b0237b73baf33869296
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
prepareExtractionDirectory
准备解压缩目录 @param archivePath 压缩文件路径 @param options 解压缩选项 @returns 目标目录路径
private async prepareExtractionDirectory( archivePath: string, options: ExtractionOptions ): Promise<string> { let targetDir: string; if (options.targetDirectory) { targetDir = options.targetDirectory; } else { // 转换URI路径为本地路径以获取正确的文件名 const localPath = this.convertUriToLocalP...
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 prepareExtractionDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left archivePath AST#identifier#Right AST#ERRO...
private async prepareExtractionDirectory( archivePath: string, options: ExtractionOptions ): Promise<string> { let targetDir: string; if (options.targetDirectory) { targetDir = options.targetDirectory; } else { // 转换URI路径为本地路径以获取正确的文件名 const localPath = this.convertUriToLocalP...
https://github.com/DaLongZhuaZi/manxia
87ea279dbf86affe636d289809f849dd7bcea6d5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets
arkts
isAlive
Check if the worker is currently alive and running @returns { boolean } True if the worker is alive, false otherwise
public isAlive(): boolean { return this.loopStarted.get() && !this.loopJoined.get(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAlive 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#boole...
public isAlive(): boolean { return this.loopStarted.get() && !this.loopJoined.get(); }
https://gitcode.com/iop123123/arkts-static-skills
83f6c9111bc79794ea541380b636e1eebcc8bb20
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
cleanupOldRecords
清理旧的识别记录(保留最近N条)
static async cleanupOldRecords(userId: number, keepCount: number = 100): Promise<number> { try { const store = DatabaseManager.getDatabase(); // 查找要保留的最早记录的时间 const sql = ` SELECT created_at FROM ${OCRRecognitionRecord.tableName} WHERE user_id = ? AND is_deleted = 0 ...
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 cleanupOldRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left...
static async cleanupOldRecords(userId: number, keepCount: number = 100): Promise<number> { try { const store = DatabaseManager.getDatabase(); // 查找要保留的最早记录的时间 const sql = ` SELECT created_at FROM ${OCRRecognitionRecord.tableName} WHERE user_id = ? AND is_deleted = 0 ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
bad4cc6cdc9b29a6253f2c8505a3933f88b30ee2
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnIconViewModel.ets
arkts
getData
获取指定索引的数据 @param index 索引 @returns 图标名称
getData(index: number): string { return this.dataArray[index]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#...
getData(index: number): string { return this.dataArray[index]; }
https://github.com/codelably/tuniao-ui
9713e0646a53724c92455480c6f68660fc7bbf91
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
toString
Converts the BigInt to a string in base 10. @returns { string } A string representation of the BigInt in base 10. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toString(): string { return this.toString(10) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): string { return this.toString(10) }
https://gitcode.com/iop123123/arkts-static-skills
3b7fe1a9212ec4bcc1d574025ce06908751a555b
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
getBoxArtUrl
获取应用图标 URL(用于 Image 组件直接加载) 使用 HTTP 端口,因为 Image 组件无法处理自签名 HTTPS 证书 @param appId 应用 ID @returns 图标 URL
getBoxArtUrl(appId: number): string { return this.buildUrl(this.getHttpBaseUrl(), 'appasset', `appid=${appId}&AssetType=2&AssetIdx=0`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBoxArtUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A...
getBoxArtUrl(appId: number): string { return this.buildUrl(this.getHttpBaseUrl(), 'appasset', `appid=${appId}&AssetType=2&AssetIdx=0`); }
https://github.com/AlkaidLab/moonlight-harmony
39016c7ce25961dd1cc566a6c19b673e3ed70d35
github
openharmony/applications_call
mobiledatasettings/src/main/ets/pages/index.ets
arkts
getSimStateDataCardOne
This interface is used to obtain sim cardOne status
getSimStateDataCardOne() { getSimStateCardOne().then((res: number) => { LogUtils.i(TAG, 'getSimStateData Card1 :success ' + JSON.stringify(res)) const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, SIM_STATE_LOCKED: 2, SIM_STATE_NOT_READY: 3, SIM_S...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSimStateDataCardOne 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_b...
getSimStateDataCardOne() { getSimStateCardOne().then((res: number) => { LogUtils.i(TAG, 'getSimStateData Card1 :success ' + JSON.stringify(res)) const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, SIM_STATE_LOCKED: 2, SIM_STATE_NOT_READY: 3, SIM_S...
https://gitee.com/openharmony/applications_call.git
3ebbdd8086953dcd197c6bef972353f9a3b341bb
gitee
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
getSpecialDanmakuVisibility
@return �Ƿ���ʾ���ⵯĻ
public getSpecialDanmakuVisibility(): boolean { return this.SpecialDanmakuVisibility; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSpecialDanmakuVisibility 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#Le...
public getSpecialDanmakuVisibility(): boolean { return this.SpecialDanmakuVisibility; }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
26cc396b56cb3eb0cff2c2701fecf6e569328f99
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseTypes.ets
arkts
createPageInfoRecord
创建页面信息数据库记录
static createPageInfoRecord(): PageInfoDatabaseRecord { return { id: '', chapterId: '', index: 0, imageUrl: '', localPath: null, width: 0, height: 0, fileSize: 0 }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createPageInfoRecord 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 P...
static createPageInfoRecord(): PageInfoDatabaseRecord { return { id: '', chapterId: '', index: 0, imageUrl: '', localPath: null, width: 0, height: 0, fileSize: 0 }; }
https://github.com/DaLongZhuaZi/manxia
8aedbb104c6b7f7fcc6758a180c3b2acd0c67374
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
subarray
Creates a Float32Array with the same underlying ArrayBuffer @param { int } [begin] - start index, inclusive @param { int } [end] - last index, exclusive @returns { Float32Array } - a new Float32Array with the same underlying ArrayBuffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public subarray(begin?: int, end?: int): Float32Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le...
public subarray(begin?: int, end?: int): Float32Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
https://gitcode.com/iop123123/arkts-static-skills
e780a9c6a7a9bfbda2818d804760069a0b37f70c
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
getOrCreateUniqueId
获取或创建设备唯一标识 优先使用缓存,其次从文件读取,最后生成新的并保存
private getOrCreateUniqueId(context?: common.UIAbilityContext): string { // 1. 如果已缓存,直接返回 if (NvHttp.cachedUniqueId) { return NvHttp.cachedUniqueId; } // 2. 尝试从文件读取 if (context) { const uniqueIdPath = context.filesDir + '/unique_id.txt'; try { if (fileIo.accessSync(uniqu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOrCreateUniqueId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right A...
private getOrCreateUniqueId(context?: common.UIAbilityContext): string { // 1. 如果已缓存,直接返回 if (NvHttp.cachedUniqueId) { return NvHttp.cachedUniqueId; } // 2. 尝试从文件读取 if (context) { const uniqueIdPath = context.filesDir + '/unique_id.txt'; try { if (fileIo.accessSync(uniqu...
https://github.com/AlkaidLab/moonlight-harmony
fab88063e3a339474b62a289194c623b0972f365
github
OHPG/FinSdk
jellyfin/src/main/ets/api/TvShowsApi.ets
arkts
getUpcomingEpisodes
getUpcomingEpisodes @summary Gets a list of upcoming episodes. @param {TvShowsApiGetUpcomingEpisodesRequest} requestParameters Request parameters. @throws {RequiredError} @memberof TvShowsApi
public async getUpcomingEpisodes(requestParameters: TvShowsApiGetUpcomingEpisodesRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Shows/Upcoming", 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 getUpcomingEpisodes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Rig...
public async getUpcomingEpisodes(requestParameters: TvShowsApiGetUpcomingEpisodesRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Shows/Upcoming", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
e569731b0c11cf223d36efeff3360f9f1eab431f
github
honjow/Next2V
shared/src/main/ets/utils/ImageUtils.ets
arkts
preferLargeAvatar
Safely upgrade V2EX avatar URL from mini/normal to large size (common in API/CDN).
private static preferLargeAvatar(path: string, size: AvatarSize = 'large'): string { return (path || '') .replace(/_(?:mini|normal)(\.\w+)([?#].*)?$/, `_${size}$1$2`) .replace(/\/(?:mini|normal)(\.\w+)([?#].*)?$/, '/large$1$2') }
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 preferLargeAvatar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Le...
private static preferLargeAvatar(path: string, size: AvatarSize = 'large'): string { return (path || '') .replace(/_(?:mini|normal)(\.\w+)([?#].*)?$/, `_${size}$1$2`) .replace(/\/(?:mini|normal)(\.\w+)([?#].*)?$/, '/large$1$2') }
https://github.com/honjow/Next2V
7814579e2c6e6ef5de9f9f2103d749be4a99ea3a
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
handleCapturedVideoFrame
处理摄像头采集的 NV12 数据 → 编码 v17: 使用 single-slot buffer + setTimeout(0) 帧丢弃机制 相机 30fps 回调通过异步链在事件循环中级联排队,VP8 编码 ~80ms/帧阻塞主线程 导致多个回调堆积。每次回调只保存最新帧,用 setTimeout(0) 延迟编码 让所有堆积的回调先跑完,然后只编码最新那一帧。
private handleCapturedVideoFrame(nv12Data: ArrayBuffer, width: number, height: number, timestampUs: number): void { // 视频开关:关闭时静默丢弃帧,摄像头和编码器保持运行 if (!this.videoSendEnabled) { return; } this.videoCaptureCount++; // v17: 只保留最新帧,丢弃旧帧 if (this.latestCameraFrame !== null) { this.videoF...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleCapturedVideoFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nv12Data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
private handleCapturedVideoFrame(nv12Data: ArrayBuffer, width: number, height: number, timestampUs: number): void { // 视频开关:关闭时静默丢弃帧,摄像头和编码器保持运行 if (!this.videoSendEnabled) { return; } this.videoCaptureCount++; // v17: 只保留最新帧,丢弃旧帧 if (this.latestCameraFrame !== null) { this.videoF...
https://github.com/tdcare/tdwebrtc
dda542289b06f08302ac3a709392aef2da526cdb
github
openharmony/applications_mms
entry/src/main/ets/pages/conversation/conversationController.ets
arkts
setCanSendMsgStatus
Setting the Sending Status
setCanSendMsgStatus() { if (this.receiveContactValue == common.string.EMPTY_STR && this.selectContacts.length == 0) { this.canSendMessage = false; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCanSendMsgStatus 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_bloc...
setCanSendMsgStatus() { if (this.receiveContactValue == common.string.EMPTY_STR && this.selectContacts.length == 0) { this.canSendMessage = false; } }
https://gitee.com/openharmony/applications_mms.git
fe1b6b2591c219946f27aa14ad09e3b92823da09
gitee
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment.ets
arkts
aboutToAppear
[EndExclude Counter_example1]
aboutToAppear(): void { // Create a complex object task, if the task takes 1s to execute, the component will be rendered again after 1s this.createComplexVideoPlayer(); }
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 { // Create a complex object task, if the task takes 1s to execute, the component will be rendered again after 1s this.createComplexVideoPlayer(); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
b6ed7a3b23fa29b23435dab0d8efb69e70aa6b30
gitcode
LongLiveY96/chatcube
entry/src/main/ets/models/ChatModels.ets
arkts
fromJson
从 JSON 对象创建
static fromJson(json: ModelCapabilitiesJson): ModelCapabilities { return new ModelCapabilities( json.supportsTools, json.supportsReasoning, json.supportsWebSearch, json.supportsVision, json.supportsStreaming ) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ModelCa...
static fromJson(json: ModelCapabilitiesJson): ModelCapabilities { return new ModelCapabilities( json.supportsTools, json.supportsReasoning, json.supportsWebSearch, json.supportsVision, json.supportsStreaming ) }
https://github.com/LongLiveY96/chatcube
abbe20cf32c39feacf0662eee05d2c7c39d8570f
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/PermissionUtils.ets
arkts
setImplementation
Force the use of a specific implementation @param implementation The implementation to use
public static setImplementation(implementation: PermissionUtils): void { PermissionUtils.instance = implementation; console.log(`Explicitly setting permission implementation to: ${implementation.constructor.name}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left setImplementation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left implementation AST#identifier#Right A...
public static setImplementation(implementation: PermissionUtils): void { PermissionUtils.instance = implementation; console.log(`Explicitly setting permission implementation to: ${implementation.constructor.name}`); }
https://github.com/somnio-software/my-bot-pal
e872519cff6a734e7665cb2f543eeda63a846768
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
hwaccel
启用硬件加速(硬解+硬编)
public hwaccel(): FFmpegCommandBuilder { this.useHwDecode = true; this.useHwEncode = true; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hwaccel 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 FFmpegCommandB...
public hwaccel(): FFmpegCommandBuilder { this.useHwDecode = true; this.useHwEncode = true; return this; }
https://github.com/jjjjjjava/ffmpeg_tools
efa1c67fcd354ac013deb9203481d831764323b0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/ESError.ets
arkts
name
Sets the name of the error in the ESValue.
override set name(val: string) { this.err_.setProperty("name", ESValue.wrapString(val)); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left name AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le...
override set name(val: string) { this.err_.setProperty("name", ESValue.wrapString(val)); }
https://gitcode.com/iop123123/arkts-static-skills
80b0c2c2b8e6d1358a2040a78c47375e18192128
gitcode
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets
arkts
getZoomRatioRange
获取支持的变焦范围
public static getZoomRatioRange(captureSession: camera.PhotoSession | camera.VideoSession): Array<number> { let zoomRatioRange: Array<number> = []; try { zoomRatioRange = captureSession.getZoomRatioRange(); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessError; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getZoomRatioRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Lef...
public static getZoomRatioRange(captureSession: camera.PhotoSession | camera.VideoSession): Array<number> { let zoomRatioRange: Array<number> = []; try { zoomRatioRange = captureSession.getZoomRatioRange(); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessError; ...
https://gitee.com/openharmony-sig/flutter_packages.git
7141fde0fb6dd94af1382a297cd3b26c22eb3a25
gitee
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/AutoCallUtils.ets
arkts
playAudio
播放音频文件
async playAudio(audioPath: string): Promise<boolean> { try { console.log('播放音频:', audioPath); this.isPlaying = true; // TODO: 实现音频播放功能 return true; } catch (err) { console.error(`播放音频失败: ${JSON.stringify(err)}`); return false; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left playAudio AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left audioPath AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async playAudio(audioPath: string): Promise<boolean> { try { console.log('播放音频:', audioPath); this.isPlaying = true; // TODO: 实现音频播放功能 return true; } catch (err) { console.error(`播放音频失败: ${JSON.stringify(err)}`); return false; } }
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
4b2eee8ba7231cbe71f8b8b916024e42ed01e3b5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
from
将普通 Promise 包装为 CancellablePromise
static from<T>(promise: Promise<T>): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { promise.then( value => { if (!signal.aborted) { resolve(value); } }, (error: ESObject) => { if (!signal.aborted) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Righ...
static from<T>(promise: Promise<T>): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { promise.then( value => { if (!signal.aborted) { resolve(value); } }, (error: ESObject) => { if (!signal.aborted) { ...
https://github.com/DaLongZhuaZi/manxia
21bcdd7eb9b555fe4769e6835611df4499ef20ad
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
text
Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. @returns {Promise}
text(): Promise<string> { let Encoding: string = "utf8"; let resolvedStart: int = 0; let resolvedEnd: int = this.arrBuffer.byteLength as int; let decodeData: string = ArrayBuffer.stringify(this.arrBuffer, Encoding, resolvedStart, resolvedEnd); return P...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left text 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#binary_expression#Left AST#...
text(): Promise<string> { let Encoding: string = "utf8"; let resolvedStart: int = 0; let resolvedEnd: int = this.arrBuffer.byteLength as int; let decodeData: string = ArrayBuffer.stringify(this.arrBuffer, Encoding, resolvedStart, resolvedEnd); return P...
https://gitcode.com/iop123123/arkts-static-skills
ae613d9662be1c26cd8f85acf567c6defd657797
gitcode
openharmony-sig/applications_clock
feature/timer/src/main/ets/controller/TimerController.ets
arkts
setClockUpdateListener
Set time clock change listening @param listener
public setClockUpdateListener(listener: (currentTimeMs: number) => void) { LogUtil.info(`${TAG} setClockUpdateListener`); this.clockUpdateListener = listener; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setClockUpdateListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expressi...
public setClockUpdateListener(listener: (currentTimeMs: number) => void) { LogUtil.info(`${TAG} setClockUpdateListener`); this.clockUpdateListener = listener; }
https://gitee.com/openharmony-sig/applications_clock.git
66a766228daaa78a8ee2c85c9893d01c89516a9c
gitee
RoooyHe/toona-ohos
toona/src/main/ets/utils/AppLogger.ets
arkts
trace
TRACE 级别日志
trace(msg: string, ...args: object[]): void { this.logger.trace(this.buildMsg(msg, args)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left trace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ...
trace(msg: string, ...args: object[]): void { this.logger.trace(this.buildMsg(msg, args)); }
https://github.com/RoooyHe/toona-ohos
2c68e13fc0d016bea7c044d1aac04961f82ade43
github