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
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Assigns val as element on insertPos. @description Added to avoid (un)packing a single value into array to use overloaded set(BigInt[], insertPos) @param val value to set @param insertPos index to change public
/* public */ internal set(insertPos: int, val: BigInt): void { throw new Error("not implemented") }
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#...
/* public */ internal set(insertPos: int, val: BigInt): void { throw new Error("not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7b856889cd3ef4d501b4219fee7668e0df660eec
gitee
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
fromRadius
Creates a Size from a radius
static fromRadius(radius: number): Size { return new Size(radius * 2, radius * 2); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left radius AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
static fromRadius(radius: number): Size { return new Size(radius * 2, radius * 2); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L193-L195
33468556f037b00875f7ab788207a124eaff1575
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
moveViewToAnimated
This will move the left side of the current viewport to the specified x-value and center the viewport to the y value animated. This also refreshes the chart by calling invalidate(). @param xValue @param yValue @param axis - which axis should be used as a reference for the y axis @param duration the duration of the anim...
public moveViewToAnimated(xValue: number, yValue: number, axis: AxisDependency, duration: number): void { let bounds: MPPointD = this.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop(), axis); let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.getS...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left moveViewToAnimated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public moveViewToAnimated(xValue: number, yValue: number, axis: AxisDependency, duration: number): void { let bounds: MPPointD = this.getValuesByTouchPoint(this.mViewPortHandler.contentLeft(), this.mViewPortHandler.contentTop(), axis); let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.getS...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5bec4e87bfa2500eaadabd4d08ab70a76ef4cd31
gitee
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
persist
持久化当前用户状态 @returns {void} 无返回值
private persist(): void { PersistenceV2.save(USER_STATE_KEY); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left persist 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_...
private persist(): void { PersistenceV2.save(USER_STATE_KEY); }
https://github.com/Joker-x-dev/CoolMallArkTS
d35e46cbdc6d75df20cc63a8aa5eaca3f8073b04
github
Bistu-OSSDT-2024/16-ArkNotes
Index.ets
arkts
refreshByOrder
排序状态变化事件监听函数
refreshByOrder() { let orderList: MemoModel[] = this.memoList const length = orderList.length for (let i = 0; i < length - 1; i++) { for (let j = 0; j < length - i - 1; j++) { const timeA = orderList[j].updateTime const timeB = orderList[j+1].updateTime if ((timeA > timeB &&...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshByOrder 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#Lef...
refreshByOrder() { let orderList: MemoModel[] = this.memoList const length = orderList.length for (let i = 0; i < length - 1; i++) { for (let j = 0; j < length - i - 1; j++) { const timeA = orderList[j].updateTime const timeB = orderList[j+1].updateTime if ((timeA > timeB &&...
https://github.com/Bistu-OSSDT-2024/16-ArkNotes
be0a8bf456ed863f6c2c2157e1c94f0c62a9175b
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
constructor
The EventEmitter constructor.
constructor() { this.handlers = new Map<string, Array<Function>>(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.handlers = new Map<string, Array<Function>>(); }
https://gitcode.com/iop123123/arkts-static-skills
74d718fe9ca43d48eacdb45edc7c97441dd6ba14
gitcode
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/ChatHandler.ets
arkts
queryChatList
显式声明返回类型 Promise<Message[]> async queryChatList(myPhone: string): Promise<Message[]> { const list: Message[] = []; // 核心逻辑:先过滤 owner,然后通过子查询找到每个 targetPhone 对应的最大 ID(即最新消息) const SQL = `SELECT * FROM ChatHistory WHERE owner = '${myPhone}' AND id IN ( SELECT MAX(id) FROM ChatHistory WHERE owner = '${myPhone}' GROUP BY t...
async queryChatList(myPhone: string): Promise<Message[]> { const list: Message[] = []; // 核心:查询 owner 是我的记录中,每个 targetPhone 对应的最新一条(无论是我发的还是对方发的) const SQL = `SELECT * FROM ChatHistory WHERE owner = '${myPhone}' AND id IN ( SELECT MAX(id) FROM ChatHistory ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryChatList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left myPhone AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async queryChatList(myPhone: string): Promise<Message[]> { const list: Message[] = []; // 核心:查询 owner 是我的记录中,每个 targetPhone 对应的最新一条(无论是我发的还是对方发的) const SQL = `SELECT * FROM ChatHistory WHERE owner = '${myPhone}' AND id IN ( SELECT MAX(id) FROM ChatHistory ...
https://gitcode.com/openharmony/codelabs
0b43a470612dfed82197d3838c78dcb50682a7a2
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_ulong.ets
arkts
main
--- desc: check prefix decrement for unsigned long integer operand ---
function main(): void { let value: ulong = {{v.value}} let result: ulong = --value assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: ulong = {{v.value}} let result: ulong = --value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
074ecbc029b0467bc6165bf0d66904f41435082b
gitee
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/FolderUtil.ets
arkts
getFolderTextColor
Get folder Text color @param isSelected - is selected or not @return Resource | string - color value
getFolderTextColor(isSelected: boolean): Resource | string { LogUtil.info(TAG, "isSelected " + isSelected) return isSelected ? $r("app.color.folder_color_f86d05") : $r("app.color.folder_color_182431") }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFolderTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isSelected AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean ...
getFolderTextColor(isSelected: boolean): Resource | string { LogUtil.info(TAG, "isSelected " + isSelected) return isSelected ? $r("app.color.folder_color_f86d05") : $r("app.color.folder_color_182431") }
https://gitee.com/openharmony/applications_notes.git
5433d56f6895d19c307a8ef62f4f7667760f45fa
gitee
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseProperty.ets
arkts
updateViewSize
Updates the view size.
private updateViewSize(attrMap: Map<string, string>) { attrMap.forEach((value, key) => { switch (key) { case BaseProperty.ATTRIBUTE_WIDTH: this.setViewWidth(parseFloat(value)); break; case BaseProperty.ATTRIBUTE_HEIGHT: this.setViewHeight(parseFloat(value)); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateViewSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left attrMap AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig...
private updateViewSize(attrMap: Map<string, string>) { attrMap.forEach((value, key) => { switch (key) { case BaseProperty.ATTRIBUTE_WIDTH: this.setViewWidth(parseFloat(value)); break; case BaseProperty.ATTRIBUTE_HEIGHT: this.setViewHeight(parseFloat(value)); ...
https://github.com/AGenUI/AGenUI
1e2122b9cff5b8ad966788e6307c1961d92c0fb2
github
richshaw2015/nds
ohos/entry/src/main/ets/components/game/RewindSelector.ets
arkts
formatTimeDelta
格式化时间差为可读字符串 对齐 Android RewindWindow.getDeltaFromEmulationTimeToRewindState
function formatTimeDelta(deltaMs: number): string { const totalSeconds = Math.floor(deltaMs / 1000); if (totalSeconds < 60) { return I18n.tf1('seconds_ago_fmt', 'seconds', totalSeconds); } const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return I18n.tf2('minutes_seconds_...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatTimeDelta AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deltaMs AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function formatTimeDelta(deltaMs: number): string { const totalSeconds = Math.floor(deltaMs / 1000); if (totalSeconds < 60) { return I18n.tf1('seconds_ago_fmt', 'seconds', totalSeconds); } const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return I18n.tf2('minutes_seconds_...
https://github.com/richshaw2015/nds
0eb5ed7fd9a1a734930d3b0b65f23d694f223b44
github
OHPG/FinSdk
jellyfin/src/main/ets/api/VideosApi.ets
arkts
getVideoStreamUrlByContainer
getVideoStreamByContainer @summary Gets a video stream. @param {VideosApiGetVideoStreamByContainerRequest} requestParameters Request parameters. @throws {RequiredError} @memberof VideosApi
public async getVideoStreamUrlByContainer(requestParameters: VideosApiGetVideoStreamByContainerRequest): Promise<string> { this.assertParam(requestParameters.itemId) this.assertParam(requestParameters.container) return this.apiClient.createUrl({ method: "GET", path: `/Videos/${requestParameters.itemId}/st...
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 getVideoStreamUrlByContainer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#ident...
public async getVideoStreamUrlByContainer(requestParameters: VideosApiGetVideoStreamByContainerRequest): Promise<string> { this.assertParam(requestParameters.itemId) this.assertParam(requestParameters.container) return this.apiClient.createUrl({ method: "GET", path: `/Videos/${requestParameters.itemId}/st...
https://github.com/OHPG/FinSdk
1e7801968919bef09858fd7c172db70a5579b2e3
github
xblLab/HarmonyProjectTemplate
products/phone/src/main/ets/common/WindowUtils.ets
arkts
setWinConfig
窗口设置 @param windowStage
public static async setWinConfig(windowStage: window.WindowStage) { AppStorage.setOrCreate('windowStage', windowStage); let windowClass: window.Window = windowStage.getMainWindowSync(); await windowClass.setWindowLayoutFullScreen(true); WindowUtils.setAvoidArea(windowClass); WindowUtils.onAvoidAre...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left setWinConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifie...
public static async setWinConfig(windowStage: window.WindowStage) { AppStorage.setOrCreate('windowStage', windowStage); let windowClass: window.Window = windowStage.getMainWindowSync(); await windowClass.setWindowLayoutFullScreen(true); WindowUtils.setAvoidArea(windowClass); WindowUtils.onAvoidAre...
https://github.com/xblLab/HarmonyProjectTemplate
3ae07460b897646f66ef5a5dc402b72a432cccae
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/SplashPage.ets
arkts
pageTransition
页面过渡动画
pageTransition() { // SplashPage 退出时保持不变(让 MainMenuPage 淡入覆盖) PageTransitionExit({ duration: 350, curve: Curve.EaseOut }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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#Lef...
pageTransition() { // SplashPage 退出时保持不变(让 MainMenuPage 淡入覆盖) PageTransitionExit({ duration: 350, curve: Curve.EaseOut }) }
https://github.com/DaLongZhuaZi/manxia
aacb3c52eabc11247ce5514b4c4d01c5d822159f
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/pages/RollPage/RollDataManager.ets
arkts
constructor
子选项列表
constructor(index: string, rollName: string, rollItems: Array<RollItem>) { this.index = index this.rollName = rollName this.rollItems = rollItems }
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 index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
constructor(index: string, rollName: string, rollItems: Array<RollItem>) { this.index = index this.rollName = rollName this.rollItems = rollItems }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
81c379b04e54a07e94b8ed28790ea5e093fd2220
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getDividerStyle
获取分割线样式
static getDividerStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); return { height: '1px', backgroundColor: theme.colors.divider, width: '100%', margin: `${ThemeUtil.getSpacing('md')}px 0` }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDividerStyle 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...
static getDividerStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); return { height: '1px', backgroundColor: theme.colors.divider, width: '100%', margin: `${ThemeUtil.getSpacing('md')}px 0` }; }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
5f1353e3d611b141e1a712328fcc17a34385f25e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ChangelogManager.ets
arkts
checkAndShowChangelog
检查并显示更新日志(如果是新版本) 首次安装时静默记录当前版本号,不显示更新日志
async checkAndShowChangelog(): Promise<boolean> { // 首次安装时,静默记录当前版本号,不显示更新日志 if (this.isFirstInstall()) { logger.info(TAG, `首次安装,静默记录版本 ${this.currentVersion} (${this.currentVersionCode})`); await this.markCurrentVersionAsShown(); return false; } if (this.shouldShowChangelog()) ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkAndShowChangelog 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 AS...
async checkAndShowChangelog(): Promise<boolean> { // 首次安装时,静默记录当前版本号,不显示更新日志 if (this.isFirstInstall()) { logger.info(TAG, `首次安装,静默记录版本 ${this.currentVersion} (${this.currentVersionCode})`); await this.markCurrentVersionAsShown(); return false; } if (this.shouldShowChangelog()) ...
https://github.com/DaLongZhuaZi/manxia
5033440a13e712c79b42b9e3c528a4abec2fcd82
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/MaxLinesPerFunctionCheck/ets/MaxLinesPerFunction.ets
arkts
foo2
eslint max-lines-per-function: ["error", 4]
function foo2() { // a comment followed by a blank line let x = 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // a comm...
function foo2() { // a comment followed by a blank line let x = 0; }
https://github.com/SMAT-Lab/Homecheck-Sec2026
d657d5c7cb2b760ba32446f0403a8aa6c193ef96
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setHardwareAccelerationEnabled
Setting this to true will set the layer-type HARDWARE for the view, false will set layer-type SOFTWARE. @param enabled
public setHardwareAccelerationEnabled(enabled: boolean) { // if (enabled) // setLayerType(View.LAYER_TYPE_HARDWARE, null); // else // setLayerType(View.LAYER_TYPE_SOFTWARE, null); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHardwareAccelerationEnabled 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 AS...
public setHardwareAccelerationEnabled(enabled: boolean) { // if (enabled) // setLayerType(View.LAYER_TYPE_HARDWARE, null); // else // setLayerType(View.LAYER_TYPE_SOFTWARE, null); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8d0c7964faffb00609d2a4678aa14c0eaaea22c1
gitee
openharmony/applications_call
entry/src/main/ets/common/components/FuncBtnGroup.ets
arkts
onDestroy
Clear timer
onDestroy() { LogUtils.i(TAG, 'onDestroy'); this.timer && clearInterval(this.timer); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDestroy 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...
onDestroy() { LogUtils.i(TAG, 'onDestroy'); this.timer && clearInterval(this.timer); }
https://gitee.com/openharmony/applications_call.git
fdc382b4e64af563df2ecbcbaee717b4efbdd7e1
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
at
Returns an instance of primitive type at passed index if index is correct. @param { int } index - index to look at @returns { BigInt | undefined } - a primitive at index @syscap SystemCapability.Utils.Lang @FaAndStageModel
public at(index: int): BigInt | undefined { let k: int if (index >= 0) { k = index } else { k = this.lengthInt + index } if (k < 0 || k >= this.lengthInt) { return undefined } return BigInt.fromULong(this.getUnsafe(k)) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERR...
public at(index: int): BigInt | undefined { let k: int if (index >= 0) { k = index } else { k = this.lengthInt + index } if (k < 0 || k >= this.lengthInt) { return undefined } return BigInt.fromULong(this.getUnsafe(k)) }
https://gitcode.com/iop123123/arkts-static-skills
88aa56c1b5d1a5d4226653b467aacfff0365e899
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getInstance
Gets ArrayType instance from Class and optional element type descriptor @param {Class} arrayClass Array class @param {RuntimeTypeDescriptor} [elemTD] Optional element type descriptor @returns {ArrayType} ArrayType instance @throws { TypeError } Unexpected TypeKind @static @syscap SystemCapability.Utils.Lang @FaAndStage...
public static getInstance(arrayClass: Class, elemTD?: RuntimeTypeDescriptor): ArrayType { elemTD = elemTD ?? TypeAPI.getArrayElementType(arrayClass) const contextLinker = arrayClass.getLinker() let ek = (TypeAPI.getTypeKind(elemTD, contextLinker) & TypeKindMask).toByte() switch (ek) ...
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#identifier#Left arrayClass AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public static getInstance(arrayClass: Class, elemTD?: RuntimeTypeDescriptor): ArrayType { elemTD = elemTD ?? TypeAPI.getArrayElementType(arrayClass) const contextLinker = arrayClass.getLinker() let ek = (TypeAPI.getTypeKind(elemTD, contextLinker) & TypeKindMask).toByte() switch (ek) ...
https://gitcode.com/iop123123/arkts-static-skills
b291a430c0914a5547b1f61d16730882fd03bd4b
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
getStore
获取 CloudStore RDB 实例
private getStore(): relationalStore.RdbStore | null { try { const cryptoStore = this.cloudStore as CryptoCloudStore; if (cryptoStore && cryptoStore.getStore) { return cryptoStore.getStore(); } } catch (_e) { /* ignore */ } return null; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStore 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#binary_expression#Left AST...
private getStore(): relationalStore.RdbStore | null { try { const cryptoStore = this.cloudStore as CryptoCloudStore; if (cryptoStore && cryptoStore.getStore) { return cryptoStore.getStore(); } } catch (_e) { /* ignore */ } return null; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
d6a86ac9e820c3edfdacfa8fa96710816c4be9c8
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnImageUploadViewModel.ets
arkts
addFilesWithUpload
添加文件并模拟上传过程 @param files 待添加的文件数组
addFilesWithUpload(files: TnUploadFile[]): void { const uploadingFiles: TnUploadFile[] = files.map((f: TnUploadFile): TnUploadFile => { return new TnUploadFile(f.url, "uploading"); }); this.uploadDemoFileList = [...this.uploadDemoFileList, ...uploadingFiles]; for (let i: number = 0; i < uploadin...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addFilesWithUpload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left files AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left TnUplo...
addFilesWithUpload(files: TnUploadFile[]): void { const uploadingFiles: TnUploadFile[] = files.map((f: TnUploadFile): TnUploadFile => { return new TnUploadFile(f.url, "uploading"); }); this.uploadDemoFileList = [...this.uploadDemoFileList, ...uploadingFiles]; for (let i: number = 0; i < uploadin...
https://github.com/codelably/tuniao-ui
4dfeded2928dab6fff00ce5f091fa89a52870abf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaMinFromTime
@see ECMA-262, 21.4.1.13 @returns Minute component of a given time.
function ecmaMinFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return ((timeInDay / msPerMinute) % minutesPerHour).toByte(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMinFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function ecmaMinFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return ((timeInDay / msPerMinute) % minutesPerHour).toByte(); }
https://gitcode.com/iop123123/arkts-static-skills
26ea1eea7f4697041b4836aede616466f011bde4
gitcode
heeh02/superconnect
harmony/entry/src/main/ets/input/GestureController.ets
arkts
stillDown
Fingers still on the glass AFTER this event, robust to either ArkUI semantics for whether event.touches still lists a finger that this event lifted.
private stillDown(ev: TouchEvent): TouchObject[] { const ch: TouchObject[] = ev.changedTouches; const out: TouchObject[] = []; for (const t of ev.touches) { let lifted: boolean = false; for (const c of ch) { if (c.id === t.id) { lifted = true; break; } } if (!lifted) { out.push(t); } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stillDown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ev AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Touch...
private stillDown(ev: TouchEvent): TouchObject[] { const ch: TouchObject[] = ev.changedTouches; const out: TouchObject[] = []; for (const t of ev.touches) { let lifted: boolean = false; for (const c of ch) { if (c.id === t.id) { lifted = true; break; } } if (!lifted) { out.push(t); } ...
https://github.com/heeh02/superconnect
6f47a769482f12931ed851128efa0da861a83712
github
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/utils/AIService.ets
arkts
testConnection
测试 API 连接
static async testConnection(config: AIConfigClass): Promise<AIResponse> { const testMessages: ChatMessage[] = [ { role: 'user', content: '你好,请用一句话介绍你自己。' } ]; return await AIService.chat(config, testMessages); }
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 testConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : ...
static async testConnection(config: AIConfigClass): Promise<AIResponse> { const testMessages: ChatMessage[] = [ { role: 'user', content: '你好,请用一句话介绍你自己。' } ]; return await AIService.chat(config, testMessages); }
https://github.com/electronicminer/Harmony-Markdown-Editor
85120ef5d876e88456f08874170259144facf3c8
github
offlinecat-dev/OCNetORM
src/main/ets/repository/BatchInsertResult.ets
arkts
createPartialSuccess
创建部分成功的批量插入结果 @param insertedCount 成功插入的数量 @param totalCount 总数量 @param failedIndexes 失败的索引列表 @param errorMessage 错误信息 @returns BatchInsertResult 实例
static createPartialSuccess( insertedCount: number, totalCount: number, failedIndexes: Array<number>, errorMessage: string = '' ): BatchInsertResult { const result = new BatchInsertResult() result.success = false result.insertedCount = insertedCount result.totalCount = totalCount ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createPartialSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertedCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number...
static createPartialSuccess( insertedCount: number, totalCount: number, failedIndexes: Array<number>, errorMessage: string = '' ): BatchInsertResult { const result = new BatchInsertResult() result.success = false result.insertedCount = insertedCount result.totalCount = totalCount ...
https://github.com/offlinecat-dev/OCNetORM
4d0f5b80aecdc63449d99a1ce635552a75100659
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
constructor
Creates a new Buffer instance @param {ArrayBuffer} buffer - The underlying ArrayBuffer to use @param {int} [byteOffset=0] - The starting offset into the ArrayBuffer
public constructor(buffer: ArrayBuffer, byteOffset: int = 0, byteLength?: int) { this.bufferData = buffer; this.byteOffsetNumber = byteOffset; if (byteLength == undefined) { this.byteLength = buffer.getByteLength() - byteOffset; } else { ...
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 buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ar...
public constructor(buffer: ArrayBuffer, byteOffset: int = 0, byteLength?: int) { this.bufferData = buffer; this.byteOffsetNumber = byteOffset; if (byteLength == undefined) { this.byteLength = buffer.getByteLength() - byteOffset; } else { ...
https://gitcode.com/iop123123/arkts-static-skills
fb6d8a8cad4fe6a380882fa91479c5310ec97fbc
gitcode
dingzhilin1990/zhilinclaw
src/security/SecurityContext.ets
arkts
checkPermission
检查操作是否被允许 @param action 操作名称 @param permissions 当前权限列表
public checkPermission(action: string, permissions: string[]): boolean { // 首先检查是否被明确禁止 if (this.policy.deniedActions.includes(action)) { return false; } // 检查是否在允许列表中(如果有设置) if (this.policy.allowedActions.length > 0) { if (!this.policy.allowedActions.includes(action)) { retur...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left checkPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public checkPermission(action: string, permissions: string[]): boolean { // 首先检查是否被明确禁止 if (this.policy.deniedActions.includes(action)) { return false; } // 检查是否在允许列表中(如果有设置) if (this.policy.allowedActions.length > 0) { if (!this.policy.allowedActions.includes(action)) { retur...
https://github.com/dingzhilin1990/zhilinclaw
ef31ffb97dfe794d89e57cd297c4830bf775f6de
github
openharmony/applications_call
entry/src/main/ets/model/CallServiceProxy.ets
arkts
dialCall
Make a phone call
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) { LogUtils.i(TAG, 'dialCall phoneNumber :'); return call.dial(phoneNumber, { accountId, videoState, dialScene }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left dialCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left phoneNumber AST#identifier#Right AST#,#Left , AST#,#Right AST#assignment_expression#Left AST#identifier#Left ...
public dialCall(phoneNumber, accountId = 0, videoState = 0, dialScene = 0) { LogUtils.i(TAG, 'dialCall phoneNumber :'); return call.dial(phoneNumber, { accountId, videoState, dialScene }); }
https://gitee.com/openharmony/applications_call.git
06e98bb6cf8ee5c26d14a4a4ae04d172a3a8b1ac
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets
arkts
keys
Returns elements from the HashMap as an keys Iterator @returns ValueIterator with hash map keys
keys(): IterableIterator<K> { return this.buckets.keys(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left keys 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#call_expression#Left AST#me...
keys(): IterableIterator<K> { return this.buckets.keys(); }
https://gitcode.com/iop123123/arkts-static-skills
1349b7d8ed9b14d472072f0580c69c19b9faf98c
gitcode
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets
arkts
encryptField
字段级加密:新写入统一追加前缀,历史密文保持兼容
static async encryptField(value: string, password?: string): Promise<string> { if (value.length === 0) { return '' } if (value.startsWith(FIELD_ENCRYPTION_PREFIX)) { return value } if (CryptoService.isEncrypted(value)) { try { const plainText = await CryptoService.decrypt...
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 encryptField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST...
static async encryptField(value: string, password?: string): Promise<string> { if (value.length === 0) { return '' } if (value.startsWith(FIELD_ENCRYPTION_PREFIX)) { return value } if (CryptoService.isEncrypted(value)) { try { const plainText = await CryptoService.decrypt...
https://github.com/encorexin/WordPressCMS
91da74605f985c6befc321e7d23979887281e958
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
addToFootprint
添加商品到足迹 @param {Goods} goods - 商品信息 @returns {void} 无返回值
private addToFootprint(goods: Goods): void { if (!goods.id) { return; } const footprint = new Footprint(); footprint.goodsId = goods.id; footprint.goodsName = goods.title; footprint.goodsSubTitle = goods.subTitle; footprint.goodsMainPic = goods.mainPic; footprint.goodsPrice = goo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addToFootprint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goods AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private addToFootprint(goods: Goods): void { if (!goods.id) { return; } const footprint = new Footprint(); footprint.goodsId = goods.id; footprint.goodsName = goods.title; footprint.goodsSubTitle = goods.subTitle; footprint.goodsMainPic = goods.mainPic; footprint.goodsPrice = goo...
https://github.com/Joker-x-dev/CoolMallArkTS
da774d5701d458b9ae3a78af4eb95c7a6da19874
github
XXYoLoong/FortuneBet
entry/src/main/ets/services/ProbabilityPredictor.ets
arkts
pick
执行一次加权随机开奖。可注入随机函数以便测试。
pick(randomFn: () => number = Math.random): number { const r = randomFn() * this.totalWeight; for (let i = 0; i < this.cumulative.length; i++) { if (r <= this.cumulative[i]) { return this.values[i]; } } return this.values[this.values.length - 1]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left randomFn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#L...
pick(randomFn: () => number = Math.random): number { const r = randomFn() * this.totalWeight; for (let i = 0; i < this.cumulative.length; i++) { if (r <= this.cumulative[i]) { return this.values[i]; } } return this.values[this.values.length - 1]; }
https://github.com/XXYoLoong/FortuneBet
2fb3c5f4520efa4198b6eea2b081160d594d5917
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
copy
Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. @param { Buffer | Uint8Array } target - A Buffer or Uint8Array to copy in...
public copy( target: Buffer | Uint8Array, targetStart?: int, sourceStart?: int, sourceEnd?: int): int { const resolvedTarget = target.buffer; const resolvedSource: ArrayBuffer = this.buffer; const resolvedTargetStart = (...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left copy AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public copy( target: Buffer | Uint8Array, targetStart?: int, sourceStart?: int, sourceEnd?: int): int { const resolvedTarget = target.buffer; const resolvedSource: ArrayBuffer = this.buffer; const resolvedTargetStart = (...
https://gitcode.com/iop123123/arkts-static-skills
c25ed10f82efa381011fb1eca0722d4ac5fa9bc9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toLocaleString
Returns a locale string representing the specified array and its elements. @returns string representation
public toLocaleString(): string { return this.toLocaleString(new Object(), new Object()) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString 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#...
public toLocaleString(): string { return this.toLocaleString(new Object(), new Object()) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2a6f13a1ec3555820cafb9073fc393fae91357e6
gitee
harmonyos/codelabs
HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets
arkts
insertOrder
Insert order to orderData. @param props: insert props @returns orderId
insertOrder(props: InsertOrderProps): string | undefined { if (props.order !== undefined) { const orderId = props.order.orderId; const newOrder: Order = props.order; newOrder.orderId = (orderId !== undefined ? orderId : ''); newOrder.uid = '1'; newOrder.status = props.status; n...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left insertOrder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left I...
insertOrder(props: InsertOrderProps): string | undefined { if (props.order !== undefined) { const orderId = props.order.orderId; const newOrder: Order = props.order; newOrder.orderId = (orderId !== undefined ? orderId : ''); newOrder.uid = '1'; newOrder.status = props.status; n...
https://gitee.com/harmonyos/codelabs.git
20ae238becda42bcb5f65e185ae2b5c81b91c636
gitee
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets
arkts
getYMax
Returns the greatest y-value the data object contains. @return public getYMax() : number { return this.mYMax; } Returns the maximum y-value for the specified axis. @param axis @return
public getYMax(axis ?: AxisDependency) : number { if (axis == null) { return this.mYMax; } if (axis == AxisDependency.LEFT) { if (this.mLeftAxisMax == -Number.MAX_VALUE) { return this.mRightAxisMax; } else return this.mLeft...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYMax AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axis AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
public getYMax(axis ?: AxisDependency) : number { if (axis == null) { return this.mYMax; } if (axis == AxisDependency.LEFT) { if (this.mLeftAxisMax == -Number.MAX_VALUE) { return this.mRightAxisMax; } else return this.mLeft...
https://gitee.com/openharmony-sig/smartperf.git
32fb77ea929aff9909c75e78d08fca7b4151b6ff
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/NetworkManager.ets
arkts
setOnReconnectSuccessCallback
Set callback for reconnect success
static setOnReconnectSuccessCallback(callback: () => void): void { onReconnectSuccessCallback = callback; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setOnReconnectSuccessCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AS...
static setOnReconnectSuccessCallback(callback: () => void): void { onReconnectSuccessCallback = callback; }
https://github.com/tangwengang-del/freerdp-harmonyos
5baebcc32b5af588c58545eee3eeb2778c5a4394
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
createAllTables
批量创建所有已注册实体的表 @param store RdbStore 实例 @returns Promise<CreateAllTablesResult>
async createAllTables( store: relationalStore.RdbStore, includeJoinTables: boolean = true ): Promise<CreateAllTablesResult> { const storage = MetadataStorage.getInstance() const entities = storage.getAllEntities() const results: Array<CreateTableResult> = [] for (let i = 0; i < entities.len...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createAllTables AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left store AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async createAllTables( store: relationalStore.RdbStore, includeJoinTables: boolean = true ): Promise<CreateAllTablesResult> { const storage = MetadataStorage.getInstance() const entities = storage.getAllEntities() const results: Array<CreateTableResult> = [] for (let i = 0; i < entities.len...
https://github.com/offlinecat-dev/OCNetORM
0e1fcaf9319cc5f2a48b79e6700d5810569c6bb2
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets
arkts
set
Set a new element into the TreeMap @param key: the key of the new element to be added into the TreeMap @param value: the value of the new element to be added into the TreeMap @returns the TreeMap
set(key: K, value: V): Object { const entry = this.getEntry(key); if (entry !== undefined) { entry.val = value; return this; } if (this.rootEntry === undefined) { this.rootEntry = new TreeMapEntry<K, V>(key, value); this.rootEntry!.isB...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#i...
set(key: K, value: V): Object { const entry = this.getEntry(key); if (entry !== undefined) { entry.val = value; return this; } if (this.rootEntry === undefined) { this.rootEntry = new TreeMapEntry<K, V>(key, value); this.rootEntry!.isB...
https://gitcode.com/iop123123/arkts-static-skills
1529ceedae9cf944c97cf68028d068d8f958613b
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
toLocaleDateString
Gets a string with a language-sensitive representation of the date portion of the specified date in the user agent's timezone. @returns a string with a language-sensitive representation of the date portion of the specified date in the user agent's timezone.
public toLocaleDateString(): String { return Date.getLocaleString("%Ex", "", this.ms, false); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Str...
public toLocaleDateString(): String { return Date.getLocaleString("%Ex", "", this.ms, false); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8324c504190e231b381c383b906e239bb6858e6e
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an object of FixedArray<number>. @param { FixedArray<number> } arr - An instance of the FixedArray type to convert to an array. @returns { Float64Array } - A new Float64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: FixedArray<number>): Float64Array { let result = new Float64Array(arr.length) result.ofNumber(stub.toValueArray(arr)) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: FixedArray<number>): Float64Array { let result = new Float64Array(arr.length) result.ofNumber(stub.toValueArray(arr)) return result }
https://gitcode.com/iop123123/arkts-static-skills
45eec769a663e20f5f183f43414aa1e6d27b0476
gitcode
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
createVideoOutputFn
[End create_photo_outputFn] Creating a videoOutPut Output Object
createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile, surfaceId: string): camera.VideoOutput | undefined { let videoOutput: camera.VideoOutput; try { videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId); Logger.info(TAG, `createVide...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createVideoOutputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR...
createVideoOutputFn(cameraManager: camera.CameraManager, videoProfileObj: camera.VideoProfile, surfaceId: string): camera.VideoOutput | undefined { let videoOutput: camera.VideoOutput; try { videoOutput = cameraManager.createVideoOutput(videoProfileObj, surfaceId); Logger.info(TAG, `createVide...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
cfdad5532133a632bddf0bc7240081cdc6f814b5
gitcode
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
getAllRecords
获取所有词汇记录
getAllRecords(): VocabularyRecord[] { return Array.from(this.vocabulary.values()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllRecords 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 VocabularyRecord AST#identifier#Right AST#[#Left...
getAllRecords(): VocabularyRecord[] { return Array.from(this.vocabulary.values()); }
https://github.com/CLMC2025/Vignette
897fb404aa246a2b46ba46729b360b29477f8301
github
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets
arkts
set
存储disk缓存数据 @param key 键值 @param content 文件内容
set(key: string, content: ArrayBuffer | string) { let fileSize: number = 0; if (content instanceof ArrayBuffer) { fileSize = content.byteLength; } else { fileSize = content.length; } if (fileSize > this.maxSize) { return; } this.size = this.size + fileSize; // 文件记录...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left...
set(key: string, content: ArrayBuffer | string) { let fileSize: number = 0; if (content instanceof ArrayBuffer) { fileSize = content.byteLength; } else { fileSize = content.length; } if (fileSize > this.maxSize) { return; } this.size = this.size + fileSize; // 文件记录...
https://gitcode.com/arkui-x/samples
22df502269f75e7d20b9efd322f3f4cecc1faf7c
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/RomParser.ets
arkts
paletteToArgb
将 NDS 调色板颜色转换为 ARGB (与 Android 版本一致)
function paletteToArgb(palette: Uint16Array): Int32Array { const argb = new Int32Array(16); for (let i = 0; i < 16; i++) { const color = palette[i]; // NDS 使用 RGB555 格式,使用与 Android 相同的转换方式 const r = expand5to8((color >> 0) & 0x1F); const g = expand5to8((color >> 5) & 0x1F); const b = expand5to8(...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left paletteToArgb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left palette AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function paletteToArgb(palette: Uint16Array): Int32Array { const argb = new Int32Array(16); for (let i = 0; i < 16; i++) { const color = palette[i]; // NDS 使用 RGB555 格式,使用与 Android 相同的转换方式 const r = expand5to8((color >> 0) & 0x1F); const g = expand5to8((color >> 5) & 0x1F); const b = expand5to8(...
https://github.com/richshaw2015/nds
a772acd1c41c6a6aacc4e74f9ab5328561902995
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets
arkts
setAll
Set all elements of the given TreeMap into the TreeMap @param map: the given TreeMap which elements will be set into the TreeMap
setAll(map: TreeMap<K, V>): void { let entry = map.rootEntry; if (entry === undefined) { return; } while (entry!.left !== undefined) { entry = entry!.left; } while (entry !== undefined) { const resEntry = this.getEntry(entry!.key...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left TreeMap AST#iden...
setAll(map: TreeMap<K, V>): void { let entry = map.rootEntry; if (entry === undefined) { return; } while (entry!.left !== undefined) { entry = entry!.left; } while (entry !== undefined) { const resEntry = this.getEntry(entry!.key...
https://gitcode.com/iop123123/arkts-static-skills
e0406b20f604f32e6a250645916b975470431878
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_and/bitwise_and_int.ets
arkts
main
--- desc: check bitwise and operation for int operands ---
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a & b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a & b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
084a1ee125ef408149c3342e09dab35a86239b67
gitee
terryma2024/happyword
harmonyos/entry/src/main/ets/services/GlobalPackService.ets
arkts
currentPacks
In-memory copy of the parsed pack list. Empty when nothing is cached.
currentPacks(): Pack[] { return this.memoryPacks.slice(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left currentPacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
currentPacks(): Pack[] { return this.memoryPacks.slice(); }
https://github.com/terryma2024/happyword
94861c7da837ac6282ccaa79ed8f33769d4d6210
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreEBookFiles
恢复电子书文件 [重构] 使用文件夹结构,每个电子书一个文件夹,包含文件本身和封面
private async restoreEBookFiles(sourceDir: string): Promise<void> { const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); // 确定目标目录 let targetBaseDir: string; if (downloadDirPath) { targetBaseDir = `${downloadDirPath}/ebooks`; } else { targetBaseDir = `${this.sand...
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 restoreEBookFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceDir AST#identifier#Right AST#ERROR#Left AST#...
private async restoreEBookFiles(sourceDir: string): Promise<void> { const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); // 确定目标目录 let targetBaseDir: string; if (downloadDirPath) { targetBaseDir = `${downloadDirPath}/ebooks`; } else { targetBaseDir = `${this.sand...
https://github.com/DaLongZhuaZi/manxia
ab49223ea9595178aecc5e9131102456b5f02a46
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets
arkts
unlock
Releases the read lock. @syscap SystemCapability.Utils.Lang
public unlock(): void { this.rwl_.unlock(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
public unlock(): void { this.rwl_.unlock(); }
https://gitcode.com/iop123123/arkts-static-skills
819e5e0ddc71f397e6f1ae2c667c65bf479d4e8d
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/DebounceUtil.ets
arkts
clearAll
清除所有节流状态
static clearAll(): void { ThrottleUtil.lastExecuteTime.clear() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearAll 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_st...
static clearAll(): void { ThrottleUtil.lastExecuteTime.clear() }
https://github.com/Yebingiscn/SweetVideo
22c644f95be893883b3897bf7e560e6641420879
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamInputHandler.ets
arkts
handleKeyEvent
==================== 键盘输入 ==================== 处理键盘/手柄按键事件 区分手柄按键与键盘按键: - 手柄按键(传统 InputKit 19-22/96-110,GCK 2300-2320)→ GamepadManager - 键盘按键(2000-2120)→ 翻译为 Windows VK 码后通过 sendKeyboardInput 发送 @param event 按键事件 @returns 是否已处理该事件
handleKeyEvent(event: KeyEvent): boolean { const keyCode = event.keyCode; const isGamepadKey = KeyboardTranslator.isGamepadKey(keyCode); if (!this.viewModel?.isConnected) { // 即使未连接,也要拦截手柄按键,防止触发系统导航 return isGamepadKey; } if (isGamepadKey) { // 手柄按键 → 转发给 GamepadManager ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KeyEvent AST#identifier#Right AST#)#Left...
handleKeyEvent(event: KeyEvent): boolean { const keyCode = event.keyCode; const isGamepadKey = KeyboardTranslator.isGamepadKey(keyCode); if (!this.viewModel?.isConnected) { // 即使未连接,也要拦截手柄按键,防止触发系统导航 return isGamepadKey; } if (isGamepadKey) { // 手柄按键 → 转发给 GamepadManager ...
https://github.com/AlkaidLab/moonlight-harmony
d156d45873309bd71a81b591677c7cbca681bcb5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test2_original_index.ets
arkts
testNullCheck
=== Optional Chaining / Nullish Coalescing ===
function testNullCheck(): string { let obj: string | null = null; if (obj !== null) { return obj; } return 'was null'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNullCheck 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_ty...
function testNullCheck(): string { let obj: string | null = null; if (obj !== null) { return obj; } return 'was null'; }
https://github.com/miaochiahao/ark-ghidra
c81d48bb1710f8dd6fb6af4ac243e07bb4a69717
github
HarmonyOS_Samples/BestPracticeSnippets
AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets
arkts
aboutToAppear
[Start negative_of_lazy_for_each] [StartExclude negative_of_lazy_for_each] [EndExclude negative_of_lazy_for_each]
aboutToAppear(): void { // [StartExclude negative_of_lazy_for_each] for (let i = 1; i < 1000; i++) { this.data.pushData(i); } this.item = this.itemGeneratorFunc(0); hilog.info(0x0000, 'Sample', '%{public}s', `item: ${this.item}`); // [EndExclude negative_of_lazy_for_each] }
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 { // [StartExclude negative_of_lazy_for_each] for (let i = 1; i < 1000; i++) { this.data.pushData(i); } this.item = this.itemGeneratorFunc(0); hilog.info(0x0000, 'Sample', '%{public}s', `item: ${this.item}`); // [EndExclude negative_of_lazy_for_each] }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
0fbe38032dcfe4f038c455662ae5a27a1491300f
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
isTotpUrl
检查TOTP URL是否有效 @param totpUrl @returns
public static isTotpUrl(totpUrl: string | undefined): boolean { if (!totpUrl) { return false; } return totpUrl.length > 0 && totpUrl.startsWith('otpauth://totp/'); }
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 isTotpUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left totpUrl AST#identifier#Right AST#:#Left : AST...
public static isTotpUrl(totpUrl: string | undefined): boolean { if (!totpUrl) { return false; } return totpUrl.length > 0 && totpUrl.startsWith('otpauth://totp/'); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L620-L625
77d3f818d0ef4b04d2a45777125162bcd55812f6
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets
arkts
getAudioRenderer
获取音频渲染器(播放器)
async getAudioRenderer() { if (this.audioRenderer) { return this.audioRenderer } this.audioRenderer = await audio.createAudioRenderer({ streamInfo: this.audioStreamInfo, rendererInfo: this.audioRendererInfo }) return this.audioRenderer }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAudioRenderer 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 getAudioRenderer() { if (this.audioRenderer) { return this.audioRenderer } this.audioRenderer = await audio.createAudioRenderer({ streamInfo: this.audioStreamInfo, rendererInfo: this.audioRendererInfo }) return this.audioRenderer }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
916ce37f329d7782e3a3a39ae231cbe9ef7e6525
gitcode
RoooyHe/toona-ohos
toona/src/main/ets/network/MatrixHttpClient.ets
arkts
queryKeys
✅ 加上 : Promise<Record<string, Object>> 即可
queryKeys(request: Record<string, Object>): Promise<Record<string, Object>> { return this.deviceClient.queryKeys(request); }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left queryKeys 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#ERRO...
queryKeys(request: Record<string, Object>): Promise<Record<string, Object>> { return this.deviceClient.queryKeys(request); }
https://github.com/RoooyHe/toona-ohos
284067eec61aa8c8aa21cb4ae25a6dd733dab73a
github
Countly/countly-sdk-hos
library/src/main/ets/CountlyInstance.ets
arkts
resolveUnknownConsent
@internal, invoked by `ModuleConsent` when the integrator calls `consent.giveConsentAll()` / `removeConsentAll()` while unknown mode is active. Not intended to be called directly by integrators; the only supported way to leave unknown mode is via the consent facade. When the instance isn't in unknown mode the call is a...
public async resolveUnknownConsent(givenAll: boolean): Promise<void> { if (!this.config.unknownConsentMode) { this.config.logger.w('resolveUnknownConsent called outside unknown mode, ignored'); return; } // Clear the flag FIRST so re-entry is impossible during the async work // below (a fa...
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 resolveUnknownConsent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left givenAll AST#identifier#Right AST#ERROR#Left AST#...
public async resolveUnknownConsent(givenAll: boolean): Promise<void> { if (!this.config.unknownConsentMode) { this.config.logger.w('resolveUnknownConsent called outside unknown mode, ignored'); return; } // Clear the flag FIRST so re-entry is impossible during the async work // below (a fa...
https://github.com/Countly/countly-sdk-hos
2a41dbae13eb71d013ca0f3634d45a14c88eee64
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets
arkts
lock
/ Acquires lock and allows to get shared with other readers access to the critical seciton
public lock(): void { ReadLock.lock(this.rwLock); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left lock 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#:#Righ...
public lock(): void { ReadLock.lock(this.rwLock); }
https://gitcode.com/iop123123/arkts-static-skills
c827648f21aac25dc1c2e0cfb11d61f3d2e44a13
gitcode
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/common/BioAuthConfig.ets
arkts
getFaceAuthConfig
获取人脸识别配置
static getFaceAuthConfig(): AuthConfig { return BioAuthConfig.FACE; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFaceAuthConfig 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 Auth...
static getFaceAuthConfig(): AuthConfig { return BioAuthConfig.FACE; }
https://gitcode.com/openharmony/codelabs
01f58457d058e24c418a0f324ef68b25f3f93a9e
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/checkbox/index.ets
arkts
isLeftLabel
是否是在左边的label
isLeftLabel() { return this.labelPosition === 'left' }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isLeftLabel 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...
isLeftLabel() { return this.labelPosition === 'left' }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L202-L204
7460b09749c4aff2dc5946dff37fc0ae3c4cffa6
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
markAsUsed
标记为已使用
static async markAsUsed(recordId: number, billId: number): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_used: 1, bill_id: billId, updated_at: new Date().toISOString() }; const predicates = n...
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 markAsUsed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
static async markAsUsed(recordId: number, billId: number): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_used: 1, bill_id: billId, updated_at: new Date().toISOString() }; const predicates = n...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6de43c2cbf19b00eb708259918b1a2f7f2166774
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test23_original_index.ets
arkts
directionLabel
--- Exhaustive switch with union type ---
function directionLabel(d: DirType): string { if (d === 'UP') { return 'up'; } if (d === 'DOWN') { return 'down'; } if (d === 'LEFT') { return 'left'; } return 'right'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left directionLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left d AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function directionLabel(d: DirType): string { if (d === 'UP') { return 'up'; } if (d === 'DOWN') { return 'down'; } if (d === 'LEFT') { return 'left'; } return 'right'; }
https://github.com/miaochiahao/ark-ghidra
f8c1320a890bbf8dd34bc327d5dabc77f3830a34
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
aboutToAppear
页面出现生命周期 @returns {void} 无返回值
aboutToAppear(): void { if (this.shouldLoadAddress()) { this.executeRequest(); return; } this.initCreateMode(); }
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 { if (this.shouldLoadAddress()) { this.executeRequest(); return; } this.initCreateMode(); }
https://github.com/Joker-x-dev/CoolMallArkTS
232b94379e7270ea8df35cdae3b4fe8997540a18
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncLock.ets
arkts
lockAsync
Perform an operation with the acquired lock. The method acquires the lock first, then calls the callback, and then releases the lock. The callback is called asynchronously in the same thread where lockAsync was called. @param { AsyncLockCallback<T> } callback - function to call when the lock gets acquired. @param { Asy...
public lockAsync<T>(callback: AsyncLockCallback<T>, mode: AsyncLockMode): Promise<T> { return this.lockAsync(callback, mode, new AsyncLockOptions()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left lockAsync 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#(#Rig...
public lockAsync<T>(callback: AsyncLockCallback<T>, mode: AsyncLockMode): Promise<T> { return this.lockAsync(callback, mode, new AsyncLockOptions()); }
https://gitcode.com/iop123123/arkts-static-skills
0cbc99fcda3521e3aa6b754dedf117f69fad8e6b
gitcode
huangyuanlove/HelloArkUI
entry/src/main/ets/pages/playground/FAQ/for_each/ForeachPage.ets
arkts
aboutToAppear
修改为V2
aboutToAppear(): void { this.initData() }
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 { this.initData() }
https://github.com/huangyuanlove/HelloArkUI
e41436d954500a3721393a82c3ebb4b92a637eab
github
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets
arkts
parseEnvelope
─── JSON 解析:禁用 any,全部走 ESObject + 类型守卫 ─────────
function parseEnvelope(raw: string): BridgeEnvelope | null { let parsed: object | null = null try { parsed = JSON.parse(raw) as object } catch (_e) { return null } if (parsed === null) { return null } // 解析任意 H5 传来的 JSON 时,`obj['key']` 是 ArkTS V1 在 Record<string, ESObject> // 上的合法 typed look...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseEnvelope AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function parseEnvelope(raw: string): BridgeEnvelope | null { let parsed: object | null = null try { parsed = JSON.parse(raw) as object } catch (_e) { return null } if (parsed === null) { return null } // 解析任意 H5 传来的 JSON 时,`obj['key']` 是 ArkTS V1 在 Record<string, ESObject> // 上的合法 typed look...
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
c0304739b7726715998c082116140a381c6975ca
github
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/FileImportManager.ets
arkts
deleteAudioFile
删除音频文件
static deleteAudioFile(context: common.UIAbilityContext, fileName: string): boolean { try { const filePath = `${context.filesDir}/audio/${fileName}` if (fs.accessSync(filePath)) { fs.unlink(filePath) return true } return false } catch (err) { console.error(`删除音频文件...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deleteAudioFile 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#member_expres...
static deleteAudioFile(context: common.UIAbilityContext, fileName: string): boolean { try { const filePath = `${context.filesDir}/audio/${fileName}` if (fs.accessSync(filePath)) { fs.unlink(filePath) return true } return false } catch (err) { console.error(`删除音频文件...
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
67328a7176aa82166325bcad0eef0e2fa3498ea6
github
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
ensureDefaultModelsInitialized
启动时加载五个 role 的 default model(幂等,多次调用合并为一个 promise)
async ensureDefaultModelsInitialized(): Promise<void> { if (getAppSettingsState().defaultModelsInitialized) { return } if (this.defaultModelsInitPromise !== null) { await this.defaultModelsInitPromise return } this.defaultModelsInitPromise = this.doInitializeDefaultModels() t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left ensureDefaultModelsInitialized AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_...
async ensureDefaultModelsInitialized(): Promise<void> { if (getAppSettingsState().defaultModelsInitialized) { return } if (this.defaultModelsInitPromise !== null) { await this.defaultModelsInitPromise return } this.defaultModelsInitPromise = this.doInitializeDefaultModels() t...
https://github.com/LongLiveY96/chatcube
0f7091c18a6660d6ef1ee3187a374167f46c9075
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Fills the Uint32Array with specified value @param value new valuy @returns modified Uint32Array public
/* public */ internal fill(value: number, start: int, end: int): Uint32Array { throw new Error("not implemented") }
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST...
/* public */ internal fill(value: number, start: int, end: int): Uint32Array { throw new Error("not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
fe4e79faefdb9a40bf8ecd62a1ad81f6c0b3084f
gitee
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
setParam
页面跳转携带的参数 setParam 和 withParam 方法的区别是,setParam 方法会覆盖之前的参数,而 withParam 方法会合并之前的参数,但不会合并setParam基本类型的参数 @param param @returns
public setParam(param: ObjectOrNull): NavDestBuilder<T> { // enableConvertJumpParamZeroAndFalseToString()方法启用 if (this.optionsImpl.isConvertJumpParamZeroAndFalseToString) { if (typeof param === 'number' && param === 0) { param = '0' } else if (typeof param === 'boolean' && !param) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object...
public setParam(param: ObjectOrNull): NavDestBuilder<T> { // enableConvertJumpParamZeroAndFalseToString()方法启用 if (this.optionsImpl.isConvertJumpParamZeroAndFalseToString) { if (typeof param === 'number' && param === 0) { param = '0' } else if (typeof param === 'boolean' && !param) { ...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L73-L84
f194c1e170c1575c4730f8a9b651c77e2b9ae227
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/service/RepositoryService.ets
arkts
getUserStarredRepos
用户 star 的仓库列表 —— 对齐 RN [ListPage.user_star 分支](https://github.com/CarGuo/GSYGithubApp/blob/master/app/components/ListPage.js#L236-L247) GET /users/:login/starred?sort=updated&page=N&per_page=30
async getUserStarredRepos(login: string, page: number): Promise<SubListResult<SubRepositoryItem>> { if (login.length === 0) { return new SubListResult<SubRepositoryItem>(false, 0, [], false, 'invalid login'); } const finalPage: number = page > 0 ? page : 1; const url: string = Address.getUserSta...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getUserStarredRepos AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left login AST#identifier#Righ...
async getUserStarredRepos(login: string, page: number): Promise<SubListResult<SubRepositoryItem>> { if (login.length === 0) { return new SubListResult<SubRepositoryItem>(false, 0, [], false, 'invalid login'); } const finalPage: number = page > 0 ? page : 1; const url: string = Address.getUserSta...
https://github.com/CarGuo/GSYGithubAppOH
9bff9dfe250f4642d9cd1028d6b0aab358b121d3
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/InputInterceptorService.ets
arkts
configure
配置拦截器参数(可在运行中调用以更新) @param windowX 窗口 X 坐标 (px) @param windowY 窗口 Y 坐标 (px) @param windowWidth 窗口宽度 (px) @param windowHeight 窗口高度 (px) @param screenWidth 屏幕宽度 (px) @param screenHeight 屏幕高度 (px) @param relativeMode 相对模式(游戏用)
configure(windowX: number, windowY: number, windowWidth: number, windowHeight: number, screenWidth: number, screenHeight: number, relativeMode: boolean): void { if (!this.native) return; this.native.configureMouseInterceptor(windowX, windowY, windowWidth, windowHeight, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left configure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
configure(windowX: number, windowY: number, windowWidth: number, windowHeight: number, screenWidth: number, screenHeight: number, relativeMode: boolean): void { if (!this.native) return; this.native.configureMouseInterceptor(windowX, windowY, windowWidth, windowHeight, ...
https://github.com/AlkaidLab/moonlight-harmony
d6fb2deb3f109b2520298a0f42396efea8d1b8c7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelContentProcessor.ets
arkts
removeDuplicateTitle
去除重复标题
private removeDuplicateTitle(content: string, title: string, bookName: string): RemoveTitleResult { try { // 转义特殊字符 const escapedName = this.escapeRegex(bookName); const escapedTitle = this.escapeRegex(title).replace(/\s+/g, '\\s*'); // 构建匹配模式:开头可能有空白、标点、书名,然后是章节标题 const patte...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeDuplicateTitle 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 AS...
private removeDuplicateTitle(content: string, title: string, bookName: string): RemoveTitleResult { try { // 转义特殊字符 const escapedName = this.escapeRegex(bookName); const escapedTitle = this.escapeRegex(title).replace(/\s+/g, '\\s*'); // 构建匹配模式:开头可能有空白、标点、书名,然后是章节标题 const patte...
https://github.com/DaLongZhuaZi/manxia
3d8965f3c6bbf52b0c315cbddb463df1ac5a2699
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
handleBackClick
处理系统返回按钮点击 @returns {void} 无返回值
handleBackClick(): void { this.handleBackAfterPayment(false); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleBackClick 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_bl...
handleBackClick(): void { this.handleBackAfterPayment(false); }
https://github.com/Joker-x-dev/CoolMallArkTS
911192490f701c8f609f4b1791ac7e0d5b85b30e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_int.ets
arkts
main
--- desc: check postfix decrement for integer operand ---
function main(): void { let value: int = {{v.value}} let result: int = value-- assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: int = {{v.value}} let result: int = value-- assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
24a770baa2b021ccd0bb860d43d287456754c50a
gitee
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
verifySliderCaptcha
========== Step 3: 验证滑块轨迹 ==========
async verifySliderCaptcha(tracks: TrackPoint[], pieceDataBase64: string): Promise<boolean> { const moveLength: number = tracks.length > 0 ? tracks[tracks.length - 1].a : 0; const payload: VerifyRequest = { canvasLength: this.PUZZLE_WIDTH, moveLength: moveLength, tracks: tracks }; //...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left verifySliderCaptcha AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tracks AST#identifier#Right AST#type_annotation#Left AST#:#...
async verifySliderCaptcha(tracks: TrackPoint[], pieceDataBase64: string): Promise<boolean> { const moveLength: number = tracks.length > 0 ? tracks[tracks.length - 1].a : 0; const payload: VerifyRequest = { canvasLength: this.PUZZLE_WIDTH, moveLength: moveLength, tracks: tracks }; //...
https://github.com/PollenWang6/HiXD
639a6a535edd271a55fd8ae18ae4ea72ad41e448
github
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
inputDelete
点击回退删除时触发执行
inputDelete(len: number) { if (len === 0) { return } let last = this.expressions[len - 1] let lastLen = last.length if (lastLen === 1) { this.expressions.pop() len = this.expressions.length } else { this.expressions[len - 1] = last.slice(0, last.length - 1) } if...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left inputDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS...
inputDelete(len: number) { if (len === 0) { return } let last = this.expressions[len - 1] let lastLen = last.length if (lastLen === 1) { this.expressions.pop() len = this.expressions.length } else { this.expressions[len - 1] = last.slice(0, last.length - 1) } if...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
a369968a7d0a800ffbda81a32f07425714b9ee7b
gitcode
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/model/PhotoModel.ets
arkts
getTagArray
获取标签数组 @returns 标签数组(去除 # 符号和空格)
getTagArray(): string[] { if (!this.tags || this.tags.trim() === '') { return []; } // 按空格分割,移除 # 符号,过滤空字符串 return this.tags .split(/\s+/) .map(tag => tag.replace('#', '').trim()) .filter(tag => tag.length > 0); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTagArray 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#string#Left string AST#string#Right AST#ERROR#Right...
getTagArray(): string[] { if (!this.tags || this.tags.trim() === '') { return []; } // 按空格分割,移除 # 符号,过滤空字符串 return this.tags .split(/\s+/) .map(tag => tag.replace('#', '').trim()) .filter(tag => tag.length > 0); }
https://gitcode.com/openharmony/codelabs
a789e00600791705cf3d08fde892be79bc4bea1a
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/ConversationMemory.ets
arkts
constructor
构造函数 @param config 配置
constructor(config?: Partial<ConversationMemoryConfig>) { this.config = { maxTurns: 10, sessionTTL: 3600, storageKey: 'conversation:', ...config }; }
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 config AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
constructor(config?: Partial<ConversationMemoryConfig>) { this.config = { maxTurns: 10, sessionTTL: 3600, storageKey: 'conversation:', ...config }; }
https://github.com/LJ666-ui/harmony-health-care
1f3204fcfd82228e2730be16a37edc534fbc95db
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SourceContentCache.ets
arkts
needsRefresh
检查缓存是否需要刷新(接近过期)
needsRefresh(sourceId: number, workflowKey: string): boolean { const cacheKey = this.generateCacheKey(sourceId, workflowKey); const cached = this.cacheMap.get(cacheKey); if (!cached) { return true; } // 如果缓存时间超过一半,建议刷新 const age = Date.now() - cached.timestamp; return age > this.co...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left needsRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#...
needsRefresh(sourceId: number, workflowKey: string): boolean { const cacheKey = this.generateCacheKey(sourceId, workflowKey); const cached = this.cacheMap.get(cacheKey); if (!cached) { return true; } // 如果缓存时间超过一半,建议刷新 const age = Date.now() - cached.timestamp; return age > this.co...
https://github.com/DaLongZhuaZi/manxia
30a772e6f62583f8bef1f3abc0e45d4b4f7a004b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets
arkts
stack
Forms stack and returns it @returns { String | undefined } - Current error stacktrace @syscap SystemCapability.Utils.Lang @FaAndStageModel
get stack(): String | undefined { this.formStack() return this.stack_ }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left stack 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...
get stack(): String | undefined { this.formStack() return this.stack_ }
https://gitcode.com/iop123123/arkts-static-skills
e4d20f518a6c0ee92cd8d6bb1061bbabd8e5a183
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
enlargeCropArea
Enlarge crop area.
enlargeCropArea() { let newCrop = new RectF(); let cropRatio = this.cropRect.getWidth() / this.cropRect.getHeight(); MathUtils.computeMaxRectWithinLimit(newCrop, this.limitRect, cropRatio); let scale = newCrop.getWidth() / this.cropRect.getWidth(); let tX = this.isFlipHorizontal ? -1 : 1; let...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left enlargeCropArea 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#Le...
enlargeCropArea() { let newCrop = new RectF(); let cropRatio = this.cropRect.getWidth() / this.cropRect.getHeight(); MathUtils.computeMaxRectWithinLimit(newCrop, this.limitRect, cropRatio); let scale = newCrop.getWidth() / this.cropRect.getWidth(); let tX = this.isFlipHorizontal ? -1 : 1; let...
https://gitee.com/openharmony/codelabs.git
5eb79f96b617901f8e8dfa2e0fb13881fb283a81
gitee
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/delegate/IWebDownloadFile.ets
arkts
setDownloadDelegate
设置下载委托
setDownloadDelegate(controller: webview.WebviewController, delegate?: webview.WebDownloadDelegate) { if (delegate) { this.webDownloadDelegate = delegate } try { this.controller = controller this.controller.setDownloadDelegate(this.webDownloadDelegate) this.setupDelegateCallbacks(th...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setDownloadDelegate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left webv...
setDownloadDelegate(controller: webview.WebviewController, delegate?: webview.WebDownloadDelegate) { if (delegate) { this.webDownloadDelegate = delegate } try { this.controller = controller this.controller.setDownloadDelegate(this.webDownloadDelegate) this.setupDelegateCallbacks(th...
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
ac41c5001ccf75368395ae9a342405edbfac2a62
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
getTopPathName
@deprecated @see {ZRouter.getInstance().getTopPathName} @returns
public static getTopPathName(): string | null { return ZRouter.getRouterMgr().getTopPathName() }
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 getTopPathName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public static getTopPathName(): string | null { return ZRouter.getRouterMgr().getTopPathName() }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L514-L516
b0ea6ceed690504fb9ed62aaa95e6a3cbd45203e
github
Joker-x-dev/CoolMallArkTS
feature/feedback/src/main/ets/view/FeedbackListPage.ets
arkts
build
构建反馈列表页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "反馈列表", viewModel: this.vm }) { this.FeedbackListContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "反馈列表", viewModel: this.vm }) { this.FeedbackListContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
bf79dd999b99b04789953c686044d41c32cd52d8
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets
arkts
getWidth
获取菜单项宽度 @returns 宽度值
public getWidth(): number { return this.width; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number...
public getWidth(): number { return this.width; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
7c0cb73c3ec01167b8781d4b479599aaa4471566
gitcode
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
playNext
播放后一首(根据当前循环模式)
async playNext() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + 1) % this.musicModelArr.length; this.cur...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left playNext 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#{#Right...
async playNext() { switch (this.curLoopMode) { case AVSessionManager.LoopMode.LOOP_MODE_SINGLE: { this.seek(0); break; } case AVSessionManager.LoopMode.LOOP_MODE_LIST: { this.curMusicModelIndex = (this.curMusicModelIndex + 1) % this.musicModelArr.length; this.cur...
https://gitcode.com/arkui-x/samples
f20e6f6a5ecc3e40436fd098a6a02713904e322e
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/SwipeMenu.ets
arkts
getMenuItem
获取指定索引的菜单项
getMenuItem(index: number): SwipeMenuItem | undefined { return this.items[index]; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMenuItem 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 n...
getMenuItem(index: number): SwipeMenuItem | undefined { return this.items[index]; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
4893af8104c2abf71bac7f780212dad5e888d851
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/FavoriteViewModel.ets
arkts
handleIllustClick
统一的点击处理逻辑
handleIllustClick(illust: PixivIllust) { // 判断是否处于真正的插画列表上下文中 const isIllustContext = this.mainTabIndex === 0 || this.mainTabIndex === 1; // 计算索引:只有在插画上下文中才去查索引,否则默认 0 const index = isIllustContext ? this.currentIllustList.findIndex(i => i.id === illust.id) : 0; const params: DetailPageParams = {...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleIllustClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left illust AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixivIllust AST#ident...
handleIllustClick(illust: PixivIllust) { // 判断是否处于真正的插画列表上下文中 const isIllustContext = this.mainTabIndex === 0 || this.mainTabIndex === 1; // 计算索引:只有在插画上下文中才去查索引,否则默认 0 const index = isIllustContext ? this.currentIllustList.findIndex(i => i.id === illust.id) : 0; const params: DetailPageParams = {...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L358-L374
2e52ec98d32d3fa7cce7b63a3d98b6ed84cc38f6
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isNaN
Check if the current RationalNumber object represents a finite value. @returns { boolean } if both the denominator and the numerator are 0 return true otherwise return false.
public isNaN(): boolean { return this.mnum === 0 && this.mden === 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left isNaN 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 isNaN(): boolean { return this.mnum === 0 && this.mden === 0; }
https://gitcode.com/iop123123/arkts-static-skills
d1a9f6dad9733bd8fa1419e72fc854920ba537eb
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestBuilder.ets
arkts
deviceIdTypeToWire
Server "t" source marker per dev guide: 0 = developer-supplied, 1 = SDK-generated, 3 = temporary (offline). Exhaustive switch on the enum, ArkTS will warn if new variants are added without a case here.
private static deviceIdTypeToWire(type: DeviceIdType): string { switch (type) { case DeviceIdType.DEVELOPER_SUPPLIED: return '0'; case DeviceIdType.SDK_GENERATED: return '1'; case DeviceIdType.TEMPORARY_ID: return '3'; default: return '1'; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left deviceIdTypeToWire AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#L...
private static deviceIdTypeToWire(type: DeviceIdType): string { switch (type) { case DeviceIdType.DEVELOPER_SUPPLIED: return '0'; case DeviceIdType.SDK_GENERATED: return '1'; case DeviceIdType.TEMPORARY_ID: return '3'; default: return '1'; } }
https://github.com/Countly/countly-sdk-hos
b166dfb526bc40533266b7c95ef6f9405d295964
github
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/Medicine/MedicineDetail.ets
arkts
findValidPrescriptions
查找所有包含当前药品的有效处方
findValidPrescriptions(medicineName: string): PrescriptionOption[] { const options: PrescriptionOption[] = []; console.info(`Checking prescriptions for medicine: ${medicineName}. Total prescriptions: ${this.prescriptions?.length || 0}`); if (this.prescriptions && this.prescriptions.length > 0) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left findValidPrescriptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left medicineName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER...
findValidPrescriptions(medicineName: string): PrescriptionOption[] { const options: PrescriptionOption[] = []; console.info(`Checking prescriptions for medicine: ${medicineName}. Total prescriptions: ${this.prescriptions?.length || 0}`); if (this.prescriptions && this.prescriptions.length > 0) { ...
https://github.com/luojiang001/Pulse
47dd438c836bed1dff6103c80433574b64c42b64
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
unlock
解锁 (每次启动或恢复前台时调用) 从 cloudPrefs 读取盐值和验证器, PBKDF2 派生 DEK 并验证 @returns true=解锁成功, false=密码错误
async unlock(password: string): Promise<boolean> { // 检查是否被锁定 if (this.isLocked()) { const remaining = Math.ceil((this.lockUntil - Date.now()) / 1000); hilog.warn(DOMAIN, TAG, "已锁定, 剩余 " + remaining.toString() + " 秒"); return false; } try { // 1. 读取盐值和验证器 const params = ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unlock AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left password AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async unlock(password: string): Promise<boolean> { // 检查是否被锁定 if (this.isLocked()) { const remaining = Math.ceil((this.lockUntil - Date.now()) / 1000); hilog.warn(DOMAIN, TAG, "已锁定, 剩余 " + remaining.toString() + " 秒"); return false; } try { // 1. 读取盐值和验证器 const params = ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
0831afd352fdb007db55fe0da6fde7385102f587
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets
arkts
getString
通用的获取偏好设置方法 @param key 键 @param defaultValue 默认值 @returns Promise<string> 值
async getString(key: string, defaultValue: string = ''): Promise<string> { try { const value = await this.dao.get(key, defaultValue); return value.toString(); } catch (err) { Logger.error(this.LOG_TAG, `Failed to get preference: ${JSON.stringify(err)}`); return defaultValue; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async getString(key: string, defaultValue: string = ''): Promise<string> { try { const value = await this.dao.get(key, defaultValue); return value.toString(); } catch (err) { Logger.error(this.LOG_TAG, `Failed to get preference: ${JSON.stringify(err)}`); return defaultValue; } }
https://github.com/Kira-Yagami-Light/Kira-Projects
5ac0168f757f98469fe6f061d70787a32c443fea
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/view/GoodsCategoryPage.ets
arkts
aboutToDisappear
页面离开时恢复键盘避让模式 @returns {void} 无返回值
aboutToDisappear(): void { const previousMode: KeyboardAvoidMode | null = this.vm.consumeKeyboardAvoidModeSnapshot(); if (previousMode === null) { return; } const uiContext: UIContext = this.getUIContext(); uiContext.setKeyboardAvoidMode(previousMode); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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_b...
aboutToDisappear(): void { const previousMode: KeyboardAvoidMode | null = this.vm.consumeKeyboardAvoidModeSnapshot(); if (previousMode === null) { return; } const uiContext: UIContext = this.getUIContext(); uiContext.setKeyboardAvoidMode(previousMode); }
https://github.com/Joker-x-dev/CoolMallArkTS
d531f13eaea75ea8734a8b14d11a553c1e2f59e1
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/DeviceManager.ets
arkts
registerController
注册设备控制器 @param deviceType 设备类型 @param controller 设备控制器
public registerController(deviceType: string, controller: IDeviceController): void { this.controllers.set(deviceType, controller); console.log(`Controller registered for device type: ${deviceType}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
public registerController(deviceType: string, controller: IDeviceController): void { this.controllers.set(deviceType, controller); console.log(`Controller registered for device type: ${deviceType}`); }
https://github.com/LJ666-ui/harmony-health-care
ac346b8769eaa78f2b741acc7a0372f3e06b1da8
github