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
Creates a slice of current Uint8ClampedArray using range [begin, this.length). @param begin start index to be taken into slice @returns a new Uint8ClampedArray with elements of current Uint8ClampedArray[begin, this.length) public
/* public */ internal slice(begin: int): Uint8ClampedArray { return this.slice(begin, this.length) }
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 slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Ri...
/* public */ internal slice(begin: int): Uint8ClampedArray { return this.slice(begin, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e535dbfd2e0eb4d56995331b20763c4fcb4e5c67
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/DataMapper.ets
arkts
getPrimaryKeyValue
获取实体数据的主键值 @param entityData 实体数据 @returns 主键值,如果没有主键或主键值为空返回 null
getPrimaryKeyValue(entityData: EntityData): ValueType { const pkColumn = this.entityMetadata.getPrimaryKeyColumn() if (pkColumn === null) { return null } // 优先从 properties 数组获取 const prop = entityData.getProperty(pkColumn.propertyName) if (prop !== null) { return prop.value } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPrimaryKeyValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entityData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntityData AST#identifier#Right...
getPrimaryKeyValue(entityData: EntityData): ValueType { const pkColumn = this.entityMetadata.getPrimaryKeyColumn() if (pkColumn === null) { return null } // 优先从 properties 数组获取 const prop = entityData.getProperty(pkColumn.propertyName) if (prop !== null) { return prop.value } ...
https://github.com/offlinecat-dev/OCNetORM
32170818cfd567598f79c9eaa8aed6c7248a7915
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/AdbKeyManager.ets
arkts
convertAdbKeyToX509
将ADB格式公钥转换为X.509 SubjectPublicKeyInfo (DER)
private convertAdbKeyToX509(adbKeyBytes: Uint8Array): Uint8Array | null { try { // ADB Interface: struct RSAPublicKey { int len; uint32_t n0inv; uint32_t n[RSANUMWORDS]; uint32_t rr[RSANUMWORDS]; int exponent; } // RSANUMWORDS = 64 (2048 bits) // Total size = 4 + 4 + 256 + 256 + 4 = 524 bytes ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertAdbKeyToX509 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left adbKeyBytes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Ui...
private convertAdbKeyToX509(adbKeyBytes: Uint8Array): Uint8Array | null { try { // ADB Interface: struct RSAPublicKey { int len; uint32_t n0inv; uint32_t n[RSANUMWORDS]; uint32_t rr[RSANUMWORDS]; int exponent; } // RSANUMWORDS = 64 (2048 bits) // Total size = 4 + 4 + 256 + 256 + 4 = 524 bytes ...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
1dceb9db6cae1bd0073d569e7bd006e6225d2242
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/component/CommentCard.ets
arkts
build
构建商品评价卡片 @returns {void} 无返回值
build(): void { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { RowStartTop({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { Avatar({ src: this.comment.avatarUrl ?? "", avatarSize: 40 }); S...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { RowStartTop({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { Avatar({ src: this.comment.avatarUrl ?? "", avatarSize: 40 }); S...
https://github.com/Joker-x-dev/CoolMallArkTS
3825747ba1a183579554040d2885a1c1d19fab10
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/icon/ArrowRightIcon.ets
arkts
build
构建右箭头图标 @returns {void} 无返回值
build(): void { CommonIcon({ icon: $r("app.media.ic_right"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { CommonIcon({ icon: $r("app.media.ic_right"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS
45e56f66068f754d63e0cf7682a210179d95f336
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_ushort.ets
arkts
main
--- desc: check right shift operation for unsigned short integer ---
function main(): void { const a: ushort = {{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: ushort = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
29cc7146f9773e5328a5c8c56e8d9ecc2da582a1
gitee
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setMaxHeight
弹窗最大高度,仅限于wrap=true
setMaxHeight(maxHeight: Length): Builder { this.popupConfig.maxHeight = maxHeight return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaxHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxHeight AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Length AST#identifier#Right AST#ERROR#Right AST#)#Left...
setMaxHeight(maxHeight: Length): Builder { this.popupConfig.maxHeight = maxHeight return this }
https://github.com/wuba/omni-ui
c555e1e612291ea9c0980c299ce36d0475aa5012
github
openharmony/applications_app_samples
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
parseResult
解析网络监听结果,用于打印日志 @param data 网络监听结果 @returns 解析后的结果数据
parseResult(data: emitter.EventData): string { if (data.data) { if (!data.data.eventName) { logger.info('parseResult data.data.eventName is undefined.'); return ''; } } else { logger.info('parseResult data.data is undefined.'); return ''; } let result = ''; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parseResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left emitter AST#ident...
parseResult(data: emitter.EventData): string { if (data.data) { if (!data.data.eventName) { logger.info('parseResult data.data.eventName is undefined.'); return ''; } } else { logger.info('parseResult data.data is undefined.'); return ''; } let result = ''; ...
https://github.com/openharmony/applications_app_samples
54e9fcad1a2139455e8eb7e367c0738f2b8f9a6b
github
openharmony-sig/applications_clock
common/src/main/ets/manager/ResourceManager.ets
arkts
getStringByIdAsync
获取字符串资源的异步方法 如果缓存中存在对应资源,则直接返回,否则通过资源管理器获取相关资源,并存入缓存 @param id 字符串资源的 ID @return 资源 ID 对应的当前语言下的字符串
async getStringByIdAsync(id: number): Promise<string> { const stringKey = `${i18n.getSystemLocale()}_${id}`; if (this.resourceCache.has(stringKey)) { LogUtil.info(TAG, `getStringByIdAsync ID==> ${id}`); return this.getStringById(id); } let result = ''; try { result = await (Glob...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStringByIdAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async getStringByIdAsync(id: number): Promise<string> { const stringKey = `${i18n.getSystemLocale()}_${id}`; if (this.resourceCache.has(stringKey)) { LogUtil.info(TAG, `getStringByIdAsync ID==> ${id}`); return this.getStringById(id); } let result = ''; try { result = await (Glob...
https://gitee.com/openharmony-sig/applications_clock.git
c324613b1ec35ce118a2573412b3f0df3e82e23d
gitee
HarmonyCandies/extended_text
extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets
arkts
getContent
获取 SpecialText 内容(不包含 startFlag 和 endFlag)
getContent(): string { let content = this._content; if (content.endsWith(this.endFlag)) { content = content.substring(0, content.length - this.endFlag.length); } return content; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b...
getContent(): string { let content = this._content; if (content.endsWith(this.endFlag)) { content = content.substring(0, content.length - this.endFlag.length); } return content; }
https://github.com/HarmonyCandies/extended_text
e6ce9b4865385b2db6cf464b532da94e1b8c19f6
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
toggleDynamicFilterItem
切换动态筛选项选中状态(直接操作 @State 变量,确保UI响应)
private toggleDynamicFilterItem(item: string, type: string): void { switch (type) { case 'author': if (this.dynamicFilterSelectedAuthors.has(item)) { this.dynamicFilterSelectedAuthors.delete(item); } else { this.dynamicFilterSelectedAuthors.add(item); } th...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toggleDynamicFilterItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private toggleDynamicFilterItem(item: string, type: string): void { switch (type) { case 'author': if (this.dynamicFilterSelectedAuthors.has(item)) { this.dynamicFilterSelectedAuthors.delete(item); } else { this.dynamicFilterSelectedAuthors.add(item); } th...
https://github.com/DaLongZhuaZi/manxia
1dd958c76f54cb3ab87677da85dc68e24ec1a831
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test30_original_index.ets
arkts
testMapAdvanced
--- Map advanced operations ---
function testMapAdvanced(): string { let m: Map<string, number> = new Map(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let hasB: boolean = m.has('b'); let del: boolean = m.delete('b'); let size: number = m.size; let gotA: number | undefined = m.get('a'); return String(hasB) + ',' + String(del) + ',...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapAdvanced AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_...
function testMapAdvanced(): string { let m: Map<string, number> = new Map(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let hasB: boolean = m.has('b'); let del: boolean = m.delete('b'); let size: number = m.size; let gotA: number | undefined = m.get('a'); return String(hasB) + ',' + String(del) + ',...
https://github.com/miaochiahao/ark-ghidra
1367592dfaa58e671d1ecf3468a06586313bae9a
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/utils/commonUtils.ets
arkts
isInvalid
Determines whether the object is unavailable @param {str} string to be judged
static isInvalid(str: string): boolean { return str == null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInvalid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static isInvalid(str: string): boolean { return str == null; }
https://gitee.com/openharmony/applications_permission_manager.git
dda17ac1cd04e6d31eb3e4378fd3ec2c97fb43ad
gitee
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
handleOrderComment
处理订单评价逻辑 @returns {void} 无返回值
handleOrderComment(): void { if (this.cartList.length > 1) { this.showCommentModal(); return; } const orderId: number = this.data?.id ?? 0; const goodsId: number = this.getFirstCartGoodsId(); if (!orderId || !goodsId) { return; } OrderNavigator.toComment(orderId, goodsId)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleOrderComment 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#{#Left { AST#{#Right AST#...
handleOrderComment(): void { if (this.cartList.length > 1) { this.showCommentModal(); return; } const orderId: number = this.data?.id ?? 0; const goodsId: number = this.getFirstCartGoodsId(); if (!orderId || !goodsId) { return; } OrderNavigator.toComment(orderId, goodsId)...
https://github.com/Joker-x-dev/CoolMallArkTS
43cd7b03c2dba97807d4932ab39225534b9228b4
github
CLMC2025/Vignette
entry/src/main/ets/manager/ReviewTimeManager.ets
arkts
isSessionTimeout
检查会话是否超时
isSessionTimeout(): boolean { const now = Date.now(); const sessionDuration = now - this.sessionStats.currentSessionStartTime; return sessionDuration > this.SESSION_TIMEOUT_MS; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSessionTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#st...
isSessionTimeout(): boolean { const now = Date.now(); const sessionDuration = now - this.sessionStats.currentSessionStartTime; return sessionDuration > this.SESSION_TIMEOUT_MS; }
https://github.com/CLMC2025/Vignette
5e70aeb0107d9af6d016e596cddeac79cdf6b3eb
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPPerformanceManager.ets
arkts
getConfig
获取当前配置
getConfig(): PerformanceConfig { return { ...this.config } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfig 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 PerformanceConfig AST#identifier#Right AST#ERROR#Rig...
getConfig(): PerformanceConfig { return { ...this.config } }
https://github.com/AetheriumSimulator/qemu-hmos
2d4cf50d388e07c350909499cf9a95c7ce790c5e
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/CategoryChipsSection.ets
arkts
build
Renders a row of selectable category pills with icon+title and selected styling.
build() { Scroll() { Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) { ForEach(this.recommendViewModel.categoryTabItems, (item: RecommendCategoryTabUi, index?: number) => { Row({ space: 6 }) { Image(this.chipTabIcon(item, index ?? ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Scroll() { Row({ space: new BreakpointType(8, 12, 16, 16).getValue(this.breakpointEnv.widthBreakpoint) }) { ForEach(this.recommendViewModel.categoryTabItems, (item: RecommendCategoryTabUi, index?: number) => { Row({ space: 6 }) { Image(this.chipTabIcon(item, index ?? ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
caa65d889fa94de2c734244faf47e6aec48f08cb
gitcode
CLMC2025/Vignette
entry/src/main/ets/manager/PromptTemplateManager.ets
arkts
exportTemplates
导出模板数据
exportTemplates(): PromptTemplate[] { return Array.from(this.templates.values()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left exportTemplates 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#:#Lef...
exportTemplates(): PromptTemplate[] { return Array.from(this.templates.values()); }
https://github.com/CLMC2025/Vignette
9ddf0f773afad6ba4db914851fd8c86f77b72a12
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets
arkts
drawLine
Draw line. @param ctx @param srcX @param srcY @param dstX @param dstY
static drawLine(ctx: CanvasRenderingContext2D, srcX: number, srcY: number, dstX: number, dstY: number) { ctx.beginPath(); ctx.moveTo(srcX, srcY); ctx.lineTo(dstX, dstY); ctx.stroke(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left drawLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRe...
static drawLine(ctx: CanvasRenderingContext2D, srcX: number, srcY: number, dstX: number, dstY: number) { ctx.beginPath(); ctx.moveTo(srcX, srcY); ctx.lineTo(dstX, dstY); ctx.stroke(); }
https://gitee.com/openharmony/codelabs.git
091f40321aec05598b06cf24f4c82da0ea788dd3
gitee
arkui-x/samples
CodeLab/Cases/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
deleteGridItem
删除gridItem @param item 网格元素 @param itemAreaWidth 网格区域宽度
deleteGridItem(item: T, itemAreaWidth: number): void { const index: number = this.gridData.indexOf(item); animateTo({ curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => { // 初始化偏移位置 this.modifier.forEach((item) => { item.offsetX = 0; item.offs...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteGridItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,...
deleteGridItem(item: T, itemAreaWidth: number): void { const index: number = this.gridData.indexOf(item); animateTo({ curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => { // 初始化偏移位置 this.modifier.forEach((item) => { item.offsetX = 0; item.offs...
https://gitcode.com/arkui-x/samples
106a4526b94d254ea1c509590b764c33f7183258
gitcode
openharmony/arkui_ace_engine
examples/Image/TestNavigation/entry/src/main/ets/pages/PageOne.ets
arkts
<arrow>
设置转场动画起点,根据不同的转场类型分别设置
(isPush: boolean, isExit: boolean) => {},
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isPush AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#boolean#Left boolean AST#boolean#Right AST#predefined_typ...
(isPush: boolean, isExit: boolean) => {},
https://gitcode.com/openharmony/arkui_ace_engine
edd5fb520fa096a87bcc6d67224b687b0d0d667d
gitcode
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets
arkts
setFlashMode
闪光灯开关
setFlashMode(result: MethodResult, isOpen: boolean): void { // 设备是否支持闪光灯,可使用方法hasFlash // 设备是否支持指定的闪光灯模式,可使用方法isFlashModeSupported if (!this.hasFlash()) { result.error("setFlashMode hasFlash", "The camera device does not have flash.", null); return; } const newMode = isOpen ? camera.Fl...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFlashMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#identifier#Right AST#,#L...
setFlashMode(result: MethodResult, isOpen: boolean): void { // 设备是否支持闪光灯,可使用方法hasFlash // 设备是否支持指定的闪光灯模式,可使用方法isFlashModeSupported if (!this.hasFlash()) { result.error("setFlashMode hasFlash", "The camera device does not have flash.", null); return; } const newMode = isOpen ? camera.Fl...
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
57c800b3fb353f74ab71872d7c95a7274e33a51f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
cleanOldCrashLogs
清理旧的崩溃日志(保留最近10份)
public cleanOldCrashLogs(): void { try { const files = this.getCrashLogFiles(); if (files.length <= 10) { return; } // 按文件名排序(包含时间戳,自然排序即为时间排序) files.sort(); const toDelete = files.slice(0, files.length - 10); for (const fileName of toDelete) { try { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cleanOldCrashLogs 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#v...
public cleanOldCrashLogs(): void { try { const files = this.getCrashLogFiles(); if (files.length <= 10) { return; } // 按文件名排序(包含时间戳,自然排序即为时间排序) files.sort(); const toDelete = files.slice(0, files.length - 10); for (const fileName of toDelete) { try { ...
https://github.com/DaLongZhuaZi/manxia
88c6c06128ded0b38c49b0d956568237f81e1e2a
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
validateSettingsConfig
验证配置值 @param key 配置键 @param value 要验证的配置值 @returns 配置值是否有效 Requirements: 13.7
static validateSettingsConfig(key: string, value: SettingsConfigValue): boolean { return MelonDSNative.native.validateSettingsConfig(key, value); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateSettingsConfig 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...
static validateSettingsConfig(key: string, value: SettingsConfigValue): boolean { return MelonDSNative.native.validateSettingsConfig(key, value); }
https://github.com/richshaw2015/nds
4bd0cfa7476334d5d6f09240ac392f777ca9f350
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsProcessor.ets
arkts
insertAlert
Alert插入数据表中 @param calendarAlerts 携带参数的calendarAlerts @return 成功则返回rowId
async function insertAlert(rdbStore: data_rdb.RdbStore, date: Date, calendarAlerts: CalendarAlerts): Promise<number> { let currentMillis = date.getTime(); let rowId: number = -1; const valueBucket: ValuesBucket = {}; valueBucket[CalendarAlertsColumns.EVENT_ID] = calendarAlerts.eventId; valueBucket[CalendarAle...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left insertAlert AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#typ...
async function insertAlert(rdbStore: data_rdb.RdbStore, date: Date, calendarAlerts: CalendarAlerts): Promise<number> { let currentMillis = date.getTime(); let rowId: number = -1; const valueBucket: ValuesBucket = {}; valueBucket[CalendarAlertsColumns.EVENT_ID] = calendarAlerts.eventId; valueBucket[CalendarAle...
https://gitee.com/openharmony/applications_calendar_data.git
070a0d896e129320657a55cb5b1fc7cb6384766f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isNonEmptyObject
检查值是否为非空对象 @param value - 要检查的值 @returns 是否为非空对象
static isNonEmptyObject(value: Object): boolean { if (!TypeGuards.isObject(value)) { return false; } const objValue = value as Record<string, Object>; return Object.keys(objValue).length > 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNonEmptyObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static isNonEmptyObject(value: Object): boolean { if (!TypeGuards.isObject(value)) { return false; } const objValue = value as Record<string, Object>; return Object.keys(objValue).length > 0; }
https://github.com/DaLongZhuaZi/manxia
da3788bb2a51ed282da409086644558d33ee22f6
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WishlistStore.ets
arkts
addCustomWish
V0.4.7 — append a parent-created custom wish. Returns the new wish id on success, or an empty string on validation failure. Validation rules: - displayName trimmed length in [CUSTOM_WISH_NAME_MIN_CHARS, CUSTOM_WISH_NAME_MAX_CHARS] characters. - costCoins integer in [CUSTOM_WISH_COST_MIN, CUSTOM_WISH_COST_MAX]. - iconEm...
addCustomWish(name: string, costCoins: number, iconEmoji: string, nowMs: number): string { const trimmedName: string = name.trim(); if (trimmedName.length < CUSTOM_WISH_NAME_MIN_CHARS) { return ''; } if (trimmedName.length > CUSTOM_WISH_NAME_MAX_CHARS) { return ''; } if (!Number.is...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addCustomWish AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A...
addCustomWish(name: string, costCoins: number, iconEmoji: string, nowMs: number): string { const trimmedName: string = name.trim(); if (trimmedName.length < CUSTOM_WISH_NAME_MIN_CHARS) { return ''; } if (trimmedName.length > CUSTOM_WISH_NAME_MAX_CHARS) { return ''; } if (!Number.is...
https://github.com/terryma2024/happyword
4081e5a8800dddf0dafc48067a9cb5d4be656265
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
calcNewLimit
When image changing, calc limit size again. @returns
private calcNewLimit(): RectF { let limit = new RectF(); limit.set(this.marginW, this.marginH, this.displayWidth - this.marginW, this.displayHeight - this.marginH); return limit; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcNewLimit 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 RectF ...
private calcNewLimit(): RectF { let limit = new RectF(); limit.set(this.marginW, this.marginH, this.displayWidth - this.marginW, this.displayHeight - this.marginH); return limit; }
https://gitee.com/openharmony/codelabs.git
8716fa3db29307f10e4ccb1dcf430b711c41606a
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @returns { BigUint64Array } - a new BigUint64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(): BigUint64Array { return new BigUint64Array(0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
public static of(): BigUint64Array { return new BigUint64Array(0) }
https://gitcode.com/iop123123/arkts-static-skills
6b3207d03d59e04d9a4d0ee35ff97ba80f5c87d7
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test57_original_index.ets
arkts
memoize
--- Memoization ---
function memoize(fn: (n: number) => number): (n: number) => number { let cache: Map<number, number> = new Map(); return (n: number): number => { let cached: number | undefined = cache.get(n); if (cached !== undefined) { return cached; } let result: number = fn(n); cache.set(n, result); ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left memoize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fn AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function memoize(fn: (n: number) => number): (n: number) => number { let cache: Map<number, number> = new Map(); return (n: number): number => { let cached: number | undefined = cache.get(n); if (cached !== undefined) { return cached; } let result: number = fn(n); cache.set(n, result); ...
https://github.com/miaochiahao/ark-ghidra
84056e123bb191f507e2bbf48775ee97407014d4
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/ExtensionLoader.ets
arkts
initRenderer
====== 渲染管线 ======
initRenderer(xcId: string, w: number, h: number): number { try { this.rendererHandle = rdpnapi.initRenderer(xcId, w, h) as number; } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] initRenderer: ' + JSON.stringify(err)); this.rendererHandle = -1; } return this.rendererHandl...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initRenderer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xcId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS...
initRenderer(xcId: string, w: number, h: number): number { try { this.rendererHandle = rdpnapi.initRenderer(xcId, w, h) as number; } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] initRenderer: ' + JSON.stringify(err)); this.rendererHandle = -1; } return this.rendererHandl...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
0a846dcdbd780e4deb60e7536d60e320c997e66d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringSingleInternalAsync
内部方法:获取单个规则的字符串结果(异步版本)
private async getStringSingleInternalAsync(ruleStr: string): Promise<string> { const regexGroupValue = this.getStringFromRegexGroupPayload(ruleStr); if (regexGroupValue !== null) { return regexGroupValue; } const parsedRule = this.parseRule(ruleStr); if (LegadoRuleAnalyzer.ENABLE_SELECTOR_T...
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 getStringSingleInternalAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#...
private async getStringSingleInternalAsync(ruleStr: string): Promise<string> { const regexGroupValue = this.getStringFromRegexGroupPayload(ruleStr); if (regexGroupValue !== null) { return regexGroupValue; } const parsedRule = this.parseRule(ruleStr); if (LegadoRuleAnalyzer.ENABLE_SELECTOR_T...
https://github.com/DaLongZhuaZi/manxia
d749fd7cf0b3a561736af24703bf78d4b71dbada
github
HarmonyOS_Samples/BestPracticeSnippets
ClickResponseOptimization/entry/src/main/ets/pages/CameraPage.ets
arkts
onPageHide
[Start releasecamera] Trigger once every time the camera page is hidden.
onPageHide() { this.releaseCamera(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
onPageHide() { this.releaseCamera(); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
9d10d4c4b64df1447158b2b42782a9387a7b9ce8
gitcode
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/view/HomePage.ets
arkts
build
构建首页 @returns {void} 无返回值
build(): void { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, }) { HomeTopBar({ onSearchTap: (): void => GoodsNavigator.toSearch() }); BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), conten...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, }) { HomeTopBar({ onSearchTap: (): void => GoodsNavigator.toSearch() }); BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), conten...
https://github.com/Joker-x-dev/CoolMallArkTS
a670cc97b979a3d16c980d070c68bd1fdfdcd17f
github
codelably/HCompass
core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets
arkts
fatal
致命错误级别日志 @param data 日志内容 @param tag 自定义标签
static fatal(data: Any, tag?: string) { Logger.log(LogLevel.FATAL, data, tag); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left fatal AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static fatal(data: Any, tag?: string) { Logger.log(LogLevel.FATAL, data, tag); }
https://github.com/codelably/HCompass
7e1a398f5b20944cab886525a53d24883b56951b
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
slice
Creates a slice of current Float64Array using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Float64Array with elements of current Float64Array[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/docs/Web/JavaSc...
public slice(begin: number, end: number): Float64Array { return this.slice(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public slice(begin: number, end: number): Float64Array { return this.slice(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eaae17943db28e619667bc285950269408eb0c7f
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/bean/Conversation.ets
arkts
fromObject
Create from plain object.
static fromObject(obj: IConversation): Conversation { return new Conversation( obj.conversationId, obj.otherUsername, obj.lastMessage, obj.lastMessageTime, obj.unreadCount ); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IConve...
static fromObject(obj: IConversation): Conversation { return new Conversation( obj.conversationId, obj.otherUsername, obj.lastMessage, obj.lastMessageTime, obj.unreadCount ); }
https://github.com/Harrisonls2004/WaterFlow
ece73120b3ebf8bbd59e50bffaf01e88ece17842
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/SnapshotCapture.ets
arkts
checkComponentExists
检查组件是否存在 @param componentId 组件ID @returns 是否存在
public async checkComponentExists(componentId: string): Promise<boolean> { const uiContext = this.uiContext; if (!uiContext) { logger.error(TAG, 'UIContext未初始化'); return false; } try { const pixelMap = await uiContext.getComponentSnapshot().get(componentId, { scale: 0.1 }); if...
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 checkComponentExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AS...
public async checkComponentExists(componentId: string): Promise<boolean> { const uiContext = this.uiContext; if (!uiContext) { logger.error(TAG, 'UIContext未初始化'); return false; } try { const pixelMap = await uiContext.getComponentSnapshot().get(componentId, { scale: 0.1 }); if...
https://github.com/DaLongZhuaZi/manxia
893d8d22c403356726156ea72b009f91b146e884
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
buildUrl
构建 API URL,处理 baseUrl 和 path 的拼接 @param baseUrl 基础 URL(如 https://api.example.com 或 https://api.example.com/v1) @param path API 路径(如 /chat/completions 或 v1/chat/completions) @returns 完整的 API URL
static buildUrl(baseUrl: string, path: string): string { let url = baseUrl let apiPath = path // 移除 baseUrl 末尾的斜杠 if (url.endsWith('/')) { url = url.slice(0, -1) } // 确保 path 以斜杠开头 if (!apiPath.startsWith('/')) { apiPath = '/' + apiPath } // 检查 baseUrl 是否已经包含版本路径(如 /...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ...
static buildUrl(baseUrl: string, path: string): string { let url = baseUrl let apiPath = path // 移除 baseUrl 末尾的斜杠 if (url.endsWith('/')) { url = url.slice(0, -1) } // 确保 path 以斜杠开头 if (!apiPath.startsWith('/')) { apiPath = '/' + apiPath } // 检查 baseUrl 是否已经包含版本路径(如 /...
https://github.com/LongLiveY96/chatcube
d2ad0a8a6fd56bc92cfd7eea030d1930921842f7
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
clear
返回根视图,即Navigation页面
public clear() { this.updateCurrentStackName() this.routerMgr.clear() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#L...
public clear() { this.updateCurrentStackName() this.routerMgr.clear() }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L349-L352
4878e560f56713d86bdcd00226cb4b21b7ccb91b
github
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-ttsdemo
entry/src/main/ets/pages/Index.ets
arkts
onComplete
Complete broadcast callback
onComplete(requestId: string, response: textToSpeech.CompleteResponse) { console.info(`onComplete, requestId: ${requestId} response: ${JSON.stringify(response)}`); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,...
onComplete(requestId: string, response: textToSpeech.CompleteResponse) { console.info(`onComplete, requestId: ${requestId} response: ${JSON.stringify(response)}`); },
https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-ttsdemo
c3128207a4de626ec0be5fe5562f305d1b514d00
gitcode
queueit/harmony-sdk
queueit_sdk/src/main/ets/view/QueueItViewManager.ets
arkts
handleErrorReceive
Called by <Web onErrorReceive={...}>
public handleErrorReceive(event: OnErrorReceiveEvent): void { this.isLoading = false; const error = event?.error; const req = event?.request; const errorCode = error?.getErrorCode() ?? 'Unknown'; const errorInfo = error?.getErrorInfo() ?? 'Unknown WebView error'; cons...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleErrorReceive 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#L...
public handleErrorReceive(event: OnErrorReceiveEvent): void { this.isLoading = false; const error = event?.error; const req = event?.request; const errorCode = error?.getErrorCode() ?? 'Unknown'; const errorInfo = error?.getErrorInfo() ?? 'Unknown WebView error'; cons...
https://github.com/queueit/harmony-sdk
3779e4bae3ae4c91a52704eff4d4b7120fa29249
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
updateOnlinePageCacheStatus
更新在线页面的缓存状态 用于同步磁盘缓存到数据库
public async updateOnlinePageCacheStatus( imageUrl: string, localPath: string, fileSize: number ): Promise<void> { try { const normalizedImageUrl = this.stripCachePartitionSuffix(imageUrl); const sql = `UPDATE online_page SET localPath = ?, fileSize = ?, isDownloaded ...
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 updateOnlinePageCacheStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageUrl AST#identifier#Right AST#ERROR#Lef...
public async updateOnlinePageCacheStatus( imageUrl: string, localPath: string, fileSize: number ): Promise<void> { try { const normalizedImageUrl = this.stripCachePartitionSuffix(imageUrl); const sql = `UPDATE online_page SET localPath = ?, fileSize = ?, isDownloaded ...
https://github.com/DaLongZhuaZi/manxia
ad38d8ad859cfa3dde78065edc0343e4a7fa66f8
github
ibestservices/ibest-ui
library/src/main/ets/components/cascader/index.ets
arkts
createOptionsInstance
创建当前tab下的选项实例
createOptionsInstance(children: IBestCascaderOption[] = []): IBestCascaderOptionInstance[]{ return children.length ? children.map((item: IBestCascaderOption) => { let obj: IBestCascaderOptionInstanceType = { text: item.text, value: item.value, disabled: item.disabled, children: item.children || []...
AST#program#Left AST#expression_statement#Left AST#ternary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createOptionsInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left children AST#identifier#Right AST#:#Left : AST#:#Ri...
createOptionsInstance(children: IBestCascaderOption[] = []): IBestCascaderOptionInstance[]{ return children.length ? children.map((item: IBestCascaderOption) => { let obj: IBestCascaderOptionInstanceType = { text: item.text, value: item.value, disabled: item.disabled, children: item.children || []...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cascader/index.ets#L89-L101
61255782f15015287b78b600eb715110e86898c8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
isForceLabelsEnabled
Returns true if focing the y-label count is enabled. Default: false @return
public isForceLabelsEnabled(): boolean { return this.mForceLabels; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isForceLabelsEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left bool...
public isForceLabelsEnabled(): boolean { return this.mForceLabels; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
ce2409306f659be0502ab1bcc19077dec262e5a7
gitee
somnio-software/my-bot-pal
entry/src/main/ets/utils/PermissionUtils.ets
arkts
checkPermissionGrant
Mock implementation for permission check and request @param permission The permission to check @param context Application context (not used in mock)
public async checkPermissionGrant(permission: Permissions, context: Context): Promise<boolean> { console.log(`[MOCK] Checking permission: ${permission}`); // If we have an explicit setting for this permission, use it if (this.mockPermissions.has(permission)) { const result = this.mockPermission...
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 checkPermissionGrant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST...
public async checkPermissionGrant(permission: Permissions, context: Context): Promise<boolean> { console.log(`[MOCK] Checking permission: ${permission}`); // If we have an explicit setting for this permission, use it if (this.mockPermissions.has(permission)) { const result = this.mockPermission...
https://github.com/somnio-software/my-bot-pal
9ba9666233e85fa65df8aff95daab8d07c99103b
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnWaterFallViewModel.ets
arkts
initBasicData
初始化基础用法数据
private initBasicData(): void { const items: Object[] = []; for (let i = 0; i < 20; i++) { const height = 100 + Math.floor(Math.random() * 120); const color = this.colors[i % this.colors.length]; items.push(new WaterFallDemoItem(i, height, color, `Item ${i + 1}`)); } this.basicDataSo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initBasicData 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#vo...
private initBasicData(): void { const items: Object[] = []; for (let i = 0; i < 20; i++) { const height = 100 + Math.floor(Math.random() * 120); const color = this.colors[i % this.colors.length]; items.push(new WaterFallDemoItem(i, height, color, `Item ${i + 1}`)); } this.basicDataSo...
https://github.com/codelably/tuniao-ui
f2b3be3d3a8ce98273a707d0f1d1c44641a936f1
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
uncolect
取消收藏文章 @param id article id
async uncolect(id: number) { try { const response = await wanHttpClient.uncollect(id) if (response.data.errorCode === 0) { //errorCode === 0说明收藏成功 EventBus.getInstance().post(WanEventId.EVENT_UNCOLLECT, new UncollectEvent(true, id)) } else { EventBus.getInstance() .post...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uncolect AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async uncolect(id: number) { try { const response = await wanHttpClient.uncollect(id) if (response.data.errorCode === 0) { //errorCode === 0说明收藏成功 EventBus.getInstance().post(WanEventId.EVENT_UNCOLLECT, new UncollectEvent(true, id)) } else { EventBus.getInstance() .post...
https://github.com/RedRackham-R/WanAndroidHarmoney
642ec83227cd9f9be26060cc4d2dc873763ce7b5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/AdviceFeedbackDAO.ets
arkts
update
更新反馈记录
static async update(feedback: AdviceFeedback): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const valueBucket: relationalStore.ValuesBucket = { feedback_status: feedback.feedbackStatus, actual_budget_set: feedback.actualBudgetSet, feedback_date: feedbac...
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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left feedback AST#identifier#Right AST#:#Left : AST#:#...
static async update(feedback: AdviceFeedback): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const valueBucket: relationalStore.ValuesBucket = { feedback_status: feedback.feedbackStatus, actual_budget_set: feedback.actualBudgetSet, feedback_date: feedbac...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9d6acaff9d7358e97a1269e9b79466a314c52c21
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaSecFromTime
@see ECMA-262, 21.4.1.13 @returns Seconds component of a given time.
function ecmaSecFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return ((timeInDay / msPerSecond) % secondsPerMinute).toByte(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaSecFromTime 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 ecmaSecFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return ((timeInDay / msPerSecond) % secondsPerMinute).toByte(); }
https://gitcode.com/iop123123/arkts-static-skills
59e3e34f0d0775676fb4dc301a1b6e730ca4f0a6
gitcode
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets
arkts
setAVPlayerCallback
[End create_instance]
private setAVPlayerCallback(avPlayer: media.AVPlayer) { if (!this.avPlayer) { return; } avPlayer.on('timeUpdate', (time: number) => { if (time > this.currentTime * 1000) { uiContext?.animateTo({ duration: 1000, curve: Curve.Linear }, () => { this.currentTime = Math.floor(tim...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setAVPlayerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ...
private setAVPlayerCallback(avPlayer: media.AVPlayer) { if (!this.avPlayer) { return; } avPlayer.on('timeUpdate', (time: number) => { if (time > this.currentTime * 1000) { uiContext?.animateTo({ duration: 1000, curve: Curve.Linear }, () => { this.currentTime = Math.floor(tim...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
0d98bf6f4346335eacb6c37f3988c02bafab1253
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getGlassBackgroundResource
返回通用玻璃背景颜色的资源对象(资源化,统一管理) 优先使用资源映射中的 app.color.glass_background_overlay,其次回退到 app.color.background_overlay
public getGlassBackgroundResource(): Resource { const glassRes: Resource | undefined = colorMap['app.color.glass_background_overlay']; if (glassRes !== undefined) { return glassRes; } const overlayRes: Resource | undefined = colorMap['app.color.background_overlay']; if (overlayRes !== undefi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGlassBackgroundResource 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#...
public getGlassBackgroundResource(): Resource { const glassRes: Resource | undefined = colorMap['app.color.glass_background_overlay']; if (glassRes !== undefined) { return glassRes; } const overlayRes: Resource | undefined = colorMap['app.color.background_overlay']; if (overlayRes !== undefi...
https://github.com/DaLongZhuaZi/manxia
1624bea23c916442106d9cc2dfe142a734143085
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
detectCodec
--------------------------------------------------------------------------- 内部 — 工具方法 --------------------------------------------------------------------------- 根据 videoFormat 位掩码检测编解码器名称
private static detectCodec(videoFormat: number): string { if ((videoFormat & VIDEO_FORMAT_MASK_AV1) !== 0) return 'AV1'; if ((videoFormat & VIDEO_FORMAT_MASK_H265) !== 0) return 'HEVC'; if ((videoFormat & VIDEO_FORMAT_MASK_H264) !== 0) return 'H.264'; return 'HEVC'; }
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 detectCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left videoFormat AST#identifier#Right AST#ERROR#Left AST#:#L...
private static detectCodec(videoFormat: number): string { if ((videoFormat & VIDEO_FORMAT_MASK_AV1) !== 0) return 'AV1'; if ((videoFormat & VIDEO_FORMAT_MASK_H265) !== 0) return 'HEVC'; if ((videoFormat & VIDEO_FORMAT_MASK_H264) !== 0) return 'H.264'; return 'HEVC'; }
https://github.com/AlkaidLab/moonlight-harmony
2990f1a794e9c0c745810d89089b5528c76b7ee3
github
huaiminqin/TankWar-Master-with-Many-Tasks
util/src/main/ets/services/GameService.ets
arkts
createPlayerTank
创建玩家坦克
static createPlayerTank(): Tank { return { id: 'player', type: TankType.PLAYER, position: { x: 7, y: 13 }, direction: Direction.UP, health: 100, maxHealth: 100, speed: GameConfig.PLAYER_SPEED, isAlive: true }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createPlayerTank 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 Tank ...
static createPlayerTank(): Tank { return { id: 'player', type: TankType.PLAYER, position: { x: 7, y: 13 }, direction: Direction.UP, health: 100, maxHealth: 100, speed: GameConfig.PLAYER_SPEED, isAlive: true }; }
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
7f701ca7ef517bb147719f47dc6baa1ac6cd4de0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
index
Gets the starting index of the match result. @returns { int } The starting index of the match. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get index(): int { return this.index_ }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST...
public get index(): int { return this.index_ }
https://gitcode.com/iop123123/arkts-static-skills
27a83f1603103437fd262cfa4d2d42f468ae3a1d
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitSint64
访问 sint64 字段 (zigzag 编码) Wire type: 0 (varint)
visitSint64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).sint64(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigint AST#identifier#Right AST#,#Left , AS...
visitSint64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).sint64(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
0017903ac6c71dde7205d783aa976bb157e38982
gitcode
honjow/Next2V
shared/src/main/ets/utils/FoldScreenUtil.ets
arkts
isFoldable
Check if device is foldable
isFoldable(): boolean { try { return display.isFoldable() } catch (error) { console.error('FoldScreenUtil isFoldable error:', error) return false } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFoldable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statemen...
isFoldable(): boolean { try { return display.isFoldable() } catch (error) { console.error('FoldScreenUtil isFoldable error:', error) return false } }
https://github.com/honjow/Next2V
fa032ae9d640725466aab4b1fb7ba31f07626474
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ReminderManager.ets
arkts
publishReminder
发布提醒 注意:这是简化实现,仅保存提醒设置,实际通知需要后台服务支持
async publishReminder(reminder: ReminderSettings): Promise<boolean> { try { // 保存提醒配置 await this.saveReminderConfig(reminder); console.info(`提醒已配置: ${reminder.title}`); console.info(`模式: ${reminder.mode}`); if (reminder.mode === 'fixed') { console.info(`时间: ${reminder.time}...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left publishReminder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left reminder AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async publishReminder(reminder: ReminderSettings): Promise<boolean> { try { // 保存提醒配置 await this.saveReminderConfig(reminder); console.info(`提醒已配置: ${reminder.title}`); console.info(`模式: ${reminder.mode}`); if (reminder.mode === 'fixed') { console.info(`时间: ${reminder.time}...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
d88302a43e86e05e518904dd3be27ab8f44b6e32
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheStorage.ets
arkts
init
初始化 @param config 存储配置
public init(config: StorageConfig): void { this.decoratedStorage.init(config); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public init(config: StorageConfig): void { this.decoratedStorage.init(config); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L36-L38
aa17ac9fe0fa40fe26cb1b7a418ce4cb4794cfc1
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets
arkts
$_get
Gets the element at the specified index. @param index - The index of the element to retrieve. @returns { T } The element in the buffer matching the given index. @throws { BusinessError } 10200001 - The value of index is out of range.
public $_get(index: int): T { if (index > Int.MAX_VALUE) { throw createBusinessError(TypeErrorCodeId, `The type of \"index\" must be small integer.`); } this.checkIndex(index, this.length - 1); return this.buffer.get(index)!; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public $_get(index: int): T { if (index > Int.MAX_VALUE) { throw createBusinessError(TypeErrorCodeId, `The type of \"index\" must be small integer.`); } this.checkIndex(index, this.length - 1); return this.buffer.get(index)!; }
https://gitcode.com/iop123123/arkts-static-skills
9c099626f50fb635db2c31bacdd1439c477ebe97
gitcode
arkui-x/samples
CodeLab/Cases/feature/groupavatar/src/main/ets/model/SnapShotModel.ets
arkts
getSnapShot
获取组件截图 @param {boolean} [scale] - 指定截图时图形侧绘制pixelmap的缩放比例,比例过大时截图时间会变长,或者截图可能会失败。 @param {boolean} [waitUntilRenderFinished] - 指定是否强制等待系统执行截图指令前所有绘制指令都执行完成之后再截图 @returns {image.PixelMap} 组件截图图片数据
getSnapShot(scale: number = 1, waitUntilRenderFinished?: boolean): image.PixelMap { let snapshotOptions: componentSnapshot.SnapshotOptions = { scale, waitUntilRenderFinished } return componentSnapshot.getSync(this.componentId, snapshotOptions); }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getSnapShot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres...
getSnapShot(scale: number = 1, waitUntilRenderFinished?: boolean): image.PixelMap { let snapshotOptions: componentSnapshot.SnapshotOptions = { scale, waitUntilRenderFinished } return componentSnapshot.getSync(this.componentId, snapshotOptions); }
https://gitcode.com/arkui-x/samples
ed9ea77496694c626891826c5186cb1352f6a2db
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
fixAllSourcePkgFields
[修复] 批量修复所有图源的 pkg 字段 遍历所有 pkg 为空的图源,从 configJson 中提取 metadata.id 并更新 @returns 修复的图源数量
async fixAllSourcePkgFields(): Promise<number> { try { // 查询所有 pkg 为空的图源 const sql = `SELECT id, name, configJson FROM comic_source WHERE pkg IS NULL OR pkg = ''`; const result = await this.databaseManager.querySql(sql, []); if (!result || result.length === 0) { logger.info(...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fixAllSourcePkgFields 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 fixAllSourcePkgFields(): Promise<number> { try { // 查询所有 pkg 为空的图源 const sql = `SELECT id, name, configJson FROM comic_source WHERE pkg IS NULL OR pkg = ''`; const result = await this.databaseManager.querySql(sql, []); if (!result || result.length === 0) { logger.info(...
https://github.com/DaLongZhuaZi/manxia
2a41ea740116e793614b2990591acfa9bb54fed5
github
ChangJing01/HarmonyOS-FinalProject
entry/src/main/ets/viewmodel/InitialData.ets
arkts
getSalesText
获取销量显示文本
getSalesText(): string { return `${this.salesCount}人已购买`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSalesText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
getSalesText(): string { return `${this.salesCount}人已购买`; }
https://github.com/ChangJing01/HarmonyOS-FinalProject
23ffaaea6722cd35cc7ef0a7c75a0579c0c038e2
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/RuntimeAudioSettingsController.ets
arkts
setAudioSyncMode
音频同步模式 0=NonBlocking / 1=Blocking。当前生产路径保留默认 Blocking, 此入口预留给未来需要切非阻塞抗抖动时使用。
setAudioSyncMode(mode: number): boolean { try { if (!testNapi) { LogHelper.warn('RuntimeAudioSettings', 'Audio', '设置音频同步模式跳过: engine not ready') return false } return nativeApi.refactoredSetAudioSyncMode(mode) } catch (err) { const message = (err as Error).message || St...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAudioSyncMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ...
setAudioSyncMode(mode: number): boolean { try { if (!testNapi) { LogHelper.warn('RuntimeAudioSettings', 'Audio', '设置音频同步模式跳过: engine not ready') return false } return nativeApi.refactoredSetAudioSyncMode(mode) } catch (err) { const message = (err as Error).message || St...
https://github.com/daugf2527/harmonyos-libretro-emulator
40a7faf199e01eae7f4f62a39eda38915e235957
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectStaticField.ets
arkts
getValue
Reads value from an instance field. @returns { Any } field value. @throws { OutofMemoryError } if there is no memory to allocate return value. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getValue(): Any { return super.getValue(undefined) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue 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 Any AST#ident...
public getValue(): Any { return super.getValue(undefined) }
https://gitcode.com/iop123123/arkts-static-skills
d593857245c4dad5f502d73b22501255611e3386
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
indexOf
Returns the first index where `value` is found in the buffer. @param {string | int | double | long | Buffer | Uint8Array} value - The value to search for @param {int} [byteOffset=0] - The byte position to start searching from. - If negative, it is counted from the end of the buffer (`len + byteOffset`). - If out of bou...
public indexOf(value: string | int | double | long | Buffer | Uint8Array, byteOffset?: int, encoding?: BufferEncoding): int { const searchBuffer = this.normalizeValueToBuffer(value, encoding ?? "utf8"); const len: int = this.length; const searchLen = searchBuffer.length; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left ...
public indexOf(value: string | int | double | long | Buffer | Uint8Array, byteOffset?: int, encoding?: BufferEncoding): int { const searchBuffer = this.normalizeValueToBuffer(value, encoding ?? "utf8"); const len: int = this.length; const searchLen = searchBuffer.length; ...
https://gitcode.com/iop123123/arkts-static-skills
79405b2cf0662279ff2f4c973ec387742c42336c
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitUint64
访问 uint64 字段 JSON: string (避免精度丢失)
visitUint64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitUint64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigint AST#identifier#Right AST#,#Left , AS...
visitUint64(value: bigint, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value.toString() as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
a744cc54ce4da9ab59a242781ddfd891021f89c2
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Creates a new BigInt64Array using initializer @param { FixedArray<Object> } data - initializer @returns { BigInt64Array } - a new BigInt64Array @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(data: FixedArray<Object>): BigInt64Array { throw new Error("BigInt64Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public of(data: FixedArray<Object>): BigInt64Array { throw new Error("BigInt64Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
476d5461973d47fe5e912c83b17c56a20f615895
gitcode
wgli-collab/qs-arkts
entry/src/main/ets/pages/Index.ets
arkts
t2_nestedKeys
T2: Nested keys a[b][c]=d
t2_nestedKeys(): void { const r: Record<string, Object> = parse('a[b][c]=d'); const expected: string = '{"a":{"b":{"c":"d"}}}'; const actual: string = JSON.stringify(r); this.record('T2 Nested keys', expected === actual, expected, actual); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t2_nestedKeys 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...
t2_nestedKeys(): void { const r: Record<string, Object> = parse('a[b][c]=d'); const expected: string = '{"a":{"b":{"c":"d"}}}'; const actual: string = JSON.stringify(r); this.record('T2 Nested keys', expected === actual, expected, actual); }
https://github.com/wgli-collab/qs-arkts
ff4d2bf1844e8b44b2e81267a823c2aea14a4d86
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/SongItemBuilder.ets
arkts
getRealUrl
Descriptor for AVPlayer.fdSrc after a successful build.
public getRealUrl(): resourceManager.RawFileDescriptor | undefined { Logger.info(`url ${this.realUrl}`); return this.realUrl; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRealUrl 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_...
public getRealUrl(): resourceManager.RawFileDescriptor | undefined { Logger.info(`url ${this.realUrl}`); return this.realUrl; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ee2c2425ff526587a275cc6ca89c1b224979e9cc
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/03.numeric_types_hierarchies/hier1.ets
arkts
main
--- desc: A smaller type's value can be assigned to a larger type's variable. params: {{c.sm.split(" ").0}} to {{c.lg.split(" ").0}} ---
function main(): void { let smaller: {{c.sm}}
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 smaller: {{c.sm}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7a4e5c5b5d0b224849d425153f269faacb4d1c94
gitee
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
addDragNode
Add the first dragging node in dragging nodes 1.the first dragging node needs to distinguish the position to insert
private addDragNode(parentNodeId: number, currentNodeId: number, insertCurrentNodeId: number, isAfter: boolean, data: NodeParamV2): boolean { if (this._root === null) { this._root = new NodeItem(emptyNodeInfo); this._root.nodeLevel = this.INITIAL_INVALID_VALUE; } if (this.nod...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addDragNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentNodeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
private addDragNode(parentNodeId: number, currentNodeId: number, insertCurrentNodeId: number, isAfter: boolean, data: NodeParamV2): boolean { if (this._root === null) { this._root = new NodeItem(emptyNodeInfo); this._root.nodeLevel = this.INITIAL_INVALID_VALUE; } if (this.nod...
https://gitcode.com/openharmony/arkui_ace_engine
95d32de98d196a4c8a480536070c5a57145fc1b9
gitcode
offlinecat-dev/OCNetORM
src/main/ets/mapping/ResultSetRow.ets
arkts
getColumnNames
获取所有列名 @returns 列名数组
getColumnNames(): Array<string> { const result: Array<string> = [] this.data.forEach((_, key) => { result.push(key) }) return result }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getColumnNames 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#:#Le...
getColumnNames(): Array<string> { const result: Array<string> = [] this.data.forEach((_, key) => { result.push(key) }) return result }
https://github.com/offlinecat-dev/OCNetORM
fc81be2c26ab30d15ef6007d6e5b2babeb45253f
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Matrix4.ets
arkts
invert
/ Invert this.
invert(): number { return this.copyInverse(this); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left invert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block...
invert(): number { return this.copyInverse(this); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Matrix4.ets#L278-L280
3a3c9f4c35c842566f5f8a29a9c02ac6223b8759
github
erosTeam/NextE
shared/src/main/ets/settings/CookieJarSettings.ets
arkts
replaceFromHeader
Like applyFromHeader, but CLEARS the jar first so the result is exactly the pasted account — no cookies leftover from a previously-active account. Used by the cookie-import login so adding a second account never inherits the previous account's igneous/sk. Returns true iff both identity cookies are present.
static replaceFromHeader(header: string): boolean { EhCookieStore.getInstance().clear() return CookieJarSettings.applyFromHeader(header) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replaceFromHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left header AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static replaceFromHeader(header: string): boolean { EhCookieStore.getInstance().clear() return CookieJarSettings.applyFromHeader(header) }
https://github.com/erosTeam/NextE
085dbcfded3098a96363530ca0d014b20d6e40ad
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
getPenToolType
====== 手写笔(Pen/Stylus)处理 ====== 检测手写笔的工具类型 ArkUI SourceTool.Pen = 2, 这里还需要区分橡皮擦 注意:ArkUI 没有直接区分 PEN 和 ERASER 的 SourceTool, 但 InputKit 的 ToolType 有 RUBBER = 2 和 PENCIL = 4 这里我们只能通过 SourceTool 判断是否为笔类输入
private getPenToolType(): number { // ArkUI 层面暂无橡皮擦区分,统一为 PEN return LI_TOOL_TYPE_PEN; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getPenToolType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number A...
private getPenToolType(): number { // ArkUI 层面暂无橡皮擦区分,统一为 PEN return LI_TOOL_TYPE_PEN; }
https://github.com/AlkaidLab/moonlight-harmony
4aa65337b90378aca0f0b16117cbd212436c1242
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideorecommended/src/main/ets/view/PopularVideo.ets
arkts
mainWindowInfoChange
Updates video grid column when window breakpoint changes.
mainWindowInfoChange(): void { if (this.curBp !== this.mainWindowInfo.widthBp) { this.curBp = this.mainWindowInfo.widthBp; this.updateVideoGridColumn(); } if (this.mainWindowInfo.widthBp <= WidthBreakpoint.WIDTH_SM && this.mainWindowInfo.heightBp <= HeightBreakpoint.HEIGHT_MD) { t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mainWindowInfoChange 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#{#Left { AST#{#Right AS...
mainWindowInfoChange(): void { if (this.curBp !== this.mainWindowInfo.widthBp) { this.curBp = this.mainWindowInfo.widthBp; this.updateVideoGridColumn(); } if (this.mainWindowInfo.widthBp <= WidthBreakpoint.WIDTH_SM && this.mainWindowInfo.heightBp <= HeightBreakpoint.HEIGHT_MD) { t...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
ad59c5e19933b15330d1117cfce18c3f6780b653
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets
arkts
sub
Performs floating point subtraction of this instance with provided one, returns the result as new instance @param other Right hand side of the subtraction @returns Result of the subtraction
public sub(other: Float): Float { return new Float((this.value - other.toFloat()) as float) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sub AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public sub(other: Float): Float { return new Float((this.value - other.toFloat()) as float) }
https://gitcode.com/iop123123/arkts-static-skills
416992f836ff17a611b105f570b70ab6af4376dc
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
extractAndFindComicInfo
解压缩并查找ComicInfo.xml文件 @param archivePath 压缩文件路径 @param options 解压缩选项 @returns 解压缩结果和ComicInfo.xml内容
public async extractAndFindComicInfo( archivePath: string, options?: Partial<ExtractionOptions> ): Promise<ExtractionResultWithComicInfo> { try { // 修复扩展运算符错误:使用显式属性赋值替代扩展运算符 const extractOptions: Partial<ExtractionOptions> = { targetDirectory: options?.targetDirectory, overw...
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 extractAndFindComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left archivePath AST#identifier#Right AST#ERROR#Left...
public async extractAndFindComicInfo( archivePath: string, options?: Partial<ExtractionOptions> ): Promise<ExtractionResultWithComicInfo> { try { // 修复扩展运算符错误:使用显式属性赋值替代扩展运算符 const extractOptions: Partial<ExtractionOptions> = { targetDirectory: options?.targetDirectory, overw...
https://github.com/DaLongZhuaZi/manxia
4ac29a6c836e67e3d1210fee012a17d576774d81
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setBoolean
Sets a current JsonElement to a boolean value. @param {boolean} value - The boolean value to set
setBoolean(value: boolean): void { this.setUndefined() this.maybeBoolValue = value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) AS...
setBoolean(value: boolean): void { this.setUndefined() this.maybeBoolValue = value }
https://gitcode.com/iop123123/arkts-static-skills
5ee7bc3d4abaffebf54c4baf71f90db777acd35b
gitcode
tdcare/tdwebrtc
src/main/ets/AudioPlayback.ets
arkts
setAudioRoute
设置音频路由(听筒/扬声器) 使用 AudioRoutingManager.setCommunicationDevice 进行真正的输出设备切换 @param isSpeakerOn true为扬声器(免提),false为听筒
public async setAudioRoute(isSpeakerOn: boolean): Promise<void> { if (this.renderer === null) { LogUtil.warn('[AudioPlayback] 未初始化,无法设置音频路由'); return; } try { const startTime: number = Date.now(); const audioManager: audio.AudioManager = audio.getAudioManager(); const ...
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 setAudioRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isSpeakerOn AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async setAudioRoute(isSpeakerOn: boolean): Promise<void> { if (this.renderer === null) { LogUtil.warn('[AudioPlayback] 未初始化,无法设置音频路由'); return; } try { const startTime: number = Date.now(); const audioManager: audio.AudioManager = audio.getAudioManager(); const ...
https://github.com/tdcare/tdwebrtc
521cc8c73d5ae0c105afead86e41d7b803ec6695
github
arkui-x/samples
CodeLab/Cases/common/utils/src/main/ets/utils/NWebUtils.ets
arkts
createNWeb
创建web实例,如果已经存在web实例,复用 @param url @param uiContext
function createNWeb(url: string | Resource, uiContext: UIContext): void { if (currentNode.webController && currentNode.nWebController && currentNode.url !== url || !currentNode.lastNetAvailable) { loadUrl(url); connection.hasDefaultNet().then((data: boolean) => { currentNode.lastNetAvailable = data;...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createNWeb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function createNWeb(url: string | Resource, uiContext: UIContext): void { if (currentNode.webController && currentNode.nWebController && currentNode.url !== url || !currentNode.lastNetAvailable) { loadUrl(url); connection.hasDefaultNet().then((data: boolean) => { currentNode.lastNetAvailable = data;...
https://gitcode.com/arkui-x/samples
5187b0c10cbadc27af22ee236f5249d7dd345edb
gitcode
arkui-x/samples
CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
setFullScreenRoutes
设置折叠屏下全屏路由信息
public static setFullScreenRoutes(routes: string[]) { DynamicsRouter.fullScreenRoutes = routes; }
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 setFullScreenRoutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left routes AST#identifier#Right AST#:#L...
public static setFullScreenRoutes(routes: string[]) { DynamicsRouter.fullScreenRoutes = routes; }
https://gitcode.com/arkui-x/samples
6e091e3dba4ee9b5a6b2259b2c103758607d8b2e
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_api/src/main/ets/services/MineService.ets
arkts
deleteFromHistory
从浏览历史中删除 @param label
public deleteFromHistory(label: string) { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; const index = mineUserInfo?.myHistory.findIndex(id => id === label); if (index !== -1) { mineUserInfo?.myHistory.splice(index, 1); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteFromHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public deleteFromHistory(label: string) { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; const index = mineUserInfo?.myHistory.findIndex(id => id === label); if (index !== -1) { mineUserInfo?.myHistory.splice(index, 1); } }
https://github.com/xblLab/HarmonyProjectTemplate
800450eb8bf8e675278738cef601be1156d8a03e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { number } value - value to set @returns { Int16Array } - an Int16Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStage...
public with(index: int, value: number): Int16Array { let res = new Int16Array(this) res.set(index, value.toShort()) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: number): Int16Array { let res = new Int16Array(this) res.set(index, value.toShort()) return res }
https://gitcode.com/iop123123/arkts-static-skills
05a74ad881889b190ad832ef7a434b03d2710341
gitcode
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/HomePage.ets
arkts
dealAllError
Handle the error.
dealAllError(error: BusinessError): void { hilog.error(domainId, logTag, `Failed to login, errorCode: ${error.code}, errorMsg: ${error.message}`); /* * In app sign-in scenarios involving UI interactions, * it is recommended to guide users with the following error code prompts: * */ if (erro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dealAllError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BusinessError AST#identifier#Right AST#)#L...
dealAllError(error: BusinessError): void { hilog.error(domainId, logTag, `Failed to login, errorCode: ${error.code}, errorMsg: ${error.message}`); /* * In app sign-in scenarios involving UI interactions, * it is recommended to guide users with the following error code prompts: * */ if (erro...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
12f14edb3b4b49759ca3be4dbd5c5556da7d484d
gitcode
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/PlayerDataUtil.ets
arkts
getCurrentSongItem
Current SongItem from appState queue and selectIndex.
private static getCurrentSongItem(appState: MusicAppState): SongItem | undefined { return appState.getCurrentSongItem(); }
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 getCurrentSongItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appState AST#identifier#Right AST...
private static getCurrentSongItem(appState: MusicAppState): SongItem | undefined { return appState.getCurrentSongItem(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
dffafff39d6e26aa1b21743aa001f7ee2bc5e73f
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
invalidateEntity
使指定实体的所有缓存失效 @param entityName 实体名称
invalidateEntity(entityName: string): void { const prefix = `${this.encodeKeyPart(this.namespace)}\x00${this.encodeKeyPart(entityName)}\x00` const keysToDelete: Array<string> = [] this.cache.forEach((_: CacheEntry, key: string) => { if (key.startsWith(prefix)) { keysToDelete.push(key) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left invalidateEntity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) ...
invalidateEntity(entityName: string): void { const prefix = `${this.encodeKeyPart(this.namespace)}\x00${this.encodeKeyPart(entityName)}\x00` const keysToDelete: Array<string> = [] this.cache.forEach((_: CacheEntry, key: string) => { if (key.startsWith(prefix)) { keysToDelete.push(key) ...
https://github.com/offlinecat-dev/OCNetORM
fab8823684f6ab68ec673c86efc83fa88cd1f868
github
arkui-x/samples
CodeLab/Cases/feature/customview/src/main/ets/view/CustomView.ets
arkts
achieveEffect
实现动画效果
achieveEffect(temIndex: number) { // 高性能知识点:scrollToIndex方法,开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题 this.scroller.scrollToIndex(temIndex, true, ScrollAlign.START); this.wantGoIndex = temIndex; // 动画效果 animateTo({ duration: Math.abs(temIndex - this.currentIndex) * this.durationRadi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left achieveEffect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left temIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST...
achieveEffect(temIndex: number) { // 高性能知识点:scrollToIndex方法,开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题 this.scroller.scrollToIndex(temIndex, true, ScrollAlign.START); this.wantGoIndex = temIndex; // 动画效果 animateTo({ duration: Math.abs(temIndex - this.currentIndex) * this.durationRadi...
https://gitcode.com/arkui-x/samples
83824316aa2be1c6a4c3fbbec88f5f5b4873fdac
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SeasonalityDetectionService.ets
arkts
determineStrength
判断季节性强度
private static determineStrength(confidence: number): string { if (confidence < 0.3) { return SEASONALITY_STRENGTH_NONE; } else if (confidence < 0.5) { return SEASONALITY_STRENGTH_WEAK; } else if (confidence < 0.7) { return SEASONALITY_STRENGTH_MODERATE; } else { return SEASONA...
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 determineStrength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left confidence AST#identifier#Right AST#ERROR#Left AS...
private static determineStrength(confidence: number): string { if (confidence < 0.3) { return SEASONALITY_STRENGTH_NONE; } else if (confidence < 0.5) { return SEASONALITY_STRENGTH_WEAK; } else if (confidence < 0.7) { return SEASONALITY_STRENGTH_MODERATE; } else { return SEASONA...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
05497b5c8391a9c357993a22848f855b4a1e1af4
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/tests/NeurologyAgentTest.ets
arkts
testGetConfidenceScore
测试getConfidenceScore方法
async testGetConfidenceScore(): Promise<void> { console.log('【测试2】getConfidenceScore方法测试'); const testCases = [ { question: '脑梗塞急性期怎么处理', minScore: 0.9 }, { question: '帕金森病用药指导', minScore: 0.85 }, { question: '偏头痛怎么治疗', minScore: 0.8 }, { question: '老年痴呆早期症状', minScore: 0.8 }, ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testGetConfidenceScore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#...
async testGetConfidenceScore(): Promise<void> { console.log('【测试2】getConfidenceScore方法测试'); const testCases = [ { question: '脑梗塞急性期怎么处理', minScore: 0.9 }, { question: '帕金森病用药指导', minScore: 0.85 }, { question: '偏头痛怎么治疗', minScore: 0.8 }, { question: '老年痴呆早期症状', minScore: 0.8 }, ...
https://github.com/LJ666-ui/harmony-health-care
4875cb89431d9bec5b00020019dc5ce3092e535e
github
erosTeam/NextE
shared/src/main/ets/model/EhGallery.ets
arkts
renderKey
LazyForEach identity must change when async tag translation fills display text.
renderKey(): string { let key: string = `${this.gid}:${this.translated}` for (let i = 0; i < this.simpleTags.length; i++) { const tag: SimpleTag = this.simpleTags[i] key = `${key}:${tag.namespace}:${tag.text}:${tag.siteLabel}:${tag.translat}` } for (let i = 0; i < this.tagGroups.length; i+...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left renderKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bl...
renderKey(): string { let key: string = `${this.gid}:${this.translated}` for (let i = 0; i < this.simpleTags.length; i++) { const tag: SimpleTag = this.simpleTags[i] key = `${key}:${tag.namespace}:${tag.text}:${tag.siteLabel}:${tag.translat}` } for (let i = 0; i < this.tagGroups.length; i+...
https://github.com/erosTeam/NextE
c51236d9a6980d7f6c75e43a44abf9bed85bc5c8
github
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
probePolylineAnnotationPageIndices
在 TaskPool 中分批探测含折线批注的页码;主线程仅 await,不执行 getPage。
public async probePolylineAnnotationPageIndices( documentPath: string, openPassword: string, onBatchComplete?: (processedEnd: number, total: number) => void ): Promise<number[]> { const total = this.pages.length; if (total === 0 || documentPath.length === 0) { return []; } const P...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left probePolylineAnnotationPageIndices AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left documentPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#st...
public async probePolylineAnnotationPageIndices( documentPath: string, openPassword: string, onBatchComplete?: (processedEnd: number, total: number) => void ): Promise<number[]> { const total = this.pages.length; if (total === 0 || documentPath.length === 0) { return []; } const P...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L1274-L1305
178a9936f9809e394d2fd3076274c1be046f53a8
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/Auth.ets
arkts
fromResponse
从接口响应构建安全的认证对象 @param {Partial<Auth>} data - 接口返回的认证数据 @returns {Auth} 已兜底的认证对象
static fromResponse(data: Partial<Auth>): Auth { return new Auth(data); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre...
static fromResponse(data: Partial<Auth>): Auth { return new Auth(data); }
https://github.com/Joker-x-dev/CoolMallArkTS
740afef730b66272c973b8c9edbc303e83d122cf
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets
arkts
setLoop
设置loop函数
setLoop(loopValue: boolean): void { if (this.avPlayer != undefined) { this.avPlayer.loop = loopValue; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left loopValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
setLoop(loopValue: boolean): void { if (this.avPlayer != undefined) { this.avPlayer.loop = loopValue; } }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
da8a4af2c897bec64ca3c6ff82606f0f8ae2ea71
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
getFileSize
获取文件大小
private async getFileSize(): Promise<number> { try { let openTarget: string = this.filePath; if (!this.filePath.startsWith('file://') && !this.filePath.startsWith('/')) { openTarget = `/${this.filePath}`; } let file = SafeFileUtils.openSync(openTarget, fileIo.OpenMode.READ_ONLY); ...
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 getFileSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private async getFileSize(): Promise<number> { try { let openTarget: string = this.filePath; if (!this.filePath.startsWith('file://') && !this.filePath.startsWith('/')) { openTarget = `/${this.filePath}`; } let file = SafeFileUtils.openSync(openTarget, fileIo.OpenMode.READ_ONLY); ...
https://github.com/DaLongZhuaZi/manxia
3b20d4a38714c393626e58239de7cafbad62f542
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/entity/UserEntity.ets
arkts
constructor
token类型
constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) { this.token = token; this.expiresIn = expiresIn; this.refreshToken = refreshToken; this.expiresAt = expiresAt; this.tokenType = tokenType; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Str...
constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) { this.token = token; this.expiresIn = expiresIn; this.refreshToken = refreshToken; this.expiresAt = expiresAt; this.tokenType = tokenType; }
https://gitee.com/openharmony/developtools_profiler.git
0fe158d91cc207a443155c8998c430bf8feb2b0a
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
restore
恢复软删除的提醒
static async restore(userId: number, reminderId: number): Promise<void> { await DAOHelper.restore(Reminder.tableName, 'reminder_id', reminderId, '[ReminderDAO]'); }
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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R...
static async restore(userId: number, reminderId: number): Promise<void> { await DAOHelper.restore(Reminder.tableName, 'reminder_id', reminderId, '[ReminderDAO]'); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
28459a9c5ec0879bb84dc01c4b48b230911b52e9
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/DeviceIdProvider.ets
arkts
get
Returns the device id, generating + persisting it if missing.
async get(): Promise<DeviceIdResult> { if (this.cached !== null) { return this.cached; } // 1) Try AssetStoreKit-backed read. try { const existing: string | null = await this.assetStore.query(ASSET_ALIAS); if (existing !== null && existing.length > 0) { this.cached = new Dev...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
async get(): Promise<DeviceIdResult> { if (this.cached !== null) { return this.cached; } // 1) Try AssetStoreKit-backed read. try { const existing: string | null = await this.assetStore.query(ASSET_ALIAS); if (existing !== null && existing.length > 0) { this.cached = new Dev...
https://github.com/terryma2024/happyword
dd25a479118f98fba0c238ca1552992ea1c34d0c
github
honjow/Next2V
entry/src/main/ets/model/ImagePreviewCoordinator.ets
arkts
maxOffset
Half of how far the scaled image overflows the viewport on one axis = the max translate before a black gap would show. 0 when the scaled image still fits (no pan, stays centered). Center-pivot transform, so the overflow splits symmetrically to each side.
static maxOffset(viewport: number, displaySize: number, scale: number): number { const scaled: number = displaySize * scale const over: number = scaled - viewport return over > 0 ? over / 2 : 0 }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left maxOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewport AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Righ...
static maxOffset(viewport: number, displaySize: number, scale: number): number { const scaled: number = displaySize * scale const over: number = scaled - viewport return over > 0 ? over / 2 : 0 }
https://github.com/honjow/Next2V
c558ce4f96197d42290a3725aa573a252a7347f2
github