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 |
|---|---|---|---|---|---|---|---|---|---|---|
Your-USTC/DailyNic_HMOS | entry/src/main/ets/utils/Classes/ScheduleManager.ets | arkts | newSemester | 创建新学期
@param name 学期名称
@param source 来源
@param beginTime 开始时间戳
@param createTime 创建时间戳
@param totWeekNum 总周数
@param timetable 课程表
@returns undefined,但如果发生错误则返回错误信息的字符串 | newSemester(name: string, source: string, beginTime: number, createTime: number, totWeekNum: number = 0, timetable: classAttribute[] = []): string | undefined {
try {
if (timetable) {
totWeekNum = this.getLatestWeek(timetable);
}
const semesterConfig: semesterAttribute = {
name: ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left newSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | newSemester(name: string, source: string, beginTime: number, createTime: number, totWeekNum: number = 0, timetable: classAttribute[] = []): string | undefined {
try {
if (timetable) {
totWeekNum = this.getLatestWeek(timetable);
}
const semesterConfig: semesterAttribute = {
name: ... | https://github.com/Your-USTC/DailyNic_HMOS | c82b3f3a79b4821ac089e8d862dd56d0cb9ec670 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AnimationUtils.ets | arkts | easeOutQuad | 缓动函数 - 快进慢出
@param t 进度 (0-1)
@returns 缓动后的进度 | static easeOutQuad(t: number): number {
return t * (2 - t);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left easeOutQuad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | static easeOutQuad(t: number): number {
return t * (2 - t);
} | https://github.com/the-wwyang/kids-learning-app | d637abe104c6ce3f18ed316ae1c86777bbbd2174 | github |
LZZLHY/hlib | entry/src/main/ets/utils/Layout.ets | arkts | useDetailTwoColumn | 是否启用 BookDetail 双栏布局(≥md)。 | static useDetailTwoColumn(bp: Breakpoint): boolean {
return bp !== 'sm';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left useDetailTwoColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static useDetailTwoColumn(bp: Breakpoint): boolean {
return bp !== 'sm';
} | https://github.com/LZZLHY/hlib | c78fbbf4a3790ebc69cb23ca9ca7f2599add95aa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | cbrt | Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
`precision` significant digits using rounding mode `rounding`.
@returns { Decimal } the Decimal type | public cbrt(): Decimal {
let x: Decimal = this;
if (!x.isFinite() || x.isZero()) {
return new Decimal(x);
}
external = false;
// Initial estimate.
let s: double = x.s * Math.pow(x.s * x.toNumber(), 1 / 3);
// Math.cbrt underflow/overflow?
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left cbrt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public cbrt(): Decimal {
let x: Decimal = this;
if (!x.isFinite() || x.isZero()) {
return new Decimal(x);
}
external = false;
// Initial estimate.
let s: double = x.s * Math.pow(x.s * x.toNumber(), 1 / 3);
// Math.cbrt underflow/overflow?
... | https://gitcode.com/iop123123/arkts-static-skills | 8a312145f4e8eeebc77ab03a8c22c805df15cf03 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | xComponentDisPatchMouseWheel | xcomponent send mouseWheel event to flutterEngine
@param xcomponentId
@param eventType
@param event | xComponentDisPatchMouseWheel(xcomponentId: string, eventType: string, event: PanGestureEvent) {
// only mouse
if (event.source !== SourceType.Mouse) {
return;
}
const vaildFinger = event.fingerList?.find(item => item.globalX && item.globalY);
if (!vaildFinger) {
return;
}
flutt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left xComponentDisPatchMouseWheel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xcomponentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ... | xComponentDisPatchMouseWheel(xcomponentId: string, eventType: string, event: PanGestureEvent) {
// only mouse
if (event.source !== SourceType.Mouse) {
return;
}
const vaildFinger = event.fingerList?.find(item => item.globalX && item.globalY);
if (!vaildFinger) {
return;
}
flutt... | https://gitee.com/openharmony-sig/flutter_engine.git | c979abfd768239ecdaa8aefb96b09b22e1c6bb0c | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | send_play_list | 7x4 列表广播 // | private send_play_list() {
emitter.emit({ eventId: 714 }, { data: { play_list: this.play_list } })
emitter.emit({ eventId: 724 }, { data: { play_list: this.play_list } })
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_play_list 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#{#Le... | private send_play_list() {
emitter.emit({ eventId: 714 }, { data: { play_list: this.play_list } })
emitter.emit({ eventId: 724 }, { data: { play_list: this.play_list } })
} | https://github.com/Nekofox-POT/LinMusic | 2cbf2d80a4336dab62a63a786afed25f269a5e78 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_uint.ets | arkts | main | ---
desc: check postfix increment for unsigned integer operand
--- | function main(): void {
let value: uint = {{v.value}}
let result: uint = value++
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: uint = {{v.value}}
let result: uint = value++
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f084dcafacbd7263ce7a313352712794e71754d9 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | expand | Creates the smallest range that includes the current range and the given lower and upper bounds.
@param { ScopeType } lowerObj - A ScopeType value
@param { ScopeType } upperObj - A ScopeType value
@returns { ScopeHelper } Returns the smallest range that includes the current range and the given lower and upper bounds. | expand(lowerObj: T, upperObj: T): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(lowerObj) ? lowerObj : this._lowerLimit
let upperLimit = this._upperLimit.compareTo(upperObj) ? this._upperLimit : upperObj
return new ScopeHelper<T>(lowerLimit, upperLimit)
... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left expand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lowerObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#R... | expand(lowerObj: T, upperObj: T): ScopeHelper<T> {
let lowerLimit = this._lowerLimit.compareTo(lowerObj) ? lowerObj : this._lowerLimit
let upperLimit = this._upperLimit.compareTo(upperObj) ? this._upperLimit : upperObj
return new ScopeHelper<T>(lowerLimit, upperLimit)
... | https://gitcode.com/iop123123/arkts-static-skills | 8fe1adea4d06676d266db6b5dc221ff52db49ea5 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Int16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = (this.getUnsafe(0)).toDouble(... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Int16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = (this.getUnsafe(0)).toDouble(... | https://gitcode.com/iop123123/arkts-static-skills | 37adc4f0cf0c34fc44fea8d3cb5960a10b7c990b | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | clear | Removes all elements from the ArrayList. | public clear(): void {
this.capacity = this.DEFAULT_CAPACITY;
this.buffer = new Array<T>();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | public clear(): void {
this.capacity = this.DEFAULT_CAPACITY;
this.buffer = new Array<T>();
} | https://gitcode.com/iop123123/arkts-static-skills | 88a4d07a6c73f35ebba5ec7309787cbc121d0e29 | gitcode |
openharmony/applications_filepicker | audiopicker/src/main/ets/localresource/localaudio/LocalAudioManager.ets | arkts | getLocalAudio | 获取FetchResult<FileAsset> | getLocalAudio(offset: number, limit: number, context: Context): Promise<Array<LocalAudioFile>> {
logger.info('getAudioAssets');
let mgr = userFileManager.getUserFileMgr(context);
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions: ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLocalAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | getLocalAudio(offset: number, limit: number, context: Context): Promise<Array<LocalAudioFile>> {
logger.info('getAudioAssets');
let mgr = userFileManager.getUserFileMgr(context);
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
let fetchOptions: ... | https://gitee.com/openharmony/applications_filepicker.git | 49787038b2a078b6c2d98cb4434b62d460640872 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | remove | Remove an element from the TreeMap
@param key: the key of the element which will be remove from the TreeMap
@returns the value of the removed element if the element is successfully removed from the TreeSet | remove(key: K): V | undefined {
let entry = this.getEntry(key);
if (entry === undefined) {
return undefined;
}
if (this.elementNum === 1) {
this.clear();
return entry.val;
}
if ((entry.left !== undefined) && (entry.right !== unde... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right A... | remove(key: K): V | undefined {
let entry = this.getEntry(key);
if (entry === undefined) {
return undefined;
}
if (this.elementNum === 1) {
this.clear();
return entry.val;
}
if ((entry.left !== undefined) && (entry.right !== unde... | https://gitcode.com/iop123123/arkts-static-skills | 61e78dc79aad3dde91986a396122e9eaa76b7dd1 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets | arkts | subscribeUncollectEvent | 订阅取消收藏event
@param callback | subscribeUncollectEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT, key, callback)
} | AST#program#Left AST#ERROR#Left AST#identifier#Left subscribeUncollectEvent AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left... | subscribeUncollectEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT, key, callback)
} | https://github.com/RedRackham-R/WanAndroidHarmoney | c96d79770b3f6adc86b25e512ed4355992cdd153 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | unregisterGlobalCallback | 取消全局回调 | public unregisterGlobalCallback(callback: UnifiedDownloadCallback): void {
this.globalCallbacks.delete(callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterGlobalCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | public unregisterGlobalCallback(callback: UnifiedDownloadCallback): void {
this.globalCallbacks.delete(callback);
} | https://github.com/DaLongZhuaZi/manxia | 3956468019bbf7d3ac61b84b218a16707fb8b416 | github |
openharmony/arkui_ace_engine | examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets | arkts | build | 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面 | build() {
Column() {
Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 })
TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%')
.onChange((value: string) => {
this.textValue = value
})
.key('keyboard_in_customDialog')
Text('Wh... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 })
TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%')
.onChange((value: string) => {
this.textValue = value
})
.key('keyboard_in_customDialog')
Text('Wh... | https://gitee.com/openharmony/arkui_ace_engine.git | 7a3ea7abcefe9b1a37b64eb835cbd4bfd1fc5ccb | gitee |
Joker-x-dev/CoolMallArkTS | core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets | arkts | getPassword | 读取密码(默认返回空字符串)
@returns {Promise<string>} 用户密码 | async getPassword(): Promise<string> {
const value: preferences.ValueType = await this.prefs.get(AccountStoreDataSourceImpl.KEY_PASSWORD, "");
return typeof value === "string" ? value : "";
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPassword AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getPassword(): Promise<string> {
const value: preferences.ValueType = await this.prefs.get(AccountStoreDataSourceImpl.KEY_PASSWORD, "");
return typeof value === "string" ? value : "";
} | https://github.com/Joker-x-dev/CoolMallArkTS | a6159a718fff568ee2205edd07e481b71ce34961 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | getConnectedGamepads | 获取已连接的手柄列表(已去重) | getConnectedGamepads(): GamepadInfo[] {
if (this.useGameControllerKit) {
// Game Controller Kit 模式下从设备列表构建,按槽位去重
const devices = gameControllerService.getAllDevices();
const slotSeen = new Set<number>();
const result: GamepadInfo[] = [];
for (const d of devices) {
const slot ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getConnectedGamepads 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#... | getConnectedGamepads(): GamepadInfo[] {
if (this.useGameControllerKit) {
// Game Controller Kit 模式下从设备列表构建,按槽位去重
const devices = gameControllerService.getAllDevices();
const slotSeen = new Set<number>();
const result: GamepadInfo[] = [];
for (const d of devices) {
const slot ... | https://github.com/AlkaidLab/moonlight-harmony | bd020994fc5e686a649a67caf381cda34ed57458 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/BatchInsertOptions.ets | arkts | createFast | 创建快速插入选项(不使用事务,不执行钩子)
适用于大量数据的快速导入场景
@returns 快速插入的 BatchInsertOptions 实例 | static createFast(): BatchInsertOptions {
return new BatchInsertOptions(false, false, false)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFast 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 BatchInsert... | static createFast(): BatchInsertOptions {
return new BatchInsertOptions(false, false, false)
} | https://github.com/offlinecat-dev/OCNetORM | 7a512dc1d405b6b1225b0adb28ac7a243198c0bc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | multiline | Gets the multiline flag, indicating whether to perform multiline matching.
@return { boolean } `true` if multiline matching is enabled, `false` otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get multiline(): boolean {
return this.isMultiline
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left multiline 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#Righ... | get multiline(): boolean {
return this.isMultiline
} | https://gitcode.com/iop123123/arkts-static-skills | 56b59faa8767ddf408b42cf186b55c69841c0767 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamWindowManager.ets | arkts | calculateXComponentSizeForViewport | 按指定视口尺寸计算 XComponent 尺寸。
全屏和浮窗共用同一套等比适配逻辑,避免窗口模式下 Surface 拉伸/裁剪。 | calculateXComponentSizeForViewport(viewportWidth: number, viewportHeight: number,
stretchVideo: boolean = false): XComponentSize {
if (stretchVideo) {
return { width: '100%', height: '100%' };
}
if (viewportWidth <= 0 || viewportHeight <= 0) {
return { width: '100%', height: '100%' };
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateXComponentSizeForViewport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewportWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERRO... | calculateXComponentSizeForViewport(viewportWidth: number, viewportHeight: number,
stretchVideo: boolean = false): XComponentSize {
if (stretchVideo) {
return { width: '100%', height: '100%' };
}
if (viewportWidth <= 0 || viewportHeight <= 0) {
return { width: '100%', height: '100%' };
... | https://github.com/AlkaidLab/moonlight-harmony | c0c6af800e85b81b950ecf5b8c028be322688053 | github |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/CheckinSettings.ets | arkts | load | 从持久化对象加载签到字段 | load(saved: SettingsState): void {
if (saved.autoCheckin !== undefined) this.ctx.state.autoCheckin = saved.autoCheckin
if (saved.lastCheckinDate) this.ctx.state.lastCheckinDate = saved.lastCheckinDate
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saved AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SettingsState AST#identifier#Right AST#)#Left ) AS... | load(saved: SettingsState): void {
if (saved.autoCheckin !== undefined) this.ctx.state.autoCheckin = saved.autoCheckin
if (saved.lastCheckinDate) this.ctx.state.lastCheckinDate = saved.lastCheckinDate
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/CheckinSettings.ets#L46-L49 | 393dbecb225b5255dac62ee06c615157d1949ba5 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedEnum | 访问 repeated enum 字段
JSON: array of number | visitRepeatedEnum(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedEnum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number ... | visitRepeatedEnum(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = [...value] as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 805d30bc194caf0b38e69ca37a344f04d86f1e1d | gitcode |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | getSupportedCamerasFn | 获取支持指定的相机设备对象 | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSupportedCamerasFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#E... | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
Logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng... | https://gitee.com/openharmony/multimedia_camera_framework.git | 33eb40f4a42aaccbf76cb50a5fd773948847d816 | gitee |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/transcoder/Transcoder.ets | arkts | startTranscoderingProcess | 开始转码对应的流程。 | async startTranscoderingProcess(srcPath: string, dstPath: string) {
if (Transcoder.canIUse()) {
if (this.avTranscoder != undefined) {
await this.avTranscoder.release();
this.avTranscoder = undefined;
}
// 1.创建转码实例。
this.avTranscoder = await media.createAVTranscoder();
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startTranscoderingProcess AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left srcPath AST#identif... | async startTranscoderingProcess(srcPath: string, dstPath: string) {
if (Transcoder.canIUse()) {
if (this.avTranscoder != undefined) {
await this.avTranscoder.release();
this.avTranscoder = undefined;
}
// 1.创建转码实例。
this.avTranscoder = await media.createAVTranscoder();
... | https://github.com/iHongRen/harmony-study-demo | e608069daabdb4750fa5ceed86457c8a3051b4d4 | github |
Vsolon0401/MallShopping | common/src/main/ets/utils/Preferences.ets | arkts | getPreferences | 获取首选项实例
@returns | getPreferences(): Promise<dataPreferences.Preferences> {
return GlobalContext.getContext().getObject(this.keyPreferences) as Promise<dataPreferences.Preferences>
} | AST#program#Left AST#expression_statement#Left AST#as_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#... | getPreferences(): Promise<dataPreferences.Preferences> {
return GlobalContext.getContext().getObject(this.keyPreferences) as Promise<dataPreferences.Preferences>
} | https://github.com/Vsolon0401/MallShopping | 6e137c0a30cf2c5260f016fac584c4e7074bbee7 | github |
ibestservices/ibest-ui | library/src/main/ets/components/form/index.ets | arkts | getValues | 获取表单值 | getValues(){
const result: Record<string, IBestFieldValueType> = {}
this.formItems.forEach((item: IBestFieldItem) => {
result[item.prop] = item.getValue()
})
return Promise.resolve(result)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | getValues(){
const result: Record<string, IBestFieldValueType> = {}
this.formItems.forEach((item: IBestFieldItem) => {
result[item.prop] = item.getValue()
})
return Promise.resolve(result)
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/form/index.ets#L171-L177 | 2617b33889370e1319d1804efd2fb4e4211f0222 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/components/CommonCodeLayout.ets | arkts | vibratorPlay | 传感器震动 | vibratorPlay() {
try {
vibrator.startVibration({
type: 'time',
duration: 100
}, {
id: 0,
usage: 'alarm'
}).then((): void => {
}, (error: BusinessError) => {
logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left vibratorPlay 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 ... | vibratorPlay() {
try {
vibrator.startVibration({
type: 'time',
duration: 100
}, {
id: 0,
usage: 'alarm'
}).then((): void => {
}, (error: BusinessError) => {
logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
... | https://gitcode.com/arkui-x/samples | 35313cf7dd83d218db0cbf141f92a6e86e3c6e48 | gitcode |
honjow/Next2V | shared/src/main/ets/settings/CloudSyncSettings.ets | arkts | isFeatureEnabled | ----- Per-feature toggles ----- | static isFeatureEnabled(key: string): boolean {
const state: CloudSyncState = connectCloudSync()
if (key === CloudSyncFeature.SEARCH_HISTORY) {
return state.featSearchHistory
}
if (key === CloudSyncFeature.COLLECTIONS) {
return state.featCollections
}
if (key === CloudSyncFeature.R... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFeatureEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static isFeatureEnabled(key: string): boolean {
const state: CloudSyncState = connectCloudSync()
if (key === CloudSyncFeature.SEARCH_HISTORY) {
return state.featSearchHistory
}
if (key === CloudSyncFeature.COLLECTIONS) {
return state.featCollections
}
if (key === CloudSyncFeature.R... | https://github.com/honjow/Next2V | 498e8bc494314f852498707a81651d1f8cf6c710 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/DebounceUtil.ets | arkts | immediate | 立即执行并取消待执行的防抖
@param key 唯一标识键
@param func 要执行的函数 | static immediate(key: string, func: Function): void {
DebounceUtil.cancel(key)
func()
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left immediate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static immediate(key: string, func: Function): void {
DebounceUtil.cancel(key)
func()
} | https://github.com/Yebingiscn/SweetVideo | cfebbbb1c9f7492ddd9a13d1f067e2198022325f | github |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/pages/CameraOptPage.ets | arkts | build | [End release_camera] | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
RelativeContainer() {
Text(this.message)
.id('HelloWorld')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 4df75edc4b573a8d06e246b1d1ae8f3562ad6392 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Message.ets | arkts | getCallback | Get the message callback function
@returns { Task } The callback function | public getCallback(): CB | undefined {
if (this.callback != undefined) {
return this.callback as CB;
}
return undefined;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST... | public getCallback(): CB | undefined {
if (this.callback != undefined) {
return this.callback as CB;
}
return undefined;
} | https://gitcode.com/iop123123/arkts-static-skills | eca2d5ceb220bb4bc66032f43608a5e1e427b322 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | flags | Gets the flags of the regular expression.
@return { String } A string containing the flags used for the regular expression.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get flags(): String {
if (!this.flagsSorted_) {
this.flags_ = this.flags_.split("").sort().join("")
this.flagsSorted_ = true
}
return this.flags_
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left flags 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 AST#identifier#Rig... | get flags(): String {
if (!this.flagsSorted_) {
this.flags_ = this.flags_.split("").sort().join("")
this.flagsSorted_ = true
}
return this.flags_
} | https://gitcode.com/iop123123/arkts-static-skills | 30b3228d8791bfe7c4449fd764b2a0479fbf51ef | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | ssp | Gets the decoding scheme-specific part of the URI.
@returns { string } | get ssp(): string {
return this.dealDecodeInput(this.uriEntry.getSsp())
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left ssp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERR... | get ssp(): string {
return this.dealDecodeInput(this.uriEntry.getSsp())
} | https://gitcode.com/iop123123/arkts-static-skills | e1d67fcc542c17d7c4ccbbe2ed6f60fb746487ab | gitcode |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CartRepository.ets | arkts | clearCart | 清空购物车
@returns {Promise<void>} Promise<void> | clearCart(): Promise<void> {
return this.dataSource.clearCart();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearCart 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#iden... | clearCart(): Promise<void> {
return this.dataSource.clearCart();
} | https://github.com/Joker-x-dev/CoolMallArkTS | abe3d7b65dda2f8e1ac7db6d977a09af6ef4ed9d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/AvifTranscoder.ets | arkts | probeAvifHeader | 读取并解析 AVIF 的 ISOBMFF 头部(ftyp box),用于诊断源文件格式是否正确 | private async probeAvifHeader(avifPath: string): Promise<AvifHeaderInfo> {
let fd: number | null = null;
try {
const file = await fileIo.open(avifPath, fileIo.OpenMode.READ_ONLY);
fd = file.fd;
const bufferSize: number = 64;
const buffer: ArrayBuffer = new ArrayBuffer(bufferSize as num... | 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 probeAvifHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left avifPath AST#identifier#Right AST#ERROR#Left AST#:#L... | private async probeAvifHeader(avifPath: string): Promise<AvifHeaderInfo> {
let fd: number | null = null;
try {
const file = await fileIo.open(avifPath, fileIo.OpenMode.READ_ONLY);
fd = file.fd;
const bufferSize: number = 64;
const buffer: ArrayBuffer = new ArrayBuffer(bufferSize as num... | https://github.com/DaLongZhuaZi/manxia | ebf53c5b91f3b4cba136a717744399deb66e0a08 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getTopicsByUsername | Get topics by username | async getTopicsByUsername(username: string): Promise<V2exTopic[]> {
const snapshot = await this.getMemberTopicsPage(username, 1)
return this.getTopicsByIds(snapshot.topicIds)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTopicsByUsername AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#... | async getTopicsByUsername(username: string): Promise<V2exTopic[]> {
const snapshot = await this.getMemberTopicsPage(username, 1)
return this.getTopicsByIds(snapshot.topicIds)
} | https://github.com/honjow/Next2V | b3f8bd2fb6bf37db14a4460c5643e18a80683545 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | setParentSize | 设置容器尺寸 | setParentSize(width: number, height: number): void {
this.parentWidth = width;
this.parentHeight = height;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setParentSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | setParentSize(width: number, height: number): void {
this.parentWidth = width;
this.parentHeight = height;
} | https://github.com/AlkaidLab/moonlight-harmony | d90bbd5576afae6e69b1e02a7e31cf7bf215088f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test25_original_index.ets | arkts | testInstanceOf | --- instanceof narrowing --- | function testInstanceOf(): string {
let err: Object = new Error('test') as Object;
if (err instanceof Error) {
let e: Error = err as Error;
return e.message;
}
return 'not error';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testInstanceOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testInstanceOf(): string {
let err: Object = new Error('test') as Object;
if (err instanceof Error) {
let e: Error = err as Error;
return e.message;
}
return 'not error';
} | https://github.com/miaochiahao/ark-ghidra | ebd688701a295642a4e9866338de36d147579a41 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getAppFontFamily | ==================== 字体应用接口 ====================
获取APP界面字体族 | public static getAppFontFamily(): string {
return FontAwareHelper.globalState.appFontFamily;
} | 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 getAppFontFamily AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public static getAppFontFamily(): string {
return FontAwareHelper.globalState.appFontFamily;
} | https://github.com/DaLongZhuaZi/manxia | 0c753c800502e801d715388f401f576bdaf546b6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | subTypeOf | class.subTypeOf(U) means that `class extends U` or `class implements U`
Checks if this type is a subtype of another type.
@param {Type} other Type to check against.
@returns {boolean} True if this type is a subtype of other.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | protected override subTypeOf(other: Type): boolean {
if (super.subTypeOf(other)) {
return true
}
// `this` is derived of `other` class?
if (other instanceof ClassType) {
if (other.isAnyClass()) {
return true;
}
if (this.... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left subTypeOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#L... | protected override subTypeOf(other: Type): boolean {
if (super.subTypeOf(other)) {
return true
}
// `this` is derived of `other` class?
if (other instanceof ClassType) {
if (other.isAnyClass()) {
return true;
}
if (this.... | https://gitcode.com/iop123123/arkts-static-skills | a36f639c6a6f82e1fed5893b00b0efe56c338376 | gitcode |
openharmony/codelabs | ETSUI/ECommerce/entry/src/main/ets/utils/RdbUtil.ets | arkts | addToCart | 添加商品到购物车 | static async addToCart(item: CartItem): Promise<void> {
const existingMem = RdbUtil.memCart.find(c => c.productId === item.productId);
if (existingMem) {
existingMem.count += item.count;
existingMem.selected = true;
} else {
item.id = RdbUtil.memCart.length + 1;
RdbUtil.memCart.pus... | 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 addToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#R... | static async addToCart(item: CartItem): Promise<void> {
const existingMem = RdbUtil.memCart.find(c => c.productId === item.productId);
if (existingMem) {
existingMem.count += item.count;
existingMem.selected = true;
} else {
item.id = RdbUtil.memCart.length + 1;
RdbUtil.memCart.pus... | https://gitcode.com/openharmony/codelabs | 7ae86cdfd764666d0c34fb6ce9c2038ad245c24e | gitcode |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/CloudSyncService.ets | arkts | syncUserFromCloud | 同步单个用户:从云端拉取用户数据到本地
用于登录时检查用户是否存在
返回结构与CloudService.login兼容 | async syncUserFromCloud(username: string, passwordHash: string): Promise<CloudResult> {
console.info('[CloudSyncService]: 同步用户', username);
try {
const cloudResult: CloudResult = await this.cloud.login(username, passwordHash);
if (cloudResult.success && cloudResult.user) {
cons... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left syncUserFromCloud AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Le... | async syncUserFromCloud(username: string, passwordHash: string): Promise<CloudResult> {
console.info('[CloudSyncService]: 同步用户', username);
try {
const cloudResult: CloudResult = await this.cloud.login(username, passwordHash);
if (cloudResult.success && cloudResult.user) {
cons... | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/CloudSyncService.ets#L68-L134 | 93d0e9add41ffd1dc43f3552542e92e3737b4ce7 | github |
the-wwyang/kids-learning-app | src/main/ets/pages/DrawingGalleryPage.ets | arkts | getWork | 获取单个作品 | async getWork(workId: string): Promise<DrawingWork | null> {
try {
const works = await this.getAllWorks();
const work = works.find(w => w.id === workId);
return work || null;
} catch (error) {
console.error('获取作品失败:', error);
return null;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWork AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left workId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async getWork(workId: string): Promise<DrawingWork | null> {
try {
const works = await this.getAllWorks();
const work = works.find(w => w.id === workId);
return work || null;
} catch (error) {
console.error('获取作品失败:', error);
return null;
}
} | https://github.com/the-wwyang/kids-learning-app | 90768a479bce1a95aa3b8a10501583002b5866f8 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | evaluateACF | 评估ACF得分 | private static evaluateACF(acf: number[], threshold: number): number {
if (acf.length < 2) {
return 0;
}
// 跳过lag=0(总是1),检查其他滞后期
let significantLags = 0;
let maxACF = 0;
for (let i = 1; i < acf.length; i++) {
const absACF = Math.abs(acf[i]);
if (absACF > threshold) {
... | 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 evaluateACF AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left acf AST#identifier#Right AST#:#Left : AS... | private static evaluateACF(acf: number[], threshold: number): number {
if (acf.length < 2) {
return 0;
}
// 跳过lag=0(总是1),检查其他滞后期
let significantLags = 0;
let maxACF = 0;
for (let i = 1; i < acf.length; i++) {
const absACF = Math.abs(acf[i]);
if (absACF > threshold) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3941b9c5e44939d33c421757e8506c448af8e455 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/BackupService.ets | arkts | restore | entry/src/main/ets/services/BackupService.ets | public async restore(context: Context): Promise<number> {
logger.info('Starting restore...');
try {
const filesDir = context.filesDir;
const filePath = `${filesDir}/${BACKUP_FILE_NAME}`;
// 检查文件是否存在
if (!fs.accessSync(filePath)) {
const msg = context.resourceManager.getString... | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#... | public async restore(context: Context): Promise<number> {
logger.info('Starting restore...');
try {
const filesDir = context.filesDir;
const filePath = `${filesDir}/${BACKUP_FILE_NAME}`;
// 检查文件是否存在
if (!fs.accessSync(filePath)) {
const msg = context.resourceManager.getString... | https://gitcode.com/openharmony/codelabs | 7ef57bb9b961f0dcf34928c47119f7d4059ab6ae | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets | arkts | getUserInfoEndpoint | 获取用户信息端点URL
@return string 用户信息端点URL | protected getUserInfoEndpoint(): string {
return `${this.apiBaseUrl}/oauth2/v2/userinfo`;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getUserInfoEndpoint 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#Le... | protected getUserInfoEndpoint(): string {
return `${this.apiBaseUrl}/oauth2/v2/userinfo`;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets#L68-L70 | 6d17e17f209bc94990f2ba156faba04dbb292526 | github |
StarHeartY/CalculatorX | entry/src/main/ets/pages/settings/Settings.ets | arkts | build | 🌟 核心修复:路由地图必须放在主页面里!
@Builder pageMap(name: string, param: Object) {
if (name === 'MathStylePage') {
// param 传入 'comb' 表示组合,传入 'perm' 表示排列
MathStylePage({ styleType: param as string })
}
} | build() {
HdsNavigation() {
Scroll(this.scrollerForScroll) {
Column() {
Row().width('100%').height(96)
// ====================== 计算设置 ==========================
Column() {
GroupHeader({ title: '计算设置' })
MenuGroup() {
// 1. 角度单位
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
HdsNavigation() {
Scroll(this.scrollerForScroll) {
Column() {
Row().width('100%').height(96)
// ====================== 计算设置 ==========================
Column() {
GroupHeader({ title: '计算设置' })
MenuGroup() {
// 1. 角度单位
... | https://github.com/StarHeartY/CalculatorX | e73a0870ef9e323e240ebc0222651539b1800805 | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | hasNetEthernet | 判断当前网络是否是以太网网络。 | static hasNetEthernet(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_ETHERNET);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNetEthernet 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 AS... | static hasNetEthernet(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_ETHERNET);
} | https://github.com/tdcare/tdwebrtc | 70e1821f0064d113b658cf1f9e27576819a26f54 | github |
openharmony-tpc/openharmony_tpc_samples | SmartRefreshLayout/library/src/main/ets/components/bottomRefresh/BezierCircleBottomRefresh.ets | arkts | resetCount | Reset the count (in increment mode) | resetCount(): void{
this.progress = 0
this.mTargetProgress = 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetCount 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#L... | resetCount(): void{
this.progress = 0
this.mTargetProgress = 0
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 1de79de0c5c79c07616b28973af89aa3cac5cbb4 | gitee |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getCurrentHintText | 获取当前提示文本 | getCurrentHintText(): string {
const current: GameRecord | null = this.getCurrentQuestion();
if (!current) {
return '';
}
// 如果已经答错到极限(闯关模式),直接显示答案
if (current.errorCount >= GAME_CONFIG.MAX_ERROR_COUNT) {
return current.currentChengyu;
}
return getHintText(current.currentChen... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentHintText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#sta... | getCurrentHintText(): string {
const current: GameRecord | null = this.getCurrentQuestion();
if (!current) {
return '';
}
// 如果已经答错到极限(闯关模式),直接显示答案
if (current.errorCount >= GAME_CONFIG.MAX_ERROR_COUNT) {
return current.currentChengyu;
}
return getHintText(current.currentChen... | https://github.com/zcg741/chengyu-game | 125fdfe689aea0ef455c9d4b18ebfcb4547bd61d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneManager.ets | arkts | setStateListener | 设置状态监听器 | setStateListener(listener: MicrophoneStateListener): void {
this.externalListener = listener;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setStateListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MicrophoneStateListener AST#identif... | setStateListener(listener: MicrophoneStateListener): void {
this.externalListener = listener;
} | https://github.com/AlkaidLab/moonlight-harmony | 6337119e54df7364d8c69bd4e7a3dfef4d411d44 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | getShowAreaItemTranslate | Display area movement function | getShowAreaItemTranslate(index: int): TranslateOptions {
// Position when dragging
if (this.isStartDrag) {
let coodXY = this.getCoodXY(index);
return {
x: coodXY.x,
y: coodXY.y
};
}
// Position when remove item
if (!this.isStartDrag && index === this.selectedInde... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getShowAreaItemTranslate 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#Right AST#ERROR#Right AST#)... | getShowAreaItemTranslate(index: int): TranslateOptions {
// Position when dragging
if (this.isStartDrag) {
let coodXY = this.getCoodXY(index);
return {
x: coodXY.x,
y: coodXY.y
};
}
// Position when remove item
if (!this.isStartDrag && index === this.selectedInde... | https://gitcode.com/openharmony/arkui_ace_engine | 7ad103464edafcc2528994070ecc6f145db09cf4 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkTS/ArkTSCompilationToolchain/ArkBytecode/FundamentalsAndNamingConventions/entry/src/main/ets/pages/Index.ets | arkts | foo0 | [Start registers_accumulator] | function foo0(): number {
return 1;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo0 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 foo0(): number {
return 1;
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 50cb5c1223eb250eb6bb31ee18d73c9886f4460d | gitcode |
erosTeam/NextE | feature/reader/src/main/ets/viewmodel/ReaderViewModel.ets | arkts | jumpTo | Jump-to-page (slider release). The image list is contiguous, so reaching page N still means the
preview pages up to it must be loaded — but ensureLoaded fetches the missing ones concurrently, so
a far jump pipelines its GETs behind the `jumping` spinner instead of crawling one at a time.
Returns the clamped, now-loaded... | async jumpTo(index: number): Promise<number> {
if (index < 0 || this.jumping) {
return this.currentIndex
}
this.jumping = true
await this.ensureLoaded(index, 'jump')
this.jumping = false
const total: number = this.totalPages()
const target: number = total > 0 ? Math.min(index, total ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left jumpTo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left index AST#identifier#Right AST#type_an... | async jumpTo(index: number): Promise<number> {
if (index < 0 || this.jumping) {
return this.currentIndex
}
this.jumping = true
await this.ensureLoaded(index, 'jump')
this.jumping = false
const total: number = this.totalPages()
const target: number = total > 0 ? Math.min(index, total ... | https://github.com/erosTeam/NextE | 360a9d1b4111ccff87b948db81ca67209d679262 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/CacheStatusService.ets | arkts | getAllCachedMangas | 获取所有已缓存的漫画列表
[改进] 直接从数据库查询有缓存页面的漫画,而不是依赖文件系统扫描
这样可以获取正确的漫画标题和完整的缓存信息 | async getAllCachedMangas(sourceId: number): Promise<ContentCacheStats[]> {
try {
// 使用DataManager的新方法获取已缓存的漫画列表
const cachedMangas = await this.dataManager.getCachedMangasBySource(sourceId);
const results: ContentCacheStats[] = [];
for (const manga of cachedMangas) {
if (man... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllCachedMangas AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:... | async getAllCachedMangas(sourceId: number): Promise<ContentCacheStats[]> {
try {
// 使用DataManager的新方法获取已缓存的漫画列表
const cachedMangas = await this.dataManager.getCachedMangasBySource(sourceId);
const results: ContentCacheStats[] = [];
for (const manga of cachedMangas) {
if (man... | https://github.com/DaLongZhuaZi/manxia | 70d1c8257e4ceedfc0ad65e529d27fc70ae2771b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets | arkts | constructor | Constructs a LinkedBlockingQueue with the Iterable.
@param { Iterable<T> } iterable the Iterable of LinkedBlockingQueue | constructor(iterable: Iterable<T>) {
this.actualCapacity = Int.MAX_VALUE;
this.head = new ListNode<T>();
this.tail = this.head;
if (iterable) {
const entriesIter = iterable.$_iterator();
for (let iterRes = entriesIter.next(); !iterR... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iterable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif... | constructor(iterable: Iterable<T>) {
this.actualCapacity = Int.MAX_VALUE;
this.head = new ListNode<T>();
this.tail = this.head;
if (iterable) {
const entriesIter = iterable.$_iterator();
for (let iterRes = entriesIter.next(); !iterR... | https://gitcode.com/iop123123/arkts-static-skills | 7427db16abd5048b4ce14a63591f98ab2b4ae3a4 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | Creates a new Int16Array from current Int16Array based on a condition fn.
@param fn the condition to apply for each element
@returns a new Int16Array with elements from current Int16Array that satisfy condition fn | public filter(fn: (val: short, index: int, array: Int16Array) => boolean): Int16Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: short, index: int, array: Int16Array) => boolean): Int16Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 07ee1c440abae1f85280de7ed1928388d789ba7c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | removeListener | 移除设备变化监听器 | public removeListener(listener: DeviceChangeListener): void {
this.listeners.delete(listener);
logger.debug(TAG, `移除监听器,当前监听器数量: ${this.listeners.size}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public removeListener(listener: DeviceChangeListener): void {
this.listeners.delete(listener);
logger.debug(TAG, `移除监听器,当前监听器数量: ${this.listeners.size}`);
} | https://github.com/DaLongZhuaZi/manxia | ef7f42c5ed9b5af35a93c71ec0d102a3fa9aa9df | github |
codelably/HCompass | core/di/src/main/ets/ServiceContainer.ets | arkts | has | 检查服务是否已注册
@param key 服务标识符
@returns 是否已注册 | has(key: ServiceKey): boolean {
if (this.services.has(key)) {
return true;
}
if (this.parent) {
return this.parent.has(key);
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ServiceKey AST#identifier#Right AST#)#Left ) AST#)#Ri... | has(key: ServiceKey): boolean {
if (this.services.has(key)) {
return true;
}
if (this.parent) {
return this.parent.has(key);
}
return false;
} | https://github.com/codelably/HCompass | c52a8dda219efa0f31cbfd66495b969f7b6554ae | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Search/SearchIntentParser.ets | arkts | parseKomiicUrl | 解析Komiic URL | private static parseKomiicUrl(url: string, path: string): SearchIntent {
// /comic/12345 或 /comic/12345/chapter/xxx
const comicMatch = path.match(/\/comic\/(\d+)/);
if (comicMatch) {
const result: SearchIntent = {
type: SearchIntentType.MANGA_ID,
id: comicMatch[1],
url: url,
... | 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 parseKomiicUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left :... | private static parseKomiicUrl(url: string, path: string): SearchIntent {
// /comic/12345 或 /comic/12345/chapter/xxx
const comicMatch = path.match(/\/comic\/(\d+)/);
if (comicMatch) {
const result: SearchIntent = {
type: SearchIntentType.MANGA_ID,
id: comicMatch[1],
url: url,
... | https://github.com/DaLongZhuaZi/manxia | 42298a3de4c10890b5f4ae70ed0b63008d659407 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | manualRefresh | 手动刷新会话 | async manualRefresh(sourceId: number): Promise<boolean> {
const refreshCallback = this.refreshCallbacks.get(sourceId);
if (!refreshCallback) {
logger.warn(TAG, `未找到刷新回调: sourceId=${sourceId}`);
return false;
}
try {
await refreshCallback();
// 更新状态
const state = t... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left manualRefresh AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async manualRefresh(sourceId: number): Promise<boolean> {
const refreshCallback = this.refreshCallbacks.get(sourceId);
if (!refreshCallback) {
logger.warn(TAG, `未找到刷新回调: sourceId=${sourceId}`);
return false;
}
try {
await refreshCallback();
// 更新状态
const state = t... | https://github.com/DaLongZhuaZi/manxia | d8a9a25a4b59ab50dfac45de6fa28c595df21230 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/XAxisRendererHorizontalBarChart.ets | arkts | renderLimitLines | Draws the LimitLines associated with this axis to the screen.
This is the standard YAxis renderer using the XAxis limit lines.
@param c | public renderLimitLines(c: CanvasRenderingContext2D) {
if (!this.mXAxis || !this.mViewPortHandler) {
return;
}
let limitLines: JArrayList<LimitLine> = this.mXAxis.getLimitLines();
if (limitLines == null || limitLines.size() <= 0)
return;
let pts: number[] = this.mRenderLimitLinesBuf... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left renderLimitLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ca... | public renderLimitLines(c: CanvasRenderingContext2D) {
if (!this.mXAxis || !this.mViewPortHandler) {
return;
}
let limitLines: JArrayList<LimitLine> = this.mXAxis.getLimitLines();
if (limitLines == null || limitLines.size() <= 0)
return;
let pts: number[] = this.mRenderLimitLinesBuf... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 56636009e00ea0a89929ab78b3d7af1bd2f513bf | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | constructor | Creates a new instance of ArrayList. | public constructor() {
this.capacity = this.DEFAULT_CAPACITY;
this.buffer = new Array<T>();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.capacity = this.DEFAULT_CAPACITY;
this.buffer = new Array<T>();
} | https://gitcode.com/iop123123/arkts-static-skills | 48419cf3dbde81c5b6d717b85f700a7cc15e60ad | gitcode |
2763981847/Accounting-app | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | query | 查询数据库表数据 | query(callback: Function, predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName)) {
// 调用 Rdb 对象的查询方法,传入查询条件和回调函数
this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
// 获取查询结果的行数
let count: number = resultS... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right A... | query(callback: Function, predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName)) {
// 调用 Rdb 对象的查询方法,传入查询条件和回调函数
this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
// 获取查询结果的行数
let count: number = resultS... | https://github.com/2763981847/Accounting-app | 7ec70925bbcdc7a76e4f3bf09b3839cce438f3d2 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V30.ets | arkts | maybeUnescapeText | ESCAPED-CHAR = "\\" / "\;" / "\," / "\n" / "\N")
; \\ encodes \, \n or \N encodes newline
; \; encodes ;, \, encodes ,
Note: Apple escapes ':' into '\:' while does not escape '\' | protected maybeUnescapeText(text:string):string {
return VCardParserImpl_V30.unescapeText(text);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left maybeUnescapeText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | protected maybeUnescapeText(text:string):string {
return VCardParserImpl_V30.unescapeText(text);
} | https://gitee.com/openharmony-tpc/VCard.git | 3a5fbefad81c38745637486a6731f28d7b54e54d | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/FilenameUtils.ets | arkts | getFileExt | 获取文件后缀
@param fileName 文件名
@returns 文件后缀 | public static getFileExt(fileName: string): string {
if (!fileName) {
return '';
}
const lastDotIndex = fileName.lastIndexOf('.');
if (lastDotIndex === -1) {
return '';
}
return fileName.substring(lastDotIndex + 1);
} | 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 getFileExt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | public static getFileExt(fileName: string): string {
if (!fileName) {
return '';
}
const lastDotIndex = fileName.lastIndexOf('.');
if (lastDotIndex === -1) {
return '';
}
return fileName.substring(lastDotIndex + 1);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L113-L122 | a0314e3bd6e954e6c5e4e701d017799b7d2337e2 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BuiltinPackLoader.ets | arkts | parsePackJson | Pure parser used by tests; no IO. Returns undefined on malformed input. | static parsePackJson(jsonText: string): Pack | undefined {
let raw: RawBuiltinPack;
try {
raw = JSON.parse(jsonText) as RawBuiltinPack;
} catch (_err) {
return undefined;
}
if (raw === null || raw === undefined) {
return undefined;
}
if (typeof raw.pack_id !== 'string' ||... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parsePackJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | static parsePackJson(jsonText: string): Pack | undefined {
let raw: RawBuiltinPack;
try {
raw = JSON.parse(jsonText) as RawBuiltinPack;
} catch (_err) {
return undefined;
}
if (raw === null || raw === undefined) {
return undefined;
}
if (typeof raw.pack_id !== 'string' ||... | https://github.com/terryma2024/happyword | 9c8c8f3881d806dbe1704d4034374f1cca55740d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | setNormalSystemBar | 设置正常系统栏
@param mainWindow 主窗口实例 | static setNormalSystemBar(mainWindow: window.Window): void {
if (AppStorage.get<boolean>('window_manager_theme_bar_enabled') !== false) {
WindowManager.applyThemeAwareSystemBar(mainWindow, true);
return;
}
try {
const themeStyle = WindowManager.resolveThemeSystemBarStyle();
const s... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setNormalSystemBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left mainWindow AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | static setNormalSystemBar(mainWindow: window.Window): void {
if (AppStorage.get<boolean>('window_manager_theme_bar_enabled') !== false) {
WindowManager.applyThemeAwareSystemBar(mainWindow, true);
return;
}
try {
const themeStyle = WindowManager.resolveThemeSystemBarStyle();
const s... | https://github.com/DaLongZhuaZi/manxia | a26dd2a1a92a024e8cd82beede9041c3a1bf0e37 | github |
erosTeam/NextE | shared/src/main/ets/parser/EhImagePageParser.ets | arkts | parseShowPage | Parse the /api.php method=showpage JSON response (eros_fe paraShowPageJson). `i3` holds the full
image `<img src>`; `i6` holds the origin link + the `nl('sourceId')` reload key. Throws on the
response `error` (e.g. 'Key mismatch') so the caller can fall back to the /s/ HTML path. The
showKey is reused (not returned her... | static parseShowPage(body: string): ImagePageResult {
const r: ImagePageResult = new ImagePageResult()
let obj: ShowPageResponse
try {
obj = JSON.parse(body) as ShowPageResponse
} catch (e) {
throw new Error('showpage: invalid JSON')
}
const err: string = typeof obj.error === 'stri... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseShowPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static parseShowPage(body: string): ImagePageResult {
const r: ImagePageResult = new ImagePageResult()
let obj: ShowPageResponse
try {
obj = JSON.parse(body) as ShowPageResponse
} catch (e) {
throw new Error('showpage: invalid JSON')
}
const err: string = typeof obj.error === 'stri... | https://github.com/erosTeam/NextE | 6e179bb2fd60b7dc71fddc2f404583601f61cea5 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | max | 获取指定列的最大值
@param column 列名或属性名
@returns Promise<ValueType> | async max(column: string): Promise<ValueType> {
return await this.withStoreLease(async () => {
return await this.aggregateExecutor.max(column)
})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left max AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left column AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async max(column: string): Promise<ValueType> {
return await this.withStoreLease(async () => {
return await this.aggregateExecutor.max(column)
})
} | https://github.com/offlinecat-dev/OCNetORM | f5a86ab6c789e2fba4eafee0e020cde052a6ffa7 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/ClipboardManager.ets | arkts | setListener | Set clipboard change listener | setListener(listener: ClipboardChangeListener): void {
this.listener = listener;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ClipboardChangeListener AST#identifier#R... | setListener(listener: ClipboardChangeListener): void {
this.listener = listener;
} | https://github.com/tangwengang-del/freerdp-harmonyos | a1287179f528dd9ecccf0fe399004ba40d3a5cb9 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | onClose | 关闭事件订阅
@param callback | public onClose(callback: () => void): void {
this.mSocket?.setOnCloseListener(callback);
this.onWifiDisconnect(callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left onClose AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Le... | public onClose(callback: () => void): void {
this.mSocket?.setOnCloseListener(callback);
this.onWifiDisconnect(callback);
} | https://github.com/openharmony/applications_app_samples | 86d58b052203e66fa9c578b9e36ca707505e21ad | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | checkImplemented | 当前so方法是否都实现
@returns | checkImplemented(methodName: string = ""): boolean {
if (!this.hasImplemented) {
Log.e(TAG, "this method has not implemented -> " + methodName)
}
return this.hasImplemented;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkImplemented AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left methodName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left st... | checkImplemented(methodName: string = ""): boolean {
if (!this.hasImplemented) {
Log.e(TAG, "this method has not implemented -> " + methodName)
}
return this.hasImplemented;
} | https://gitee.com/openharmony-sig/flutter_engine.git | 130f9dddc514349ec7889024c6c37cb11685a8df | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | bytesToBase64 | ========== 辅助方法 ==========
将 Uint8Array 转换为 base64 字符串
@param bytes 字节数组
@returns base64 字符串 | private bytesToBase64(bytes: Uint8Array): string {
// Base64 字符表
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
let result = ''
let i = 0
// 每 3 个字节编码为 4 个 base64 字符
for (; i < bytes.length - 2; i += 3) {
const b1 = bytes[i]
const b2 = bytes[i + 1... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left bytesToBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private bytesToBase64(bytes: Uint8Array): string {
// Base64 字符表
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
let result = ''
let i = 0
// 每 3 个字节编码为 4 个 base64 字符
for (; i < bytes.length - 2; i += 3) {
const b1 = bytes[i]
const b2 = bytes[i + 1... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 31ed199ddedc913583e14a246977c43d503917af | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | getValueAt | Gets the value at the specified index in the LightWeightSet
@param index the index to get the value from
@returns the value at the specified index
@throws BusinessError if the index exceeds Int.MAX_VALUE. | getValueAt(index: int): T | undefined {
this.checkIndex(index);
if (index < 0 || this.buckets.length <= index) {
return undefined;
}
return this.buckets.getKeyAt(index);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getValueAt 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... | getValueAt(index: int): T | undefined {
this.checkIndex(index);
if (index < 0 || this.buckets.length <= index) {
return undefined;
}
return this.buckets.getKeyAt(index);
} | https://gitcode.com/iop123123/arkts-static-skills | 445e8d893e78021a84e4d2fe90b06d8436d6990b | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toLocaleString | Converts Float64Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Float64Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Float64Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f1fd506530698140b476adf2bce35c9f46cbd6da | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | extractMultipleItems | 提取多个项目 | private async extractMultipleItems(
baseSelector: string,
fields: Record<string, string>,
context: ActionContext
): Promise<Record<string, string[]>> {
const fieldEntries: Array<[string, string]> = Object.entries(fields) as Array<[string, string]>;
// 构建提取脚本
const extractScript = this... | 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 extractMultipleItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSelector AST#identifier#Right AST#ERROR#Lef... | private async extractMultipleItems(
baseSelector: string,
fields: Record<string, string>,
context: ActionContext
): Promise<Record<string, string[]>> {
const fieldEntries: Array<[string, string]> = Object.entries(fields) as Array<[string, string]>;
// 构建提取脚本
const extractScript = this... | https://github.com/DaLongZhuaZi/manxia | ffc88746fe979a7e18b1fcd5544394cd4d2b4b1a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | GetReaders | Gets the number of waiting readers.
@param { long } state Current lock state
@returns { long } Number of waiting readers
@syscap SystemCapability.Utils.Lang | public static GetReaders(state: long): long {
return (state & State.READERS_MASK) >> State.STATE_BITS;
} | 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 GetReaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static GetReaders(state: long): long {
return (state & State.READERS_MASK) >> State.STATE_BITS;
} | https://gitcode.com/iop123123/arkts-static-skills | 2d139f3851205ac70077914bcd5d1783a231e0d6 | gitcode |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/common/database/DietRecordDao.ets | arkts | getRecordsByDate | 3. 根据日期查询记录 (核心功能) | async getRecordsByDate(dateStr: string): Promise<DietRecord[]> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return [];
}
let predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('record_date', dateStr); // 查询特定日期
const resultSet = ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecordsByDate AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dateStr AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getRecordsByDate(dateStr: string): Promise<DietRecord[]> {
const store = RdbManager.getInstance().getRdbStore();
if (!store) {
return [];
}
let predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('record_date', dateStr); // 查询特定日期
const resultSet = ... | https://gitcode.com/openharmony/codelabs | 646a55baeea463928dc18e50da1f511758c128ed | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | createTrackRecord | 创建跟踪记录 | public async createTrackRecord(params: CreateTrackRecordParams): Promise<TrackRecord> {
const now = Date.now();
const record: TrackRecord = {
id: generateUUID(),
contentId: params.contentId,
contentType: params.contentType,
trackerId: params.trackerId,
remoteId: params.remoteId,
... | 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 createTrackRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left... | public async createTrackRecord(params: CreateTrackRecordParams): Promise<TrackRecord> {
const now = Date.now();
const record: TrackRecord = {
id: generateUUID(),
contentId: params.contentId,
contentType: params.contentType,
trackerId: params.trackerId,
remoteId: params.remoteId,
... | https://github.com/DaLongZhuaZi/manxia | 1227aca4ba1fc169e383fc41b932b70561e0de1f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setVisibleYRange | Limits the maximum and minimum y range that can be visible by pinching and zooming.
@param minYRange
@param maxYRange
@param axis | public setVisibleYRange(minYRange: number, maxYRange: number, axis: AxisDependency): void {
let minScale: number = this.getAxisRange(axis) / minYRange;
let maxScale: number = this.getAxisRange(axis) / maxYRange;
this.mViewPortHandler.setMinMaxScaleY(minScale, maxScale);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVisibleYRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minYRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public setVisibleYRange(minYRange: number, maxYRange: number, axis: AxisDependency): void {
let minScale: number = this.getAxisRange(axis) / minYRange;
let maxScale: number = this.getAxisRange(axis) / maxYRange;
this.mViewPortHandler.setMinMaxScaleY(minScale, maxScale);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 14b3825beb4ddd328854257e1127aa5a9eae612e | gitee |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | getEnabledProviders | 只返回启用状态的 providers,用于模型选择等面向用户的入口 | getEnabledProviders(): ModelProvider[] {
const all = this.getProviders()
const enabled: ModelProvider[] = []
for (let i = 0; i < all.length; i++) {
if (all[i].isConnected) {
enabled.push(all[i])
}
}
return enabled
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getEnabledProviders 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#Left ModelProvide... | getEnabledProviders(): ModelProvider[] {
const all = this.getProviders()
const enabled: ModelProvider[] = []
for (let i = 0; i < all.length; i++) {
if (all[i].isConnected) {
enabled.push(all[i])
}
}
return enabled
} | https://github.com/LongLiveY96/chatcube | 814e74556211ac7d0e8ff283a9f6c04a09ba94a3 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Connection.ets | arkts | backup | 备份,默认在RdbStore同路径下备份。也可指定路径:customDir + "backup.db" | async backup(fileName: string = 'Backup.db'): Promise<void> {
this.store.backup(fileName)
Connection.logger?.info('backup success')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left backup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#... | async backup(fileName: string = 'Backup.db'): Promise<void> {
this.store.backup(fileName)
Connection.logger?.info('backup success')
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Connection.ets#L133-L136 | 5c78165210cdc9087e2602014741df70b49e6058 | github |
CsCesium/KantaiHomo | entry/src/main/ets/infra/fairy/service/FairyService.ets | arkts | show | Re-show the SubWindow after hide(). | async show(): Promise<void> {
if (!this.subWin || !this.alive) {
return;
}
try {
await this.subWin.showWindow();
AppStorage.set<boolean>('fairy.visible', true);
} catch (e) {
hilog.error(0x1357, TAG, 'show failed: %{public}s', String(e));
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left show 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 show(): Promise<void> {
if (!this.subWin || !this.alive) {
return;
}
try {
await this.subWin.showWindow();
AppStorage.set<boolean>('fairy.visible', true);
} catch (e) {
hilog.error(0x1357, TAG, 'show failed: %{public}s', String(e));
}
} | https://github.com/CsCesium/KantaiHomo | de6f2e6fac27c6189047464b4331247149a9a7a1 | github |
openharmony/arkui_advanced_ui_component | atomicserviceweb/source/atomicserviceweb.ets | arkts | isCheckDomainBlockListAvailable | 检查checkDomainBlockList接口是否可用 | isCheckDomainBlockListAvailable(): boolean {
if (!atomicBasicEngine || !atomicBasicEngine.default) {
return false;
}
return typeof atomicBasicEngine.default.checkDomainBlockList === 'function';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCheckDomainBlockListAvailable 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#ERR... | isCheckDomainBlockListAvailable(): boolean {
if (!atomicBasicEngine || !atomicBasicEngine.default) {
return false;
}
return typeof atomicBasicEngine.default.checkDomainBlockList === 'function';
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 3ba5b853e5f4c2a3e3c63ba26b1cb50d4f23a2d5 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | hexToStr | 16进制unit8Array转字符串
@param arr
@returns | static hexToStr(arr: Uint8Array): string {
return buffer.from(arr).toString('hex');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hexToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Arr... | static hexToStr(arr: Uint8Array): string {
return buffer.from(arr).toString('hex');
} | https://github.com/tdcare/tdwebrtc | 8f7c7dc52dd79754ffccd0d902840ccaa927350e | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/TodayPlanService.ets | arkts | total | Total row count across all three buckets. | total(): number {
return this.review.length + this.learning.length + this.freshNew.length;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left total AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#... | total(): number {
return this.review.length + this.learning.length + this.freshNew.length;
} | https://github.com/terryma2024/happyword | 49e17bafd5186352f1259243dbc6b3b509238280 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/SnapshotCapture.ets | arkts | releasePixelMap | 释放PixelMap资源
@param pixelMap PixelMap对象 | public releasePixelMap(pixelMap: PixelMap): void {
try {
pixelMap.release();
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
logger.warn(TAG, `释放PixelMap失败: ${msg}`);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left releasePixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixelMap AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public releasePixelMap(pixelMap: PixelMap): void {
try {
pixelMap.release();
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
logger.warn(TAG, `释放PixelMap失败: ${msg}`);
}
} | https://github.com/DaLongZhuaZi/manxia | ee3da4abf6bb1086dc860778c6a57cdc249d6071 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/Reranker.ets | arkts | calculateMedicalRelevance | 计算医疗相关性 | private calculateMedicalRelevance(query: string, document: string): number {
// 医疗专业术语
const medicalTerms = [
'症状', '治疗', '诊断', '药物', '疾病',
'血压', '血糖', '心率', '体温',
'感冒', '发烧', '咳嗽', '头痛',
'高血压', '糖尿病', '冠心病'
];
let score = 0;
const queryLower = query.toLowerCase();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateMedicalRelevance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private calculateMedicalRelevance(query: string, document: string): number {
// 医疗专业术语
const medicalTerms = [
'症状', '治疗', '诊断', '药物', '疾病',
'血压', '血糖', '心率', '体温',
'感冒', '发烧', '咳嗽', '头痛',
'高血压', '糖尿病', '冠心病'
];
let score = 0;
const queryLower = query.toLowerCase();
... | https://github.com/LJ666-ui/harmony-health-care | 764ecd4507a970e9075c9a4a9f23708e16fdc81b | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/settings/src/main/ets/viewmodel/AboutViewModel.ets | arkts | jumpToBrowser | 跳转浏览
@param context common.UIAbilityContext | private jumpToBrowser(context: common.UIAbilityContext): void {
const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext
const want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri: ResourceUtil.getRawFileStringBy... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left jumpToBrowser 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_expre... | private jumpToBrowser(context: common.UIAbilityContext): void {
const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext
const want: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri: ResourceUtil.getRawFileStringBy... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | d0eb761497dd2fcb5a2b91ade47f7cf09334f891 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_char.ets | arkts | main | ---
desc: check division for char operands
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a / b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a / b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0525b024508853cabd3dab43080e798b4ad99640 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | updateDictionarySettings | 更新字典设置 | async updateDictionarySettings(settings: DictionarySettings): Promise<void> {
this.dictionarySettings = this.cloneDictionarySettings(settings);
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICTIONARY_SETTINGS, this.dictionarySettings);
logger.info(TAG, '字典设置已更新');
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateDictionarySettings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#ide... | async updateDictionarySettings(settings: DictionarySettings): Promise<void> {
this.dictionarySettings = this.cloneDictionarySettings(settings);
await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICTIONARY_SETTINGS, this.dictionarySettings);
logger.info(TAG, '字典设置已更新');
} | https://github.com/DaLongZhuaZi/manxia | da8644c9bb2e88d82bfd2b84f7d5596ab9d55c51 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DataConverter.ets | arkts | mergeObjects | 合并对象属性
@param target - 目标对象
@param source - 源对象
@returns 合并后的对象 | static mergeObjects<T extends Record<string, Object>>(target: T, source: T): T {
const result = DataConverter.deepClone(target);
// 修复:使用显式属性访问替代动态键访问,消除any/unknown类型推断
const sourceKeys = Object.keys(source);
for (let i = 0; i < sourceKeys.length; i++) {
const key = sourceKeys[i];
// ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left mergeObjects AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#generic_type#Left AST#type_identifier#Left Record AST#... | static mergeObjects<T extends Record<string, Object>>(target: T, source: T): T {
const result = DataConverter.deepClone(target);
// 修复:使用显式属性访问替代动态键访问,消除any/unknown类型推断
const sourceKeys = Object.keys(source);
for (let i = 0; i < sourceKeys.length; i++) {
const key = sourceKeys[i];
// ... | https://github.com/DaLongZhuaZi/manxia | 1099616fc71387ab1dd07114f65febe521052345 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | getLineHeight | 获取指定场景的行高 | getLineHeight(scene: FontScene): number {
switch (scene) {
case FontScene.NOVEL:
return this.settings.novelLineHeight;
case FontScene.EBOOK:
return this.settings.ebookLineHeight;
default:
return 1.5;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLineHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FontScene AST#identifier#Right AST#)#Left... | getLineHeight(scene: FontScene): number {
switch (scene) {
case FontScene.NOVEL:
return this.settings.novelLineHeight;
case FontScene.EBOOK:
return this.settings.ebookLineHeight;
default:
return 1.5;
}
} | https://github.com/DaLongZhuaZi/manxia | e3afce9a91c47e902bf4996eef8d068f70fca38a | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/FullscreenController.ets | arkts | isFullscreenEnabled | 获取当前全屏状态
@returns 是否处于全屏模式 | public isFullscreenEnabled(): boolean {
return this.isFullscreen;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFullscreenEnabled 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 boole... | public isFullscreenEnabled(): boolean {
return this.isFullscreen;
} | https://github.com/richshaw2015/nds | 7e2d703409444f5edf06c1c72598b6c15e45d0ea | github |
openharmony/codelabs | ETSUI/Foodbook/entry/src/main/ets/pages/edit.ets | arkts | build | 从存储读取签名,默认空字符串 | build() {
Column() {
Row() {
Button()
.height(30)
.width(30)
.margin({ left: 10 })
.backgroundImage($r('app.media.return1'))
.backgroundColor(Color.White)
.backgroundImageSize(ImageSize.FILL)
.onClick(() => {
this.save... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
Button()
.height(30)
.width(30)
.margin({ left: 10 })
.backgroundImage($r('app.media.return1'))
.backgroundColor(Color.White)
.backgroundImageSize(ImageSize.FILL)
.onClick(() => {
this.save... | https://gitcode.com/openharmony/codelabs | 9dae809d6fbc8146de851b07b1405ceb45664388 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | strToBase64 | 字符串转Base64字符串
@param src 字符串
@returns | static strToBase64(src: string): string {
const uint8Array = StrUtil.strToUint8Array(src);
const result = Base64Util.encodeToStrSync(uint8Array);
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left strToBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | static strToBase64(src: string): string {
const uint8Array = StrUtil.strToUint8Array(src);
const result = Base64Util.encodeToStrSync(uint8Array);
return result;
} | https://github.com/tdcare/tdwebrtc | 978d1bf24ca0a0494a1611e516ed2ec7e319d55c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/accessibility/AccessibilityConfig.ets | arkts | getBackgroundColor | 获取背景颜色(考虑高对比度模式)
@param normalColor 正常模式颜色
@param highContrastColor 高对比度模式颜色 | public getBackgroundColor(normalColor: string, highContrastColor?: string): string {
if (this.settings.highContrastMode) {
return highContrastColor ?? '#FFFFFF';
}
return normalColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left normalColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | public getBackgroundColor(normalColor: string, highContrastColor?: string): string {
if (this.settings.highContrastMode) {
return highContrastColor ?? '#FFFFFF';
}
return normalColor;
} | https://github.com/LJ666-ui/harmony-health-care | acadb6ed03d8c5daeb2be02aaa902643c3f5dcec | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | end | Write the last chunk to Writable.
@param { string | Uint8Array } [chunk] - Data to be written.
@param { string } [encoding] - Encoding type.
@param { Function } [callback] - Callback after writing.
@returns { Writable } Returns the Writable object.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Man... | end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable {
super.setEndType();
return this._writable.end(chunk, encoding, callback);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left end AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left... | end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable {
super.setEndType();
return this._writable.end(chunk, encoding, callback);
} | https://gitcode.com/iop123123/arkts-static-skills | c4c80aab199e4174ffb7b1735257e88825749556 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets | arkts | constructor | Constructs a new InstantiationError instance with provided message and error specific information
@param { String | undefined } message - Error text
@param { ErrorOptions | undefined } options - Error options
@syscap SystemCapability.Utils.Lang | constructor(message?: String, options?: ErrorOptions) {
super("InstantiationError", 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("InstantiationError", message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | fff486c68a8fe37cd0e697c0be115179d61d31fc | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.