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 |
|---|---|---|---|---|---|---|---|---|---|---|
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/SystemBarDemo.ets | arkts | setSystemBarStyle | 设置顶部的系统状态栏和底部的系统导航栏的样式 | setSystemBarStyle() {
let systemBarProperties: window.SystemBarProperties = {
statusBarColor: '#ff0000', // 状态栏背景色
statusBarContentColor: '#ffffff', // 状态栏前景色
navigationBarColor: '#00ff00', // 导航栏背景色(我这里测试无效)
navigationBarContentColor: '#ffffff', // 导航栏前景色(我这里测试无效)
};
this.windowC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSystemBarStyle 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#... | setSystemBarStyle() {
let systemBarProperties: window.SystemBarProperties = {
statusBarColor: '#ff0000', // 状态栏背景色
statusBarContentColor: '#ffffff', // 状态栏前景色
navigationBarColor: '#00ff00', // 导航栏背景色(我这里测试无效)
navigationBarContentColor: '#ffffff', // 导航栏前景色(我这里测试无效)
};
this.windowC... | https://github.com/webabcd/HarmonyDemo | fd5dba0aeaaa34fcd3f32855b826d35efdb9a0fb | github |
ZestBox-18/kitebook-frontend | commons/base/src/main/ets/entities/AccountBean.ets | arkts | getIconResource | 将数据库中的图标标识映射为 ArkUI 可直接使用的系统图标资源。 | getIconResource(): Resource {
const iconMap: Record<string, Resource> = {
'creditcard': $r('sys.symbol.creditcard'),
'house': $r('sys.symbol.house'),
'arrow_up_circle': $r('sys.symbol.arrow_up_circle'),
'ellipsis_circle': $r('sys.symbol.ellipsis_circle')
};
return iconMap[this.icon... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIconResource 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 Resource AST#identifier#Right AST#ERROR#Right ... | getIconResource(): Resource {
const iconMap: Record<string, Resource> = {
'creditcard': $r('sys.symbol.creditcard'),
'house': $r('sys.symbol.house'),
'arrow_up_circle': $r('sys.symbol.arrow_up_circle'),
'ellipsis_circle': $r('sys.symbol.ellipsis_circle')
};
return iconMap[this.icon... | https://github.com/ZestBox-18/kitebook-frontend | 50cd312abca5ce22a73b221fbbe3dd03b40c630c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | from | Creates a new ArrayBuffer from an array of bytes.
@param { ValueArray<byte> } arr Source byte array.
@returns { ArrayBuffer } The new ArrayBuffer.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: ValueArray<byte>): ArrayBuffer {
const bf = new ArrayBuffer(arr.length)
copyTo(arr, bf.data!, 0, 0, arr.length)
return bf
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: ValueArray<byte>): ArrayBuffer {
const bf = new ArrayBuffer(arr.length)
copyTo(arr, bf.data!, 0, 0, arr.length)
return bf
} | https://gitcode.com/iop123123/arkts-static-skills | db90eeeb13460209298de82c84467c01575b8c5b | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | setValueAt | Replace the container specified in the index corresponding keys on the key-value pair.
@param index the index of the element to replace
@param value the value of the element to replace
@throws BusinessError if the index is out of range or the container is empty. | public setValueAt(index: int, value: T): void {
this.checkIndexType(index);
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
this.buckets.setValueAt(index, value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValueAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | public setValueAt(index: int, value: T): void {
this.checkIndexType(index);
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
this.buckets.setValueAt(index, value);
} | https://gitcode.com/iop123123/arkts-static-skills | bdfafe7299b6dd07682525eec19de169952efc84 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an object of std.core.Array<int>.
@param { Array<int> } arr - An instance of the std.core.Array type to convert to an array.
@returns { Int32Array } - A new Int32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: Array<int>): Int32Array {
let result = new Int32Array(arr.length)
result.set(arr)
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: Array<int>): Int32Array {
let result = new Int32Array(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | c0d8c1e73fef489d02a2017b94ba581d831f8713 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | getVendorId | 获取厂商 ID | getVendorId(): number {
return this.vendorId;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getVendorId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getVendorId(): number {
return this.vendorId;
} | https://github.com/AlkaidLab/moonlight-harmony | f9fdabcc5da59aab55b01168d3b2a8cee9b7e1c5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | getStats | 获取统计信息 | public getStats(): AnimationStats {
return {
activeAnimations: this.activeAnimations.size,
registeredAnimations: this.animationRegistry.size
} as AnimationStats;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStats 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 AnimationStat... | public getStats(): AnimationStats {
return {
activeAnimations: this.activeAnimations.size,
registeredAnimations: this.animationRegistry.size
} as AnimationStats;
} | https://github.com/DaLongZhuaZi/manxia | 1bddd849620bf82096a6ce63eef98fce60f1ebbf | github |
CLMC2025/Vignette | entry/src/main/ets/manager/SessionPlanner.ets | arkts | getRecommendedDifficulty | 获取推荐的任务难度 | getRecommendedDifficulty(word: WordItem): TaskDifficulty {
// 根据单词状态推荐难度
if (word.status === WordStatus.NEW) {
return TaskDifficulty.EASY;
} else if (word.status === WordStatus.LEARNING) {
return TaskDifficulty.MEDIUM;
} else {
return TaskDifficulty.HARD;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecommendedDifficulty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WordItem AST#identifier#Right A... | getRecommendedDifficulty(word: WordItem): TaskDifficulty {
// 根据单词状态推荐难度
if (word.status === WordStatus.NEW) {
return TaskDifficulty.EASY;
} else if (word.status === WordStatus.LEARNING) {
return TaskDifficulty.MEDIUM;
} else {
return TaskDifficulty.HARD;
}
} | https://github.com/CLMC2025/Vignette | f7dd2f8505579bcba4de54c6f84d7e971a900e75 | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets | arkts | setCurIndex | [End set_video] | public setCurIndex(curIndex: number) {
this.curIndex = curIndex;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCurIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left curIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public setCurIndex(curIndex: number) {
this.curIndex = curIndex;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | a62c615d184afcf799e24698ba4a88d8f6c150da | gitcode |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/view/HomeMiniBarAlbumCover.ets | arkts | build | Stacks cover image, optional ring progress, and rhythm icon. | build() {
Stack({ alignContent: Alignment.Center }) {
Image(this.playerViewModel.songCover())
.width(this.coverSideLengthVp())
.height(this.coverSideLengthVp())
.borderRadius(this.coverBorderRadiusVp())
if (!this.isImmersiveFreeWindowCover()) {
Progress({
valu... | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Stack({ alignContent: Alignment.Center }) {
Image(this.playerViewModel.songCover())
.width(this.coverSideLengthVp())
.height(this.coverSideLengthVp())
.borderRadius(this.coverBorderRadiusVp())
if (!this.isImmersiveFreeWindowCover()) {
Progress({
valu... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 24ad309288e0078139c5020e3272a8ef9ae4c0d1 | gitcode |
openharmony/security_privacy_center | entry/src/main/ets/common/utils/ResourceUtil.ets | arkts | getBundleResourceManager | Get the specified package name resource manager
@params bundleName Application package name
@params context context | getBundleResourceManager(bundleName: string, context: common.Context | null): resourceManager.ResourceManager | null {
if (context === null || StringUtil.isEmpty(bundleName)) {
Logger.error(TAG, 'getBundleResourceManager error');
return null;
}
try {
let bundleContext = context.createBun... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getBundleResourceManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bundleName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | getBundleResourceManager(bundleName: string, context: common.Context | null): resourceManager.ResourceManager | null {
if (context === null || StringUtil.isEmpty(bundleName)) {
Logger.error(TAG, 'getBundleResourceManager error');
return null;
}
try {
let bundleContext = context.createBun... | https://gitee.com/openharmony/security_privacy_center.git | 88af4773006ff4e200def3889a29b8f8b553d931 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | isAutoScaleMinMaxEnabled | @return true if auto scaling on the y axis is enabled.
@default false | public isAutoScaleMinMaxEnabled(): boolean {
return this.mAutoScaleMinMaxEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAutoScaleMinMaxEnabled 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 ... | public isAutoScaleMinMaxEnabled(): boolean {
return this.mAutoScaleMinMaxEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 87e81672b39c8bf314d9e8590a62ad8f0226b267 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | isDrawMarkersEnabled | returns true if drawing the marker is enabled when tapping on values
(use the setMarker(IMarker marker) method to specify a marker)
@return | public isDrawMarkersEnabled(): boolean {
return this.mDrawMarkers;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawMarkersEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left bool... | public isDrawMarkersEnabled(): boolean {
return this.mDrawMarkers;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5fadf83671b8640ff7aa132ed6e4dd04371cd141 | gitee |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/models/user/UserModel.ets | arkts | constructor | 用户watch仓库的数量 | constructor() {
this._avatar = 'https://gitee.com/assets/no_portrait.png'
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this._avatar = 'https://gitee.com/assets/no_portrait.png'
} | https://gitee.com/openharmony-sig/online_event.git | d658e643fd088dc900b72ca141ca62c4eb60f3e4 | gitee |
bhengubv/aether-protocol | arkts/src/main/ets/market/PoVToken.ets | arkts | parse | Deserialises a snake_case JSON PoV token. `timestamp_ticks` is read as a
lossless bigint straight from the JSON text (NOT via a floating-point coercion),
so a value beyond the safe-integer range is preserved exactly. The remaining
fields are read with a small typed JSON reader. | static parse(text: string): PoVToken {
const ticks: bigint = parseTicksLiteral(text);
const obj: Record<string, ESObject> = JSON.parse(text) as Record<string, ESObject>;
const init = new PoVTokenInit();
init.witnessUhid = readString(obj, 'witness_uhid');
init.subjectUhid = readString(obj, 'subjec... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | static parse(text: string): PoVToken {
const ticks: bigint = parseTicksLiteral(text);
const obj: Record<string, ESObject> = JSON.parse(text) as Record<string, ESObject>;
const init = new PoVTokenInit();
init.witnessUhid = readString(obj, 'witness_uhid');
init.subjectUhid = readString(obj, 'subjec... | https://github.com/bhengubv/aether-protocol | 312f1d068ff01f1b3cd6fa60082b4940de1da2fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Exceptions.ets | arkts | constructor | NOTE(kparshukov): #28318 move to std/core/Errors.ets | constructor(message?: String, options?: ErrorOptions) {
super("NoDataError", message, options)
} | 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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi... | constructor(message?: String, options?: ErrorOptions) {
super("NoDataError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | 7877ad7cfd6511913e5b4e28f94593a0c526e583 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | pollComputer | 轮询单台电脑,并行尝试所有已知地址
任一地址成功即标记在线,无需等待所有地址超时
失败时不会立刻把状态标 OFFLINE:根据 offlineCount 累计达到阈值
(UNKNOWN→INITIAL_POLL_TRIES,其他→OFFLINE_POLL_TRIES)后才转 OFFLINE,
期间保留原状态,避免短暂网络抖动 / Sunshine 重启时的误报闪烁。 | async pollComputer(computer: ComputerInfo): Promise<boolean> {
const addresses = this.collectAddresses(computer);
if (addresses.length === 0) {
// 没有任何地址可试,直接认定离线;强制 OFFLINE 后计数不再被读取,清除即可
computer.state = ComputerState.OFFLINE;
this.offlineCount.delete(computer.uuid);
return false;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pollComputer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left computer AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async pollComputer(computer: ComputerInfo): Promise<boolean> {
const addresses = this.collectAddresses(computer);
if (addresses.length === 0) {
// 没有任何地址可试,直接认定离线;强制 OFFLINE 后计数不再被读取,清除即可
computer.state = ComputerState.OFFLINE;
this.offlineCount.delete(computer.uuid);
return false;
... | https://github.com/AlkaidLab/moonlight-harmony | d93b282538da7a78c6aa15693fd84ae91fda5715 | github |
YANGZX22/Voot | entry/src/main/ets/pages/ScanPage.ets | arkts | Button | 重新扫描按钮 | Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.camera'))
.fontSize(24)
.fontColor((this.activeBtn === 1 || this.activeBtn === 11) ? [THEMES[this.themeColorIndex].primaryColor] : [this.scanBtnTextColor])
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left Button AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#object#Left AST#{#Left { AST#{#Right AST#pair#Left AST#property_identifier#Left type AST#property_identifier#Right AST#:#Left : AST#:#Right AST#member_e... | Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.camera'))
.fontSize(24)
.fontColor((this.activeBtn === 1 || this.activeBtn === 11) ? [THEMES[this.themeColorIndex].primaryColor] : [this.scanBtnTextColor])
} | https://github.com/YANGZX22/Voot | bd1e37a3398aa0b85965ce53eb6a8809be15ef92 | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/view/component/TimeAnalysisCard.ets | arkts | aboutToAppear | 组件加载时先算一次 | aboutToAppear() {
this.analyze();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.analyze();
} | https://gitcode.com/openharmony/codelabs | db7e4dc4a416da26e9e337f2daa1f5bbd45bc5cb | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_complement/bitwise_complement_ubyte.ets | arkts | main | ---
desc: check bitwise complement of unsigned byte
--- | function main(): void {
const v: ubyte = {{v.value}}
assert ~(v) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const v: ubyte = {{v.value}}
assert ~(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fbd079c408416a9527efdd198d8e80ee505d1436 | gitee |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | loginExample | User login example | loginExample(username: string, password: string): LoginResponse {
try {
const userService = this.createUserService();
const call = userService.login(username, password);
const response = call.execute();
console.log('Login successful:', response.body);
return response.getNotNu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loginExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#... | loginExample(username: string, password: string): LoginResponse {
try {
const userService = this.createUserService();
const call = userService.login(username, password);
const response = call.execute();
console.log('Login successful:', response.body);
return response.getNotNu... | https://github.com/killetom/ktretrofit | 4bbf4bc0a598ce375ae0f541e12d0507d94b33a1 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | DecWritersClearState | Decrements writer count and clears lock state.
@param { long } state Current lock state
@returns { long } Updated state value with decremented writer count
@throws { RangeError } If the writer count would underflow
@syscap SystemCapability.Utils.Lang | public static DecWritersClearState(state: long): long {
if ((state & State.WRITERS_MASK) == 0) {
throw new RangeError("AsyncReadWriteLock:: Too few writers");
}
return (state - State.ONE_WRITER) & ~State.STATE_MASK;
} | 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 DecWritersClearState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#L... | public static DecWritersClearState(state: long): long {
if ((state & State.WRITERS_MASK) == 0) {
throw new RangeError("AsyncReadWriteLock:: Too few writers");
}
return (state - State.ONE_WRITER) & ~State.STATE_MASK;
} | https://gitcode.com/iop123123/arkts-static-skills | 3f0575c2b6d107bcb47e41e5bd2e5e3e8e8af16f | gitcode |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/utils/AIConfig.ets | arkts | save | 保存配置到本地存储 | static async save(context: common.UIAbilityContext, cfg: AIConfigClass): Promise<void> {
AIConfig.config = cfg;
await PreferencesUtil.saveAIConfigApiUrl(context, cfg.apiUrl);
await PreferencesUtil.saveAIConfigApiKey(context, cfg.apiKey);
await PreferencesUtil.saveAIConfigModel(context, cfg.model);
... | 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 save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async save(context: common.UIAbilityContext, cfg: AIConfigClass): Promise<void> {
AIConfig.config = cfg;
await PreferencesUtil.saveAIConfigApiUrl(context, cfg.apiUrl);
await PreferencesUtil.saveAIConfigApiKey(context, cfg.apiKey);
await PreferencesUtil.saveAIConfigModel(context, cfg.model);
... | https://github.com/electronicminer/Harmony-Markdown-Editor | eb70d142a448b2eb1973dca06e1b997d7dbdb359 | github |
CsCesium/KantaiHomo | entry/src/main/ets/infra/fairy/service/FairyService.ets | arkts | isVisible | Whether the ball is currently visible. | isVisible(): boolean {
return AppStorage.get<boolean>('fairy.visible') ?? true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isVisible 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... | isVisible(): boolean {
return AppStorage.get<boolean>('fairy.visible') ?? true;
} | https://github.com/CsCesium/KantaiHomo | 4c35da0da149613a2e8f9bd55189d669f0951c2a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | saveSessionToStorage | 保存会话到持久化存储 | private static async saveSessionToStorage(session: SessionInfo): Promise<void> {
try {
const prefs = await UserSessionService.initPreferences();
if (prefs) {
await prefs.put('current_session', session.toJSON());
await prefs.flush();
}
} catch (error) {
console.error('[U... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left saveSessionToStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier... | private static async saveSessionToStorage(session: SessionInfo): Promise<void> {
try {
const prefs = await UserSessionService.initPreferences();
if (prefs) {
await prefs.put('current_session', session.toJSON());
await prefs.flush();
}
} catch (error) {
console.error('[U... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ec6c5c7eb4632e0ec4d1470066a980bd7806a34b | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | get | 获取基线数据 | static async get(userId: number, categoryId: number, period: string): Promise<UserSpendingBaseline | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(UserSpendingBaseline.tableNam... | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right... | static async get(userId: number, categoryId: number, period: string): Promise<UserSpendingBaseline | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(UserSpendingBaseline.tableNam... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 4e7b2fa29d4abde1104f6532c0453d9fd90143d2 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | getResult | 获取识别结果 | getResult(): OCRResult | null {
if (this.resultJson === '') {
return null;
}
try {
const parsed = JSON.parse(this.resultJson) as OCRResult;
return parsed;
} catch (e) {
return null;
}
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#... | getResult(): OCRResult | null {
if (this.resultJson === '') {
return null;
}
try {
const parsed = JSON.parse(this.resultJson) as OCRResult;
return parsed;
} catch (e) {
return null;
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 03e83873e2692cf86ca1e22709dba767c027c896 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/controller/DanmakuFilters.ets | arkts | needFilter | 绘制超过20ms就跳过 ,默认保持接近50fps | private needFilter(danmaku: BaseDanmaku, orderInScreen: number,
totalsizeInScreen: number, timer: DanmakuTimer, fromCachingTask: boolean): boolean {
if (timer == null || !danmaku.isOutside()) {
return false;
}
let elapsedTime: number = SystemClock.uptimeMillis() - timer.currMil... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left needFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left danmaku AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private needFilter(danmaku: BaseDanmaku, orderInScreen: number,
totalsizeInScreen: number, timer: DanmakuTimer, fromCachingTask: boolean): boolean {
if (timer == null || !danmaku.isOutside()) {
return false;
}
let elapsedTime: number = SystemClock.uptimeMillis() - timer.currMil... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 5317fc91c6083bbbd55d98df7332a04bfe4511bd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | putLoginHeader | 保存登录头信息(对应Legado的putLoginHeader) | putLoginHeader(sourceId: string, header: string): void {
this.loginHeaderStore.set(sourceId, header);
// 如果header中包含Cookie,也保存到cookies中
try {
const headerMap = SafeUtils.parseObj(header) as Record<string, string>;
const cookie = headerMap['Cookie'] || headerMap['cookie'];
if (cookie) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left putLoginHeader 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#... | putLoginHeader(sourceId: string, header: string): void {
this.loginHeaderStore.set(sourceId, header);
// 如果header中包含Cookie,也保存到cookies中
try {
const headerMap = SafeUtils.parseObj(header) as Record<string, string>;
const cookie = headerMap['Cookie'] || headerMap['cookie'];
if (cookie) {
... | https://github.com/DaLongZhuaZi/manxia | 3d2a5f2f5794714f3a230c58c1f3ebb328fe489f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | skipGuide | 跳过引导
用于测试跳过引导的场景 | public static async skipGuide(): Promise<void> {
try {
await this.guideManager.initialize();
await this.guideManager.skipGuide();
logger.info(TAG, '✅ 引导已标记为跳过');
return Promise.resolve();
} catch (error) {
logger.error(TAG, '跳过引导失败', String(error));
return Promise.reject(er... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left skipGuide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Righ... | public static async skipGuide(): Promise<void> {
try {
await this.guideManager.initialize();
await this.guideManager.skipGuide();
logger.info(TAG, '✅ 引导已标记为跳过');
return Promise.resolve();
} catch (error) {
logger.error(TAG, '跳过引导失败', String(error));
return Promise.reject(er... | https://github.com/DaLongZhuaZi/manxia | 8d6669f907772d4bfc115e627066cf0cafe8174a | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/XboxOneController.ets | arkts | sendRumble | 发送震动命令 | private sendRumble(): void {
const data = new Uint8Array([
0x09, 0x00, this.seqNum++, 0x09, 0x00, 0x0f,
(this.leftTriggerMotor >> 9) & 0xFF,
(this.rightTriggerMotor >> 9) & 0xFF,
(this.lowFreqMotor >> 8) & 0xFF,
(this.highFreqMotor >> 8) & 0xFF,
0xff, 0x00, 0x00
]);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendRumble 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#... | private sendRumble(): void {
const data = new Uint8Array([
0x09, 0x00, this.seqNum++, 0x09, 0x00, 0x0f,
(this.leftTriggerMotor >> 9) & 0xFF,
(this.rightTriggerMotor >> 9) & 0xFF,
(this.lowFreqMotor >> 8) & 0xFF,
(this.highFreqMotor >> 8) & 0xFF,
0xff, 0x00, 0x00
]);
... | https://github.com/AlkaidLab/moonlight-harmony | 5c2d963faa74130afbf7a7fa9c9975767ff147ee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | deleteOnlineChapterPages | 删除指定章节的所有页面数据 | public async deleteOnlineChapterPages(chapterId: string): Promise<void> {
try {
const sql = 'DELETE FROM online_page WHERE chapterId = ?';
await this.databaseManager.executeSql(sql, [chapterId]);
logger.debug(TAG, `已删除章节 ${chapterId} 的所有页面数据`);
} catch (error) {
logger.error(TAG, `删除章节... | 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 deleteOnlineChapterPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left ... | public async deleteOnlineChapterPages(chapterId: string): Promise<void> {
try {
const sql = 'DELETE FROM online_page WHERE chapterId = ?';
await this.databaseManager.executeSql(sql, [chapterId]);
logger.debug(TAG, `已删除章节 ${chapterId} 的所有页面数据`);
} catch (error) {
logger.error(TAG, `删除章节... | https://github.com/DaLongZhuaZi/manxia | f7c8e49da2fa4dfe4500b994552ecc0be680e9d5 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readName | 读取一个或多个pi名称、标签名称字符
@see https://www.w3.org/TR/xml/ 2.3节 [5] Name
@return 读取到的名称字符、未读取到则返回空字符 | private _readName(): string{
return isNameStartChar(this._svgStringReader!.peek())
? this._svgStringReader!.readByFunction(isNameChar)
: this._svgStringReader!.emptyString;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readName 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#st... | private _readName(): string{
return isNameStartChar(this._svgStringReader!.peek())
? this._svgStringReader!.readByFunction(isNameChar)
: this._svgStringReader!.emptyString;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | f4e589b20bee17f450f95c4d80b1e6f8490921bc | gitee |
arkui-x/samples | CodeLab/Cases/feature/hilogmonitormanagement/src/main/ets/model/HiLogMonitorManagement.ets | arkts | cancelCallback | TODO: 知识点: 关闭日志回调 | cancelCallback() : void {
testNapi.cancelLogCallback();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | cancelCallback() : void {
testNapi.cancelLogCallback();
} | https://gitcode.com/arkui-x/samples | 4f8790aef4e246ffb183196ea5cca7c3aec6f306 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | mapRowToAnomalyRecord | 映射数据库行到 AnomalyRecord 对象 | private static mapRowToAnomalyRecord(resultSet: relationalStore.ResultSet): AnomalyRecord {
return new AnomalyRecord(
DAOHelper.getLong(resultSet, 'anomaly_id'),
DAOHelper.getLong(resultSet, 'user_id'),
DAOHelper.getLong(resultSet, 'bill_id'),
DAOHelper.getString(resultSet, 'anomaly_type')... | 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 mapRowToAnomalyRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right... | private static mapRowToAnomalyRecord(resultSet: relationalStore.ResultSet): AnomalyRecord {
return new AnomalyRecord(
DAOHelper.getLong(resultSet, 'anomaly_id'),
DAOHelper.getLong(resultSet, 'user_id'),
DAOHelper.getLong(resultSet, 'bill_id'),
DAOHelper.getString(resultSet, 'anomaly_type')... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 25495c55c9d8f4f592be4a23ccdded4cd928ec65 | github |
openharmony-sig/ohos_vlayout | library/src/main/ets/components/common/FixLayoutHelper.ets | arkts | aboutToAppear | 获取的容器高度 | aboutToAppear() {
this.vLayoutDataLocal = this.vLayoutData
this.defaultValueInit()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.vLayoutDataLocal = this.vLayoutData
this.defaultValueInit()
} | https://gitee.com/openharmony-sig/ohos_vlayout.git | 0c3165cbcaabc604256f11a5a8d38f32a63622be | gitee |
erosTeam/NextE | shared/src/main/ets/state/ListModeState.ets | arkts | overrideWidthFor | Override width for a grid-like mode, or 0 when none is set. | overrideWidthFor(mode: string): number {
if (mode === ListMode.GRID) {
return this.gridColW
}
if (mode === ListMode.WATERFALL) {
return this.waterfallColW
}
if (mode === ListMode.COVER_WALL) {
return this.coverWallColW
}
if (mode === ListMode.THUMBNAIL_GRID) {
retur... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left overrideWidthFor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | overrideWidthFor(mode: string): number {
if (mode === ListMode.GRID) {
return this.gridColW
}
if (mode === ListMode.WATERFALL) {
return this.waterfallColW
}
if (mode === ListMode.COVER_WALL) {
return this.coverWallColW
}
if (mode === ListMode.THUMBNAIL_GRID) {
retur... | https://github.com/erosTeam/NextE | 21de49b41cd8ff4f5a764eb9610453972fd83e09 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | split | Splits this String by a single char and returns an ordered array of substrings.
The order of the resulted array corresponds to the order of the passage of
this String from beginning to end. The pattern is excluded from substrings.
The array is limited by some specified value.
@param separator - Char
@param limit - max ... | private split(separator: Char, limit: Int): String[] {
if (limit == 0) {
return new String[0]("");
}
let strLen = this.getLength();
if (strLen == 0) {
return [(this)];
}
if (limit < 0) {
limit = Int.MAX_VALUE;
}
let... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left split AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left separator AST#identifier#Right AST#ERROR#Left AST#:#Left ... | private split(separator: Char, limit: Int): String[] {
if (limit == 0) {
return new String[0]("");
}
let strLen = this.getLength();
if (strLen == 0) {
return [(this)];
}
if (limit < 0) {
limit = Int.MAX_VALUE;
}
let... | https://gitcode.com/iop123123/arkts-static-skills | 9f31ffa8e636409b089be683a575ddbaa6500742 | gitcode |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/tvability/TvAbility.ets | arkts | onBackground | Logs background transition. | onBackground(): void {
Logger.info('TvAbility: Ability onBackground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground 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... | onBackground(): void {
Logger.info('TvAbility: Ability onBackground');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 7b3d5f6bd8caa791d536ec2ac7d0281524f1a319 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationList.ets | arkts | aboutToAppear | The function executes after a new instance of the custom component is created and before its build function
is executed.
You can change the state variable in the aboutToAppear function, and these changes will take effect in
subsequent executions of the build function. | aboutToAppear() {
this.delDialogController = new CustomDialogController({
builder: DeleteDialog({
cancel: () => {
this.mConListCtrl.deleteDialogCancel()
},
confirm: () => {
this.mConListCtrl.deleteDialogConfirm()
},
msg: this.mConListCtrl.strMsgDel... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.delDialogController = new CustomDialogController({
builder: DeleteDialog({
cancel: () => {
this.mConListCtrl.deleteDialogCancel()
},
confirm: () => {
this.mConListCtrl.deleteDialogConfirm()
},
msg: this.mConListCtrl.strMsgDel... | https://gitee.com/openharmony/applications_mms.git | d12b0eaa5ec323c0863ac61c4affc0a320077b9a | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/DigitPanelModel.ets | arkts | initScienceDigitPanelListInfo | init science calculator's digit panel info | private initScienceDigitPanelListInfo(): void {
let pList: SimplePhysicsButtonInfo[][] = this.getSciencePanelList();
this.scienceList = pList.map(rowItem => {
return rowItem.map(colItem => {
let pButton: PhysicsButtonInfo = new PhysicsButtonInfo();
pButton.keyCode = colItem.keyCode;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initScienceDigitPanelListInfo 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... | private initScienceDigitPanelListInfo(): void {
let pList: SimplePhysicsButtonInfo[][] = this.getSciencePanelList();
this.scienceList = pList.map(rowItem => {
return rowItem.map(colItem => {
let pButton: PhysicsButtonInfo = new PhysicsButtonInfo();
pButton.keyCode = colItem.keyCode;
... | https://gitee.com/openharmony-sig/applications_calculator.git | c9c41d7d2f02cc5894a36c67963e76339b32a8f9 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AdminAuthService.ets | arkts | getCurrentAdmin | 获取当前管理员信息
@returns 管理员信息 | static getCurrentAdmin(): AdminLoginResponse | null {
try {
const adminInfo = AppStorage.get<AdminLoginResponse>('adminInfo');
return adminInfo !== undefined ? adminInfo : null;
} catch (error) {
console.error('获取管理员信息失败:', error);
return null;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentAdmin 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... | static getCurrentAdmin(): AdminLoginResponse | null {
try {
const adminInfo = AppStorage.get<AdminLoginResponse>('adminInfo');
return adminInfo !== undefined ? adminInfo : null;
} catch (error) {
console.error('获取管理员信息失败:', error);
return null;
}
} | https://github.com/LJ666-ui/harmony-health-care | 94d82f6386d883ed8a7c1d0c54904c3a5fea3486 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | couldEnlargeImage | Whether image can enlarge.
@returns | couldEnlargeImage(): boolean {
return (this.couldEnlargeImageW() && this.couldEnlargeImageH());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left couldEnlargeImage 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#s... | couldEnlargeImage(): boolean {
return (this.couldEnlargeImageW() && this.couldEnlargeImageH());
} | https://gitee.com/openharmony/codelabs.git | fae8cf1821733468c049eab5968375f658dde2a6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getAddedItemIds | 获取新增的条目ID列表 | public getAddedItemIds(): string[] {
const prevIds = new Set(this.previousItems.map(item => item.id));
return this.currentItems
.filter(item => !prevIds.has(item.id))
.map(item => item.id);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAddedItemIds 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 string... | public getAddedItemIds(): string[] {
const prevIds = new Set(this.previousItems.map(item => item.id));
return this.currentItems
.filter(item => !prevIds.has(item.id))
.map(item => item.id);
} | https://github.com/DaLongZhuaZi/manxia | eb5cc7170da25972293af23fd8b3bafdf35490a0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | unregisterWindowStageStateMonitor | 解除窗口状态变化监听 | static unregisterWindowStageStateMonitor(): void {
WindowManager.unregisterMainWindowLayoutMonitor();
if (!WindowManager.windowStageRef || !WindowManager.windowStageEventCallback) {
return;
}
try {
WindowManager.applyBackgroundPrivacyMode(false, '解除窗口状态监听');
WindowManager.windowSta... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unregisterWindowStageStateMonitor 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#ERRO... | static unregisterWindowStageStateMonitor(): void {
WindowManager.unregisterMainWindowLayoutMonitor();
if (!WindowManager.windowStageRef || !WindowManager.windowStageEventCallback) {
return;
}
try {
WindowManager.applyBackgroundPrivacyMode(false, '解除窗口状态监听');
WindowManager.windowSta... | https://github.com/DaLongZhuaZi/manxia | 1365f3392f21df61a8c8d7a8f281dc29b23f399e | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnImagePreviewPage.ets | arkts | build | 构建图片预览展示页面 | build() {
AppNavDestination({
title: "图片预览",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ImagePreviewContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "图片预览",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ImagePreviewContent();
}
} | https://github.com/codelably/tuniao-ui | d4d014e21313217e5e99212eb8c96631ebc38412 | github |
2763981847/Clock-Alarm | entry/src/main/ets/viewmodel/WorldClockViewModel.ets | arkts | setCitiesToDatabase | 将城市保存到数据库中。
@param cities 要保存的城市数组,默认为当前城市列表 | public setCitiesToDatabase(cities: Array<CityItem> = this.cities) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.set(CommonConstants.CITY_KEY, JSON.stringify(cities));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCitiesToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cities AST#identifier#Right AST#:#Left : AST#:#Right AST#instantiation_expression#L... | public setCitiesToDatabase(cities: Array<CityItem> = this.cities) {
let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler;
preference.set(CommonConstants.CITY_KEY, JSON.stringify(cities));
} | https://github.com/2763981847/Clock-Alarm | 09ec2143a06903d5fe0a201434db11af16665a8a | github |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | getChangesAfter | 获取指定时间之后的变更 | getChangesAfter(timestamp: number): ChangeLogEntry[] {
return this.changeLog.filter(
(entry: ChangeLogEntry): boolean => entry.timestamp > timestamp
);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getChangesAfter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AS... | getChangesAfter(timestamp: number): ChangeLogEntry[] {
return this.changeLog.filter(
(entry: ChangeLogEntry): boolean => entry.timestamp > timestamp
);
} | https://github.com/CLMC2025/Vignette | 76ccabad2f3b4f0f402cdff4be9d83644439db46 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | getTransX | Returns the translation (drag / pan) distance on the x-axis
@return | public getTransX(): number {
return this.mTransX;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTransX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public getTransX(): number {
return this.mTransX;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 392fa039c7daa3ce002ae24ea9d0dbe25bc2d389 | gitee |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | onSaveSuccess | 保存成功处理
@returns {void} 无返回值 | private onSaveSuccess(): void {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onSaveSuccess 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#expre... | private onSaveSuccess(): void {
const result: RefreshResult = { refresh: true };
navigateBackWithResult(result);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 261855ff16e7d75509713f0d51a87e0beae73dc5 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/RouterManager.ets | arkts | showBannerView | Falls back to fullView when the host has disabled the incoming banner. | static showBannerView(): void {
if (!GlobalState().enableIncomingBanner) {
RouterManager.showCallingView();
return;
}
ViewState().router = CallRoute.banner;
Logger.info('RouterManager: -> banner');
if (_routeListener !== null) {
_routeListener(CallRoute.banner);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showBannerView 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 showBannerView(): void {
if (!GlobalState().enableIncomingBanner) {
RouterManager.showCallingView();
return;
}
ViewState().router = CallRoute.banner;
Logger.info('RouterManager: -> banner');
if (_routeListener !== null) {
_routeListener(CallRoute.banner);
}
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 7874eda356ee99d68d00100ef86a84466e40edc3 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test8_original_index.ets | arkts | testNestedTryCatch | --- Nested try-catch --- | function testNestedTryCatch(): string {
let result: string = '';
try {
try {
result = 'inner';
throw new Error('inner error');
} catch (e) {
result = result + ':' + 'inner_catch';
}
} catch (e) {
result = result + ':' + 'outer_catch';
}
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedTryCatch 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#predefin... | function testNestedTryCatch(): string {
let result: string = '';
try {
try {
result = 'inner';
throw new Error('inner error');
} catch (e) {
result = result + ':' + 'inner_catch';
}
} catch (e) {
result = result + ':' + 'outer_catch';
}
return result;
} | https://github.com/miaochiahao/ark-ghidra | 1d1d062f2dd1fb7831927bda6829c5e4f8890681 | github |
the-wwyang/kids-learning-app | src/main/ets/storage/AppStorageManager.ets | arkts | getCurrentUser | 获取当前用户数据 | public getCurrentUser(): UserData | null {
return this.currentUserData;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentUser 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 ... | public getCurrentUser(): UserData | null {
return this.currentUserData;
} | https://github.com/the-wwyang/kids-learning-app | 56aabeddabc265f2a6e701a20cb49875b2ddd366 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/pages/VideoPage.ets | arkts | netObserver | 网络监听回调 | netObserver(data: emitter.EventData) {
if (!data.data) {
logger.info('netObserver data.data is undefined.');
return;
}
logger.info('network observe result : ' + NetUtils.getInstance().parseResult(data));
let netEventData: NetEventData = data.data! as NetEventData;
let eventName: Networ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left netObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left em... | netObserver(data: emitter.EventData) {
if (!data.data) {
logger.info('netObserver data.data is undefined.');
return;
}
logger.info('network observe result : ' + NetUtils.getInstance().parseResult(data));
let netEventData: NetEventData = data.data! as NetEventData;
let eventName: Networ... | https://github.com/openharmony/applications_app_samples | f163ecd79179346c667c1b80edd3c190e53fc2f9 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | reset_data | 重载配置文件 // | async reset_data() {
// 记录当前状态 //
let tmp: boolean = (this.play_status == 'playing') ? true : false
// 暂停 //
this.pause(true)
// 保存 //
this.save_data()
// 重新加载数据 //
await this.load_data(tmp)
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset_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#L... | async reset_data() {
// 记录当前状态 //
let tmp: boolean = (this.play_status == 'playing') ? true : false
// 暂停 //
this.pause(true)
// 保存 //
this.save_data()
// 重新加载数据 //
await this.load_data(tmp)
} | https://github.com/Nekofox-POT/LinMusic | 8efeaa88fedea8862ca439ffe4a073111d5f8d26 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | includes | Checks if specified argument is in Int8Array
@param e search element
@returns true if e is in Int8Array, false otherwise | public includes(e: number): boolean {
return this.includes(e as double as int as byte, 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number): boolean {
return this.includes(e as double as int as byte, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0c09d063c3868949aa625092e6b41a8635160d0a | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | intersect | Returns the intersection of a given range and the current range.
@param { ScopeHelper } range - A Scope range object
@returns { ScopeHelper } Returns the intersection of a given range and the current range. | intersect(range: ScopeHelper<T>): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(range.getLower()) ? this._lowerLimit : range.getLower()
let upperLimit = this._upperLimit.compareTo(range.getUpper()) ? range.getUpper() : this._upperLimit
return new ScopeHelper<T>... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left intersect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#... | intersect(range: ScopeHelper<T>): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(range.getLower()) ? this._lowerLimit : range.getLower()
let upperLimit = this._upperLimit.compareTo(range.getUpper()) ? range.getUpper() : this._upperLimit
return new ScopeHelper<T>... | https://gitcode.com/iop123123/arkts-static-skills | f73cb953309e7fa6d5e2832b2879b68cef33cff5 | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnImageUploadViewModel.ets | arkts | simulateUpload | 模拟单个文件的上传过程
直接修改 TnUploadFile 的 @Trace 属性,仅触发进度文字的局部刷新
@param file 文件对象引用 | private simulateUpload(file: TnUploadFile): void {
const timerId: number = setInterval(() => {
if (file.status !== "uploading") {
clearInterval(timerId);
return;
}
const newProgress: number = file.progress + UPLOAD_STEP;
if (newProgress >= 100) {
clearInterval(timer... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left simulateUpload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left file AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private simulateUpload(file: TnUploadFile): void {
const timerId: number = setInterval(() => {
if (file.status !== "uploading") {
clearInterval(timerId);
return;
}
const newProgress: number = file.progress + UPLOAD_STEP;
if (newProgress >= 100) {
clearInterval(timer... | https://github.com/codelably/tuniao-ui | 1fef56628d4338c7d2143c9c68d1f84c2623a21d | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | localizedTagDisplay | Gallery chip display for localized simple tags; keeps EH's short namespace prefix visible. | static localizedTagDisplay(namespace: string, localized: string): string {
const ns: string = EhConstants.compactNamespace(namespace)
const text: string = localized.trim()
if (ns.length === 0 || text.length === 0) {
return text
}
return `${ns}:${text}`
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left localizedTagDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left namespace AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | static localizedTagDisplay(namespace: string, localized: string): string {
const ns: string = EhConstants.compactNamespace(namespace)
const text: string = localized.trim()
if (ns.length === 0 || text.length === 0) {
return text
}
return `${ns}:${text}`
} | https://github.com/erosTeam/NextE | 9490b6a293c16d9cddd5fafd81bec46c70d57fbc | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CommonRepository.ets | arkts | getDictData | 获取字典数据
@param request 字典数据请求参数
@returns 字典数据结果 | async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> {
return this.networkDataSource.getDictData(request);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDictData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left request AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> {
return this.networkDataSource.getDictData(request);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 91bf1f2eb79c888b64bb7e4f64d52ba11ca4d847 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | validateExpression | 验证用户输入的表达式是否正确
@param expression 用户输入的表达式
@param cards 当前的4张牌
@returns 验证结果对象 | static validateExpression(expression: string, cards: Card[]): ValidationResult {
// 实际验证逻辑已移至ExpressionEvaluator中实现
// 这里保留此方法以保持接口一致性
const result: ValidationResult = {
isValid: false,
message: "验证功能已迁移至ExpressionEvaluator"
};
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateExpression AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expression AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | static validateExpression(expression: string, cards: Card[]): ValidationResult {
// 实际验证逻辑已移至ExpressionEvaluator中实现
// 这里保留此方法以保持接口一致性
const result: ValidationResult = {
isValid: false,
message: "验证功能已迁移至ExpressionEvaluator"
};
return result;
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | a576d046bc6e7f4811f73f0c47f0ec93b3b2f421 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | isFavoritedSync | Check if a product is favorited by user (使用内存缓存,同步方法) | static isFavoritedSync(productId: string): boolean {
return FavoritesManager.favoriteProductIds.has(productId);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFavoritedSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static isFavoritedSync(productId: string): boolean {
return FavoritesManager.favoriteProductIds.has(productId);
} | https://github.com/Harrisonls2004/WaterFlow | 3614fd61c5b24d0d4571128ad0b15de32f2ecd02 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceSearchService.ets | arkts | searchForSource | 执行换源搜索
搜索同名书籍的其他书源
@param bookName 书名
@param author 作者(可选,用于更精确匹配)
@param callback 进度回调
@param maxSources 最大搜索书源数,默认50
@returns 搜索任务句柄 | searchForSource(
bookName: string,
author?: string,
callback?: SearchProgressCallback,
maxSources: number = MAX_CONCURRENT_SOURCES
): SearchTaskHandle {
const config: SearchTaskConfig = {
keyword: bookName,
maxConcurrent: maxSources,
matchSimilarName: true,
originalBookNa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left searchForSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bookName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST... | searchForSource(
bookName: string,
author?: string,
callback?: SearchProgressCallback,
maxSources: number = MAX_CONCURRENT_SOURCES
): SearchTaskHandle {
const config: SearchTaskConfig = {
keyword: bookName,
maxConcurrent: maxSources,
matchSimilarName: true,
originalBookNa... | https://github.com/DaLongZhuaZi/manxia | 61c6682b8a8d6f7755a2369101448f16741f8c17 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/config/MessageListConfig.ets | arkts | messageActionStyle | Use dialog style in merged detail view | get messageActionStyle(): MessageActionStyle {
return 'dialog';
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left messageActionStyle 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 MessageActio... | get messageActionStyle(): MessageActionStyle {
return 'dialog';
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 9c77616c9574a3b425571d9404254d7247a60177 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | scheme | Gets the protocol part of the URI.
@returns { string | null } | get scheme(): string | null {
let s: string = this.uriEntry.getScheme();
return s == "" ? null : s;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left scheme 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#Lef... | get scheme(): string | null {
let s: string = this.uriEntry.getScheme();
return s == "" ? null : s;
} | https://gitcode.com/iop123123/arkts-static-skills | 6f9bed48aede5e126fcbadbc21ecbaf65e712577 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | shouldLog | 检查是否应该记录日志 | private shouldLog(level: LogLevel): boolean {
if (this.config.productionMode && level < LogLevel.WARN) {
return false;
}
return level >= this.config.minLevel;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Lo... | private shouldLog(level: LogLevel): boolean {
if (this.config.productionMode && level < LogLevel.WARN) {
return false;
}
return level >= this.config.minLevel;
} | https://github.com/CLMC2025/Vignette | 119e1cbe1e017286cfd26dbba3c97d5f4bd82456 | github |
honjow/Next2V | shared/src/main/ets/settings/ThemeSettings.ets | arkts | reapplyForFollowSystem | Called by ApplicationContext EnvironmentCallback (application-level async event,
outside the Configuration rebuild call chain, so setColorMode is safe). | static reapplyForFollowSystem(context: common.UIAbilityContext, newColorMode?: ConfigurationConstant.ColorMode): void {
// First, update the cached real system colorMode.
if (newColorMode !== undefined) {
setAppStorageValue<number>(StorageKeys.SYSTEM_COLOR_MODE, newColorMode as number)
connectThem... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reapplyForFollowSystem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member... | static reapplyForFollowSystem(context: common.UIAbilityContext, newColorMode?: ConfigurationConstant.ColorMode): void {
// First, update the cached real system colorMode.
if (newColorMode !== undefined) {
setAppStorageValue<number>(StorageKeys.SYSTEM_COLOR_MODE, newColorMode as number)
connectThem... | https://github.com/honjow/Next2V | 9fe7188c4a9d61970747cc4c0a7d359cddeb4113 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | deleteByUserId | 批量删除用户的识别记录 | static async deleteByUserId(userId: number): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(OCRR... | 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 deleteByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ... | static async deleteByUserId(userId: number): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.RdbPredicates(OCRR... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 49584466579e552df3936e2da6701a3495fa4fe2 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/OmniPopup.ets | arkts | setModal | 全局设置-模态对话框
@param isModal
@returns | static setModal(isModal: boolean) {
Config.dialogOptions.isModal = isModal
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setModal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isModal AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bool... | static setModal(isModal: boolean) {
Config.dialogOptions.isModal = isModal
} | https://github.com/wuba/omni-ui | 9eab07377104748c87d12d171862ae6d2331245b | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/views/components/TopicBadges.ets | arkts | getTagColor | 标签名 -> 颜色(尽量用资源色;未知退回 on_surface_secondary) | static getTagColor(tagName: string): Resource {
const key: string = tagName.trim();
switch (key) {
case '公告':
case '精华神帖':
case '碎碎碎念':
case '优质博文':
return $r('app.color.primary');
case '快问快答':
case '软件开发':
case '配置优化':
case '树洞':
case 'tips':
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTagColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static getTagColor(tagName: string): Resource {
const key: string = tagName.trim();
switch (key) {
case '公告':
case '精华神帖':
case '碎碎碎念':
case '优质博文':
return $r('app.color.primary');
case '快问快答':
case '软件开发':
case '配置优化':
case '树洞':
case 'tips':
... | https://github.com/Amaz1ny/HarmonyDO-public | bf0b8f0edd117e022834b1ecbb9ccb4cb0c55ff7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/DeviceUtils.ets | arkts | isEmulator | 是否模拟器
@returns | public static isEmulator():boolean {
return deviceInfo.productModel === 'emulator';
} | 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 isEmulator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public static isEmulator():boolean {
return deviceInfo.productModel === 'emulator';
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/DeviceUtils.ets#L12-L14 | 28195e77ed93f212646026d3828b21d6f0868837 | github |
Joker-x-dev/CoolMallArkTS | core/result/src/main/ets/RequestHelper.ets | arkts | runInternal | 核心执行逻辑
@param {boolean} returnFull - 是否返回完整响应
@returns {Promise<NetworkResponse<T> | T>} 结果 | private async runInternal(returnFull: boolean): Promise<NetworkResponse<T> | T> {
if (this.beforeStart) {
this.beforeStart();
}
if (this.useLoading) {
ToastUtils.showLoading();
}
try {
const rawResp: NetworkResponse<T> = await this.source;
const resp: NetworkResponse<T> = n... | 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 runInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left returnFull AST#identifier#Right AST#ERROR#Left AST#:#Lef... | private async runInternal(returnFull: boolean): Promise<NetworkResponse<T> | T> {
if (this.beforeStart) {
this.beforeStart();
}
if (this.useLoading) {
ToastUtils.showLoading();
}
try {
const rawResp: NetworkResponse<T> = await this.source;
const resp: NetworkResponse<T> = n... | https://github.com/Joker-x-dev/CoolMallArkTS | 64f2708998d334b698cc82de3bee7354269fc8fb | github |
XXYoLoong/FortuneBet | entry/src/main/ets/services/AuthService.ets | arkts | updatePassword | 【新增】修改密码 | async updatePassword(account: string, oldPass: string, newPass: string): Promise<AuthResult> {
if (!this.storage) return { ok: false, message: '系统未初始化' };
const user = await this.storage.getUser(account);
if (!user) return { ok: false, message: '用户不存在' };
// 验证旧密码
if (user.password !== this.simpl... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updatePassword AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left account AST#identifier#Right AST#type_annotat... | async updatePassword(account: string, oldPass: string, newPass: string): Promise<AuthResult> {
if (!this.storage) return { ok: false, message: '系统未初始化' };
const user = await this.storage.getUser(account);
if (!user) return { ok: false, message: '用户不存在' };
// 验证旧密码
if (user.password !== this.simpl... | https://github.com/XXYoLoong/FortuneBet | 25a8c6ed43dd16c2f630f397e809fb5775c80594 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | then | Schedule callback to execute after the promise is resolved
@param onFulfilled callback that will be called after the promise is resolved
@returns { Promise } new promise that will be resolved after the execution of the callback
or rejected if current promise is rejected or the callback finished with an exception | then<U = T>(onFulfilled: () => PromiseLike<U>|U): Promise<Awaited<U>> {
let promise = new Promise<Awaited<U>>();
let fn: () => void = (): void => {
try {
if (this.state == Promise.STATE_RESOLVED) {
promise.doResolve<U>(onFulfilled());
}... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left then AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#binary_expression#Left AST#identifier#Left T AST#identifier#Right AST#>#... | then<U = T>(onFulfilled: () => PromiseLike<U>|U): Promise<Awaited<U>> {
let promise = new Promise<Awaited<U>>();
let fn: () => void = (): void => {
try {
if (this.state == Promise.STATE_RESOLVED) {
promise.doResolve<U>(onFulfilled());
}... | https://gitcode.com/iop123123/arkts-static-skills | 1748c6c892c850fdcb4a71d422e497f4257bbf79 | gitcode |
codelably/HCompass | core/navigation/src/main/ets/NavigationService.ets | arkts | getRouteParams | 获取指定路由的参数
@param name 路由名称
@returns 参数对象 | getRouteParams<T>(name: string): T | undefined {
if (!this.stack) {
return undefined;
}
try {
return this.stack.getParamByName(name)[0] as T;
} catch (err) {
this.logError(`Get route params failed: ${JSON.stringify(err)}`);
return undefined;
}
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left getRouteParams AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_para... | getRouteParams<T>(name: string): T | undefined {
if (!this.stack) {
return undefined;
}
try {
return this.stack.getParamByName(name)[0] as T;
} catch (err) {
this.logError(`Get route params failed: ${JSON.stringify(err)}`);
return undefined;
}
} | https://github.com/codelably/HCompass | 19e690ca4f7e13737c11a243bb9c9469e2582b24 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieRadarChartBaseModel.ets | arkts | getAngleForPoint | returns the angle relative to the chart center for the given point on the
chart in degrees. The angle is always between 0 and 360°, 0° is NORTH,
90° is EAST, ...
@param x
@param y
@return | public getAngleForPoint(x: number, y: number): number {
const c: MPPointF | null = this.getCenterOffsets();
if (!c) {
return 0;
}
const tx: number = x - c.x;
const ty: number = y - c.y;
const length: number = Math.sqrt(tx * tx + ty * ty);
const r: number = Math.acos(ty / length);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAngleForPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public getAngleForPoint(x: number, y: number): number {
const c: MPPointF | null = this.getCenterOffsets();
if (!c) {
return 0;
}
const tx: number = x - c.x;
const ty: number = y - c.y;
const length: number = Math.sqrt(tx * tx + ty * ty);
const r: number = Math.acos(ty / length);
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 336eafd51b5050b649c1632719dcb6dba8f64d25 | gitee |
XHXYT/Pixark | entry/src/main/ets/viewmodel/DownloadsViewModel.ets | arkts | selectAllVisible | 全选当前页面 | selectAllVisible() {
this.selectedIds.clear();
this.displayList.forEach(task => this.selectedIds.add(task.task_id));
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectAllVisible 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#L... | selectAllVisible() {
this.selectedIds.clear();
this.displayList.forEach(task => this.selectedIds.add(task.task_id));
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L77-L80 | 924cd8d90ab6842a28860d627b851c94ceee033c | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getUserOrderCount | 获取用户订单数量汇总
@returns 订单数量信息 | async getUserOrderCount(): Promise<NetworkResponse<OrderCount>> {
return this.networkDataSource.getUserOrderCount();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserOrderCount AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge... | async getUserOrderCount(): Promise<NetworkResponse<OrderCount>> {
return this.networkDataSource.getUserOrderCount();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4b989e330e816653a9c9c54d62474938e08ea821 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/parkingMock.ets | arkts | calculateParkingFee | 计算停车费用
@param parkDurationMinutes 停放时长(分钟)
@param config 费率配置
@returns 费用详情 | function calculateParkingFee(parkDurationMinutes: number, config: FeeRateConfig): FeeDetailBreakdown {
let totalFee = 0;
const breakdown: FeeItem[] = [];
if (parkDurationMinutes <= config.freeMinutes) {
// 0-30分钟: 免费
const item: FeeItem = { period: '0-30分钟(免费)', fee: 0 };
breakdown.push(item);
re... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateParkingFee AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left parkDurationMinutes AST#identifier#Right AST#type_annotation#Left ... | function calculateParkingFee(parkDurationMinutes: number, config: FeeRateConfig): FeeDetailBreakdown {
let totalFee = 0;
const breakdown: FeeItem[] = [];
if (parkDurationMinutes <= config.freeMinutes) {
// 0-30分钟: 免费
const item: FeeItem = { period: '0-30分钟(免费)', fee: 0 };
breakdown.push(item);
re... | https://github.com/LJ666-ui/harmony-health-care | f4652aca48f98c55c6cba459e24d4e62c82b5007 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/pages/RegisterPage.ets | arkts | handleRegister | 处理注册按钮点击事件 | handleRegister() {
// 1. 校验用户名
if (this.usernameStr === '' || this.usernameStr.length < 2) {
this.showToast('请输入有效的用户名(至少2位)');
return;
}
// 2. 校验手机号
if (this.phoneStr.length !== 11) {
this.showToast('请输入11位手机号码');
return;
}
// 3. 校验密码
if (this.passwordStr ===... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleRegister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | handleRegister() {
// 1. 校验用户名
if (this.usernameStr === '' || this.usernameStr.length < 2) {
this.showToast('请输入有效的用户名(至少2位)');
return;
}
// 2. 校验手机号
if (this.phoneStr.length !== 11) {
this.showToast('请输入11位手机号码');
return;
}
// 3. 校验密码
if (this.passwordStr ===... | https://gitcode.com/openharmony/codelabs | 469b786c645eef15c616f3009ca7e384c1855098 | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/storagemanager/rdb/TrackTable.ets | arkts | deleteTrackData | delete all track data. | public async deleteTrackData(): Promise<void> {
try {
await this.trackTable.deleteRdb();
await this.resetId();
} catch (e) {
Logger.error(TAG, `deleteTrackData failed. cause: ${e.message}`);
}
} | 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 deleteTrackData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async deleteTrackData(): Promise<void> {
try {
await this.trackTable.deleteRdb();
await this.resetId();
} catch (e) {
Logger.error(TAG, `deleteTrackData failed. cause: ${e.message}`);
}
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 700a432171f709d0633da4464b5913ab616a67a4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | confirmRenameShelf | 确认重命名书架 | private async confirmRenameShelf(): Promise<void> {
if (!this.renamingShelf || this.renameShelfName.trim().length === 0) return;
const newName = this.renameShelfName.trim();
const shelfId = this.renamingShelf.id;
const success = await this.typeShelfManager.updateShelf(shelfId, { name: newName });
... | 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 confirmRenameShelf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async confirmRenameShelf(): Promise<void> {
if (!this.renamingShelf || this.renameShelfName.trim().length === 0) return;
const newName = this.renameShelfName.trim();
const shelfId = this.renamingShelf.id;
const success = await this.typeShelfManager.updateShelf(shelfId, { name: newName });
... | https://github.com/DaLongZhuaZi/manxia | 96aa2e6e407e1574b97a0e30e786d7a680f85c56 | github |
buqiuz/game-puzzle | entry/src/main/ets/model/GameRules.ets | arkts | findEmptyIndex | 在图片数组中找到空白块的索引。 | findEmptyIndex(pictures: PictureItem[]): number {
let cutCount=Math.sqrt(pictures.length)
for (let i = 0; i < pictures.length; i++) {
if (pictures[i].index === cutCount*cutCount-1) {
return i;
}
}
return -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left findEmptyIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pictures AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Picture... | findEmptyIndex(pictures: PictureItem[]): number {
let cutCount=Math.sqrt(pictures.length)
for (let i = 0; i < pictures.length; i++) {
if (pictures[i].index === cutCount*cutCount-1) {
return i;
}
}
return -1;
} | https://github.com/buqiuz/game-puzzle | 58e4c940a93b053e1b8fda9b257c286f2f43ad9d | github |
bhengubv/aether-protocol | arkts/src/main/ets/market/PoVTokenExchangeService.ets | arkts | handleTokenExchange | Processes an inbound PoV exchange packet (type 43).
Returns true when the token was accepted, counter-signed, and recorded. Returns
false when the packet should be silently discarded (wrong type,
bad/stale/replayed envelope, malformed payload, self-echo, not addressed to us,
missing/invalid witness signature, witness =... | handleTokenExchange(packet: MeshPacket | null, senderPublicKey: Uint8Array | null): boolean {
if (packet === null || senderPublicKey === null) {
return false;
}
if (packet.type !== PacketType.PoVTokenExchange) {
this.logMsg(`PoV exchange: unexpected packet type ${packet.type} — ignored`);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleTokenExchange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left packet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left MeshPac... | handleTokenExchange(packet: MeshPacket | null, senderPublicKey: Uint8Array | null): boolean {
if (packet === null || senderPublicKey === null) {
return false;
}
if (packet.type !== PacketType.PoVTokenExchange) {
this.logMsg(`PoV exchange: unexpected packet type ${packet.type} — ignored`);
... | https://github.com/bhengubv/aether-protocol | 6a03fb3ad34f6f85b062c30d9a88a41e374bafb5 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/common/ThemeManager.ets | arkts | getSystemTheme | 0: 浅色, 1: 深色 | private getSystemTheme(): AppTheme {
// 0: 浅色模式, 1: 深色模式
return this.systemColorMode === 1 ? DarkTheme : LightTheme
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSystemTheme 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 AppT... | private getSystemTheme(): AppTheme {
// 0: 浅色模式, 1: 深色模式
return this.systemColorMode === 1 ? DarkTheme : LightTheme
} | https://github.com/AetheriumSimulator/qemu-hmos | 2455174b49a19115ae523925750ee82555f3dc1b | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LimitLine.ets | arkts | getLabelPosition | Returns the position of the LimitLine label (value).
@return | public getLabelPosition(): LimitLabelPosition {
return this.mLabelPosition;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelPosition 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 Limit... | public getLabelPosition(): LimitLabelPosition {
return this.mLabelPosition;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6a2acf5d02f48895d8db09697ab48fe49c038b02 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getReceiverType | Returns receiver type of this method
@throws {TypeError} if method has no receiver (i.e. static)
@returns {Type} Type corresponding to method's receiver
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getReceiverType(): Type {
const receiverTd = this.getReceiverTypeDescriptor()
if (receiverTd) {
return Type.resolve(receiverTd, this.getContextLinker())!
}
throw new TypeError("Method does not have receiver")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getReceiverType 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 Type A... | public getReceiverType(): Type {
const receiverTd = this.getReceiverTypeDescriptor()
if (receiverTd) {
return Type.resolve(receiverTd, this.getContextLinker())!
}
throw new TypeError("Method does not have receiver")
} | https://gitcode.com/iop123123/arkts-static-skills | 187fd9b7f41693d7b8a213f5e0306460827fd124 | gitcode |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | save | Save all models to preferences | async save(): Promise<void> {
if (!this.context) {
console.warn('OpenBoard: Cannot save prediction data - context not set');
return;
}
try {
const pref = await preferences.getPreferences(this.context, 'OpenBoard_prediction_data');
const allModels: Record<string, SerializedModel> =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left save 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 save(): Promise<void> {
if (!this.context) {
console.warn('OpenBoard: Cannot save prediction data - context not set');
return;
}
try {
const pref = await preferences.getPreferences(this.context, 'OpenBoard_prediction_data');
const allModels: Record<string, SerializedModel> =... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L508-L533 | 6424626750b6c3d5ac3379274ac7d16fca21d67a | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/SystemApi.ets | arkts | getServerLogs | getServerLogs
@summary Gets a list of available server log files.
@throws {RequiredError}
@memberof SystemApi | public async getServerLogs(): Promise<Array<LogFile>> {
return this.apiClient.get({ path: "/System/Logs" })
} | 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 getServerLogs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public async getServerLogs(): Promise<Array<LogFile>> {
return this.apiClient.get({ path: "/System/Logs" })
} | https://github.com/OHPG/FinSdk | 71792b0f6fae2529c511d98ff63bfbadbea68153 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | initCoverPath | 初始化封面存储路径 | private async initCoverPath(): Promise<void> {
if (this.isPathInitialized) {
return;
}
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
if (!this.pendingContextLogged) {
logger.debug(TAG, 'Context未初始化,封面路径等待后续按需初始化');
this.pendi... | 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 initCoverPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async initCoverPath(): Promise<void> {
if (this.isPathInitialized) {
return;
}
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
if (!this.pendingContextLogged) {
logger.debug(TAG, 'Context未初始化,封面路径等待后续按需初始化');
this.pendi... | https://github.com/DaLongZhuaZi/manxia | c8e7aa2f80f26ab601f602e5a5a3ff1597249f58 | github |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | setData | 替换整个数据数组 | setData(dataArray?: T[]) {
if (dataArray) {
this.originDataArray.splice(0, this.originDataArray.length)
this.originDataArray.push(...dataArray)
} else {
this.originDataArray = []
}
this.notifyDataReload()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataArray AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Ri... | setData(dataArray?: T[]) {
if (dataArray) {
this.originDataArray.splice(0, this.originDataArray.length)
this.originDataArray.push(...dataArray)
} else {
this.originDataArray = []
}
this.notifyDataReload()
} | https://gitee.com/openharmony/arkui_ace_engine.git | e7d90eec15c01b9250f7b1acc534bdffcd9792ba | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | checkWhetherPostgraduate | 登录后检测是否为研究生账号(能否访问 yjspt)→ 设置 role 偏好 | async checkWhetherPostgraduate(): Promise<void> {
console.info(TAG, 'checkWhetherPostgraduate: start');
try {
await this.navigateToYjspt(
'https://yjspt.xidian.edu.cn/gsapp/sys/yjsemaphome/portal/index.do');
const resp: HttpResponse = await this.http.post(
'https://yjspt.xidian.edu... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left checkWhetherPostgraduate 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 : AS... | async checkWhetherPostgraduate(): Promise<void> {
console.info(TAG, 'checkWhetherPostgraduate: start');
try {
await this.navigateToYjspt(
'https://yjspt.xidian.edu.cn/gsapp/sys/yjsemaphome/portal/index.do');
const resp: HttpResponse = await this.http.post(
'https://yjspt.xidian.edu... | https://github.com/PollenWang6/HiXD | 35604d413e24bc432f8b7575ee234e5f19915a49 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | loadAllHosts | ==================== RemoteHost CRUD ==================== | loadAllHosts(): RemoteHost[] {
return this.loadAllHostsInternal(true);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left loadAllHosts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left :... | loadAllHosts(): RemoteHost[] {
return this.loadAllHostsInternal(true);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | c28c3066d10e50062d7f9f71f36056288bdb568d | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getGlassBorderColor | 获取玻璃边框色 | static getGlassBorderColor(): string {
return GlassColors.GLASS_BORDER;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getGlassBorderColor 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... | static getGlassBorderColor(): string {
return GlassColors.GLASS_BORDER;
} | https://github.com/chendi126/harmonyOS-TCP | 7fd04b5d852e2668c025e42978efb060e8861a70 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | buildHostRoute | Build a single-host (/32 or /128) tun route for one resolver IP. | private buildHostRoute(ip: string): vpnExtension.RouteInfo {
const isV6: boolean = ip.includes(':');
return {
interface: 'vpn-tun',
destination: {
address: {
address: ip,
family: isV6 ? 2 : 1,
port: 0,
},
prefixLength: isV6 ? IPV6_HOST_PREFIX_L... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildHostRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ip AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private buildHostRoute(ip: string): vpnExtension.RouteInfo {
const isV6: boolean = ip.includes(':');
return {
interface: 'vpn-tun',
destination: {
address: {
address: ip,
family: isV6 ? 2 : 1,
port: 0,
},
prefixLength: isV6 ? IPV6_HOST_PREFIX_L... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L591-L611 | 13a67704fada16f81f80ef972880a5708a927bf4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NativeJsEngine.ets | arkts | getVmCount | 获取当前活跃的虚拟机数量 | static getVmCount(): number {
if (!jsvmEngine) {
return 0;
}
try {
return jsvmEngine.getVmCount();
} catch (e) {
return 0;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getVmCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | static getVmCount(): number {
if (!jsvmEngine) {
return 0;
}
try {
return jsvmEngine.getVmCount();
} catch (e) {
return 0;
}
} | https://github.com/DaLongZhuaZi/manxia | 4e0cb9c1a9107ee07f6394b574f0865ff5587364 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/pages/Index.ets | arkts | getOsIcon | 获取系统图标资源 | function getOsIcon(osType: string): Resource {
switch (osType.toLowerCase()) {
case 'windows': return $r('app.media.ic_os_windows')
case 'linux': return $r('app.media.ic_os_linux')
case 'macos': return $r('app.media.ic_os_macos')
case 'harmonyos': return $r('app.media.ic_os_harmonyos')
case 'bsd':... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getOsIcon AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left osType AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function getOsIcon(osType: string): Resource {
switch (osType.toLowerCase()) {
case 'windows': return $r('app.media.ic_os_windows')
case 'linux': return $r('app.media.ic_os_linux')
case 'macos': return $r('app.media.ic_os_macos')
case 'harmonyos': return $r('app.media.ic_os_harmonyos')
case 'bsd':... | https://github.com/AetheriumSimulator/qemu-hmos | dd5c9751fa85d882c010489f7930fb55cf4b7ac3 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/select/picker/components/BasicStylePicker.ets | arkts | formatDateTitle | Formats a date string based on the system locale.
Chinese format: "YYYY年 MM月, DD日" (e.g., "2023年 11月, 17日")
English format: "Month DD, YYYY" (e.g., "November 17, 2023")
@param {Context | undefined} ctx - context of the ability
@param {Date} date - the date object to be formatted
@returns {string} the formatted date str... | function formatDateTitle(ctx: Context | undefined, date: Date): string {
const month = date.getMonth() + 1;
const day = date.getDate();
const year = date.getFullYear();
const context = ctx as common.UIAbilityContext;
if (context.config.language?.startsWith('zh')) {
return `${year}年 ${month}月 ${day}日`;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatDateTitle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function formatDateTitle(ctx: Context | undefined, date: Date): string {
const month = date.getMonth() + 1;
const day = date.getDate();
const year = date.getFullYear();
const context = ctx as common.UIAbilityContext;
if (context.config.language?.startsWith('zh')) {
return `${year}年 ${month}月 ${day}日`;
... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 96cd2161239143e504b39f740c40bc2688a67c38 | gitcode |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/security/SecurityService.ets | arkts | decryptText | Decrypt encrypted data back to plain text | static decryptText(data: EncryptedData): string {
if (!data) {
throw new Error('SecurityService.decryptText: encrypted data is null')
}
return CryptoUtil.decrypt(data)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decryptText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Encr... | static decryptText(data: EncryptedData): string {
if (!data) {
throw new Error('SecurityService.decryptText: encrypted data is null')
}
return CryptoUtil.decrypt(data)
} | https://gitcode.com/openharmony/codelabs | f678ba1509ceffef8fe7e3c6cdfd6dcde0466483 | gitcode |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/SunshineRatingSystem.ets | arkts | evaluateSimple | 评估基础评估器结果
@param totalSunshineHours 全年总日照时长(小时)
@param dahanHours 大寒日照时长(小时)
@param dongzhiHours 冬至日照时长(小时)
@param averageDailyHours 年平均每日日照时长(小时) | static evaluateSimple(
totalSunshineHours: number,
dahanHours: number,
dongzhiHours: number,
averageDailyHours: number
): RatingResult {
let score = 0;
let suggestions: string[] = [];
// 1. 国标符合性评估 (40分)
const meetsDahan = dahanHours >= 2;
const meetsDongzhi = dongzhiHours >... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left evaluateSimple AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left totalSunshineHours AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | static evaluateSimple(
totalSunshineHours: number,
dahanHours: number,
dongzhiHours: number,
averageDailyHours: number
): RatingResult {
let score = 0;
let suggestions: string[] = [];
// 1. 国标符合性评估 (40分)
const meetsDahan = dahanHours >= 2;
const meetsDongzhi = dongzhiHours >... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 7e31522ecb2430b72da2a59947ad9e2f815aff14 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.