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
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
entries
Creates and returns an iterator of [index, byte] pairs from the contents of buf. @returns { IterableIterator<[int, long]> }
public entries(): IterableIterator<[int, long]> { return new BufferEntriesIterator(this); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries 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_sta...
public entries(): IterableIterator<[int, long]> { return new BufferEntriesIterator(this); }
https://gitcode.com/iop123123/arkts-static-skills
649013301908da26fce82da33d7e5ff0dc6469d5
gitcode
honjow/Next2V
shared/src/main/ets/services/AutoDailyCheckinService.ets
arkts
surfaceFailure
FAILURE is the actionable case: the redeem was attempted but did NOT claim (anti-bot wall / nothing claimable), so today is still unsigned. Reach the user even if the app is already backgrounded — ALWAYS post a persistent, tap-to-open notification; the shell adds a foreground toast on top for immediacy.
private static surfaceFailure(): void { const title = AppStrings.text($r('app.string.daily_checkin_notify_title'), 'Daily check-in') const text = AppStrings.text( $r('app.string.daily_checkin_failed_toast'), "Today's auto check-in didn't go through — open the app to check in manually", ) C...
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 surfaceFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private static surfaceFailure(): void { const title = AppStrings.text($r('app.string.daily_checkin_notify_title'), 'Daily check-in') const text = AppStrings.text( $r('app.string.daily_checkin_failed_toast'), "Today's auto check-in didn't go through — open the app to check in manually", ) C...
https://github.com/honjow/Next2V
0686e513a52b6d060fb650f3e98d1f28e45e457f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates a copy of Int32Array. @param { Int32Array } other - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(other: Int32Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLength = other.byteLength this.lengthInt = other.length this.byteOffset = 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Int...
public constructor(other: Int32Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLength = other.byteLength this.lengthInt = other.length this.byteOffset = 0 }
https://gitcode.com/iop123123/arkts-static-skills
86bf1d1a95f87c9c28326e19c8f37e30494825a0
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/SearchViewModel.ets
arkts
handleSearchInput
从搜索建议点击或搜索框提交时调用 先判断是否为纯数字 ID,若是则跳转详情;否则执行关键词搜索
async handleSearchInput(input: string, type: 'illust' | 'user' | 'novel' = 'illust', force = false) { const text = input.trim(); // 存数据库 const currentMode = appSettings.novel_mode ? 'novel' : 'illust'; this.getDB().saveOrUpdate(text, currentMode).then(async () => { const values = await this.getD...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left handleSearchInput AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async handleSearchInput(input: string, type: 'illust' | 'user' | 'novel' = 'illust', force = false) { const text = input.trim(); // 存数据库 const currentMode = appSettings.novel_mode ? 'novel' : 'illust'; this.getDB().saveOrUpdate(text, currentMode).then(async () => { const values = await this.getD...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/SearchViewModel.ets#L197-L227
f2ca4d8fd5d6e3d5000b3a2a1e36ad44bde112ce
github
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets
arkts
deleteLastItem
删除最后一个元素
public deleteLastItem(): void { this.dataArray.splice(-1, 1); this.notifyDataDelete(this.dataArray.length); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteLastItem 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#express...
public deleteLastItem(): void { this.dataArray.splice(-1, 1); this.notifyDataDelete(this.dataArray.length); }
https://gitee.com/openharmony/xts_tools.git
6f57c73f7b7ed8696b3265f0cca26568be03b289
gitee
openharmony/codelabs
Card/MovieCard/entry/src/main/ets/viewmodel/FormBean.ets
arkts
toValuesBucket
Get inserted form data. @return Return form data
toValuesBucket(): relationalStore.ValuesBucket { return { 'formId': this.formId, 'formName': this.formName, 'dimension': this.dimension }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toValuesBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#member_expression#Left AST#identifier#Left relationalStore AST#...
toValuesBucket(): relationalStore.ValuesBucket { return { 'formId': this.formId, 'formName': this.formName, 'dimension': this.dimension }; }
https://gitee.com/openharmony/codelabs.git
86d46cafdc056f313ad5977392c07491e2d455c7
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
find
Finds the first element in the Uint32Array that satisfies the condition @param fn condition @returns the first element that satisfies fn
public find(fn: (val: number, index: int) => boolean): number { let newF: (val: number, index: int, array: Uint32Array) => boolean = (val: number, index: int, array: Uint32Array): boolean => { return fn(val, index) } return this.find(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public find(fn: (val: number, index: int) => boolean): number { let newF: (val: number, index: int, array: Uint32Array) => boolean = (val: number, index: int, array: Uint32Array): boolean => { return fn(val, index) } return this.find(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9f91f3b3b7b68867b56cadaeec9d4958a226bb50
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
equals
Checks for equality this instance with provided object, treated as a ShortType @param {Type} other type to be checked against @returns {boolean} true if object also has ShortType and this type and other type both are reference or value @throws {Error} - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndS...
public override equals(other: Type): boolean { return other instanceof ShortType }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public override equals(other: Type): boolean { return other instanceof ShortType }
https://gitcode.com/iop123123/arkts-static-skills
50071468ef163a1a1685b6c96f45f4c12c5d1f25
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/model/RustDeskRelayConfig.ets
arkts
isValid
验证必填字段
isValid(): boolean { return this.idServer.length > 0 && this.relayServer.length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b...
isValid(): boolean { return this.idServer.length > 0 && this.relayServer.length > 0; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
7d16cbb2217c86213e09b1f2c495dbc226020475
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitMapInt32Message
访问 map<int32, message> 字段 JSON: object with string keys
visitMapInt32Message(value: Map<number, Message>, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) const obj: Record<string, Object> = {} value.forEach((v, k) => { const nestedVisitor = new JsonEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth +...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt32Message AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifi...
visitMapInt32Message(value: Map<number, Message>, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) const obj: Record<string, Object> = {} value.forEach((v, k) => { const nestedVisitor = new JsonEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth +...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
579dda5e5f6beeb31a55ff6a67915c8d7da3ed36
gitcode
openharmony/codelabs
ETSUI/SchoolTimeTable/entry/src/main/ets/service/CourseDataService.ets
arkts
getStatistics
统计方法改为直接接收数组参数,或者你可以让统计页面也使用 @StorageLink
getStatistics(): CourseStatistics { const courses = this.getAllCourses(); const stats: CourseStatistics = { totalCourses: courses.length, totalHours: 0, coursesByDay: new Map<WeekDay, number>(), }; for (let i = 1; i <= 7; i++) { stats.coursesByDay.set(i as WeekDay, 0); } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatistics 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 CourseStatistics AST#identifier#Right AST#ERROR#...
getStatistics(): CourseStatistics { const courses = this.getAllCourses(); const stats: CourseStatistics = { totalCourses: courses.length, totalHours: 0, coursesByDay: new Map<WeekDay, number>(), }; for (let i = 1; i <= 7; i++) { stats.coursesByDay.set(i as WeekDay, 0); } ...
https://gitcode.com/openharmony/codelabs
ee747099c5b2b273c8789ddd8e3f5ee401087046
gitcode
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/pages/HeartRate.ets
arkts
showWarningReminder
心率异常警告
showWarningReminder(): boolean { return this.tooHigh() || this.tooLow(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showWarningReminder 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...
showWarningReminder(): boolean { return this.tooHigh() || this.tooLow(); }
https://gitcode.com/arkui-x/samples
667e4c6132a65f3fed068f0072ae16fbfae537cb
gitcode
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/Auth.ets
arkts
shouldRefresh
检查令牌是否需要刷新(过期前15分钟) @returns {boolean} 是否需要刷新
shouldRefresh(): boolean { const currentTime: number = Date.now(); const refreshTime: number = this.createdAt + this.expire * 1000 - 15 * 60 * 1000; return currentTime >= refreshTime && !this.isRefreshTokenExpired(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldRefresh 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#state...
shouldRefresh(): boolean { const currentTime: number = Date.now(); const refreshTime: number = this.createdAt + this.expire * 1000 - 15 * 60 * 1000; return currentTime >= refreshTime && !this.isRefreshTokenExpired(); }
https://github.com/Joker-x-dev/CoolMallArkTS
81f9beadd8c605b97094f5c5267741cce15926ff
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/ThemeManager.ets
arkts
settingStatusBarBlack
设置状态栏为黑色
settingStatusBarBlack() { this.settingStatusBar({ statusBarContentColor: '#000000' }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingStatusBarBlack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl...
settingStatusBarBlack() { this.settingStatusBar({ statusBarContentColor: '#000000' }) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
1aed19e912a2ded7d0b966422ca155e3a0400dbe
gitcode
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/waterflowFad23.ets
arkts
aboutToReuse
从复用缓存中加入到组件树之前调用,可在此处更新组件的状态变量以展示正确的内容
aboutToReuse(params: Record<string, number>) { this.item = params.item; console.info('Reuse item:' + this.item); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifi...
aboutToReuse(params: Record<string, number>) { this.item = params.item; console.info('Reuse item:' + this.item); }
https://gitee.com/openharmony/xts_tools.git
da6b0c14ea9218bb064fa939d6d10071f0797d08
gitee
fbinba3955/Flymby
main/src/main/ets/pages/home/media/EmbyEpisodeDetail/index.ets
arkts
gotoPlay
去播放影片
gotoPlay(currentIndex: number | undefined) { const playerParam = new PlayerParam() const coverUrl = CommonRequest.getImageUrl({ itemId: this.mSeriesDetail?.Id ||this.mEpisodeDetail?.Id || '', maxWidth: 800, imageType: ImageType.主要图片 }) playerParam.coverUrl = coverUrl playerParam...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left gotoPlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left currentIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number...
gotoPlay(currentIndex: number | undefined) { const playerParam = new PlayerParam() const coverUrl = CommonRequest.getImageUrl({ itemId: this.mSeriesDetail?.Id ||this.mEpisodeDetail?.Id || '', maxWidth: 800, imageType: ImageType.主要图片 }) playerParam.coverUrl = coverUrl playerParam...
https://github.com/fbinba3955/Flymby
5fbafb36450b0f15945f53ead8fce2264c71120c
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getValueFromRecord
从记录中获取值
getValueFromRecord(record: HealthRecord): number { switch (this.selectedMetric) { case 'weight': return record.weight || 0; case 'heartRate': return record.heartRate || 0; case 'bloodPressure': return record.bloodPressureHigh || 0; case 'steps': return recor...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValueFromRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HealthRecord AST#identifier#Right A...
getValueFromRecord(record: HealthRecord): number { switch (this.selectedMetric) { case 'weight': return record.weight || 0; case 'heartRate': return record.heartRate || 0; case 'bloodPressure': return record.bloodPressureHigh || 0; case 'steps': return recor...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
e9226d4819b0fed90d37a02bde7ea7fe343a4e42
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
addSegment
Encodes the given path segment and appends it to the path. @param { string } [pathSegment] - path segment to be added. @returns { URI } After adding, return the URI object.
addSegment(pathSegment: string): URI { let uriStr = this.uriEntry.addSegment(encodeURIComponent(pathSegment)); return new URI(uriStr); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addSegment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pathSegment AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)...
addSegment(pathSegment: string): URI { let uriStr = this.uriEntry.addSegment(encodeURIComponent(pathSegment)); return new URI(uriStr); }
https://gitcode.com/iop123123/arkts-static-skills
fee4b42373fac5b034d51061f1cc8aaf6336cc6e
gitcode
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
getUserRecommended
─── 浏览 / 搜索 ──────────────────────────────────── 推荐书目(首页 Trending)。 注:此 endpoint 是基于登录账号历史的个性化推荐,languages 参数可能不被服务端尊重, 但仍透传以保持调用一致性。
async getUserRecommended(languages?: string[]): Promise<Book[]> { const query: QueryParams = {}; if (languages !== undefined && languages.length > 0) { query['languages'] = languages; } const json = await this.http.get<BooksEnvelope>('/eapi/user/book/recommended', query); ZLibraryClient.asse...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserRecommended AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left languages AST#identifier#Right AST#?#Left ? AST#?#Right AST#...
async getUserRecommended(languages?: string[]): Promise<Book[]> { const query: QueryParams = {}; if (languages !== undefined && languages.length > 0) { query['languages'] = languages; } const json = await this.http.get<BooksEnvelope>('/eapi/user/book/recommended', query); ZLibraryClient.asse...
https://github.com/LZZLHY/hlib
50303e663b6300d1e69fb63a2b2d3b8985a9a695
github
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/CartModel.ets
arkts
getCartList
获取购物车列表
static getCartList(): CartItemType[] { return AppStorage.get<CartItemType[]>('cartList') || []; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCartList 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...
static getCartList(): CartItemType[] { return AppStorage.get<CartItemType[]>('cartList') || []; }
https://github.com/Eklps/harmony-mall-perf
a22287004119a5fff3a5a060898dfcdedfad7486
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
reset
Resets AVPlayer and releases SongItemBuilder resources.
private async reset() { Logger.info(TAG, 'reset()'); await this.songItemBuilder.release(); if (this.avPlayer) { try { await this.avPlayer.reset(); } catch (error) { Logger.error(TAG, `${error.code} + ${error.message}`); } } this.isPrepared = false; }
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 reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#R...
private async reset() { Logger.info(TAG, 'reset()'); await this.songItemBuilder.release(); if (this.avPlayer) { try { await this.avPlayer.reset(); } catch (error) { Logger.error(TAG, `${error.code} + ${error.message}`); } } this.isPrepared = false; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
c1af0c526eeb494a8989085b54d344e88c511869
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
int64
Read signed varint64 as bigint
int64(): bigint { let x = 0n, s = 0n while (true) { const b = BigInt(this.b[this.pos++]); x |= (b & 0x7Fn) << s; if ((b & 0x80n) === 0n) break; s += 7n } const signBit = 1n << 63n return (x & signBit) !== 0n ? (x - (1n << 64n)) : x }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left int64 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 bigint AST#identifier#Right AST#ERROR#Right AST#statemen...
int64(): bigint { let x = 0n, s = 0n while (true) { const b = BigInt(this.b[this.pos++]); x |= (b & 0x7Fn) << s; if ((b & 0x80n) === 0n) break; s += 7n } const signBit = 1n << 63n return (x & signBit) !== 0n ? (x - (1n << 64n)) : x }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
4d5c9520be178b8458e622b25d3b5480faf118c4
gitcode
openharmony-sig/ohos-beacon-library
library/src/main/ets/components/beacon/logging/LogManager.ets
arkts
d
Send a debug log message to the logger. @param message The message you would like logged. This message may contain string formatting which will be replaced with values from args. @param args Arguments for string formatting.
public static d(message: string, ...args: Object[]): void { LogManager.sLogger.d(message, args); }
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#identifier#Left d AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right ...
public static d(message: string, ...args: Object[]): void { LogManager.sLogger.d(message, args); }
https://gitee.com/openharmony-sig/ohos-beacon-library.git
fecb8cdfbf5d1e3461ddf27cbd7e8bb0748df218
gitee
the-wwyang/kids-learning-app
src/main/ets/utils/AnimationUtils.ets
arkts
calculateStaggerDelay
计算阶梯延迟(用于列表项依次动画) @param index 元素索引 @param stepDelay 每步延迟时间(毫秒) @returns 延迟时间
static calculateStaggerDelay(index: number, stepDelay: number = 50): number { return index * stepDelay; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStaggerDelay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
static calculateStaggerDelay(index: number, stepDelay: number = 50): number { return index * stepDelay; }
https://github.com/the-wwyang/kids-learning-app
73770ab7a749bec9fed29c135ae362a151b9fd9a
github
richshaw2015/nds
ohos/entry/src/test/DependencyRelations.test.ets
arkts
reset
重置所有状态
reset(): void { this.settingStates.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.settingStates.clear(); }
https://github.com/richshaw2015/nds
f9ef43e0d6585daa06966e395af0b89281255887
github
harmonyos/codelabs
HarmonyOS_NEXT/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
getFruitData
Process the data obtained from the database.
async getFruitData() { this.fruitData = await this.getPreference(); return this.fruitData; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFruitData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R...
async getFruitData() { this.fruitData = await this.getPreference(); return this.fruitData; }
https://gitee.com/harmonyos/codelabs.git
86d5fee9864f71af5698527c9145eb0dc5306f9e
gitee
the-wwyang/kids-learning-app
src/main/ets/storage/UserSettingsStorageService.ets
arkts
exportSettings
导出设置为JSON字符串 @returns JSON字符串
static async exportSettings(): Promise<string> { try { const settings = await UserSettingsStorageService.loadSettings(); return JSON.stringify(settings, null, 2); } catch (error) { console.error('[UserSettingsStorage] Failed to export settings:', error); return '{}'; } }
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 exportSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async exportSettings(): Promise<string> { try { const settings = await UserSettingsStorageService.loadSettings(); return JSON.stringify(settings, null, 2); } catch (error) { console.error('[UserSettingsStorage] Failed to export settings:', error); return '{}'; } }
https://github.com/the-wwyang/kids-learning-app
bb518f0a3612a95cf322b09160f9359f42f50420
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
mergeChunks
合并数据块为单个 Uint8Array
private mergeChunks(chunks: Uint8Array[]): Uint8Array { if (chunks.length === 1) return chunks[0]; const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0); const result = new Uint8Array(totalLength); let offset = 0; for (const chunk of chunks) { result.set(chunk, offset); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeChunks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
private mergeChunks(chunks: Uint8Array[]): Uint8Array { if (chunks.length === 1) return chunks[0]; const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0); const result = new Uint8Array(totalLength); let offset = 0; for (const chunk of chunks) { result.set(chunk, offset); ...
https://github.com/richshaw2015/nds
29bd762aa532883a181476862f2716ad39a5841b
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
getAllUnknownWords
获取所有未知词汇
getAllUnknownWords(): UnknownWordInfo[] { return Array.from(this.unknownWords.values()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllUnknownWords 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#:#...
getAllUnknownWords(): UnknownWordInfo[] { return Array.from(this.unknownWords.values()); }
https://github.com/CLMC2025/Vignette
434e4e0d2a2914a0035054c392e027530cac480f
github
OHPG/FinSdk
jellyfin/src/main/ets/api/MediaInfoApi.ets
arkts
getPlaybackInfo
getPlaybackInfo @summary Gets live playback media info for an item. @param {MediaInfoApiGetPlaybackInfoRequest} requestParameters Request parameters. @throws {RequiredError} @memberof MediaInfoApi
public async getPlaybackInfo(requestParameters: MediaInfoApiGetPlaybackInfoRequest): Promise<PlaybackInfoResponse> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/PlaybackInfo`, parameters: requestParameters, excludeParams: ['itemId']}) }
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 getPlaybackInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right A...
public async getPlaybackInfo(requestParameters: MediaInfoApiGetPlaybackInfoRequest): Promise<PlaybackInfoResponse> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/PlaybackInfo`, parameters: requestParameters, excludeParams: ['itemId']}) }
https://github.com/OHPG/FinSdk
329c03ce6f5d2c275057d5dd4f273e0f61794172
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/BackgroundStreamService.ets
arkts
cleanup
清理所有资源
private async cleanup(): Promise<void> { // 取消监听 this.unregisterCancelListener(); // 停止长时任务 try { if (this.context) { await backgroundTaskManager.stopBackgroundRunning(this.context); console.info(`${TAG} 长时任务已停止`); } } catch (err) { console.warn(`${TAG} 停止长时任务失败:...
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 cleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
private async cleanup(): Promise<void> { // 取消监听 this.unregisterCancelListener(); // 停止长时任务 try { if (this.context) { await backgroundTaskManager.stopBackgroundRunning(this.context); console.info(`${TAG} 长时任务已停止`); } } catch (err) { console.warn(`${TAG} 停止长时任务失败:...
https://github.com/AlkaidLab/moonlight-harmony
80c6105f4daa96dc90b2970e36709791ddf65a01
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
clearBackgroundImageFromSettings
清除使用特定背景图片的电子书阅读设置 将使用该图片的电子书背景设置重置为默认颜色背景
public async clearBackgroundImageFromSettings(imagePath: string): Promise<number> { try { // 更新所有使用该背景图片的电子书阅读设置 const sql = `UPDATE ebook_reading_settings SET backgroundType = 'COLOR', backgroundImagePath = '' WHERE backgroundImagePath = ?`; await this.db...
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 clearBackgroundImageFromSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imagePath AST#identifier#Right AST#ERR...
public async clearBackgroundImageFromSettings(imagePath: string): Promise<number> { try { // 更新所有使用该背景图片的电子书阅读设置 const sql = `UPDATE ebook_reading_settings SET backgroundType = 'COLOR', backgroundImagePath = '' WHERE backgroundImagePath = ?`; await this.db...
https://github.com/DaLongZhuaZi/manxia
1ce277472e0b8f761725aaea769e01f60ba2b59b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets
arkts
innerRule
内嵌规则替换(同步版本) 参考: RuleAnalyzer.kt 的 innerRule()
private innerRule(str: string, startStr: string, endStr: string, fr: (expr: string) => string): string { const result: string[] = []; let pos = 0; let startX = 0; while (pos < str.length) { const startIndex = str.indexOf(startStr, pos); if (startIndex === -1) { break; } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left innerRule 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 stri...
private innerRule(str: string, startStr: string, endStr: string, fr: (expr: string) => string): string { const result: string[] = []; let pos = 0; let startX = 0; while (pos < str.length) { const startIndex = str.indexOf(startStr, pos); if (startIndex === -1) { break; } ...
https://github.com/DaLongZhuaZi/manxia
2dbd7ceaf9ef7883b7a865bb3e79db6e24c6bdb5
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/JMap.ets
arkts
keysByValue
获取key通过value
keysByValue(_value:T2):Array<T1> { let arr: Array<T1> = new Array(); for (let i = 0; i < this.elements.length; i++) { if(_value == this.elements[i].value){ arr.push(this.elements[i].key); } } return arr; };
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left keysByValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
keysByValue(_value:T2):Array<T1> { let arr: Array<T1> = new Array(); for (let i = 0; i < this.elements.length; i++) { if(_value == this.elements[i].value){ arr.push(this.elements[i].key); } } return arr; };
https://gitee.com/openharmony-sig/commons-cli.git
8e1e0226aa35762a2c43a2035585dbeafd38be62
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
cleanMangaCache
清理指定漫画的缓存
async cleanMangaCache(sourceId: number, mangaId: string): Promise<void> { try { if (!this.ensureCachePathsReady('cleanMangaCache')) { return; } const safeMangaId = mangaId.replace(/[^a-zA-Z0-9_-]/g, '_'); const mangaPath = `${this.permanentCachePath}/source_${sourceId}/manga_${safe...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cleanMangaCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async cleanMangaCache(sourceId: number, mangaId: string): Promise<void> { try { if (!this.ensureCachePathsReady('cleanMangaCache')) { return; } const safeMangaId = mangaId.replace(/[^a-zA-Z0-9_-]/g, '_'); const mangaPath = `${this.permanentCachePath}/source_${sourceId}/manga_${safe...
https://github.com/DaLongZhuaZi/manxia
32ea95abb3d153cf240445ee85d4b724eae1d6db
github
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
sampleIntensity
Sample intensity at given angles @param cAngle C-plane angle in degrees (0-360) @param gAngle Gamma angle in degrees (0-180) @returns Intensity in cd/klm
public sampleIntensity(cAngle: number, gAngle: number): number { return eulumdat_napi.sampleIntensity(cAngle, gAngle); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sampleIntensity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cAngle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public sampleIntensity(cAngle: number, gAngle: number): number { return eulumdat_napi.sampleIntensity(cAngle, gAngle); }
https://github.com/holg/eulumdat-rs
6c91af43834bbea3f965c137c76737dfc1a9830d
github
HarmonyOS_Samples/BestPracticeSnippets
AppColdStart/entry/src/main/ets/utils/NetRequest.ets
arkts
transcodePixelMap
Use createPixelMap to replace pictures of ArrayBuffer types with PixelMap types.
function transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); co...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left transcodePixelMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); co...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
f41bdf082b783cbb3bf6c18c1a4e29ed25a141d8
gitcode
killetom/ktretrofit
entry/src/main/ets/example/RetrofitConfigExample.ets
arkts
getUserByIdExample
Get user by ID
getUserByIdExample(id: number): User { try { const userService = this.createUserService(); const call = userService.getUserById(id); const response = call.execute(); console.log('User fetched successfully:', response.body); return response.getNotNullBody(); } catch (error) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserByIdExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ...
getUserByIdExample(id: number): User { try { const userService = this.createUserService(); const call = userService.getUserById(id); const response = call.execute(); console.log('User fetched successfully:', response.body); return response.getNotNullBody(); } catch (error) { ...
https://github.com/killetom/ktretrofit
220a85b8aa7fb2f75c9c38579bb28c44797511b3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
applyXPathPredicate
应用XPath谓词
private applyXPathPredicate(elements: string[], pred: XPathPredicate): string[] { switch (pred.type) { case 'position': const idx = (pred.position || 1) - 1; return idx >= 0 && idx < elements.length ? [elements[idx]] : []; case 'last': return elements.length > 0 ? [ele...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyXPathPredicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
private applyXPathPredicate(elements: string[], pred: XPathPredicate): string[] { switch (pred.type) { case 'position': const idx = (pred.position || 1) - 1; return idx >= 0 && idx < elements.length ? [elements[idx]] : []; case 'last': return elements.length > 0 ? [ele...
https://github.com/DaLongZhuaZi/manxia
1373febe26fec5ff1e7c5d51ce43bdb4da6055d2
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
arkts
stop
停止智能码率调节
async stop(): Promise<void> { if (!this.enabled) return; if (this.tickInterval >= 0) { clearInterval(this.tickInterval); this.tickInterval = -1; } this.unsubscribeNetworkBoostSignals(); // 通知服务端关闭 if (this.serverSupported) { await this.nvHttp.setAbrMode({ enabled: ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stop AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left...
async stop(): Promise<void> { if (!this.enabled) return; if (this.tickInterval >= 0) { clearInterval(this.tickInterval); this.tickInterval = -1; } this.unsubscribeNetworkBoostSignals(); // 通知服务端关闭 if (this.serverSupported) { await this.nvHttp.setAbrMode({ enabled: ...
https://github.com/AlkaidLab/moonlight-harmony
41d6d501cb96cff2b93fe95dffcf79039af6a503
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
getGroupWithPermission
获取待授权权限及其所属权限组 @param reqPerms 权限 @param reqPermsState 权限状态 return key:权限组,value:待授权权限
private getGroupWithPermission( reqPerms: Permission[], reqPermsState: number[] ): Map<PermissionGroup, Set<Permission>> { if (reqPerms.length !== reqPermsState.length) { return new Map<PermissionGroup, Set<Permission>>(); } let groupWithPermission: Map<PermissionGroup, Set<Permission>> = new ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGroupWithPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reqPerms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#su...
private getGroupWithPermission( reqPerms: Permission[], reqPermsState: number[] ): Map<PermissionGroup, Set<Permission>> { if (reqPerms.length !== reqPermsState.length) { return new Map<PermissionGroup, Set<Permission>>(); } let groupWithPermission: Map<PermissionGroup, Set<Permission>> = new ...
https://gitee.com/openharmony/applications_permission_manager.git
257364daa5fdc77448865138060a077a9c2c8644
gitee
FinalScave/SweetEditor
platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets
arkts
setReadOnly
==================== Read-Only Mode ====================
setReadOnly(readOnly: boolean): EditorActionResult { return CoreProtocol.decodeEditorActionResult(native.editorSetReadOnly(this.handle, readOnly)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setReadOnly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left readOnly AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ) AST#...
setReadOnly(readOnly: boolean): EditorActionResult { return CoreProtocol.decodeEditorActionResult(native.editorSetReadOnly(this.handle, readOnly)); }
https://github.com/FinalScave/SweetEditor
43a303178cab091f88a8dea09d301c53add7b1bb
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets
arkts
resetPassword
重置密码按钮点击 @returns {void} 无返回值
resetPassword(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetPassword 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#L...
resetPassword(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
599308c70788d76fd7e0fda520339dd7edb372ea
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
enableLog
print log? @param enable @return BleManager
public enableLog(enable: boolean): BleManager { BleLog.isPrint = enable; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bool...
public enableLog(enable: boolean): BleManager { BleLog.isPrint = enable; return this; }
https://gitee.com/openharmony-sig/FastBle.git
3fbae352d24cd9b92a6875a9493d49d1eb7ce6e4
gitee
openharmony/arkcompiler_taihe_ffi_gen
test/ani_union/user/main.ets
arkts
test_2_primitive1
2 个组合 primitive
function test_2_primitive1() { let instance: UnionTest1.MyInterface = UnionTest1.getInterface(); instance.funcUnionPrimitiveReturn("s"); instance.funcUnionPrimitiveReturn("i8"); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_2_primitive1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_d...
function test_2_primitive1() { let instance: UnionTest1.MyInterface = UnionTest1.getInterface(); instance.funcUnionPrimitiveReturn("s"); instance.funcUnionPrimitiveReturn("i8"); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
55319faa66ed56a451252275d3c5abab8e706e89
gitcode
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawArcText
Draw text in the internal fan area.
drawArcText() { if (this.canvasContext !== undefined) { this.canvasContext.textAlign = CommonConstants.TEXT_ALIGN; this.canvasContext.textBaseline = CommonConstants.TEXT_BASE_LINE; this.canvasContext.fillStyle = ColorConstants.TEXT_COLOR; this.canvasContext.font = StyleConstants.ARC_TEXT_S...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawArcText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
drawArcText() { if (this.canvasContext !== undefined) { this.canvasContext.textAlign = CommonConstants.TEXT_ALIGN; this.canvasContext.textBaseline = CommonConstants.TEXT_BASE_LINE; this.canvasContext.fillStyle = ColorConstants.TEXT_COLOR; this.canvasContext.font = StyleConstants.ARC_TEXT_S...
https://gitee.com/harmonyos/codelabs.git
49fc6c071a49a50ba213035b91d44acc05a41aed
gitee
popsiclelmlm/Hey
entry/src/main/ets/core/XrayConfig.ets
arkts
isSupportedProtocol
协议是否被本 App 支持:Xray 核心原生支持,或须交给 sing-box 的协议(anytls/tuic)。 校验闸门用它放行节点;真正用哪个内核由 ConnectionController 按协议决定。
function isSupportedProtocol(protocol: string): boolean { const lower = protocol.toLowerCase(); return SUPPORTED_PROTOCOLS.indexOf(lower) >= 0 || isSingboxOnlyProtocol(lower); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isSupportedProtocol AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left protocol AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function isSupportedProtocol(protocol: string): boolean { const lower = protocol.toLowerCase(); return SUPPORTED_PROTOCOLS.indexOf(lower) >= 0 || isSingboxOnlyProtocol(lower); }
https://github.com/popsiclelmlm/Hey
49978f7cd17448db86fa6b8cca0bd58fed097e34
github
YANGZX22/Voot
entry/src/main/ets/workers/NonStreamingAsrWithVadWorker.ets
arkts
constructor
ignored (we always use rawfile)
constructor(modelDir?: string) { this.modelDir = modelDir; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelDir AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
constructor(modelDir?: string) { this.modelDir = modelDir; }
https://github.com/YANGZX22/Voot
a25de0a2de7e8efe8d0ce5821a8c3bfe8a20dac5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectMethod.ets
arkts
isNative
Checks if the method is a native method. @returns { boolean } Returns true if it is a native method, otherwise returns false.
public isNative(): boolean { return (this.attributes & Attributes.NATIVE) != 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isNative 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#bool...
public isNative(): boolean { return (this.attributes & Attributes.NATIVE) != 0 }
https://gitcode.com/iop123123/arkts-static-skills
253271e38e27a14ceb663989237ef7393c377958
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieRadarChartBaseModel.ets
arkts
setRotationEnabled
Set this to true to enable the rotation / spinning of the chart by touch. Set it to false to disable it. Default: true @param enabled
public setRotationEnabled(enabled: boolean): void { this.mRotateEnabled = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRotationEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setRotationEnabled(enabled: boolean): void { this.mRotateEnabled = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
24cee03dcc841e1ad5c0429deb4dcf951ebeb310
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets
arkts
processQueue
处理请求队列
private async processQueue(): Promise<void> { // 检查是否可以处理新请求 if (this.activeRequests >= this.MAX_CONCURRENT || this.requestQueue.length === 0) { return; } // 取出优先级最高的请求 const request = this.requestQueue.shift(); if (!request) { return; } this.activeRequests++; ...
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 processQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async processQueue(): Promise<void> { // 检查是否可以处理新请求 if (this.activeRequests >= this.MAX_CONCURRENT || this.requestQueue.length === 0) { return; } // 取出优先级最高的请求 const request = this.requestQueue.shift(); if (!request) { return; } this.activeRequests++; ...
https://github.com/DaLongZhuaZi/manxia
2f59d15e85e61ed191ffabaa927b0938c9c29dc6
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test22_original_index.ets
arkts
testObjectKeys
--- Object.keys on Record ---
function testObjectKeys(): string { let obj: Record<string, number> = {}; obj['a'] = 1; obj['b'] = 2; obj['c'] = 3; let keys: string[] = Object.keys(obj) as string[]; return keys.join(','); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectKeys 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_t...
function testObjectKeys(): string { let obj: Record<string, number> = {}; obj['a'] = 1; obj['b'] = 2; obj['c'] = 3; let keys: string[] = Object.keys(obj) as string[]; return keys.join(','); }
https://github.com/miaochiahao/ark-ghidra
af7813e42c366037a7645103e61c8565dcb6d50e
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/DiffEngine.ets
arkts
computeDiffWithAlignments
========== 手动对齐分段 diff ==========
private static computeDiffWithAlignments( linesA: string[], linesB: string[], options: DiffOptions, startTime: number ): DiffResult { const alignments = options.manualAlignments; const sorted: number[][] = []; alignments.forEach((b, a) => sorted.push([a, b])); sorted.sort((x, y) => x[0] - y[0]);...
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 computeDiffWithAlignments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linesA AST#identifier#Righ...
private static computeDiffWithAlignments( linesA: string[], linesB: string[], options: DiffOptions, startTime: number ): DiffResult { const alignments = options.manualAlignments; const sorted: number[][] = []; alignments.forEach((b, a) => sorted.push([a, b])); sorted.sort((x, y) => x[0] - y[0]);...
https://github.com/XJTUWYD/ArkDiff
c109d017b510b877290e6b7989c5ace4f56bf430
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GyroAssistService.ets
arkts
updateActivation
更新激活状态(根据当前手柄扳机值) 在 handleGamepadInput 中每帧调用
updateActivation(leftTrigger: number, rightTrigger: number): void { if (this._activationKey === GYRO_ACTIVATION_ALWAYS) { this.holdActive = true; return; } const wasActive = this.holdActive; if (this._activationKey === GYRO_ACTIVATION_LT) { this.holdActive = leftTrigger >= TRIGGER_...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateActivation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left leftTrigger AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left ,...
updateActivation(leftTrigger: number, rightTrigger: number): void { if (this._activationKey === GYRO_ACTIVATION_ALWAYS) { this.holdActive = true; return; } const wasActive = this.holdActive; if (this._activationKey === GYRO_ACTIVATION_LT) { this.holdActive = leftTrigger >= TRIGGER_...
https://github.com/AlkaidLab/moonlight-harmony
c4cd1279485788c2c37eb4262bf13c27ff80f10c
github
openharmony/codelabs
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
createRdbStore
Create rdb store @param {context} Context @return {globalThis.rdbStore} return rdbStore RDB database
async createRdbStore(context: Context) { if (!GlobalContext.getContext().getObject('rdbStore')) { await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG) .then((rdbStore: DataRdb.RdbStore) => { if (rdbStore) { rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM)....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createRdbStore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right A...
async createRdbStore(context: Context) { if (!GlobalContext.getContext().getObject('rdbStore')) { await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG) .then((rdbStore: DataRdb.RdbStore) => { if (rdbStore) { rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM)....
https://gitee.com/openharmony/codelabs.git
f754d0ad9f1f1fc30dc1c14f4878a17d0a1c0aa9
gitee
arkui-x/samples
CodeLab/Cases/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets
arkts
deleteData
在指定索引位置移除一个元素
public deleteData(index: number): void { this.originDataArray.splice(index, 1); this.notifyDataReload(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public deleteData(index: number): void { this.originDataArray.splice(index, 1); this.notifyDataReload(); }
https://gitcode.com/arkui-x/samples
62be50356afb24f31f83bc87450f9fa681594251
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/components/TouchPointerView.ets
arkts
setCursorType
Set cursor type
setCursorType(type: number): void { this.cursorType = type; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCursorType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A...
setCursorType(type: number): void { this.cursorType = type; }
https://github.com/tangwengang-del/freerdp-harmonyos
6b6c333b637ed0a8d6dbf8bd8a4b85c76e6f2a50
github
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/Index.ets
arkts
build
---- 构建UI ----
build() { Stack() { Scroll() { Column({ space: 12 }) { // 标题栏 Row() { Text('智家安防') .fontSize(22) .fontWeight(FontWeight.Bold) Text(this.currentTime) .fontSize(19) .fontColor('#000000') ....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { Scroll() { Column({ space: 12 }) { // 标题栏 Row() { Text('智家安防') .fontSize(22) .fontWeight(FontWeight.Bold) Text(this.currentTime) .fontSize(19) .fontColor('#000000') ....
https://github.com/LiHuaJZOAQ/GuardSysAPP
2c3f64a4fb706b25e73a3d2d184f3ac03fe2d3ae
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
removeElement
Removes a JSON element from an object by key. @param {string} key - The key to remove @returns {boolean} True if the element was removed, false otherwise
removeElement(key: string): boolean { return this.jsonType === JsonType.JsonObject ? this.maybeObjectValues!.delete(key) : false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS...
removeElement(key: string): boolean { return this.jsonType === JsonType.JsonObject ? this.maybeObjectValues!.delete(key) : false }
https://gitcode.com/iop123123/arkts-static-skills
fd6e89e855ca058bd741f5d44e0e8f50530b9876
gitcode
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/common/database/tables/SelfInfoApi.ets
arkts
insertData
Insert selfInfo. @param selfInfo @param callback
insertData(selfInfo: SelfInfo, callback : Function): void { const valueBucket = generateBucket(selfInfo); RdbUtils.insert('SelfInfo', valueBucket).then(result => { Logger.info('SelfInfoTable' + 'Insert selfInfo finished'); callback(result); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selfInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SelfInfo AST#identifier#Right AST#,#Left ...
insertData(selfInfo: SelfInfo, callback : Function): void { const valueBucket = generateBucket(selfInfo); RdbUtils.insert('SelfInfo', valueBucket).then(result => { Logger.info('SelfInfoTable' + 'Insert selfInfo finished'); callback(result); }); }
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
0c1204b1d81f16d1f40a5141e7cb630644cc234c
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
exp
Return a new Decimal whose value is the natural exponential of the value of this Decimal, i.e. the base e raised to the power the value of this Decimal, rounded to `precision` significant digits using rounding mode `rounding`. @returns { Decimal } the Decimal type
public exp(): Decimal { return this.naturalExponential(this); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left exp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right...
public exp(): Decimal { return this.naturalExponential(this); }
https://gitcode.com/iop123123/arkts-static-skills
a271b9aed4d3568d694de25c3a73166512dbb42c
gitcode
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
handleShortAndLongOption
Handles the following tokens: -S -SV -S V -S=V -S1S2 -S1S2 V -SV1=V2 -L -LV -L V -L=V -l @param token the command line token to handle
private handleShortAndLongOption(token: string): void { let t = Util.stripLeadingHyphens(token); let pos = t.indexOf('='); if (t.length == 1) { // -S if (this.options.hasShortOption(t)) { this.handleOption(this.options.getOption(t)); } else { this.handleUnknownToken(tok...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShortAndLongOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private handleShortAndLongOption(token: string): void { let t = Util.stripLeadingHyphens(token); let pos = t.indexOf('='); if (t.length == 1) { // -S if (this.options.hasShortOption(t)) { this.handleOption(this.options.getOption(t)); } else { this.handleUnknownToken(tok...
https://gitee.com/openharmony-sig/commons-cli.git
f218af4d7ee635a28c699399eb64450b7b3d41b1
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
connectToServer
--------------------------------------------------------------------------- 内部 — 服务器连接 ---------------------------------------------------------------------------
private async connectToServer(): Promise<void> { if (!this.config || !this.computer || !this.riKey) { throw new Error('配置未设置'); } // 构建 supportedVideoFormats let supportedVideoFormats = 0x0001; // H.264 let actualCodec: 'H.264' | 'HEVC' = this.config.codec; try { const caps = Str...
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 connectToServer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async connectToServer(): Promise<void> { if (!this.config || !this.computer || !this.riKey) { throw new Error('配置未设置'); } // 构建 supportedVideoFormats let supportedVideoFormats = 0x0001; // H.264 let actualCodec: 'H.264' | 'HEVC' = this.config.codec; try { const caps = Str...
https://github.com/AlkaidLab/moonlight-harmony
9d23b1fa4ddf31bd1f84f6be5a62a35480be79e4
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
ListItemAnimation
列表项动画组件
@Builder function ListItemAnimation( key: string, index: number, progress: number ): void { Column() { // 内容直接嵌入 } .opacity(progress) .translate({ y: (1 - progress) * 50 }) .animation({ duration: 300, delay: index * 50, curve: Curve.EaseOut, iterations: 1, playMode: PlayMod...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left ListItemAnimation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST...
@Builder function ListItemAnimation( key: string, index: number, progress: number ): void { Column() { // 内容直接嵌入 } .opacity(progress) .translate({ y: (1 - progress) * 50 }) .animation({ duration: 300, delay: index * 50, curve: Curve.EaseOut, iterations: 1, playMode: PlayMod...
https://github.com/CLMC2025/Vignette
4d62262f4ff7930d5c6f90a4c6f92c5f1939ac29
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/RecurringBillDatabase.ets
arkts
queryAllConfigs
查询所有定期配置(包括禁用的)
async queryAllConfigs(): Promise<RecurringBillConfig[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE); predicates.orderByDesc('createTime'); try { const resultSet = await this.rdbStore.query(predicates); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryAllConfigs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left...
async queryAllConfigs(): Promise<RecurringBillConfig[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE); predicates.orderByDesc('createTime'); try { const resultSet = await this.rdbStore.query(predicates); ...
https://github.com/qiuhaotc/HarmonyOSPlayground
7c6d49b788f8218f7f4781c4d5fe5dab606281c4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
addChapterInfo
添加章节信息
public async addChapterInfo(chapter: ChapterInfoInput): Promise<string> { try { // 确保externalId不为undefined const tempExternalId = chapter.externalId || this.generateId(); // 检查是否已存在相同externalId的章节(根据数据库唯一性约束) const checkSql = `SELECT id FROM chapter WHERE comicId = ? AND externalId ...
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 addChapterInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right AST#:#Left :...
public async addChapterInfo(chapter: ChapterInfoInput): Promise<string> { try { // 确保externalId不为undefined const tempExternalId = chapter.externalId || this.generateId(); // 检查是否已存在相同externalId的章节(根据数据库唯一性约束) const checkSql = `SELECT id FROM chapter WHERE comicId = ? AND externalId ...
https://github.com/DaLongZhuaZi/manxia
f7eccdbd7d205bfa7881cd299abffcfd6f99f9be
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
writableHighWatermark
Value of highWatermark.
get writableHighWatermark(): int { return this.writableHighWatermarkInner; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writableHighWatermark 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 int AST#i...
get writableHighWatermark(): int { return this.writableHighWatermarkInner; }
https://gitcode.com/iop123123/arkts-static-skills
16e43780621bfac5ca64dbfcfbb899ac68b1d58f
gitcode
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets
arkts
startRecorder
开始录音采集
async startRecorder(filePath: string) { try { if (canIUse('SystemCapability.FileManagement.File.FileIO')) { // 保存 文件路径 和 时间戳 this.filePath = filePath this.date_added = Date.now() // 1) 打开文件,注意设置模式 const file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startRecorder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async startRecorder(filePath: string) { try { if (canIUse('SystemCapability.FileManagement.File.FileIO')) { // 保存 文件路径 和 时间戳 this.filePath = filePath this.date_added = Date.now() // 1) 打开文件,注意设置模式 const file = fileIo.openSync(filePath, fileIo.OpenMode.CREATE | fileIo...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
175a826ecd14544cc248b393ba94f38ce39cfac3
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
refreshWebStateId
WEB STATES Updates and also returns the new webstate id built based on current time. @returns The ID.
refreshWebStateId() { this.webStateId = 'meow_' + Date.now().toString(16).padStart(16, '0'); return this.webStateId; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshWebStateId 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#...
refreshWebStateId() { this.webStateId = 'meow_' + Date.now().toString(16).padStart(16, '0'); return this.webStateId; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
cb2efec1f0de2273884ddba7011d170aebfd7446
github
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoadResult.ets
arkts
create
创建并行加载结果 @param results 各个关联的加载结果 @param totalDuration 总耗时 @returns ParallelRelationLoadResult 实例
static create(results: Array<RelationLoadResult>, totalDuration: number): ParallelRelationLoadResult { const parallelResult = new ParallelRelationLoadResult() parallelResult.results = results parallelResult.totalDuration = totalDuration return parallelResult }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left results AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
static create(results: Array<RelationLoadResult>, totalDuration: number): ParallelRelationLoadResult { const parallelResult = new ParallelRelationLoadResult() parallelResult.results = results parallelResult.totalDuration = totalDuration return parallelResult }
https://github.com/offlinecat-dev/OCNetORM
d27485bfa537104b568be81483187bca3993fccb
github
Cierra-Runis/Honey
app/entry/src/main/ets/pages/UploadAvatarPage.ets
arkts
onInit
默认头像,使用 Resource 类型
onInit() { const params = router.getParams() as any; // 使用 any 类型,或更具体的类型,如果你知道参数结构 if (params && params.avatarUrl) { this.img = params.avatarUrl; // 注意这里也需要是 Resource 类型 } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#c...
onInit() { const params = router.getParams() as any; // 使用 any 类型,或更具体的类型,如果你知道参数结构 if (params && params.avatarUrl) { this.img = params.avatarUrl; // 注意这里也需要是 Resource 类型 } }
https://github.com/Cierra-Runis/Honey
42353ca0fed269ec4b74cc4fa8ec53623a009019
github
offlinecat-dev/OCNetORM
src/main/ets/logging/Logger.ets
arkts
resetInstance
重置单例实例(仅用于测试)
static resetInstance(): void { Logger.instance = new Logger() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resetInstance 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#...
static resetInstance(): void { Logger.instance = new Logger() }
https://github.com/offlinecat-dev/OCNetORM
4441d453631a187667f2ac2ef09c080e01713012
github
HarmonyCandies/extended_text
extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets
arkts
toString
转换为字符串表示
toString(): string { return this.startFlag + this.getContent() + this.endFlag; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo...
toString(): string { return this.startFlag + this.getContent() + this.endFlag; }
https://github.com/HarmonyCandies/extended_text
151c5548555d3e9ed337582e809f45827cad5f77
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
serializeV3
============================================================================= v3 管道分隔格式 — 比 JSON 更紧凑 (~50% smaller) ============================================================================= 格式: "3\n名称\nl|a|x|y|w|h[|flags]\n..." flags: 可选字段用 key=value 对表示,仅非默认值时出现 例: "A|K65|0.5|0.3|40|40" 或 "A|K65|0.5|0.3|40|40|s=c|...
function serializeV3(profileName: string, keys: CustomKeyDef[]): string { const lines: string[] = []; lines.push('3'); // version lines.push(profileName); for (const key of keys) { const action = encodeAction(key.action); const x = Math.round(key.xPercent * 1000) / 1000; const y = Math.round(key.yP...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left serializeV3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left profileName AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function serializeV3(profileName: string, keys: CustomKeyDef[]): string { const lines: string[] = []; lines.push('3'); // version lines.push(profileName); for (const key of keys) { const action = encodeAction(key.action); const x = Math.round(key.xPercent * 1000) / 1000; const y = Math.round(key.yP...
https://github.com/AlkaidLab/moonlight-harmony
0c94d863d378f49076325701d50e619d2285e030
github
openharmony-sig/ohos_banner
library/src/main/ets/component/TransformerBanner.ets
arkts
includeSepAnimateEffects
是否包含指定动画效果 @param animatedEnum @returns
includeSepAnimateEffects(sepAnimateEnum: AnimatedEnum): boolean { if (this.supportAnimatedEnum == sepAnimateEnum) { return true; } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left includeSepAnimateEffects AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sepAnimateEnum AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left AnimatedEnum AST#identifier#Right AST...
includeSepAnimateEffects(sepAnimateEnum: AnimatedEnum): boolean { if (this.supportAnimatedEnum == sepAnimateEnum) { return true; } return false; }
https://gitee.com/openharmony-sig/ohos_banner.git
58e1a8b23569d9fbe4959124acfb3c485826790a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets
arkts
resetToDefault
重置为默认设置(所有场景使用默认详情页) 仅供测试或特殊情况使用
async resetToDefault(): Promise<void> { if (!this.settingsManager) { throw new Error('强制执行器未初始化'); } await this.settingsManager.setString(PageSettingKeys.MANGA_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT); await this.settingsManager.setString(PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE, DetailPageType....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resetToDefault AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ...
async resetToDefault(): Promise<void> { if (!this.settingsManager) { throw new Error('强制执行器未初始化'); } await this.settingsManager.setString(PageSettingKeys.MANGA_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT); await this.settingsManager.setString(PageSettingKeys.EBOOK_DETAIL_PAGE_TYPE, DetailPageType....
https://github.com/DaLongZhuaZi/manxia
5d2c658d57fed719ac9c6523b85351b659a1927d
github
Countly/countly-sdk-hos
library/src/main/ets/internal/ModuleBase.ets
arkts
consentWillChange
Called right before consents are updated.
public consentWillChange(added: string[], removed: string[], source: ConsentChangeSource): Promise<void> { return Promise.resolve(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left consentWillChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left added AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp...
public consentWillChange(added: string[], removed: string[], source: ConsentChangeSource): Promise<void> { return Promise.resolve(); }
https://github.com/Countly/countly-sdk-hos
f971b97cfc506914a7af47b51add26c4b2662401
github
FadingLight9291117/vscode-arkts
examples/sample.ets
arkts
onCountChange
监听器回调
onCountChange() { console.log('Count changed to: ' + this.count) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCountChange 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...
onCountChange() { console.log('Count changed to: ' + this.count) }
https://github.com/FadingLight9291117/vscode-arkts
c2c8c73643db973dddf2c65a666fc2c9ddc86efb
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createDeleteBillCommand
创建账单删除命令 @param userId 用户ID @param billId 账单ID @param reason 删除原因 @param expectedVersion 期望版本号
static createDeleteBillCommand( userId: number, billId: number, reason: string, expectedVersion: number ): Command { const payloadObj: DeleteBillPayload = { billId: billId, reason: reason }; const command = new Command( '', 'DeleteBill', AGGREGATE_TYPE_BILL...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDeleteBillCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
static createDeleteBillCommand( userId: number, billId: number, reason: string, expectedVersion: number ): Command { const payloadObj: DeleteBillPayload = { billId: billId, reason: reason }; const command = new Command( '', 'DeleteBill', AGGREGATE_TYPE_BILL...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
3105b2c525609ce5cf8e68a4572edb752f7beb04
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/AudioFocusManager.ets
arkts
cleanup
Cleanup audio focus manager
static cleanup(): void { console.info(`${TAG}: Cleaning up audio focus manager`); AudioFocusManager.releaseFocus(); audioManager = null; currentFocusState = null; onAudioFocusLostCallback = null; onAudioFocusGainedCallback = null; onAudioDuckCallback = null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
static cleanup(): void { console.info(`${TAG}: Cleaning up audio focus manager`); AudioFocusManager.releaseFocus(); audioManager = null; currentFocusState = null; onAudioFocusLostCallback = null; onAudioFocusGainedCallback = null; onAudioDuckCallback = null; }
https://github.com/tangwengang-del/freerdp-harmonyos
2e39cacb10a59b3fd1472a27286824ddd0ce4749
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
clearAll
清空所有历史记录 用于隐私保护或重置功能 @returns 删除的记录数量
async clearAll(): Promise<number> { logger.debug('clearAll') return this.deleteItem(this.getPredicates()) }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearAll 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#ge...
async clearAll(): Promise<number> { logger.debug('clearAll') return this.deleteItem(this.getPredicates()) }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L186-L189
d25809de84a4ba7ec9726668949207221391ff2f
github
AuspiciousSign/HarmonyOS
entry/src/main/ets/database/Rdb.ets
arkts
query
查询数据的方法,接收两个参数,谓词、回调函数
query(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { // 如果回调函数为空、或undefined 打印错误日志,退出方法 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!'); return; } // 如果rdbStore存在则...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left re...
query(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { // 如果回调函数为空、或undefined 打印错误日志,退出方法 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!'); return; } // 如果rdbStore存在则...
https://github.com/AuspiciousSign/HarmonyOS
e2cf78da62819a223b5f6a0a97fef2cccc2be3ca
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets
arkts
getAddressInfo
获取地址详情 @param {number} id - 地址 ID @returns {Promise<NetworkResponse<Address>>} 地址详情
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { const resp: AxiosResponse<NetworkResponse<Address>> = await NetworkClient.http.get("user/address/info", { params: { id } }); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAddressInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { const resp: AxiosResponse<NetworkResponse<Address>> = await NetworkClient.http.get("user/address/info", { params: { id } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
b8809bc92e8136c3ae496e529113b38a02e86d4c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SessionManager.ets
arkts
getRefreshStatistics
获取刷新统计
getRefreshStatistics(sourceId: number): string { const state = this.sessionStates.get(sourceId); if (!state) { return '无会话状态'; } const lastRefresh = new Date(state.lastRefreshTime).toLocaleString(); const nextRefresh = new Date(state.nextRefreshTime).toLocaleString(); return `活跃: $...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRefreshStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ...
getRefreshStatistics(sourceId: number): string { const state = this.sessionStates.get(sourceId); if (!state) { return '无会话状态'; } const lastRefresh = new Date(state.lastRefreshTime).toLocaleString(); const nextRefresh = new Date(state.nextRefreshTime).toLocaleString(); return `活跃: $...
https://github.com/DaLongZhuaZi/manxia
4a71c79f8409d8b926f0721328e8106894d1c4f7
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeStateController.ets
arkts
registerItemController
注册列表项控制器
public registerItemController(position: number, controller: SwipeMenuItemController): void { this._itemControllers.set(position, controller); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerItemController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public registerItemController(position: number, controller: SwipeMenuItemController): void { this._itemControllers.set(position, controller); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
134d907653fff0c01b133f6763a397d2c7330608
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/EnhancedRAGRetriever.ets
arkts
estimateTokens
估算token数量
private estimateTokens(references: KnowledgeReference[]): number { const totalContent = references .map(ref => ref.content) .join(''); // 简单估算:中文约1.5字符/token,英文约4字符/token return Math.ceil(totalContent.length / 2); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left estimateTokens AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left references AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip...
private estimateTokens(references: KnowledgeReference[]): number { const totalContent = references .map(ref => ref.content) .join(''); // 简单估算:中文约1.5字符/token,英文约4字符/token return Math.ceil(totalContent.length / 2); }
https://github.com/LJ666-ui/harmony-health-care
c597f426080576995905b2e3d9da65a2d6f6963f
github
HarmonyOS_Samples/HMRouter
entry/src/main/ets/component/live/LiveHome.ets
arkts
onAppear
[EndExclude live_home_life_cycle]
onAppear(ctx: HMLifecycleContext): void { this.commentRenderNode.makeNode(ctx.uiContext); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAppear 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 HMLifecycleContext AST#identifier#Right AST#)#Le...
onAppear(ctx: HMLifecycleContext): void { this.commentRenderNode.makeNode(ctx.uiContext); }
https://gitcode.com/HarmonyOS_Samples/HMRouter
7f35c97ad252ec14e00be03cfe09b385b2d6015a
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/pages/StreamPage.ets
arkts
onBackPress
处理返回按键 - 显示串流菜单而不是直接返回 @returns true 表示已处理返回事件,阻止默认行为
onBackPress(): boolean { // 释放所有通过 onKeyEvent 按下但未释放的物理键(防止 ESC 等键卡住) this.inputHandler.releaseAllKeys(); if (this.showStreamReport) { this.closeStreamReportAndReturn(); return true; } // 如果正在连接中,允许直接返回 if (this.viewModel.isConnecting) { return false; } // 虚拟 PC 键盘...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme...
onBackPress(): boolean { // 释放所有通过 onKeyEvent 按下但未释放的物理键(防止 ESC 等键卡住) this.inputHandler.releaseAllKeys(); if (this.showStreamReport) { this.closeStreamReportAndReturn(); return true; } // 如果正在连接中,允许直接返回 if (this.viewModel.isConnecting) { return false; } // 虚拟 PC 键盘...
https://github.com/AlkaidLab/moonlight-harmony
f90bde12a8f756b3f15101f7fc9507f698917508
github
PollenWang6/HiXD
entry/src/main/ets/services/DormWaterService.ets
arkts
toggleFavorite
===== 收藏/取消收藏 =====
async toggleFavorite(deviceId: string, remove: boolean): Promise<void> { const url: string = API_BASE + '/api/v1/dev/favo?did=' + deviceId + '&remove=' + (remove ? 'true' : 'false'); const resp: string = await httpGet(url, authHeaders()); const obj: Record<string, Object> = JSON.parse(resp) as Record<stri...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left toggleFavorite AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceId AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async toggleFavorite(deviceId: string, remove: boolean): Promise<void> { const url: string = API_BASE + '/api/v1/dev/favo?did=' + deviceId + '&remove=' + (remove ? 'true' : 'false'); const resp: string = await httpGet(url, authHeaders()); const obj: Record<string, Object> = JSON.parse(resp) as Record<stri...
https://github.com/PollenWang6/HiXD
eea6a39d471c827d8a08124bfbf0cd01b5e43514
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getNovelFontSize
获取小说字号
public static getNovelFontSize(): number { return FontAwareHelper.globalState.novelFontSize; }
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 getNovelFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public static getNovelFontSize(): number { return FontAwareHelper.globalState.novelFontSize; }
https://github.com/DaLongZhuaZi/manxia
a0d4813bcda5ee11383fe6097ff47a016ba15593
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsSpecList
查询商品规格列表 @param {GoodsIdRequest} params - 商品 ID 请求参数 @returns {Promise<NetworkResponse<GoodsSpec[]>>} 商品规格列表
async getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>> { return this.networkDataSource.getGoodsSpecList(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsSpecList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>> { return this.networkDataSource.getGoodsSpecList(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
b10aedc03c6ec21554c1d623765001a12fa42707
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
commons/componentuxexamplesbase/src/main/ets/utils/CommonUtils.ets
arkts
isClickable
Check whether a click operation can be executed (Keep this method for button debouncing in non-popup scenarios, such as page navigation.)
public static isClickable(interval: number = CommonConstants.DEFAULT_CLICK_INTERVAL): boolean { const currentTime = Date.now(); if (currentTime - CommonUtils.lastClickTime >= interval) { CommonUtils.lastClickTime = currentTime; return true; } return false; }
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 isClickable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interval AST#identifier#Right AST#:#Left : ...
public static isClickable(interval: number = CommonConstants.DEFAULT_CLICK_INTERVAL): boolean { const currentTime = Date.now(); if (currentTime - CommonUtils.lastClickTime >= interval) { CommonUtils.lastClickTime = currentTime; return true; } return false; }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
7d9eeae2bf5019fc4b074bb53b41c65d9d900259
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/PaginationHandler.ets
arkts
handleCursorPagination
处理cursor分页
handleCursorPagination( sourceId: string, response: any, config: PaginationConfig ): PaginationResult { const state = this.paginationStates.get(sourceId); if (!state) { logger.warn(TAG, `分页状态未初始化: ${sourceId}`); return { hasMore: false, nextCursor: null }; }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleCursorPagination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Lef...
handleCursorPagination( sourceId: string, response: any, config: PaginationConfig ): PaginationResult { const state = this.paginationStates.get(sourceId); if (!state) { logger.warn(TAG, `分页状态未初始化: ${sourceId}`); return { hasMore: false, nextCursor: null }; }...
https://github.com/DaLongZhuaZi/manxia
51809f992915250d2a7ea87cc07254ee76390d98
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getSetting
获取单个设置
async getSetting(key: string): Promise<UserSettingsDatabaseRecord | null> { try { const sql = 'SELECT * FROM user_settings WHERE userId = ? AND settingKey = ?'; const result = await this.databaseManager.querySql(sql, ['default_user', key]); if (result && result.length > 0) { return resul...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSetting AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async getSetting(key: string): Promise<UserSettingsDatabaseRecord | null> { try { const sql = 'SELECT * FROM user_settings WHERE userId = ? AND settingKey = ?'; const result = await this.databaseManager.querySql(sql, ['default_user', key]); if (result && result.length > 0) { return resul...
https://github.com/DaLongZhuaZi/manxia
3b1b3b719208bd4f2960e0e3a704c6fc46daaedc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets
arkts
emergencyCleanup
紧急清理(内存压力时)
async emergencyCleanup(): Promise<void> { logger.warn(TAG, '执行紧急清理...'); const managers: IPageManager[] = []; this.pageManagers.forEach((value: IPageManager) => { managers.push(value); }); let cleanedPages = 0; // 获取各页面的运行时间 interface PageUptimeInfo { pageId: string; ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left emergencyCleanup 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#:#Righ...
async emergencyCleanup(): Promise<void> { logger.warn(TAG, '执行紧急清理...'); const managers: IPageManager[] = []; this.pageManagers.forEach((value: IPageManager) => { managers.push(value); }); let cleanedPages = 0; // 获取各页面的运行时间 interface PageUptimeInfo { pageId: string; ...
https://github.com/DaLongZhuaZi/manxia
62f6ba74a519bdc8a380300186f51cff553e88c2
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitBytes
访问 bytes 字段 Wire type: 2 (length-delimited)
visitBytes(value: Uint8Array, fieldNumber: number): void { this.writer.tag(fieldNumber, 2).bytes(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitBytes 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 Uint8Array AST#identifier#Right AST#,#Left ,...
visitBytes(value: Uint8Array, fieldNumber: number): void { this.writer.tag(fieldNumber, 2).bytes(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
cc8940d750c0d87910911b880e168d4626a5a1b7
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
createAnswer
创建 Answer
public createAnswer(): string | null { if (!this.client) { LogUtil.error('[WebRTC] 客户端未初始化'); return null; } return this.client.createAnswer(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AS...
public createAnswer(): string | null { if (!this.client) { LogUtil.error('[WebRTC] 客户端未初始化'); return null; } return this.client.createAnswer(); }
https://github.com/tdcare/tdwebrtc
1b6d0fc361228c5db50d9900af2dac9e5b427ac6
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/external_manager.ets
arkts
scan_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 初始化 // //////// 扫描数据 //
async scan_data() { // 扫描歌曲(格式化完整路径) // let tmp_audio: string[] = [] for (const i of await fs.listFile(external_path)) { tmp_audio.push(external_path + i) } // 获取元数据 // const tmp_meta = await get_meta_batch(tmp_audio) // 保存 // this.save_data(tmp_meta) }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left scan_data AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#comment#Le...
async scan_data() { // 扫描歌曲(格式化完整路径) // let tmp_audio: string[] = [] for (const i of await fs.listFile(external_path)) { tmp_audio.push(external_path + i) } // 获取元数据 // const tmp_meta = await get_meta_batch(tmp_audio) // 保存 // this.save_data(tmp_meta) }
https://github.com/Nekofox-POT/LinMusic
6c47af89ccba4fada3327043ae9c9f50e910e17d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/PaginationHandler.ets
arkts
hasMoreData
是否还有更多数据
hasMoreData(sourceId: string): boolean { const state = this.paginationStates.get(sourceId); return state ? state.hasMore : false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasMoreData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
hasMoreData(sourceId: string): boolean { const state = this.paginationStates.get(sourceId); return state ? state.hasMore : false; }
https://github.com/DaLongZhuaZi/manxia
beb8bd87453fcbff7cfdb05889c043621551d802
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CategoryDAO.ets
arkts
mapRowToCategory
将查询结果映射为 Category 实例
private static mapRowToCategory(resultSet: relationalStore.ResultSet): Category { const category = new Category(); category.categoryId = resultSet.getLong(resultSet.getColumnIndex('category_id')); category.userId = resultSet.getLong(resultSet.getColumnIndex('user_id')); category.name = resultSet.getSt...
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 mapRowToCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#...
private static mapRowToCategory(resultSet: relationalStore.ResultSet): Category { const category = new Category(); category.categoryId = resultSet.getLong(resultSet.getColumnIndex('category_id')); category.userId = resultSet.getLong(resultSet.getColumnIndex('user_id')); category.name = resultSet.getSt...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
60ba6b3578b6084534bdf37dd885dbb675093166
github