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
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/database/PrivacyPhotoDB.ets
arkts
queryCoverUri
查询相册封面
async queryCoverUri() { const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) predicates.orderByDesc('date_added') const resultSet = await store.query(predicates) let coverUri = '' // 查询第一条数据 if (resultSet.goToFirstRow()) { /...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryCoverUri AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#...
async queryCoverUri() { const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) predicates.orderByDesc('date_added') const resultSet = await store.query(predicates) let coverUri = '' // 查询第一条数据 if (resultSet.goToFirstRow()) { /...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
b0f9ddc93ddcd3ece75487860b783d9cba4aef94
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets
arkts
if
Fast path: if first char is not a digit, it's not an IPv4 address
if (input.length > 0 && !Char.isDecDigit(input.charAt(0))) { let host = input.toLowerCase(); // Strip trailing dots (WHATWG URL spec: normalize host by removing trailing dots) while (host.length > 0 && host.charAt(host.length - 1) == c'.') { ...
AST#program#Left AST#if_statement#Left AST#if#Left if AST#if#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left input AST#identifier#Right AST#.#Left . AST#.#Right AST#property_identifier#Left length AST#p...
if (input.length > 0 && !Char.isDecDigit(input.charAt(0))) { let host = input.toLowerCase(); // Strip trailing dots (WHATWG URL spec: normalize host by removing trailing dots) while (host.length > 0 && host.charAt(host.length - 1) == c'.') { ...
https://gitcode.com/iop123123/arkts-static-skills
ab8ed15469580cdb051b498deb95def29049d2fd
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets
arkts
saveKomgaCache
==================== Komga缓存 ==================== 保存Komga Tab缓存
async saveKomgaCache(data: KomgaCacheData): Promise<void> { try { this.komgaCache = data; const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME); await dataPreferences.put(this.KOMGA_KEY, JSON.stringify(data)); await dataPreferences.flush(); logger.deb...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveKomgaCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async saveKomgaCache(data: KomgaCacheData): Promise<void> { try { this.komgaCache = data; const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME); await dataPreferences.put(this.KOMGA_KEY, JSON.stringify(data)); await dataPreferences.flush(); logger.deb...
https://github.com/DaLongZhuaZi/manxia
dfe6020a2ba6bfc52daefe81f9e99a5690864733
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallNotifier.ets
arkts
init
init @param ctx context needed init
public init(ctx: Context) { this.context = ctx; if (!this.label) { this.label = this.getContext()?.resourceManager.getStringSync($r('app.string.missed_call')); } sharedPreferencesUtils.init(this.getContext()); }
AST#program#Left AST#expression_statement#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 ctx AST#identifier#Right AST#:#Left : AST#:#...
public init(ctx: Context) { this.context = ctx; if (!this.label) { this.label = this.getContext()?.resourceManager.getStringSync($r('app.string.missed_call')); } sharedPreferencesUtils.init(this.getContext()); }
https://gitee.com/openharmony/applications_contacts.git
d6c46d5d0696f6a0f0b9115e8909e0cc66927ac4
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
buildRequestBody
构建请求体 maxTokens 语义: - undefined / 0 表示"无限制", 仅在 Anthropic Claude 路径会兜底成 128_000 (Anthropic API 强制要求); - OpenAI Chat / OpenAI Responses / Google Gemini 等路径在 0/undefined 时直接不下发对应字段, 让模型按自身上限输出, 避免被全局 4096 锁死。 调用方应将助手配置中的 maxOutputTokens (0 = 无限制) 直接透传到这里。
private buildRequestBody( config: AIApiConfig, messages: RequestMessage[], model: string, temperature: number | undefined, maxTokens?: number, reasoningLevel: ReasoningLevel = ReasoningLevel.OFF, tools?: ToolDefinition[], toolChoice?: OpenAIResponsesToolChoice, forceChatCompletions...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left buildRequestBody AST#identifier#Right AST#arguments#Left AST#(#Left ( AST...
private buildRequestBody( config: AIApiConfig, messages: RequestMessage[], model: string, temperature: number | undefined, maxTokens?: number, reasoningLevel: ReasoningLevel = ReasoningLevel.OFF, tools?: ToolDefinition[], toolChoice?: OpenAIResponsesToolChoice, forceChatCompletions...
https://github.com/LongLiveY96/chatcube
c311400b047e56ca95fb5b1eb78a5edd58d9a88d
github
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
parseLdt
Parse LDT (EULUMDAT) format content @param content The LDT file content as a string @returns true if parsing succeeded @throws Error if parsing fails
public parseLdt(content: string): boolean { return eulumdat_napi.parseLdt(content); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left parseLdt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ...
public parseLdt(content: string): boolean { return eulumdat_napi.parseLdt(content); }
https://github.com/holg/eulumdat-rs
33e7cba2baa9e71028be195e166b95ae93a432df
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets
arkts
constructor
Constructs a ArrayConcurrentQueue with provided capaity from iterable. @param { int } capacity the capacity of the ArrayConcurrentQueue @param { Iterable<T> } iterable the iterable instance to initialize ArrayConcurrentQueue @syscap SystemCapability.Utils.Lang
constructor(capacity: int, iterable: Iterable<T>) { this(capacity) const entriesIter = iterable.$_iterator(); for (let iterRes = entriesIter.next(); !iterRes.done; iterRes = entriesIter.next()) { const val = iterRes.value; if (val !== undefined...
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 capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ...
constructor(capacity: int, iterable: Iterable<T>) { this(capacity) const entriesIter = iterable.$_iterator(); for (let iterRes = entriesIter.next(); !iterRes.done; iterRes = entriesIter.next()) { const val = iterRes.value; if (val !== undefined...
https://gitcode.com/iop123123/arkts-static-skills
f6633b32b9f1a42a902e1135ca4ea5d6657008e3
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
exitImmersiveFullscreen
退出沉浸式全屏:退出沉浸式 → 显示系统栏 → 显示装饰栏 → 退出沉浸式最大化
private async exitImmersiveFullscreen(win: window.Window): Promise<void> { // 1. 退出沉浸式模式 try { win.setImmersiveModeEnabledState(false); } catch (_e) {} // 2. 显示系统栏(不恢复 navigationIndicator,避免白色不透明样式) await this.setSystemBarsVisible(win, true); // 3. 显示装饰栏 this.setDecorVisible(win, true); ...
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 exitImmersiveFullscreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#...
private async exitImmersiveFullscreen(win: window.Window): Promise<void> { // 1. 退出沉浸式模式 try { win.setImmersiveModeEnabledState(false); } catch (_e) {} // 2. 显示系统栏(不恢复 navigationIndicator,避免白色不透明样式) await this.setSystemBarsVisible(win, true); // 3. 显示装饰栏 this.setDecorVisible(win, true); ...
https://github.com/AlkaidLab/moonlight-harmony
7e4aad66b67c744b6956a25d494136f4d9567f81
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/components/AlarmCard/index.ets
arkts
secondaryText
Font in the second line of the card
@Extend(Text) function secondaryText() { .fontSize($r('sys.float.Body_M')) .fontColor($r('sys.color.font_secondary')) .fontWeight(FontWeight.Regular) }
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 secondaryText() { .fontSize($r('sys.float.Body_M')) .fontColor($r('sys.color.font_secondary')) .fontWeight(FontWeight.Regular) }
https://gitee.com/openharmony-sig/applications_clock.git
f08a8268abed087bd0c0b7facd095f2f2d2e5257
gitee
arkui-x/samples
CodeLab/Cases/feature/groupavatar/src/main/ets/utils/ImageCombination.ets
arkts
RowComponent
群组头像横向列表组件 @param imageArray
@Builder function RowComponent(imageArray: GroupAvatarModel[]) { Row({ space: 2 }) { ForEach(imageArray, (item: GroupAvatarModel) => { Image(item.src) .height(item.height) .width(item.width) }) } .width($r('app.integer.group_avatar_custom_loading_drawing_size')) .justifyContent(Fle...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left RowComponent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requ...
@Builder function RowComponent(imageArray: GroupAvatarModel[]) { Row({ space: 2 }) { ForEach(imageArray, (item: GroupAvatarModel) => { Image(item.src) .height(item.height) .width(item.width) }) } .width($r('app.integer.group_avatar_custom_loading_drawing_size')) .justifyContent(Fle...
https://gitcode.com/arkui-x/samples
cf0756e976366e3313cff6046fa9302b852a957a
gitcode
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/BrInterfaceTest.ets
arkts
confirmPairing
Confirm pairing
confirmPairing(accept: boolean) { console.log("confirmPairing start -----------") LogUtil.info(this.TAG_PAGE + 'confirmPairing : pairingDevice + ' + JSON.stringify(this.pairingDevice)); this.controller.confirmPairing(this.pairingDevice.deviceId , accept); console.log("confirmPairing end -----------") ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left confirmPairing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left accept AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#R...
confirmPairing(accept: boolean) { console.log("confirmPairing start -----------") LogUtil.info(this.TAG_PAGE + 'confirmPairing : pairingDevice + ' + JSON.stringify(this.pairingDevice)); this.controller.confirmPairing(this.pairingDevice.deviceId , accept); console.log("confirmPairing end -----------") ...
https://gitee.com/openharmony/communication_bluetooth_service.git
872c7dc6c93a846265230b1da0b582d791e775ac
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int32Array from FixedArray<number> @param { FixedArray<number> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, Int32Array.doubleToInt(numbers[i])) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, Int32Array.doubleToInt(numbers[i])) } }
https://gitcode.com/iop123123/arkts-static-skills
27b55fd312e61b006df31643930b6155bbcb11e9
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
interceptImageRequest
拦截图片请求
interceptImageRequest(request: ImageRequestInfo): WebViewLoadingResult { try { // 通知加载开始 this.notifyLoadStart(request); // 检查缓存 const cacheKey = WebViewImageUtils.generateCacheKey(request.url, request.headers); const cachedData = this.imageCache.get(cacheKey); if (cache...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left interceptImageRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageRequestInfo AST#identifier...
interceptImageRequest(request: ImageRequestInfo): WebViewLoadingResult { try { // 通知加载开始 this.notifyLoadStart(request); // 检查缓存 const cacheKey = WebViewImageUtils.generateCacheKey(request.url, request.headers); const cachedData = this.imageCache.get(cacheKey); if (cache...
https://github.com/DaLongZhuaZi/manxia
b9753c27c4a393efd5dd7647bea18291f0a51f23
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarData.ets
arkts
setBarWidth
Sets the width each bar should have on the x-axis (in values, not pixels). Default 0.85f @param mBarWidth
public setBarWidth(mBarWidth: number): void { this.mBarWidth = mBarWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBarWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mBarWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
public setBarWidth(mBarWidth: number): void { this.mBarWidth = mBarWidth; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
01061ac8b7563027f2b5c4f7917c84f8037a0bdd
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets
arkts
clear
Deletes all elements from the ConcurrentSet.
public clear(): void { this.elements.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public clear(): void { this.elements.clear(); }
https://gitcode.com/iop123123/arkts-static-skills
1624719e69ea11c6023605425ba127d870fe9dd2
gitcode
Tlntin/home-cloud-shield
entry/src/main/ets/serviceextability/MyVpnExtAbility.ets
arkts
reapplyVpnConfig
Tear down the running native filter and tun, then rebuild both with routes computed from the current network. The status pump and the network listener stay alive across this. Throws if the rebuild fails.
private async reapplyVpnConfig(): Promise<void> { if (this.vpnConnection === undefined) { return; } this.appendDebugLog('==/vpn_ext/reapply_begin/'); const nativeStopErr: string | undefined = vpnclientbridge.stopDnsFilter(); if (nativeStopErr !== undefined) { this.appendDebugLog(`==/vp...
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 reapplyVpnConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
private async reapplyVpnConfig(): Promise<void> { if (this.vpnConnection === undefined) { return; } this.appendDebugLog('==/vpn_ext/reapply_begin/'); const nativeStopErr: string | undefined = vpnclientbridge.stopDnsFilter(); if (nativeStopErr !== undefined) { this.appendDebugLog(`==/vp...
https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L802-L833
30a0a53033fc8fb3907bcfa0d01d3ca2038acd7a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets
arkts
constructor
Constructs a ConcurrentHashMap from any iterable @param { Iterable<[K, V]> } iterable The iterable object
constructor(iterable: Iterable<[K, V]>) { const entriesIter = (iterable as Iterable<[K, V]>).$_iterator(); const entriesBuf = new Array<[K, V]>(); for (let iterRes = entriesIter.next();!iterRes.done;iterRes = entriesIter.next()) { const entry = iterRes.value; ...
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 iterable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif...
constructor(iterable: Iterable<[K, V]>) { const entriesIter = (iterable as Iterable<[K, V]>).$_iterator(); const entriesBuf = new Array<[K, V]>(); for (let iterRes = entriesIter.next();!iterRes.done;iterRes = entriesIter.next()) { const entry = iterRes.value; ...
https://gitcode.com/iop123123/arkts-static-skills
8130a9f17fd175d227fb6d7aa52d6045642bad36
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
getPresetRules
获取预设规则
public getPresetRules(): AutomationRule[] { return presetRules; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPresetRules 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 Automat...
public getPresetRules(): AutomationRule[] { return presetRules; }
https://github.com/LJ666-ui/harmony-health-care
92133b61a0b28d193f16aaaa32005098c4c798bb
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/DatabaseHelper.ets
arkts
initDatabase
初始化数据库 @param config 数据库配置 @param callback 初始化完成回调
async initDatabase( config: relationalStore.StoreConfig = DatabaseConstants.STORE_CONFIG, callback?: () => void ): Promise<void> { // 如果已经初始化,直接回调 if (this.rdbStore !== null) { callback?.(); return; } // 如果正在初始化,将回调加入队列 if (this.isInitializing) { if (callback) { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initDatabase AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async initDatabase( config: relationalStore.StoreConfig = DatabaseConstants.STORE_CONFIG, callback?: () => void ): Promise<void> { // 如果已经初始化,直接回调 if (this.rdbStore !== null) { callback?.(); return; } // 如果正在初始化,将回调加入队列 if (this.isInitializing) { if (callback) { ...
https://github.com/Kira-Yagami-Light/Kira-Projects
d3bf98d53b578d319bed838c1a3304d6db8dbfa7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SettingsManager.ets
arkts
initialize
初始化设置管理器
async initialize(): Promise<void> { try { this.dataManager = DataManager.getInstance(); // 加载所有设置到缓存 await this.loadAllSettings(); this.initialized = true; logger.info(TAG, '✅ 设置管理器初始化完成'); } catch (error) { logger.error(TAG, '❌ 设置管理器初始化失败', String(error)); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async initialize(): Promise<void> { try { this.dataManager = DataManager.getInstance(); // 加载所有设置到缓存 await this.loadAllSettings(); this.initialized = true; logger.info(TAG, '✅ 设置管理器初始化完成'); } catch (error) { logger.error(TAG, '❌ 设置管理器初始化失败', String(error)); ...
https://github.com/DaLongZhuaZi/manxia
143ff2adbead9540e3e5fe18d5bc1294027c6d42
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets
arkts
closePicker
关闭基础选择器弹出层
closePicker(): void { this.pickerOpen = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closePicker 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#...
closePicker(): void { this.pickerOpen = false; }
https://github.com/codelably/tuniao-ui
1d03fc8629d88670e7d233f8dd1fa8c4ab22c1fb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
getDirectorySize
获取目录大小
public async getDirectorySize(path: string): Promise<number> { try { let totalSize = 0; const files = await this.listDirectory(path); for (const file of files) { const filePath = `${path}/${file}`; const stat = await fileIo.stat(filePath); if (stat.isDirec...
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 getDirectorySize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : ...
public async getDirectorySize(path: string): Promise<number> { try { let totalSize = 0; const files = await this.listDirectory(path); for (const file of files) { const filePath = `${path}/${file}`; const stat = await fileIo.stat(filePath); if (stat.isDirec...
https://github.com/DaLongZhuaZi/manxia
e437753c744b7decaa96ec13b1eaf802f777dbfb
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypeConverter.ets
arkts
booleanToInt
boolean 转换为整数 @param value boolean 值 @returns 1 表示 true,0 表示 false
static booleanToInt(value: boolean): number { return value ? 1 : 0 }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left booleanToInt 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#identifier#Left bo...
static booleanToInt(value: boolean): number { return value ? 1 : 0 }
https://github.com/offlinecat-dev/OCNetORM
8f45e59e7bcc153815ef952624ff8201c31f19e6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
isEmpty
Checks whether the queue currently contains no elements. Returns false as soon as at least one element is present. @returns { boolean } True when the LinkedConcurrentQueue contains no elements, else false when at least one element is present. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isEmpty(): boolean { return this.atomicsGetSize() == 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEmpty 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 isEmpty(): boolean { return this.atomicsGetSize() == 0; }
https://gitcode.com/iop123123/arkts-static-skills
19dc3d3a82c6f9f66a8252cee69c27a81b3b4f07
gitcode
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/ProcessingInterfaceTest/entry/src/main/ets/utils/AVPlayerDemo.ets
arkts
avPlayerUrlDemo
以下demo为使用fs文件系统打开沙箱地址获取媒体文件地址并通过url属性进行播放示例
async avPlayerUrlDemo(surfaceId: string, filePath: string, callBack: SizeChangeListener) { Logger.debug(TAG, 'avPlayerUrlDemo ..... surface id ' + surfaceId); this.surfaceID = surfaceId; // 创建avPlayer实例对象 // this.avPlayer = await media.createAVPlayer(); await media.createAVPlayer() .then((da...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left avPlayerUrlDemo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surfaceId AST#identifier#Right AST#type_annotation#Lef...
async avPlayerUrlDemo(surfaceId: string, filePath: string, callBack: SizeChangeListener) { Logger.debug(TAG, 'avPlayerUrlDemo ..... surface id ' + surfaceId); this.surfaceID = surfaceId; // 创建avPlayer实例对象 // this.avPlayer = await media.createAVPlayer(); await media.createAVPlayer() .then((da...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
9fbad367894c9badf0dbc2648685efeaeeb70a88
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/PaginatedResult.ets
arkts
isLastPage
检查当前页是否为最后一页 @returns 是否为最后一页
isLastPage(): boolean { return this.page >= this.totalPages }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLastPage 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#statemen...
isLastPage(): boolean { return this.page >= this.totalPages }
https://github.com/offlinecat-dev/OCNetORM
3a7ba9f4a1616d591f8a19e0d319f8f1afff7903
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/model/repository/HabitRepository.ets
arkts
queryAll
2. 检查 QUERY:取的时候读出来了吗?(最容易漏这里!)
queryAll(): Promise<Array<Habit>> { const store = RdbHelper.getRdbStore(); if (!store) { return Promise.reject('数据库未初始化'); } try { let predicates = new relationalStore.RdbPredicates(CommonConstants.HABIT_TABLE_NAME); return store.query(predicates).then((resultSet) => { let h...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left queryAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#L...
queryAll(): Promise<Array<Habit>> { const store = RdbHelper.getRdbStore(); if (!store) { return Promise.reject('数据库未初始化'); } try { let predicates = new relationalStore.RdbPredicates(CommonConstants.HABIT_TABLE_NAME); return store.query(predicates).then((resultSet) => { let h...
https://gitcode.com/openharmony/codelabs
7f9aa90b7b69a8de362164a25e41fb83490958c8
gitcode
LZZLHY/hlib
entry/src/main/ets/viewmodel/SpeedTestVM.ets
arkts
loadCached
从持久层加载上次结果 -> AppStorage。启动时调用一次让 UI 立即有数据。
static async loadCached(): Promise<DomainTestResult[]> { const arr: DomainTestResult[] = await PreferencesStore.getObject<DomainTestResult[]>( 'settings', KEY_RESULTS, [] as DomainTestResult[] ); AppStorage.setOrCreate<DomainTestResult[]>(AppStorageKeys.SPEED_RESULTS, arr); const ts...
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 loadCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static async loadCached(): Promise<DomainTestResult[]> { const arr: DomainTestResult[] = await PreferencesStore.getObject<DomainTestResult[]>( 'settings', KEY_RESULTS, [] as DomainTestResult[] ); AppStorage.setOrCreate<DomainTestResult[]>(AppStorageKeys.SPEED_RESULTS, arr); const ts...
https://github.com/LZZLHY/hlib
87233b5169a394fd01371710545124448db0a073
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
subarray
Creates a Float64Array with the same underlying ArrayBuffer @param { int } [begin] - start index, inclusive @param { int } [end] - last index, exclusive @returns { Float64Array } - a new Float64Array with the same underlying ArrayBuffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public subarray(begin?: int, end?: int): Float64Array { 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): Float64Array { 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
4c9e6f7799095aac3d6f6b9d41dc222e4210f51b
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/RedemptionHistoryStore.ets
arkts
list
Returns deep-cloned records sorted newest-first (ts desc).
list(): RedemptionRecord[] { const out: RedemptionRecord[] = []; for (let i = 0; i < this.snap.records.length; i++) { out.push(cloneRecord(this.snap.records[i])); } out.sort((a: RedemptionRecord, b: RedemptionRecord): number => b.ts - a.ts); return out; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left list 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 RedemptionRecord AST#identifier#Right AST#[#Left [ AST#[#...
list(): RedemptionRecord[] { const out: RedemptionRecord[] = []; for (let i = 0; i < this.snap.records.length; i++) { out.push(cloneRecord(this.snap.records[i])); } out.sort((a: RedemptionRecord, b: RedemptionRecord): number => b.ts - a.ts); return out; }
https://github.com/terryma2024/happyword
d2618d62c147c29618fac0e329387d450c8af833
github
panedioic/blender-harmonyos-app
entry/src/main/ets/entryability/EntryAbility.ets
arkts
mkdirsSync
手动可靠的递归创建目录树
function mkdirsSync(dirPath: string): void { const parts = dirPath.split('/'); let current = ''; for (let i = 0; i < parts.length; i++) { if (parts[i] === '') { current += '/'; continue; } if (current !== '/' && current !== '') { current += '/'; } current += parts[i]; try...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mkdirsSync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dirPath AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function mkdirsSync(dirPath: string): void { const parts = dirPath.split('/'); let current = ''; for (let i = 0; i < parts.length; i++) { if (parts[i] === '') { current += '/'; continue; } if (current !== '/' && current !== '') { current += '/'; } current += parts[i]; try...
https://github.com/panedioic/blender-harmonyos-app
816245135c0102e426abc1a9268f1d8f76660435
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
cleanupFontAware
清理组件的字体感知功能
public static cleanupFontAware(componentId: string): void { FontAwareHelper.fontChangeCallbacks.delete(componentId); logger.debug(TAG, `组件 ${componentId} 字体感知功能已清理`); }
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 cleanupFontAware AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:...
public static cleanupFontAware(componentId: string): void { FontAwareHelper.fontChangeCallbacks.delete(componentId); logger.debug(TAG, `组件 ${componentId} 字体感知功能已清理`); }
https://github.com/DaLongZhuaZi/manxia
20e09f967c0bedb6b0dbb00fca96f0ac2ae0dbec
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
createPoiMessage
Create a POI message from AI message and POI data
private createPoiMessage( aiMessage: ChatApiResponseMessage, poiData: PoiData[], locationRequired?: boolean ): ChatMessage { return new ChatMessage( util.generateRandomUUID(), aiMessage.content || '', [], MessageType.POI, ApiMessageType.TOOL, undefined, poiD...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createPoiMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private createPoiMessage( aiMessage: ChatApiResponseMessage, poiData: PoiData[], locationRequired?: boolean ): ChatMessage { return new ChatMessage( util.generateRandomUUID(), aiMessage.content || '', [], MessageType.POI, ApiMessageType.TOOL, undefined, poiD...
https://github.com/somnio-software/my-bot-pal
29eb0014a9cdb5954718a87a55795cd06d6804e6
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
onPageEndLoadFinished
Called on both onPageEnd and onLoadFinished.
onPageEndLoadFinished() { this.endOfLoadTimestamp = Date.now() + 5000; // Extend a few seconds. // Set the fake last saved history, so that won't punch duplicated histories. if (this.restoringWebState) { this.lastSavedHistoryEntries = [new meowHistoryEntry(this.title || '', this.url || '', Date.now...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageEndLoadFinished 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_bl...
onPageEndLoadFinished() { this.endOfLoadTimestamp = Date.now() + 5000; // Extend a few seconds. // Set the fake last saved history, so that won't punch duplicated histories. if (this.restoringWebState) { this.lastSavedHistoryEntries = [new meowHistoryEntry(this.title || '', this.url || '', Date.now...
https://github.com/awaLiny2333/LinysBrowser_NEXT
d6916a0ed0553bdf0c87e9cbccd7a6982b0281ad
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/canvas/CanvasDemo.ets
arkts
aboutToAppear
displaySync.create() - 创建 DisplaySync 对象 DisplaySync - 用于监听每一帧的回调 on("frame", callback) - 注册监听(回调参数是一个 IntervalInfo 对象) off("frame") - 取消注册监听 start() - 开始监听 stop() - 停止监听 setExpectedFrameRateRange() - 设置期望帧率的范围(指定一个 ExpectedFrameRateRange 对象) expected - 期望的最优帧率 min - 期望的最小帧率 max - 期望的最大帧率 IntervalInfo - 每一帧回调时的相关信息 tim...
aboutToAppear(): void { let callback = (frameInfo: displaySync.IntervalInfo) => { this.message = `timestamp:${frameInfo.timestamp}, targetTimestamp:${frameInfo.targetTimestamp}\n` if (this.prevTimestamp > 0) { this.message += `fps:${ 1_000_000_000 / (frameInfo.timestamp - this.prevTimestamp)}`...
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 { let callback = (frameInfo: displaySync.IntervalInfo) => { this.message = `timestamp:${frameInfo.timestamp}, targetTimestamp:${frameInfo.targetTimestamp}\n` if (this.prevTimestamp > 0) { this.message += `fps:${ 1_000_000_000 / (frameInfo.timestamp - this.prevTimestamp)}`...
https://github.com/webabcd/HarmonyDemo
61dbce0f231f3a1e2ee6eff9a0ab3b5060fcccba
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrCodeGenerator.ets
arkts
placeDataBits
Place data bits with mask
placeDataBits(codewords: number[], maskPattern: number): void { let bitIdx = 0; const totalBits = codewords.length * 8; let col = this.size - 1; while (col > 0) { if (col === 6) col--; // skip timing column for (let row = 0; row < this.size; row++) { for (let c = 0; c < 2; c++) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left placeDataBits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left codewords AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Left [ AST#[#Right AST#]#Le...
placeDataBits(codewords: number[], maskPattern: number): void { let bitIdx = 0; const totalBits = codewords.length * 8; let col = this.size - 1; while (col > 0) { if (col === 6) col--; // skip timing column for (let row = 0; row < this.size; row++) { for (let c = 0; c < 2; c++) { ...
https://github.com/AlkaidLab/moonlight-harmony
11f7c69face3dc9f5fe74fe1dffce9aa89a6f808
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
pushForResult
页面跳转 可监听返回结果,需与popWithResult配合使用 pushForResult - popWithResult 场景 A->B, B->A ,A监听B的返回结果 @see {popWithResult} @param name @param param @param callback
public pushForResult<T>(name: string, param?: ObjectOrNull, callback?: OnPopCallback, builder?: NavDestBuilder<T>): Promise<void> { return this.pushDestination<T>(name, param, callback, builder) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left pushForResult AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(...
public pushForResult<T>(name: string, param?: ObjectOrNull, callback?: OnPopCallback, builder?: NavDestBuilder<T>): Promise<void> { return this.pushDestination<T>(name, param, callback, builder) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L216-L219
abaf139055b9f0aa9b37e118a7b1dc7a6b57dddc
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
mouseUpdatePosition
更新绝对鼠标位置(限制在组件区域内)
private mouseUpdatePosition(eventX: number, eventY: number): void { // 坐标变换(画面缩放/平移状态下修正触摸坐标) let posX = eventX; let posY = eventY; if (this.coordinateTransform) { const transformed = this.coordinateTransform(posX, posY); posX = transformed.x; posY = transformed.y; } const x ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mouseUpdatePosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private mouseUpdatePosition(eventX: number, eventY: number): void { // 坐标变换(画面缩放/平移状态下修正触摸坐标) let posX = eventX; let posY = eventY; if (this.coordinateTransform) { const transformed = this.coordinateTransform(posX, posY); posX = transformed.x; posY = transformed.y; } const x ...
https://github.com/AlkaidLab/moonlight-harmony
3513d1a249490fb3a7a4616535ea2e2554976b21
github
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
getUserWordBooks
==================== WORD BOOK OPERATIONS ====================
async getUserWordBooks(): Promise<UserWordBook[]> { return this.wordBookRepo.getUserWordBooks(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserWordBooks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getUserWordBooks(): Promise<UserWordBook[]> { return this.wordBookRepo.getUserWordBooks(); }
https://github.com/CLMC2025/Vignette
7b4d5d98a25a1ce9de6c180a55d7a1af952148c4
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
removeStatusListener
移除状态监听器
public removeStatusListener(listener: (info: ServerInfo) => void): void { const index = this.statusListeners.indexOf(listener); if (index !== -1) { this.statusListeners.splice(index, 1); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeStatusListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ...
public removeStatusListener(listener: (info: ServerInfo) => void): void { const index = this.statusListeners.indexOf(listener); if (index !== -1) { this.statusListeners.splice(index, 1); } }
https://github.com/richshaw2015/nds
674007ec177636d3030ef0509231417081a971b1
github
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets
arkts
insertUser
========================================== 用户表 (USER_TABLE) 操作 ========================================== 插入新用户 (注册)
public insertUser(user: User): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { this.rdbStore.insert('USER_TABLE', user.toValuesBucket(), (err, rowId) => { if (err) { console.error(`[RdbHelper] Insert user failed: ${e...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left User ...
public insertUser(user: User): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { this.rdbStore.insert('USER_TABLE', user.toValuesBucket(), (err, rowId) => { if (err) { console.error(`[RdbHelper] Insert user failed: ${e...
https://gitcode.com/openharmony/codelabs
18fe03d1834d72906c1c5a34e2d6bec90f86d4eb
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
setScatterShape
Sets the ScatterShape this DataSet should be drawn with. This will search for an available IShapeRenderer and set this renderer for the DataSet. @param shape
public setScatterShape(shape: ChartShape): void { this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScatterShape AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shape AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setScatterShape(shape: ChartShape): void { this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1d6cc423b6e9e12fc13e060fd1ac6f798f6f9653
gitee
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 Uint32Array. 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 { Uint32Array } @sysc...
public copyWithin(target: int): Uint32Array { 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): Uint32Array { this.copyWithinImpl(target, 0, this.lengthInt) return this }
https://gitcode.com/iop123123/arkts-static-skills
588622bcaa21457a966d3b3f705315cf527e9a3f
gitcode
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
startVideoDecoder
启动视频解码器
public async startVideoDecoder(): Promise<boolean> { if (this.videoDecoder !== null) { await this.videoDecoder.start(); LogUtil.info('[MediaStream] 视频解码器已启动'); // OH_AVCodec 是异步的,需要等待 on_need_input_buffer 回调 // 等待 100ms 让 Buffer 队列就绪 await new Promise<void>((resolve) => setTimeout(()...
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 startVideoDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public async startVideoDecoder(): Promise<boolean> { if (this.videoDecoder !== null) { await this.videoDecoder.start(); LogUtil.info('[MediaStream] 视频解码器已启动'); // OH_AVCodec 是异步的,需要等待 on_need_input_buffer 回调 // 等待 100ms 让 Buffer 队列就绪 await new Promise<void>((resolve) => setTimeout(()...
https://github.com/tdcare/tdwebrtc
8d21d7130aa8acd4906976c393a4d131f5d0ec8a
github
honjow/Next2V
shared/src/main/ets/parser/V2exWriteFormParser.ets
arkts
extractSyntaxMarkdownValue
The compose form's syntax control is a `<select name="syntax" id="select_syntax">` whose Markdown option's VALUE (not its visible "Markdown" text) is what the server expects. Return that value, or '' if the form has no syntax select (then Markdown is only honoured via the /write endpoint).
static extractSyntaxMarkdownValue(formHtml: string): string { const select = V2exWriteFormParser.extractSyntaxSelect(formHtml) if (!select) { return '' } const re = /<option\b([^>]*)>([\s\S]*?)<\/option>/gi let m: RegExpExecArray | null = re.exec(select) while (m) { const optionTex...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractSyntaxMarkdownValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left formHtml AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
static extractSyntaxMarkdownValue(formHtml: string): string { const select = V2exWriteFormParser.extractSyntaxSelect(formHtml) if (!select) { return '' } const re = /<option\b([^>]*)>([\s\S]*?)<\/option>/gi let m: RegExpExecArray | null = re.exec(select) while (m) { const optionTex...
https://github.com/honjow/Next2V
014303003e6d9bcd3e45fb5aa2d48a6290b1aefb
github
guoxiucai/ohos-scrcpy-app
scrcpy_server/entry/src/main/ets/scrcpyservice/InputInjector.ets
arkts
charToKeyCode
将单个 ASCII 字符映射为 OpenHarmony KeyCode,无法映射返回 -1。
private charToKeyCode(ch: string): number { const code: number = ch.charCodeAt(0); // a-z → KEYCODE_A + offset if (code >= 97 && code <= 122) { return KeyCode.KEYCODE_A + (code - 97); } // A-Z → 同键位(输出小写,注入 API 无法传 Shift 修饰键) if (code >= 65 && code <= 90) { return KeyCode.KEYCODE_A...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left charToKeyCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
private charToKeyCode(ch: string): number { const code: number = ch.charCodeAt(0); // a-z → KEYCODE_A + offset if (code >= 97 && code <= 122) { return KeyCode.KEYCODE_A + (code - 97); } // A-Z → 同键位(输出小写,注入 API 无法传 Shift 修饰键) if (code >= 65 && code <= 90) { return KeyCode.KEYCODE_A...
https://github.com/guoxiucai/ohos-scrcpy-app
74fd57c4c2623c307b759a669e08b0ef1965cfd8
github
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/Consent.test.ets
arkts
<arrow>
UserProfileApi, all 13 mutators
async (): Promise<void> => { h.instance.userProfile.setProperty('post_halt_prop', 'x'); },
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Left AST#type_identifier#Left Promise AST#type_identifi...
async (): Promise<void> => { h.instance.userProfile.setProperty('post_halt_prop', 'x'); },
https://github.com/Countly/countly-sdk-hos
3050feb8abdf06484e3b58cbd73378daa7f122db
github
the-wwyang/kids-learning-app
src/main/ets/storage/AppStorageManager.ets
arkts
updateLearningProgress
更新学习进度
public async updateLearningProgress(progress: LearningProgress): Promise<boolean> { if (this.dataPreferences === null || this.currentUserData === null) { return false; } try { const username = this.currentUserData.username; const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${usern...
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 updateLearningProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left progress AST#identifier#Right AST...
public async updateLearningProgress(progress: LearningProgress): Promise<boolean> { if (this.dataPreferences === null || this.currentUserData === null) { return false; } try { const username = this.currentUserData.username; const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${usern...
https://github.com/the-wwyang/kids-learning-app
d00dea8b89b1430adefa419f748185c115e0183d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/ComputerViewModel.ets
arkts
updateItem
更新单个数据项(不重建组件,只更新内容)
updateItem(index: number): void { this.notifyDataChange(index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateItem 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...
updateItem(index: number): void { this.notifyDataChange(index); }
https://github.com/AlkaidLab/moonlight-harmony
854d9275c11201626d9cfe637a128e520d896969
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
reorderCategories
重新排序分类(用于拖动排序后保存)
async reorderCategories(categories: BookshelfCategory[]): Promise<void> { this.categories = categories; await this.saveCategories(); logger.info(TAG, `重新排序分类,共 ${categories.length} 个`); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reorderCategories AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier...
async reorderCategories(categories: BookshelfCategory[]): Promise<void> { this.categories = categories; await this.saveCategories(); logger.info(TAG, `重新排序分类,共 ${categories.length} 个`); }
https://github.com/DaLongZhuaZi/manxia
6f7e5ac4b07b3248fbb003995ac3566c63b28873
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets
arkts
setWindowLimits
设置窗口限制尺寸
setWindowLimits(maxWidth: number, maxHeight: number, minWidth: number, minHeight: number): void { let windowLimits: window.WindowLimits = { maxWidth: maxWidth, maxHeight: maxHeight, minWidth: minWidth, minHeight: minHeight } this.mainWindow.setWindowLimits(windowLimits).then((data:...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowLimits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST...
setWindowLimits(maxWidth: number, maxHeight: number, minWidth: number, minHeight: number): void { let windowLimits: window.WindowLimits = { maxWidth: maxWidth, maxHeight: maxHeight, minWidth: minWidth, minHeight: minHeight } this.mainWindow.setWindowLimits(windowLimits).then((data:...
https://github.com/ZestBox-18/kitebook-frontend
a97c93985fc9055314515e2225f3a8b6612a12db
github
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/common/BioAuthConfig.ets
arkts
authenticateFingerprint
执行指纹认证
static authenticateFingerprint(): Promise<boolean> { return new Promise<boolean>((resolve) => { try { const authParam: userAuth.AuthParam = { authType: [userAuth.UserAuthType.FINGERPRINT], authTrustLevel: userAuth.AuthTrustLevel.ATL3, challenge: new Uint8Array([1, 2, 3,...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left authenticateFingerprint 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 AS...
static authenticateFingerprint(): Promise<boolean> { return new Promise<boolean>((resolve) => { try { const authParam: userAuth.AuthParam = { authType: [userAuth.UserAuthType.FINGERPRINT], authTrustLevel: userAuth.AuthTrustLevel.ATL3, challenge: new Uint8Array([1, 2, 3,...
https://gitcode.com/openharmony/codelabs
0a2cd4289fae1a6aba7dd41b1cd424363ebe8f42
gitcode
HarmonyOS_Samples/sample_in_harmonyos
features/devpractices/src/main/ets/model/ImageModel.ets
arkts
imageReset
When switching images, reset the previous image.
imageReset(): void { setTimeout(() => { this.matrix = matrix4.identity().scale({ x: this.defaultScaleValue, }).copy(); this.lastScale = this.defaultScaleValue; this.offsetReset(); }, 200); AppStorage.setOrCreate(StorageKey.IS_IMAGE_DEFAULT_SIZE, true); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left imageReset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left...
imageReset(): void { setTimeout(() => { this.matrix = matrix4.identity().scale({ x: this.defaultScaleValue, }).copy(); this.lastScale = this.defaultScaleValue; this.offsetReset(); }, 200); AppStorage.setOrCreate(StorageKey.IS_IMAGE_DEFAULT_SIZE, true); }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
09017f4957500160d1e345367bc5905e8bf44864
gitcode
erosTeam/NextE
feature/user/src/main/ets/pages/FavoritesPage.ets
arkts
favcatPageBuilder
Global @Builder (no `this`) for RetainedSubtabHost's @BuilderParam. Renders one retained favcat page, handed the shared active-key signal.
@Builder function favcatPageBuilder( key: string, active: ActiveKeyState, scroller: Scroller, onDidScroll: (offset: number, state: ScrollState) => void, ) { FavcatPage({ favcatKey: key, active: active, scroller: scroller, onDidScroll: onDidScroll }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left favcatPageBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST...
@Builder function favcatPageBuilder( key: string, active: ActiveKeyState, scroller: Scroller, onDidScroll: (offset: number, state: ScrollState) => void, ) { FavcatPage({ favcatKey: key, active: active, scroller: scroller, onDidScroll: onDidScroll }) }
https://github.com/erosTeam/NextE
baef045d55055c6929a7018edf0c9c7ef3fedc0c
github
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets
arkts
nativeOnWindowStageInActive
Notifies engine windowstage inacttived.
public static nativeOnWindowStageInActive(): void { tuanjie.nativeOnWindowStageInActive(); }
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 nativeOnWindowStageInActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi...
public static nativeOnWindowStageInActive(): void { tuanjie.nativeOnWindowStageInActive(); }
https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
2e36e3a054b0d9eb31f36d1a524c662df26d61e3
github
openharmony/codelabs
Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets
arkts
healthyLifeTextStyle
Healthy living text common styles.
@Extend(Text) function healthyLifeTextStyle(fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) { .fontWeight(fontWeight) .letterSpacing(textAttribute) .fontSize(fontSize) .fontColor(fontColor) }
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 healthyLifeTextStyle(fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) { .fontWeight(fontWeight) .letterSpacing(textAttribute) .fontSize(fontSize) .fontColor(fontColor) }
https://gitee.com/openharmony/codelabs.git
7cdab26fe4b603e2eac9ca201b46deebcb0cc554
gitee
smarthane/DrawerLayout
entry/src/main/ets/pages/DrawerLayoutPage.ets
arkts
onBackPress
用于判断手机的物理返回按钮
onBackPress() { if (this.model.isDrawerOpen) { this.model.closeDrawer(); return true; } return false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackPress 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...
onBackPress() { if (this.model.isDrawerOpen) { this.model.closeDrawer(); return true; } return false; }
https://github.com/smarthane/DrawerLayout
7b3a63b1510c2e357243383b93d68f56507d55ec
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/OptionGroup.ets
arkts
toString
Returns the stringified version of this OptionGroup. @return the stringified representation of this group
public toString(): string{ let buff: string = ""; let iter = this.getOptions(); buff += "["; for (let index = 0;index < iter.length(); index++) { let option: CliOption = iter.get(index); if (option.getOpt() != null) { buff += "-"; buff += option.getOpt(); } else { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#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#:#Left : AST#:#Right AST#string#Left string AST#string...
public toString(): string{ let buff: string = ""; let iter = this.getOptions(); buff += "["; for (let index = 0;index < iter.length(); index++) { let option: CliOption = iter.get(index); if (option.getOpt() != null) { buff += "-"; buff += option.getOpt(); } else { ...
https://gitee.com/openharmony-sig/commons-cli.git
5a2e865629f42a5d1a297d184fa010b8dcb8001a
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isInt32Array
Check whether the entered value is the int32array array type. @param { Object } value - A Int32Array value @returns { boolean } Returns true if the value is a built-in Int32Array instance.
isInt32Array(value: Object): boolean { return value instanceof Int32Array; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isInt32Array 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#identifier#Left Object AST#identifier#Right AST#)#Left ) A...
isInt32Array(value: Object): boolean { return value instanceof Int32Array; }
https://gitcode.com/iop123123/arkts-static-skills
7592aa38c2b694b0ec7d7ff6cbceb7a40aa50d04
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/DeviceManager.ets
arkts
getAllDeviceStatuses
获取所有设备状态 @returns Map<string, DeviceStatus> 设备状态映射
public getAllDeviceStatuses(): Map<string, DeviceStatus> { return new Map(this.deviceStatuses); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllDeviceStatuses 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#e...
public getAllDeviceStatuses(): Map<string, DeviceStatus> { return new Map(this.deviceStatuses); }
https://github.com/LJ666-ui/harmony-health-care
e6a82990bcddfd93940bd559adf0e0923b35f978
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
goToDebugSource
进入书源调试页面
goToDebugSource(source: NovelSourceInfo): void { // 通过AppStorage传递参数 AppStorage.setOrCreate('NovelSourceDebugPageParams', { sourceId: source.id }); this.pathStack.pushPathByName('NovelSourceDebugPage', null); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left goToDebugSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NovelSourceInfo AST#identifier#Right A...
goToDebugSource(source: NovelSourceInfo): void { // 通过AppStorage传递参数 AppStorage.setOrCreate('NovelSourceDebugPageParams', { sourceId: source.id }); this.pathStack.pushPathByName('NovelSourceDebugPage', null); }
https://github.com/DaLongZhuaZi/manxia
9c918dc6a6e51a68bda3bb9eb0fe44005ce05362
github
OHPG/FinSdk
emby/src/main/ets/api/UserApi.ets
arkts
forgotPasswordPin
forgotPasswordPin @summary Redeems a forgot password pin. @param forgotPasswordPinDto requestParameters Request parameters. @throws {RequiredError} @memberof UserApi
public async forgotPasswordPin(forgotPasswordPinDto: ForgotPasswordPinDto): Promise<PinRedeemResult> { return this.apiClient.post({ path: "/Users/ForgotPassword/Pin", data: forgotPasswordPinDto }) }
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 forgotPasswordPin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left forgotPasswordPinDto AST#identifier#Ri...
public async forgotPasswordPin(forgotPasswordPinDto: ForgotPasswordPinDto): Promise<PinRedeemResult> { return this.apiClient.post({ path: "/Users/ForgotPassword/Pin", data: forgotPasswordPinDto }) }
https://github.com/OHPG/FinSdk
cac1b5e81b9adfa15e7422597fbcde5d8e110364
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {int} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: int): Type { return IntType.VAL }
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#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: int): Type { return IntType.VAL }
https://gitcode.com/iop123123/arkts-static-skills
b211217590371265e3a228fe4821c2bcd9fd25c5
gitcode
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/LoginView.ets
arkts
showToast
统一显示 Toast
showToast(msg: string, isSuccess: boolean) { this.toastMsg = msg; if (isSuccess) { this.showSuccessToast = true; setTimeout(() => { this.showSuccessToast = false; }, 2000); } else { this.showFailureToast = true; setTimeout(() => { this.showFailureToast = false; }, 2000); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast 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#...
showToast(msg: string, isSuccess: boolean) { this.toastMsg = msg; if (isSuccess) { this.showSuccessToast = true; setTimeout(() => { this.showSuccessToast = false; }, 2000); } else { this.showFailureToast = true; setTimeout(() => { this.showFailureToast = false; }, 2000); } }
https://github.com/luojiang001/Pulse
d6e85ab3be5c87174e502015811c15317ebd70dd
github
openharmony-sig/ohos_checksum
library/src/main/ets/md5.ets
arkts
bit_rol
Bitwise rotate a 32-bit number to the left.
bit_rol(num: number, cnt: number) :number { return (num << cnt) | (num >>> (32 - cnt)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left bit_rol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Ri...
bit_rol(num: number, cnt: number) :number { return (num << cnt) | (num >>> (32 - cnt)); }
https://gitee.com/openharmony-sig/ohos_checksum.git
2f13be967ded7ebe4741532d5f2d8ea67c6592d8
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/IndexManager.ets
arkts
createBillsIndexes
创建 Bills 表的核心索引 Bills 表是系统中访问最频繁的表,需要针对以下场景优化: 1. 日期范围查询(账单列表按日期倒序) 2. 统计查询(按账户、类型聚合金额) 3. 账户流水查询(某账户的账单记录)
private static async createBillsIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // ========== 索引 1: 日期索引 ========== // 用途:优化账单列表的日期范围查询和排序 // 场景:SELECT * FROM bills WHERE is_deleted = 0 ORDER BY transaction_date DESC // 优化原理: // - transaction_...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left createBillsIndexes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#ar...
private static async createBillsIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // ========== 索引 1: 日期索引 ========== // 用途:优化账单列表的日期范围查询和排序 // 场景:SELECT * FROM bills WHERE is_deleted = 0 ORDER BY transaction_date DESC // 优化原理: // - transaction_...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9dbcd076fee95d85a3b071a6dd1cb7105631968f
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPDriveManager.ets
arkts
getSharedDirectoryStatus
获取共享目录状态
public getSharedDirectoryStatus(vmName: string): 'active' | 'inactive' | 'error' { const sharedDir = this.sharedDirectories.get(`shared-${vmName}`); if (!sharedDir) { return 'error'; } try { const stat = fs.statSync(sharedDir.hostPath); return stat.isDirectory() ? 'active' : 'er...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSharedDirectoryStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public getSharedDirectoryStatus(vmName: string): 'active' | 'inactive' | 'error' { const sharedDir = this.sharedDirectories.get(`shared-${vmName}`); if (!sharedDir) { return 'error'; } try { const stat = fs.statSync(sharedDir.hostPath); return stat.isDirectory() ? 'active' : 'er...
https://github.com/AetheriumSimulator/qemu-hmos
7c56d07898a3fe1142510aea139a68bf1827679b
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test9_original_index.ets
arkts
testObjectMerge
--- Object merge (manual copy) ---
function testObjectMerge(): string { let a: Record<string, number> = {}; a['x'] = 1; let b: Record<string, number> = {}; b['y'] = 2; let merged: Record<string, number> = {}; merged['x'] = a['x']; merged['y'] = b['y']; return String(merged['x']) + ',' + String(merged['y']); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectMerge 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_...
function testObjectMerge(): string { let a: Record<string, number> = {}; a['x'] = 1; let b: Record<string, number> = {}; b['y'] = 2; let merged: Record<string, number> = {}; merged['x'] = a['x']; merged['y'] = b['y']; return String(merged['x']) + ',' + String(merged['y']); }
https://github.com/miaochiahao/ark-ghidra
efb1037b901c692cae1ee4d5d8f428867d9298d4
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets
arkts
setMuteState
设置全局开关状态 @param context ServiceExtensionContext | UIAbilityContext @param type 全局开关类型 @param flag 全局开关状态 @param isKill 是否销毁ability return
public setMuteState( context: common.ServiceExtensionContext | common.UIAbilityContext, type: string, flag: boolean, isKill: boolean ): void { if (type === MICROPHONE || type === PermissionGroup.MICROPHONE) { this.setMicrophoneMute(context, flag, isKill); } else if (type === CAMERA || type === Per...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMuteState 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#ERROR#Right AST#binary_expressio...
public setMuteState( context: common.ServiceExtensionContext | common.UIAbilityContext, type: string, flag: boolean, isKill: boolean ): void { if (type === MICROPHONE || type === PermissionGroup.MICROPHONE) { this.setMicrophoneMute(context, flag, isKill); } else if (type === CAMERA || type === Per...
https://gitee.com/openharmony/applications_permission_manager.git
3164cb28c06f73bd7583ea6173f17cd7cd3ffe8e
gitee
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets
arkts
MemTest001
===== 内存回收验证测试 ===== MEM_001: 批量创建 DrawableDescriptor → release → PSS 下降 创建 500 个 DrawableDescriptor,触发 getPixelMap 解码图片, 对比 release 前后 PSS 内存差异
MemTest001() { const id = 'MEM_001' const COUNT = 500 try { // 1. 记录基线 PSS let pssBefore = Number(hidebug.getPss()) this.AppendLog(`[${id}] 基线 PSS: ${pssBefore} KB`) // 2. 批量创建并触发解码 let drawables: DrawableDescriptor[] = [] for (let i = 0; i < COUNT; i++) { let ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left MemTest001 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 AS...
MemTest001() { const id = 'MEM_001' const COUNT = 500 try { // 1. 记录基线 PSS let pssBefore = Number(hidebug.getPss()) this.AppendLog(`[${id}] 基线 PSS: ${pssBefore} KB`) // 2. 批量创建并触发解码 let drawables: DrawableDescriptor[] = [] for (let i = 0; i < COUNT; i++) { let ...
https://gitcode.com/openharmony/arkui_ace_engine
1862b47ed4f1471d6d2ff97a01f0a8d1bc08205f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WindowManager.ets
arkts
setImmersiveWithBars
设置沉浸式但保持系统栏可见(透明背景) @param uiContext 可选的UIContext,推荐在组件中传入
static setImmersiveWithBars(uiContext?: UIContext): void { try { const mainWindow = uiContext ? WindowManager.getMainWindowFromUIContext(uiContext) : WindowManager.getMainWindow(); if (!mainWindow) { logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置沉浸式模式失败'); retur...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setImmersiveWithBars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right A...
static setImmersiveWithBars(uiContext?: UIContext): void { try { const mainWindow = uiContext ? WindowManager.getMainWindowFromUIContext(uiContext) : WindowManager.getMainWindow(); if (!mainWindow) { logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置沉浸式模式失败'); retur...
https://github.com/DaLongZhuaZi/manxia
60686e51604fd1402d1b307b251713da7119a6c6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
sort
Sorts in-place @param { function } [compareFn] - comparator _ used to determine the order of the elements. compareFn returns a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. @returns { this } - sorted BigUint64Array @syscap SystemCapability.Utils.La...
public sort(compareFn?: (a: BigInt, b: BigInt) => int | BigInt): this { if (compareFn == undefined) { this.sort() return this } let cmp = (l: long, r: long): int => { const result = compareFn!(BigInt.fromULong(l), BigInt.fromULong(r)) if (resu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#...
public sort(compareFn?: (a: BigInt, b: BigInt) => int | BigInt): this { if (compareFn == undefined) { this.sort() return this } let cmp = (l: long, r: long): int => { const result = compareFn!(BigInt.fromULong(l), BigInt.fromULong(r)) if (resu...
https://gitcode.com/iop123123/arkts-static-skills
e5088889a53332342bf7bbbb00f72a8bde4640c9
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/HighLightInfoOfComponent.ets
arkts
getRectF
获取高亮图形的区域坐标,组件要求必传id,rectF区域需要为相对于父组件的相对坐标,坐标值需要转换为vp,不能直接为px @param parentId 高亮区域为组件时,必传,父组件id:__HighLightGuideComponentContainer__ + 组件创建时的时间戳,id需要整个应用内唯一 @param componentId 高亮区域为组件时,必传,组件id需要整个应用内唯一 @returns 返回高亮区域的坐标,单位为vp
getRectF(parentId?: string, componentId?: string): RectF | null { if (!parentId || !componentId) { return null; } if (this.rectF == null || this.rectF == undefined) { this.rectF = this.fetchLocation(parentId, componentId); } else if (this.options && this.options.fetchLocationEveryTime) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRectF AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#L...
getRectF(parentId?: string, componentId?: string): RectF | null { if (!parentId || !componentId) { return null; } if (this.rectF == null || this.rectF == undefined) { this.rectF = this.fetchLocation(parentId, componentId); } else if (this.options && this.options.fetchLocationEveryTime) { ...
https://github.com/wuba/omni-ui
1ff34c08137067ef16674b3b7ad085037235be53
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
toggleHighContrastMode
切换高对比度模式
public toggleHighContrastMode(): void { this.config.isHighContrastMode = !this.config.isHighContrastMode; AppStorage.setOrCreate<boolean>('isHighContrastMode', this.config.isHighContrastMode); console.log('[Accessibility] 高对比度模式:', this.config.isHighContrastMode ? '已启用' : '已关闭'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toggleHighContrastMode 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...
public toggleHighContrastMode(): void { this.config.isHighContrastMode = !this.config.isHighContrastMode; AppStorage.setOrCreate<boolean>('isHighContrastMode', this.config.isHighContrastMode); console.log('[Accessibility] 高对比度模式:', this.config.isHighContrastMode ? '已启用' : '已关闭'); }
https://github.com/LJ666-ui/harmony-health-care
da1615254a0427638a99d0d760cf21e3f74f1c4c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets
arkts
setForceEnabled
设置强制模式开关
async setForceEnabled(enabled: boolean): Promise<void> { if (!this.settingsManager) { throw new Error('强制执行器未初始化'); } await this.settingsManager.setBoolean(EnforcementSettingKeys.FORCE_UNIFIED_DETAIL_PAGE, enabled); logger.info(TAG, `强制模式已${enabled ? '启用' : '禁用'}`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setForceEnabled AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left enabled AST#identifier#Right ...
async setForceEnabled(enabled: boolean): Promise<void> { if (!this.settingsManager) { throw new Error('强制执行器未初始化'); } await this.settingsManager.setBoolean(EnforcementSettingKeys.FORCE_UNIFIED_DETAIL_PAGE, enabled); logger.info(TAG, `强制模式已${enabled ? '启用' : '禁用'}`); }
https://github.com/DaLongZhuaZi/manxia
23268cd647dcd56d447da211d5a9f659b89b4137
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
result
Get the matching result array itself. @returns { Array<String | undefined> } Match result array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get result(): Array<String | undefined> { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left result AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
public get result(): Array<String | undefined> { return this }
https://gitcode.com/iop123123/arkts-static-skills
503e51d7c920880f1c0a48c3504b75b7cc3f7de9
gitcode
codelably/HCompass
core/spatialization/src/main/ets/util/WindowUtil.ets
arkts
initialize
初始化窗口信息管理,需在 onWindowStageCreate 加载页面后调用 @param windowStage UIAbility 的 windowStage 实例
public static initialize(windowStage: window.WindowStage): void { try { WindowUtil.windowClass = windowStage.getMainWindowSync(); const uiContext: UIContext = WindowUtil.windowClass.getUIContext(); WindowUtil.uiContext = uiContext; AppStorageV2.connect(UIContext, StorageKey.UI_CONTEXT, () ...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right...
public static initialize(windowStage: window.WindowStage): void { try { WindowUtil.windowClass = windowStage.getMainWindowSync(); const uiContext: UIContext = WindowUtil.windowClass.getUIContext(); WindowUtil.uiContext = uiContext; AppStorageV2.connect(UIContext, StorageKey.UI_CONTEXT, () ...
https://github.com/codelably/HCompass
46b6aec77c22cfeecf273bc27cabb97e3cae5b24
github
terryma2024/happyword
harmonyos/entry/src/test/LocalUnit.test.ets
arkts
makeRecorderWithSnapshot
Build a LearningRecorder seeded with a pre-existing snapshot and a no-op preferences stub. Factored to the top level because ArkTS strict mode rejects nested functions inside a `describe` block.
function makeRecorderWithSnapshot(stats: WordStat[]): LearningRecorder { const snap: LearningSnapshot = new LearningSnapshot(); for (let i = 0; i < stats.length; i++) { snap.stats.push(stats[i]); } const store: WrongAnswerStore = new WrongAnswerStore(); store.injectPreferences(new FakePreferences()); co...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeRecorderWithSnapshot AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stats AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
function makeRecorderWithSnapshot(stats: WordStat[]): LearningRecorder { const snap: LearningSnapshot = new LearningSnapshot(); for (let i = 0; i < stats.length; i++) { snap.stats.push(stats[i]); } const store: WrongAnswerStore = new WrongAnswerStore(); store.injectPreferences(new FakePreferences()); co...
https://github.com/terryma2024/happyword
3b3ecacbc0e0fa68db7986ff0006c5dc2b23665d
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readUInt8
Reads an unsigned 8-bit integer from the buffer at the specified offset @param {int} [offset=0] - Number of bytes to skip before reading @returns {long} The read value
public readUInt8(offset: int = 0): long { let lengthOffset: int = this.length - 1; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${length...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio...
public readUInt8(offset: int = 0): long { let lengthOffset: int = this.length - 1; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${length...
https://gitcode.com/iop123123/arkts-static-skills
0cf693b57442015615886220ea63c20fe7b0e65f
gitcode
openharmony/applications_app_samples
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
stopNetObserve
停止网络监听
public stopNetObserve(netType: connection.NetBearType) { this.connectionMap.get(netType).unregister(() => { logger.info('Success unregister:' + netType.toString()); }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopNetObserve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left netType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_express...
public stopNetObserve(netType: connection.NetBearType) { this.connectionMap.get(netType).unregister(() => { logger.info('Success unregister:' + netType.toString()); }) }
https://github.com/openharmony/applications_app_samples
4673217adb7ded0736704bce656cb1b4b1aa4165
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppShell.ets
arkts
buildBaseContent
渲染基础流程页面(启动/认证/主流程)。
private buildBaseContent() { if (this.app.flow === AppFlow.SPLASH) { SplashPage(); } else if (this.app.flow === AppFlow.AUTH) { LoginPage(); } else { MainShell(); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildBaseContent 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#{#...
private buildBaseContent() { if (this.app.flow === AppFlow.SPLASH) { SplashPage(); } else if (this.app.flow === AppFlow.AUTH) { LoginPage(); } else { MainShell(); } }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppShell.ets#L92-L100
fe318b7a3876facc793b110db6099e4f3f01adeb
github
openharmony/applications_app_samples
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
arkts
getRandomFileName
根据时间生成随机文件名 @param filePrefix 文件名前缀 @param fileSuffix 文件名后缀
getRandomFileName(filePrefix: string, fileSuffix: string) { let dateTimeUtil = new DateTimeUtil() return filePrefix + `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}` + fileSuffix }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRandomFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePrefix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
getRandomFileName(filePrefix: string, fileSuffix: string) { let dateTimeUtil = new DateTimeUtil() return filePrefix + `${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}` + fileSuffix }
https://github.com/openharmony/applications_app_samples
bd55b6737c0a36706def9782de86c786664c0563
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
toSafeBoolean
安全的布尔值转换 @param value - 要转换的值 @param defaultValue - 默认值 @returns 布尔值
static toSafeBoolean(value: Object, defaultValue: boolean = false): boolean { if (TypeGuards.isBoolean(value)) { return value as boolean; } return defaultValue; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSafeBoolean 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#identifier#Left O...
static toSafeBoolean(value: Object, defaultValue: boolean = false): boolean { if (TypeGuards.isBoolean(value)) { return value as boolean; } return defaultValue; }
https://github.com/DaLongZhuaZi/manxia
3f12e65dcbc98917ede1e05de311939a1e6411a8
github
openharmony/codelabs
ETSUI/MediaReview/entry/src/main/ets/pages/Index.ets
arkts
onPageShow
页面回到前台时通知子组件刷新
onPageShow() { this.userUpdateTrigger++ }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow 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 AS...
onPageShow() { this.userUpdateTrigger++ }
https://gitcode.com/openharmony/codelabs
4134e7086e73d15e18e085aca4e56de24443450c
gitcode
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets
arkts
isSet
是否是set对象 @param obj 对象
static isSet<T>(obj: T): boolean { return obj !== null && typeof obj !== 'undefined' && obj instanceof Set; }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left isSet AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_par...
static isSet<T>(obj: T): boolean { return obj !== null && typeof obj !== 'undefined' && obj instanceof Set; }
https://gitee.com/openharmony/testfwk_arkxtest.git
484af72e4a913877287e6701727c07edf13cc459
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/EntityMetadata.ets
arkts
setSoftDelete
设置软删除配置 @param enabled 是否启用软删除 @param columnName 软删除时间戳列名(可选)
setSoftDelete(enabled: boolean, columnName?: string): void { this.softDelete = enabled if (columnName !== undefined) { this.deletedAtColumn = columnName } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSoftDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#,#Left...
setSoftDelete(enabled: boolean, columnName?: string): void { this.softDelete = enabled if (columnName !== undefined) { this.deletedAtColumn = columnName } }
https://github.com/offlinecat-dev/OCNetORM
fd7c0eb438b9df7a500ab582d94d347eadfeeec3
github
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
deleteRdbStore
删除rdbStore
deleteRdbStore(): void { if (store === undefined) { return; } relationalStore.deleteRdbStore(CONTEXT, Constants.DB_FILE_NAME, (err) => { if (err) { logger.error('delete rdbStore failed'); } store = undefined; }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteRdbStore 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...
deleteRdbStore(): void { if (store === undefined) { return; } relationalStore.deleteRdbStore(CONTEXT, Constants.DB_FILE_NAME, (err) => { if (err) { logger.error('delete rdbStore failed'); } store = undefined; }); }
https://gitcode.com/arkui-x/samples
4f3b55bcf99b7137efffe46c055234ebd62c1885
gitcode
openharmony/applications_print_spooler
entry/src/main/ets/pages/component/PreviewComponent.ets
arkts
onMediaSizeChange
纸张尺寸修改事件
onMediaSizeChange() { let pixelSize = this.mediaSize.getPixelMediaSize() this.canvasWidth = pixelSize.width / this.rate this.canvasHeight = pixelSize.height / this.rate; this.canvasRatio = pixelSize.width / pixelSize.height this.checkCanvasWidth() this.parseImageSize(true) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onMediaSizeChange 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#...
onMediaSizeChange() { let pixelSize = this.mediaSize.getPixelMediaSize() this.canvasWidth = pixelSize.width / this.rate this.canvasHeight = pixelSize.height / this.rate; this.canvasRatio = pixelSize.width / pixelSize.height this.checkCanvasWidth() this.parseImageSize(true) }
https://gitee.com/openharmony/applications_print_spooler.git
1c14a2142b5d8fc02fa91c1575b628b793431fb0
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/Rect.ets
arkts
copyOrNull
Returns a copy of {@code r} if {@code r} is not {@code null}, or {@code null} otherwise. @hide
public static copyOrNull(r: MyRect): MyRect | null { return r == null ? null : new MyRect(r.left, r.top, r.right, r.bottom); }
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 copyOrNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left r AST#identifier#Right AST#:#Left : AST#:#Ri...
public static copyOrNull(r: MyRect): MyRect | null { return r == null ? null : new MyRect(r.left, r.top, r.right, r.bottom); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
b299126998f2a9a44983d31a3e9ce61c6885c552
gitee
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
playPrevious
Goes to the previous track for order / single-cycle, or random pick in random mode.
public playPrevious() { const len = this.getQueueLength(); if (len === 0) { return; } switch (this.playMode) { case MusicPlayMode.RANDOM: this.playRandom(); break; case MusicPlayMode.ORDER: case MusicPlayMode.SINGLE_CYCLE: if (this.musicIndex === 0) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playPrevious 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 { ...
public playPrevious() { const len = this.getQueueLength(); if (len === 0) { return; } switch (this.playMode) { case MusicPlayMode.RANDOM: this.playRandom(); break; case MusicPlayMode.ORDER: case MusicPlayMode.SINGLE_CYCLE: if (this.musicIndex === 0) { ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
8bcb9df27318143a7f9917c6516caf1f81e6545f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
find
Finds the first element in the Float64Array that satisfies the condition @param fn condition @returns the first element that satisfies fn
public find(fn: (val: double, index: int) => boolean): double { let newF: (val: double, index: int, array: Float64Array) => boolean = (val: double, index: int, array: Float64Array): boolean => { return fn(val, index) } return this.find(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public find(fn: (val: double, index: int) => boolean): double { let newF: (val: double, index: int, array: Float64Array) => boolean = (val: double, index: int, array: Float64Array): boolean => { return fn(val, index) } return this.find(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7e5bd91effd47e2b90ebf5f990826a3c4ee89062
gitee
zcg741/chengyu-game
entry/src/main/ets/viewmodel/TimerViewModel.ets
arkts
start
开始计时 @param duration 时长(秒),默认60秒
start(duration?: number): void { this.stop(); this.remaining = duration || GAME_CONFIG.TIMER_MODE_DURATION; this.isRunning = true; // 立即触发一次回调 if (this.onTickCallback) { this.onTickCallback(this.remaining); } // 使用setInterval代替@ohos.base.timer this.timerId = setInt...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
start(duration?: number): void { this.stop(); this.remaining = duration || GAME_CONFIG.TIMER_MODE_DURATION; this.isRunning = true; // 立即触发一次回调 if (this.onTickCallback) { this.onTickCallback(this.remaining); } // 使用setInterval代替@ohos.base.timer this.timerId = setInt...
https://github.com/zcg741/chengyu-game
e0c8abf7c5c73a7be6fe7a07ec3e436d4531e708
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
getParamByKey
通过key获取当前页面的参数,建议带上默认值和泛型 @param key @returns
public getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { const p = this.getParam() try { if (ObjectUtil.hasProperty(p, key)) { const o = p as Record<string, ObjectOrNull> const target = o[key] return target as P } return this.defaultValue<...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left getParamByKey AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left P AST#identifier#Right AST#=#Left = AST#=#Ri...
public getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { const p = this.getParam() try { if (ObjectUtil.hasProperty(p, key)) { const o = p as Record<string, ObjectOrNull> const target = o[key] return target as P } return this.defaultValue<...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L431-L443
0aaa750e183c52e3b988e46f2bc79c7a152d7009
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
reportInput
报告输入状态给监听器
protected reportInput(): void { if (this.listener) { this.listener.reportControllerState( this.deviceId, this.buttonFlags, this.leftStickX, this.leftStickY, this.rightStickX, this.rightStickY, this.leftTrigger, this.rightTrigger ); } ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left reportInput 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#e...
protected reportInput(): void { if (this.listener) { this.listener.reportControllerState( this.deviceId, this.buttonFlags, this.leftStickX, this.leftStickY, this.rightStickX, this.rightStickY, this.leftTrigger, this.rightTrigger ); } ...
https://github.com/AlkaidLab/moonlight-harmony
89cc8dad9a76f8a2236582be48c9a35fe03e64ee
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/HomeVM.ets
arkts
resolveLanguages
读取 CONTENT_LANG 偏好并转成 API 的 languages 数组。 - '' / 'all' → undefined(不过滤;走原 endpoint) - 'chinese'/'english'/... → 单值数组(走 search-based endpoint)
private static async resolveLanguages(): Promise<string[] | undefined> { const key: string = await PreferencesStore.getString('settings', AppStorageKeys.CONTENT_LANG, ''); if (key.length === 0 || key === 'all') { return undefined; } for (let i = 0; i < LANGUAGE_FILTERS.length; i++) { const...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left resolveLanguages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu...
private static async resolveLanguages(): Promise<string[] | undefined> { const key: string = await PreferencesStore.getString('settings', AppStorageKeys.CONTENT_LANG, ''); if (key.length === 0 || key === 'all') { return undefined; } for (let i = 0; i < LANGUAGE_FILTERS.length; i++) { const...
https://github.com/LZZLHY/hlib
197cf7e2a467d38547128263aa349aa0005931af
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneStream.ets
arkts
stop
停止麦克风流
async stop(): Promise<void> { if (!this.running) { return; } console.info(TAG, '停止麦克风流'); this.running = false; this.paused = false; // 停止统计定时器 this.stopStatsTimer(); // 停止 native 采集器(会释放 OHAudio capturer + Opus 编码器) this.moonBridge.nativeMicStop(); this.notifyStateC...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stop 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...
async stop(): Promise<void> { if (!this.running) { return; } console.info(TAG, '停止麦克风流'); this.running = false; this.paused = false; // 停止统计定时器 this.stopStatsTimer(); // 停止 native 采集器(会释放 OHAudio capturer + Opus 编码器) this.moonBridge.nativeMicStop(); this.notifyStateC...
https://github.com/AlkaidLab/moonlight-harmony
4d0f2cf408be025a4ee1b7a5b9874516ad628e09
github
zhen666555-sketch/HarmonyOS-community
entry/src/main/ets/pages/jzyy.ets
arkts
onPageShow
服务满意度
onPageShow(){ this.getData() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow 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 AS...
onPageShow(){ this.getData() }
https://github.com/zhen666555-sketch/HarmonyOS-community
7c14430acb961f0d9662160b47b276c82a65d9cc
github
openharmony-tpc/MMKV
entry/src/main/ets/pages/index.ets
arkts
resortDir
test restore
resortDir() { LogUtil.i('resortDir 0 ') let dstDir = filePath + '/mmkv_backup_3' let mMapID = 'testCrud' let otherDir = filePath + '/mmkv_3' let ret = MMKV.restoreOneMMKVFromDirectory(mMapID, dstDir, otherDir); LogUtil.i('resortDir one [' + mMapID + '] ret = ' + ret) if (ret) { let ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resortDir 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 AST...
resortDir() { LogUtil.i('resortDir 0 ') let dstDir = filePath + '/mmkv_backup_3' let mMapID = 'testCrud' let otherDir = filePath + '/mmkv_3' let ret = MMKV.restoreOneMMKVFromDirectory(mMapID, dstDir, otherDir); LogUtil.i('resortDir one [' + mMapID + '] ret = ' + ret) if (ret) { let ...
https://gitee.com/openharmony-tpc/MMKV.git
281d450cda2a630d8d534902d71dc4370800448f
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartWardInitializer.ets
arkts
getInstance
获取初始化器单例实例
public static getInstance(): SmartWardInitializer { if (!SmartWardInitializer.instance) { SmartWardInitializer.instance = new SmartWardInitializer(); } return SmartWardInitializer.instance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): SmartWardInitializer { if (!SmartWardInitializer.instance) { SmartWardInitializer.instance = new SmartWardInitializer(); } return SmartWardInitializer.instance; }
https://github.com/LJ666-ui/harmony-health-care
eb997eadaf4baa7ab9b0782c99a2dcef3dd98306
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
recognizeReceipt
OCR识别 识别票据图片 @param params 识别参数 @returns 识别结果
static async recognizeReceipt(params: OCRRecognitionParams): Promise<OCRRecognitionResult> { try { // 1. 创建识别记录 const record = new OCRRecognitionRecord(); record.userId = params.userId; record.imagePath = params.imagePath; record.thumbnailPath = params.thumbnailPath || ''; reco...
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 recognizeReceipt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left ...
static async recognizeReceipt(params: OCRRecognitionParams): Promise<OCRRecognitionResult> { try { // 1. 创建识别记录 const record = new OCRRecognitionRecord(); record.userId = params.userId; record.imagePath = params.imagePath; record.thumbnailPath = params.thumbnailPath || ''; reco...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3f09e943377605e80cd6def3b2a349663123f160
github